3 Replies Latest reply: May 29, 2012 3:47 AM by Lukasz Dworski RSS

Testing ESB with AbstractTestRunner

Lukasz Dworski Newbie

Hi,

 

I'm trying to write test that simply invokes ESB service. But during executing run operation I'm getting:

 

org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException: Unexpected error during registration for epr JMSEpr [ PortReference < <wsa:Address jms:localhost#queue/quickstart_helloworld_Request_esb/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.initial : org.jnp.interfaces.NamingContextFactory/>, <wsa:ReferenceProperties jbossesb:java.naming.provider.url : localhost/>, <wsa:ReferenceProperties jbossesb:java.naming.factory.url.pkgs : org.jnp.interfaces/>, <wsa:ReferenceProperties jbossesb:destination-type : queue/>, <wsa:ReferenceProperties jbossesb:destination-name : queue/quickstart_helloworld_Request_esb/>, <wsa:ReferenceProperties jbossesb:specification-version : 1.1/>, <wsa:ReferenceProperties jbossesb:connection-factory : ConnectionFactory/>, <wsa:ReferenceProperties jbossesb:persistent : true/>, <wsa:ReferenceProperties jbossesb:acknowledge-mode : AUTO_ACKNOWLEDGE/>, <wsa:ReferenceProperties jbossesb:transacted : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/jms/> > ]

          at org.jboss.soa.esb.listeners.message.MessageAwareListener.doInitialise(MessageAwareListener.java:201)

          at org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle.initialise(AbstractManagedLifecycle.java:133)

          at org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController.initialiseInstances(ManagedLifecycleController.java:109)

          at org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController.start(ManagedLifecycleController.java:66)

          at org.jboss.soa.esb.listeners.config.ConfigurationController.startController(ConfigurationController.java:355)

          at org.jboss.soa.esb.testutils.ESBConfigUtil.startController(ESBConfigUtil.java:223)

          at org.jboss.soa.esb.testutils.AbstractTestRunner.run(AbstractTestRunner.java:82)

          at org.jboss.soa.esb.samples.quickstart.helloworld.HelloWorldTest.test_async(HelloWorldTest.java:38)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

          at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

          at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)

          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Caused by: org.jboss.soa.esb.services.registry.RegistryException: org.apache.ws.scout.transport.TransportException: java.lang.reflect.InvocationTargetException

          at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.registerEPR(JAXRRegistryImpl.java:213)

          at org.jboss.internal.soa.esb.services.registry.InVMRegistryInterceptor.registerEPR(InVMRegistryInterceptor.java:47)

          at org.jboss.soa.esb.services.registry.RegistryFactory$HeadRegistryInterceptor.registerEPR(RegistryFactory.java:242)

          at org.jboss.soa.esb.listeners.RegistryUtil.register(RegistryUtil.java:150)

          at org.jboss.soa.esb.listeners.message.MessageAwareListener.doInitialise(MessageAwareListener.java:197)

          ... 30 more

Caused by: javax.xml.registry.JAXRException: org.apache.ws.scout.transport.TransportException: java.lang.reflect.InvocationTargetException

          at org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.findConcepts(BusinessQueryManagerV3Impl.java:535)

          at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.getJBossESBTModel(JAXRRegistryImpl.java:795)

          at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.registerEPR(JAXRRegistryImpl.java:179)

          ... 34 more

 

Here is my code:

 

 

AbstractTestRunner testRunner = new AbstractTestRunner() {
                              public void test() throws Exception {
                                        ServiceInvoker invoker = new ServiceInvoker("FirstServiceESB",
                                                            "SimpleListener");
                                        Message message = MessageFactory.getInstance().getMessage();
                                        message.getBody().add("helloworld");


                                        invoker.deliverAsync(message);


                                        Assert.assertTrue(true);
                              }
                    }.setServiceConfig(
                                        new FileInputStream("esbcontent/META-INF/jboss-esb.xml"));
                    testRunner.run();

 

 

 

 

 

When I start JBoss instance with invoked service deployed everything is working well. Is it required to have JBoss ESB running with deployed application during testing??

 

I think that jbossesb-properties.xml configuration is possible problem. Could someone send me example jbossesb-properties.xml prepared for AbstractTestRunner?

 

thanks

  • 1. Re: Testing ESB with AbstractTestRunner
    Lukasz Dworski Newbie

    Maybe someone could attach some simple working example of test using AbstractTestRunner.

     

    Please help.

  • 2. Re: Testing ESB with AbstractTestRunner
    Tom Cunningham Master

    Lukasz,

     

    There's a number of examples in the ESB codebase :

     

    http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/

  • 3. Re: Testing ESB with AbstractTestRunner
    Lukasz Dworski Newbie

    Thanks for your answer.

     

    During the execution of the test now I have:

     

    org.jboss.soa.esb.listeners.message.MessageDeliverException: org.apache.ws.scout.transport.TransportException: java.lang.reflect.InvocationTargetException

              at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:545)

              at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:174)

              at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:155)

              at org.jboss.soa.esb.client.ServiceInvoker.<init>(ServiceInvoker.java:197)

              at org.jboss.soa.esb.samples.quickstart.helloworld.HelloWorldTest$1.test(HelloWorldTest.java:35)

              at org.jboss.soa.esb.testutils.AbstractTestRunner.run(AbstractTestRunner.java:84)

              at org.jboss.soa.esb.samples.quickstart.helloworld.HelloWorldTest.test_async(HelloWorldTest.java:44)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

              at java.lang.reflect.Method.invoke(Unknown Source)

              at junit.framework.TestCase.runTest(TestCase.java:168)

              at junit.framework.TestCase.runBare(TestCase.java:134)

              at junit.framework.TestResult$1.protect(TestResult.java:110)

              at junit.framework.TestResult.runProtected(TestResult.java:128)

              at junit.framework.TestResult.run(TestResult.java:113)

              at junit.framework.TestCase.run(TestCase.java:124)

              at junit.framework.TestSuite.runTest(TestSuite.java:243)

              at junit.framework.TestSuite.run(TestSuite.java:238)

              at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)

              at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

              at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

              at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

    Caused by: org.jboss.soa.esb.services.registry.RegistryException: org.apache.ws.scout.transport.TransportException: java.lang.reflect.InvocationTargetException

              at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:358)

              at org.jboss.internal.soa.esb.services.registry.CachingRegistryInterceptor.getEPRs(CachingRegistryInterceptor.java:348)

              at org.jboss.internal.soa.esb.services.registry.CachingRegistryInterceptor.findEPRs(CachingRegistryInterceptor.java:137)

              at org.jboss.internal.soa.esb.services.registry.InVMRegistryInterceptor.findEPRs(InVMRegistryInterceptor.java:88)

              at org.jboss.soa.esb.services.registry.RegistryFactory$HeadRegistryInterceptor.findEPRs(RegistryFactory.java:229)

              at org.jboss.soa.esb.listeners.RegistryUtil.getEprs(RegistryUtil.java:228)

              at org.jboss.soa.esb.client.ServiceInvoker.loadServiceClusterInfo(ServiceInvoker.java:532)

              ... 25 more

    Caused by: javax.xml.registry.JAXRException: org.apache.ws.scout.transport.TransportException: java.lang.reflect.InvocationTargetException

              at org.apache.ws.scout.registry.BusinessQueryManagerV3Impl.findConcepts(BusinessQueryManagerV3Impl.java:535)

              at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.getJBossESBTModel(JAXRRegistryImpl.java:795)

              at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:327)

              ... 31 more

     

     

    Should JBoss AS be started while I'm running tests?