soi-toolkit / soi-toolkit-google-code

Automatically exported from code.google.com/p/soi-toolkit
0 stars 0 forks source link

Integration tests not working with multiple connectors of same type #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a component and a file-to-file service
2. Declare two file connectors in the service file and create a reference from 
the inbound-endpoint to one of them and and a reference from the 
outbound-endpoint to the other connector.  
3. Run the integration test.

What is the expected output? What do you see instead?
You get the following excepion

org.mule.api.config.ConfigurationException: Error creating bean with name 
'mySample-teststub-service': Cannot create inner bean '(inner bean)' of type 
[org.mule.config.spring.factories.InboundEndpointFactoryBean] while setting 
bean property 'messageSource'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name '(inner bean)': FactoryBean threw exception on object creation; 
nested exception is org.mule.transport.service.TransportFactoryException: There 
are at least 2 connectors matching protocol "file", so the connector to use 
must be specified on the endpoint using the 'connector' property/attribute. 
Connectors in your configuration that support "file" are: a, b,  
(java.lang.IllegalStateException) 
(org.mule.api.lifecycle.InitialisationException)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:80)
    at org.mule.tck.junit4.AbstractMuleContextTestCase.createMuleContext(AbstractMuleContextTestCase.java:203)
    at org.mule.tck.junit4.AbstractMuleContextTestCase.setUpMuleContext(AbstractMuleContextTestCase.java:133)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62)
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean 
with name 'mySample-teststub-service': Cannot create inner bean '(inner bean)' 
of type [org.mule.config.spring.factories.InboundEndpointFactoryBean] while 
setting bean property 'messageSource'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name '(inner bean)': FactoryBean threw exception on object creation; 
nested exception is org.mule.transport.service.TransportFactoryException: There 
are at least 2 connectors matching protocol "file", so the connector to use 
must be specified on the endpoint using the 'connector' property/attribute. 
Connectors in your configuration that support "file" are: a, b,  
(java.lang.IllegalStateException)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:117)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    ... 15 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'mySample-teststub-service': Cannot create inner bean 
'(inner bean)' of type 
[org.mule.config.spring.factories.InboundEndpointFactoryBean] while setting 
bean property 'messageSource'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name '(inner bean)': FactoryBean threw exception on object creation; 
nested exception is org.mule.transport.service.TransportFactoryException: There 
are at least 2 connectors matching protocol "file", so the connector to use 
must be specified on the endpoint using the 'connector' property/attribute. 
Connectors in your configuration that support "file" are: a, b,  
(java.lang.IllegalStateException)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:125)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
    ... 18 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name '(inner bean)': FactoryBean threw exception on object 
creation; nested exception is 
org.mule.transport.service.TransportFactoryException: There are at least 2 
connectors matching protocol "file", so the connector to use must be specified 
on the endpoint using the 'connector' property/attribute. Connectors in your 
configuration that support "file" are: a, b,  (java.lang.IllegalStateException)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:274)
    ... 32 more
Caused by: org.mule.transport.service.TransportFactoryException: There are at 
least 2 connectors matching protocol "file", so the connector to use must be 
specified on the endpoint using the 'connector' property/attribute. Connectors 
in your configuration that support "file" are: a, b,  
(java.lang.IllegalStateException)
    at org.mule.endpoint.AbstractEndpointBuilder.getConnector(AbstractEndpointBuilder.java:635)
    at org.mule.endpoint.AbstractEndpointBuilder.getDefaultConnector(AbstractEndpointBuilder.java:452)
    at org.mule.endpoint.AbstractEndpointBuilder.getConnector(AbstractEndpointBuilder.java:447)
    at org.mule.endpoint.AbstractEndpointBuilder.doBuildInboundEndpoint(AbstractEndpointBuilder.java:194)
    at org.mule.endpoint.AbstractEndpointBuilder.buildInboundEndpoint(AbstractEndpointBuilder.java:117)
    at org.mule.endpoint.DefaultEndpointFactory.getInboundEndpoint(DefaultEndpointFactory.java:83)
    at org.mule.config.spring.factories.InboundEndpointFactoryBean.doGetObject(InboundEndpointFactoryBean.java:49)
    at org.mule.config.spring.factories.AbstractEndpointFactoryBean.getObject(AbstractEndpointFactoryBean.java:43)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    ... 34 more
Caused by: java.lang.IllegalStateException: There are at least 2 connectors 
matching protocol "file", so the connector to use must be specified on the 
endpoint using the 'connector' property/attribute. Connectors in your 
configuration that support "file" are: a, b, 
    at org.mule.transport.service.TransportFactory.getConnectorByProtocol(TransportFactory.java:179)
    at org.mule.endpoint.AbstractEndpointBuilder.getConnector(AbstractEndpointBuilder.java:625)
    ... 42 more

What version of the product are you using? On what operating system?
0.5.0

Please provide any additional information below.
The MuleClient creates a dynamic outbound enpoint in order to dispatch the test 
message on the inbound endpoint. The outbound endpoint needs a connector, but 
since there are two connectors defined in the component the EndpointBuilder 
gets confused...

look at method org.mule.module.client.MuleClient.getOutboundEndpoint(String, 
MessageExchangePattern, Integer)

Original issue reported on code.google.com by par.wena...@gmail.com on 27 Apr 2012 at 2:35

GoogleCodeExporter commented 9 years ago
Example use cases where this is a problem:
1. WMQ (JMS-compliant) inbound --> WMQ (native) outbound
2. SFTP (using keys) inbound --> SFTP (using username/password) outbound

Original comment by hakan.dahl@gmail.com on 7 May 2012 at 9:33

GoogleCodeExporter commented 9 years ago
Did you specify what file-connector to use also for the 
mySample-teststub-service once you introduced two file-connectors in the code?

If not, I guess that you simple have broken the test yourself by not doing so 
:-)

But it should be simple to fix by specifying what file connector to use also on 
the mySample-teststub-service, right?

Regards,
Magnus.

Original comment by magnus.l...@gmail.com on 17 May 2012 at 6:13

GoogleCodeExporter commented 9 years ago

Original comment by magnus.l...@gmail.com on 17 May 2012 at 6:47

GoogleCodeExporter commented 9 years ago
See issue 256 "Generated flows should always specify a connector-ref for 
endpoints" for a related issue regarding usage of explicit connector-refs on 
endpoints instead of relying on the default connector.

I guess that issue will help you a bin in this case, you however always needs 
to consider all your endpoints anyhow when adding a new connector for a 
transport, including the test-endpoints. Even though you will not be required 
to update them all once issue 256 is completed :-)

I set this as blocked by issue 256 an continue the work there.

Original comment by magnus.l...@gmail.com on 20 May 2012 at 6:50

GoogleCodeExporter commented 9 years ago
No action will be taken for this issue, see related issue 256.

Original comment by magnus.l...@gmail.com on 20 May 2012 at 6:53

GoogleCodeExporter commented 9 years ago
Sorry for explaining a a non-problem. I forgot to reference the connector in 
the stub in my example and the above stacktrace is the wrong one. If you put a 
connector-ref on the stub-endpoint (mySample-teststub-service) you will get the 
problem that I really wanted to report. I hope that this issue will be 
reopened. This is the description I should have posted in the first case. Issue 
256 will in my opinion not solve this problem.

What steps will reproduce the problem?
1. Create a component and a file-to-file service
2. Declare two file connectors in the service file and create a reference from 
the inbound-endpoint to one of them and and a reference from the 
outbound-endpoint to the other connector.  
3. Add a connector-ref to the stub endpoint
4. Run the integration test.

What is the expected output? What do you see instead?

I would expect the tests to run, since all endpoints have references to 
connectors, but there is an exception thrown.

java.lang.RuntimeException: 
org.mule.transport.service.TransportFactoryException: There are at least 2 
connectors matching protocol "file", so the connector to use must be specified 
on the endpoint using the 'connector' property/attribute. Connectors in your 
configuration that support "file" are: c1, c2,  
(java.lang.IllegalStateException)
    at org.soitoolkit.commons.mule.test.DispatcherMuleClientImpl.doDispatch(DispatcherMuleClientImpl.java:34)
    at org.soitoolkit.commons.mule.test.junit4.AbstractTestCase.dispatchAndWaitForServiceComponent(AbstractTestCase.java:221)
    at org.soitoolkit.commons.mule.test.junit4.AbstractTestCase.dispatchAndWaitForServiceComponent(AbstractTestCase.java:274)
    at org.sample.sample1.mysample.MySampleIntegrationTest.testMySample_ok(MySampleIntegrationTest.java:174)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62)
Caused by: org.mule.transport.service.TransportFactoryException: There are at 
least 2 connectors matching protocol "file", so the connector to use must be 
specified on the endpoint using the 'connector' property/attribute. Connectors 
in your configuration that support "file" are: c1, c2,  
(java.lang.IllegalStateException)
    at org.mule.endpoint.AbstractEndpointBuilder.getConnector(AbstractEndpointBuilder.java:635)
    at org.mule.endpoint.AbstractEndpointBuilder.getDefaultConnector(AbstractEndpointBuilder.java:452)
    at org.mule.endpoint.AbstractEndpointBuilder.getConnector(AbstractEndpointBuilder.java:447)
    at org.mule.endpoint.AbstractEndpointBuilder.doBuildOutboundEndpoint(AbstractEndpointBuilder.java:251)
    at org.mule.endpoint.AbstractEndpointBuilder.buildOutboundEndpoint(AbstractEndpointBuilder.java:122)
    at org.mule.endpoint.DefaultEndpointFactory.getOutboundEndpoint(DefaultEndpointFactory.java:89)
    at org.mule.module.client.MuleClient.getOutboundEndpoint(MuleClient.java:748)
    at org.mule.module.client.MuleClient.dispatch(MuleClient.java:268)
    at org.mule.module.client.MuleClient.dispatch(MuleClient.java:254)
    at org.soitoolkit.commons.mule.test.DispatcherMuleClientImpl.doDispatch(DispatcherMuleClientImpl.java:31)
    ... 15 more
Caused by: java.lang.IllegalStateException: There are at least 2 connectors 
matching protocol "file", so the connector to use must be specified on the 
endpoint using the 'connector' property/attribute. Connectors in your 
configuration that support "file" are: c1, c2, 
    at org.mule.transport.service.TransportFactory.getConnectorByProtocol(TransportFactory.java:179)
    at org.mule.endpoint.AbstractEndpointBuilder.getConnector(AbstractEndpointBuilder.java:625)
    ... 24 more

What version of the product are you using? On what operating system?
0.5.0

Please provide any additional information below.
The MuleClient creates a dynamic outbound endpoint in order to dispatch the 
test message on the inbound endpoint. The outbound endpoint needs a connector, 
but since there are two connectors defined in the component the EndpointBuilder 
gets confused. As far as I can see from the Mule source code there is no way to 
define which of the connectors to use, so it might be a case for a issue on 
Mule. 

The endpoint is created in method 
org.mule.module.client.MuleClient.getOutboundEndpoint(String, 
MessageExchangePattern, Integer)

Original comment by par.wena...@gmail.com on 20 May 2012 at 6:54

Attachments:

GoogleCodeExporter commented 9 years ago
Move all closed v0.5.1 issues to v0.6.0

Original comment by magnus.l...@gmail.com on 26 Jul 2012 at 4:24