Quantcast

Paxexam-karaf startup issue

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Paxexam-karaf startup issue

woggle23
Good afternoon team

I've recently started using Servicemix and would like to use the Paxexam-karaf framework to perform integration testing. I followed the simple test example shown at github:

https://github.com/openengsb/labs-paxexam-karaf/wiki

After this I attempted to write a basic JMS camel route, the bundle under test, which looked something like the following:

from("jms:topic:simple.camel.in")
  .beanRef("tranformBean", "transformMsg")
  .to("jms:topic:simple.camel.out");

The Paxexam-karaf test attempts to connect to the message broker (running within the Servicemix container), writes a simple message to "simple.camel.in" topic, and awaits the resulting message from "simple.camel.out".

The vast majority of the time, the test fails, with the client not being able to connect the broker:

"javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616.
Reason: java.net.ConnectException: Connection refused: connect"

I added a long delay at the start of the test - in case the test was being invoked prior to Servicemix starting all installed bundles (and the paxexam.karaf.options doesn't appear to support waitForFrameworkStartup()). After this I noted that the camel route (under test) was now logging issues with connection:

"15:36:48,008 | WARN  | simple.camel.in] | faultJmsMessageListenerContainer | 117
 - org.springframework.jms - 3.0.6.RELEASE | Could not refresh JMS Connection for destination 'simple.camel.in' - retrying in 5000 ms. Cause: Could not connect
to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect"

The above indicates that without adding the delay the test was possibly running (to completion) prior to the camel route being deployed?

I can only assume that the activemq broker isn't running properly when the test is executed. Results are inconsistant; i.e. there has been a case where the test has passed, there have been occasions where the testcase has connected to the broker, and sent messages - but not consumed any from "simple.camel.out".

If I manually deploy the built camel route bundle into the Servicemix container it runs fine -  I can run the unit test (without invoking the paxexam elements) in eclipse with everything working as expected.

Any ideas how I can check the startup mechanisms of Servicemix to ensure everything is up and running prior to test invocation? Or am I just missing something fundamental?

Please note, I'm using Servicemix 4.4.1. The test configuration options are set as follows:

private KarafDistributionBaseConfigurationOption servicemixDistributionConfiguration(){
    return karafDistributionConfiguration().frameworkUrl(
        /* entry required to use Apache servicemix */
        maven().groupId("org.apache.servicemix").artifactId("apache-servicemix").type("zip")
        .versionAsInProject()).karafVersion("2.2.4").name("Apache Servicemix");
    }

Related pom.xml entries are as follows:

<dependency>
          <groupId>org.openengsb.labs.paxexam.karaf</groupId>
          <artifactId>paxexam-karaf-container</artifactId>
          <version>0.5.1</version>
          <scope>test</scope>
</dependency>
<dependency>
          <groupId>org.ops4j.pax.exam</groupId>
          <artifactId>pax-exam-junit4</artifactId>
          <version>2.3.0</version>
          <scope>test</scope>
</dependency>

<dependency>
          <groupId>org.apache.karaf</groupId>
          <artifactId>apache-karaf</artifactId>
          <version>2.2.4</version>
          <type>zip</type>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>org.apache.karaf.shell</groupId>
              <artifactId>org.apache.karaf.shell.dev</artifactId>
            </exclusion>
          </exclusions>
</dependency>
 
<dependency>
                <groupId>org.apache.servicemix</groupId>
                <artifactId>apache-servicemix</artifactId>
                <version>4.4.1</version>
                <type>zip</type>
                <scope>test</scope>
</dependency>

Any help will be greatly appreciated - many thanks in advance.

Cheers

Matt
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Paxexam-karaf startup issue

woggle23
Please see the following for updates:

http://karaf.922171.n3.nabble.com/Paxexam-karaf-startup-issue-tp3916549p3916549.html

Many thanks

Matt
Loading...