You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Mueller <ch...@gmail.com> on 2010/09/01 20:33:50 UTC

Pax Exam test for Camel

Inspired from Camels OSGiIntegrationTestSupport, I plan also to test my
routes with Pax Exam, because all our routes will be deployed into
ServiceMix (FUSE ESB 4.2.0-fuse-02-00 - Camel 2.2.0-fuse-02-00).

My first Pax Exam test

{code:java}
@RunWith(JUnit4TestRunner.class)
public class OsgiPaxExamIntegrationTest extends CamelTestSupport {

	@Inject
	protected BundleContext bundleContext;

	@EndpointInject(uri = "mock:result")
	private MockEndpoint resultEndpoint;

	@Test
	public void testSendMessage() throws Exception {
		resultEndpoint.expectedBodiesReceived("Hello World");

		template.sendBody("seda:foo", "Hello World");

		assertMockEndpointsSatisfied();
	}

	protected RouteBuilder createRouteBuilder() throws Exception {
		return new RouteBuilder() {
			public void configure() {
				from("seda:foo").to("mock:result");
			}
		};
	}

	protected CamelContext createCamelContext() throws Exception {
		setThreadContextClassLoader();

		CamelContextFactory factory = new CamelContextFactory();
		factory.setBundleContext(bundleContext);
		return factory.createContext();
	}

	protected void setThreadContextClassLoader() {
		// set the thread context classloader current bundle classloader
		Thread.currentThread().setContextClassLoader(
				this.getClass().getClassLoader());
	}

	public static UrlReference getCamelKarafFeatureUrl() {
		return mavenBundle().groupId("org.apache.camel.karaf")
				.artifactId("apache-camel").type("xml").classifier("features")
				.version("2.2.0-fuse-02-00");
	}

	public static UrlReference getServicemixFeatureUrl() {
		return mavenBundle().groupId("org.apache.servicemix")
				.artifactId("apache-servicemix").type("xml")
				.classifier("features").version("4.2.0-fuse-02-00");
	}

	@Configuration
	public static Option[] configure() throws Exception {
		Option[] options = options(
				// install the spring dm profile
				profile("spring.dm").version("1.2.0"),
				org.ops4j.pax.exam.CoreOptions.systemProperty(
						"org.ops4j.pax.logging.DefaultServiceLog.level").value(
						"INFO"),
				org.ops4j.pax.exam.CoreOptions.systemProperty(
						"org.apache.camel.jmx.disable").value("true"),
				repositories("http://repo.fusesource.com/maven2/",
						"http://repository.ops4j.org/maven2/"),
				scanFeatures(getCamelKarafFeatureUrl(), "camel-core",
						"camel-osgi", "camel-spring", "camel-test",
						"camel-jaxb", "camel-cxf"),
				/*
				 * scanFeatures(getServicemixFeatureUrl(), "camel-activemq"),
				 */
				workingDirectory("target/paxrunner/"), felix(),

				waitForFrameworkStartupFor(30000));

		return options;
	}
}
{code}

The test succeed, but in the log I see the following error message:

{code}
ERROR: Error starting
file:bundles/org.apache.felix.karaf.deployer.spring_1.4.0.fuse-02-00.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.felix.karaf.deployer.spring [21]: package;
(&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.felix.karaf.deployer.spring [21]: package;
(&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0)))
	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3263)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1597)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
	at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
	at java.lang.Thread.run(Thread.java:637)
{code}

full stack trace:

{code}
__________                 ___________
\______   \_____  ___  ___ \_   _____/__  ________    _____
 |     ___/\__  \ \  \/  /  |    __)_\  \/  /\__  \  /     \
 |    |     / __ \_>    <   |        \>    <  / __ \|  Y Y  \
 |____|    (____  /__/\_ \ /_______  /__/\_ \(____  /__|_|  /
                \/      \/         \/      \/     \/      \/

Pax Exam 1.2.1 from OPS4J - http://www.ops4j.org
------------------------------------------------

[              JUnit4TestMethod] - Starting test testSendMessage
[felix](com.awl.wlsi.itest.sir.OsgiPaxExamIntegrationTest)
[        PaxRunnerTestContainer] - Starting up the test container (Pax
Runner 1.4.0 )
[        PaxRunnerTestContainer] - Acquire lock for new Pax Runner instance
on
/Users/muellerc/workspaceSandbox/ssp-inform-requestor/target/paxrunner/paxexam.lock
[             ConfigurationImpl] - Using config
[classpath:META-INF/runner.properties]
[                           Run] - Using only arguments from command line
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.ops4j.pax.exam/pax-exam/1.2.1@1]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.ops4j.pax.exam/pax-exam-junit-extender/1.2.1@1]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.ops4j.pax.exam/pax-exam-junit-extender-impl/1.2.1@1]
[          ProvisionServiceImpl] - Scan bundles from
[scan-features:mvn:org.apache.camel.karaf/apache-camel/2.2.0-fuse-02-00/xml/features!/camel-core,camel-osgi,camel-spring,camel-test,camel-jaxb,camel-cxf]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.junit/com.springsource.org.junit/4.4.0@1]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.ops4j.pax.exam/pax-exam-container-rbc/1.2.1@1]
[          ProvisionServiceImpl] - Scan bundles from
[scan-composite:mvn:org.ops4j.pax.runner.profiles/spring.dm/1.2.0/composite]
[          ProvisionServiceImpl] - Scan bundles from
[scan-composite:mvn:org.ops4j.pax.runner.profiles/spring/2.5.6/composite]
[          ProvisionServiceImpl] - Scan bundles from
[scan-composite:mvn:org.ops4j.pax.runner.profiles/log//composite]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-api/1.5.1]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.ops4j.pax.logging/pax-logging-service/1.5.1]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.aopalliance/com.springsource.org.aopalliance/1.0.0]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework/spring-aop/2.5.6]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework/spring-beans/2.5.6]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework/spring-context/2.5.6]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework/spring-context-support/2.5.6]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework/spring-core/2.5.6]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:edu.emory.mathcs.backport/com.springsource.edu.emory.mathcs.backport/3.1.0]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework.osgi/spring-osgi-annotation/1.2.0]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework.osgi/spring-osgi-core/1.2.0]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework.osgi/spring-osgi-extender/1.2.0]
[          ProvisionServiceImpl] - Scan bundles from
[scan-bundle:mvn:org.springframework.osgi/spring-osgi-io/1.2.0]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.exam/pax-exam/1.2.1, at start level 1, bundle will be
started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.exam/pax-exam-junit-extender/1.2.1, at start level 1,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.exam/pax-exam-junit-extender-impl/1.2.1, at start level
1, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/1.0_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-core/2.5.6.SEC01, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-beans/2.5.6.SEC01, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-aop/2.5.6.SEC01, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-context/2.5.6.SEC01, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-context-support/2.5.6.SEC01, at default
start level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/1.4.0,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.1/1.4.0,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.stax-api-1.0/1.4.0,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.1.12_1,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.fusesource.commonman/commons-management/1.0, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.camel/camel-core/2.2.0-fuse-02-00, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-tx/2.5.6.SEC01, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.camel/camel-spring/2.2.0-fuse-02-00, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.cglib/2.1_3_4,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.springframework.osgi/spring-osgi-io/1.2.0, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework.osgi/spring-osgi-core/1.2.0, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework.osgi/spring-osgi-extender/1.2.0, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework.osgi/spring-osgi-annotation/1.2.0, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.felix.karaf.deployer/org.apache.felix.karaf.deployer.spring/1.4.0-fuse-02-00,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.camel/camel-osgi/2.2.0-fuse-02-00, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.camel/camel-spring-osgi/2.2.0-fuse-02-00, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.junit/4.7_1,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.camel/camel-test/2.2.0-fuse-02-00, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.camel/camel-jaxb/2.2.0-fuse-02-00, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.geronimo.specs/geronimo-servlet_2.5_spec/1.1.2, at default
start level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jetty-bundle/6.1.22_1,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.web/pax-web-api/0.7.2, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.web/pax-web-spi/0.7.2, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.web/pax-web-runtime/0.7.2, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.web/pax-web-jetty/0.7.2, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:commons-pool/commons-pool/1.5.4, at default start level, bundle will be
started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-jms/2.5.6.SEC01, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.asm/2.2.3_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-codec/1.3_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jdom/1.1_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.codehaus.jettison/jettison/1.2, at default start level, bundle will
be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/1.7.0_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.bcel/5.2_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan/2.7.1_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xerces/2.9.1_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlbeans/2.4.0_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlsec/1.4.3_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver/1.2_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.codehaus.woodstox/woodstox-core-asl/4.0.7, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.codehaus.woodstox/stax2-api/3.0.1, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.ws.commons.schema/XmlSchema/1.4.5, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:commons-lang/commons-lang/2.4, at default start level, bundle will be
started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:commons-collections/commons-collections/3.2.1, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr/2.7.7_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.oro/2.0.8_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity/1.6.2_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.ws.commons.axiom/axiom-impl/1.2.8, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.ws.commons.axiom/axiom-api/1.2.8, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail/1.4.1_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.neethi/2.0.4_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera/0.4.0-incubating_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.geronimo.specs/geronimo-jaxws_2.1_spec/1.0, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.geronimo.specs/geronimo-annotation_1.0_spec/1.1.1, at
default start level, bundle will be started, bundle will be loaded from the
cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.3/1.4.0,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.wsdl4j/1.6.2_2,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jsr311-api-1.0/1.4.0,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.geronimo.specs/geronimo-ws-metadata_2.0_spec/1.1.2, at
default start level, bundle will be started, bundle will be loaded from the
cache]
[                           Run] - Provision bundle
[mvn:org.apache.cxf/cxf-bundle/2.2.9-fuse-01-00, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-io/1.3.2_3,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:org.apache.camel/camel-cxf/2.2.0-fuse-02-00, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.junit/com.springsource.org.junit/4.4.0, at start level 1, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.exam/pax-exam-container-rbc/1.2.1, at start level 1,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.apache.felix/org.apache.felix.configadmin/1.2.4, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.logging/pax-logging-api/1.5.1, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.ops4j.pax.logging/pax-logging-service/1.5.1, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.aopalliance/com.springsource.org.aopalliance/1.0.0, at default
start level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-aop/2.5.6, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-beans/2.5.6, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-context/2.5.6, at default start level,
bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-context-support/2.5.6, at default start
level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.springframework/spring-core/2.5.6, at default start level, bundle
will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:org.objectweb.asm/com.springsource.org.objectweb.asm/2.2.3, at default
start level, bundle will be started, bundle will be loaded from the cache]
[                           Run] - Provision bundle
[mvn:edu.emory.mathcs.backport/com.springsource.edu.emory.mathcs.backport/3.1.0,
at default start level, bundle will be started, bundle will be loaded from
the cache]
[                           Run] - Provision bundle
[mvn:net.sourceforge.cglib/com.springsource.net.sf.cglib/2.1.3, at default
start level, bundle will be started, bundle will be loaded from the cache]
[                  PlatformImpl] - Preparing framework [Felix 2.0.2]
[                  PlatformImpl] - Downloading bundles...
[          ExecutionEnvironment] - Using execution environment [J2SE-1.6]
[             DefaultJavaRunner] - Runner has successfully finished his job!

[        PaxRunnerTestContainer] - Test container (Pax Runner 1.4.0) started
in 1785 millis
[        PaxRunnerTestContainer] - Wait for test container to finish its
initialization for 30000 millis

Welcome to Felix
================

[org.ops4j.pax.exam.rbc.internal.Activator] : RMI registry started on port
[1099]
[org.springframework.osgi.extender.internal.activator.ContextLoaderListener]
: Starting [org.springframework.osgi.extender] bundle v.[1.2.0]
[org.springframework.osgi.extender.internal.support.ExtenderConfiguration] :
No custom extender configuration detected; using defaults...
[     RemoteBundleContextClient] - Remote bundle context found after 2163
millis
[org.springframework.scheduling.timer.TimerTaskExecutor] : Initializing
Timer
ERROR: Error starting
file:bundles/org.apache.felix.karaf.deployer.spring_1.4.0.fuse-02-00.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.felix.karaf.deployer.spring [21]: package;
(&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle
org.apache.felix.karaf.deployer.spring [21]: package;
(&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0)))
	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3263)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1597)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
	at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
	at java.lang.Thread.run(Thread.java:637)
[org.apache.camel.osgi.Activator] : Camel activator starting
[org.apache.camel.osgi.Activator] : Camel activator started
[org.apache.camel.osgi.Activator] : Camel activator starting
[org.apache.camel.osgi.Activator] : Camel activator started
[org.ops4j.pax.web.service.internal.Activator] : Pax Web started
[org.ops4j.pax.web.service.jetty.internal.JettyServerImpl] : Pax Web
available at [0.0.0.0]:[8080]
[org.springframework.osgi.extender.support.DefaultOsgiApplicationContextCreator]
: Discovered configurations {osgibundle:/META-INF/spring/*.xml} in bundle
[Apache CXF Bundle Jar (org.apache.cxf.bundle)]
[org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] :
Refreshing
org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@340ae1cf:
display name [OsgiBundleXmlApplicationContext(bundle=org.apache.cxf.bundle,
config=osgibundle:/META-INF/spring/*.xml)]; startup date [Wed Sep 01
20:30:17 CEST 2010]; root of context hierarchy
[org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext] :
Unpublishing application context OSGi service for bundle Apache CXF Bundle
Jar (org.apache.cxf.bundle)
[org.springframework.beans.factory.xml.XmlBeanDefinitionReader] : Loading
XML bean definitions from URL
[bundle://66.0:0/META-INF/spring/cxf-transport-osgi.xml]
[org.ops4j.pax.web.service.jetty.internal.JettyServerImpl] : Pax Web
available at [0.0.0.0]:[8080]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling SLF4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Jakarta Commons Logging API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Log4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling Avalon Logger API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Enabling JULI Logger API support.
[SpringOsgiExtenderThread-1] INFO
org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext -
Bean factory for application context
[org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@340ae1cf]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@54cee271
[SpringOsgiExtenderThread-1] INFO
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor
- No outstanding OSGi service dependencies, completing initialization for
OsgiBundleXmlApplicationContext(bundle=org.apache.cxf.bundle,
config=osgibundle:/META-INF/spring/*.xml)
[SpringOsgiExtenderThread-2] INFO
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@54cee271:
defining beans
[cxfOsgiProperties,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,destinationRegistry,osgiServlet,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#1];
root of factory hierarchy
[SpringOsgiExtenderThread-2] INFO
org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean -
Publishing service under classes [{javax.servlet.Servlet}]
[SpringOsgiExtenderThread-2] INFO
org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean -
Publishing service under classes
[{org.apache.cxf.transport.http_osgi.OsgiDestinationRegistryIntf}]
[SpringOsgiExtenderThread-2] INFO
org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext -
Publishing application context as OSGi service with properties
{org.springframework.context.service.name=org.apache.cxf.bundle,
Bundle-SymbolicName=org.apache.cxf.bundle, Bundle-Version=2.2.9.fuse-01-00}
[SpringOsgiExtenderThread-2] INFO
org.springframework.osgi.extender.internal.activator.ContextLoaderListener -
Application context successfully refreshed
(OsgiBundleXmlApplicationContext(bundle=org.apache.cxf.bundle,
config=osgibundle:/META-INF/spring/*.xml))
[RMI TCP Connection(1)-192.168.178.27] INFO
org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Install bundle
from URL
[file:/var/folders/Y+/Y+3VSGnPGRmR4Z99OyKM2k+++TI/-Tmp-/tb/tinybundles_6604afc42939945601199c52f8dce44dd5b1bfc1.bin]
[RMI TCP Connection(1)-192.168.178.27] INFO
org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Look up service
[org.osgi.service.startlevel.StartLevel], timeout in 0 millis
[              JUnit4TestMethod] - Starting test testSendMessage
[felix](com.awl.wlsi.itest.sir.OsgiPaxExamIntegrationTest)
[RMI TCP Connection(1)-192.168.178.27] INFO
org.ops4j.pax.exam.junit.extender.impl.internal.TestBundleObserver - Found
test: com.awl.wlsi.itest.sir.OsgiPaxExamIntegrationTest.testSendMessage
[RMI TCP Connection(1)-192.168.178.27] INFO
org.ops4j.pax.exam.junit.extender.impl.internal.TestBundleObserver -
Registered testcase
[com.awl.wlsi.itest.sir.OsgiPaxExamIntegrationTest.testSendMessage]
[RMI TCP Connection(1)-192.168.178.27] INFO
org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Remote call of
[org.ops4j.pax.exam.junit.extender.CallableTestMethod.call]
[RMI TCP Connection(1)-192.168.178.27] INFO
org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl - Look up service
[org.ops4j.pax.exam.junit.extender.CallableTestMethod], timeout in 0 millis
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.2.0-fuse-02-00
(CamelContext:camel-1) is starting
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultCamelContext - JMX enabled. Using
DefaultManagedLifecycleStrategy.
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultCamelContext - Started 1 routes
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.2.0-fuse-02-00
(CamelContext:camel-1) started
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.component.mock.MockEndpoint - Asserting:
Endpoint[mock://result] is satisfied
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.2.0-fuse-02-00
(CamelContext:camel-1) is stopping
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Starting to graceful
shutdown routes (timeout 10 seconds)
[Camel thread 1: ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Route: route1 shutdown
deferred.
[Camel thread 1: ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Route: route1 shutdown
complete.
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Graceful shutdown of routes
completed in 0 seconds
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultInflightRepository - Shutting down with no
inflight exchanges.
[RMI TCP Connection(1)-192.168.178.27] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.2.0-fuse-02-00
(CamelContext:camel-1) stopped
[              JUnit4TestMethod] - Test testSendMessage
[felix](com.awl.wlsi.itest.sir.OsgiPaxExamIntegrationTest) ended succesfully
[        PaxRunnerTestContainer] - Shutting down the test container (Pax
Runner)
[RMI TCP Connection(1)-192.168.178.27] INFO
org.springframework.osgi.extender.internal.activator.ContextLoaderListener -
Stopping [org.springframework.osgi.extender] bundle v.[1.2.0]
[Timer-1] INFO
org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext -
Application Context service already unpublished
[Timer-1] INFO
org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext -
Closing
org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@340ae1cf:
display name [OsgiBundleXmlApplicationContext(bundle=org.apache.cxf.bundle,
config=osgibundle:/META-INF/spring/*.xml)]; startup date [Wed Sep 01
20:30:17 CEST 2010]; root of context hierarchy
[Timer-1] INFO
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Destroying singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@54cee271:
defining beans
[cxfOsgiProperties,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,destinationRegistry,osgiServlet,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0,org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#1];
root of factory hierarchy
[Timer-1] INFO
org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean -
Unregistered service [ServiceRegistrationWrapper for
org.apache.felix.framework.ServiceRegistrationImpl@7d6f3ed7]
[Timer-1] INFO
org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean -
Unregistered service [ServiceRegistrationWrapper for
org.apache.felix.framework.ServiceRegistrationImpl@1286d597]
[Timer-1] INFO
org.springframework.osgi.extender.internal.activator.ContextLoaderListener -
Application context succesfully closed
(OsgiBundleXmlApplicationContext(bundle=org.apache.cxf.bundle,
config=osgibundle:/META-INF/spring/*.xml))
[RMI TCP Connection(1)-192.168.178.27] INFO
org.springframework.scheduling.timer.TimerTaskExecutor - Cancelling Timer

org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Disabling SLF4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Disabling Jakarta Commons Logging API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Disabling Log4J API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Disabling Avalon Logger API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.logging.internal.Activator]
: Disabling JULI Logger API support.
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.web.service.internal.Activator]
: Pax Web stopped
org.ops4j.pax.logging.pax-logging-api[org.apache.camel.osgi.Activator] :
Camel activator stopping
org.ops4j.pax.logging.pax-logging-api[org.apache.camel.osgi.Activator] :
Camel activator stopped
org.ops4j.pax.logging.pax-logging-api[org.apache.camel.osgi.Activator] :
Camel activator stopping
org.ops4j.pax.logging.pax-logging-api[org.apache.camel.osgi.Activator] :
Camel activator stopped
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.exam.junit.extender.impl.internal.TestBundleObserver]
: Unregistered testcase
[com.awl.wlsi.itest.sir.OsgiPaxExamIntegrationTest.testSendMessage]
org.ops4j.pax.logging.pax-logging-api[org.ops4j.pax.exam.rbc.internal.Activator]
: RMI registry stopped

[             DefaultJavaRunner] - Platform has been shutdown.

{code}

Do you have any idea why this error occurs?

Thanks in advance,
Christian
-- 
View this message in context: http://camel.465427.n5.nabble.com/Pax-Exam-test-for-Camel-tp2799729p2799729.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Pax Exam test for Camel

Posted by Christian Mueller <ch...@gmail.com>.
Hello Willem!

Thank you for the quick reply and sorry for my late reaction (I was outside
my country without internet access).

In etc/startup.properties I found the following entry:
org/apache/felix/org.apache.felix.fileinstall/3.0.0/org.apache.felix.fileinstall-3.0.0.jar=11

I added the following two lines into my configure() method:

{code}
...
repositories("http://repo.fusesource.com/maven2/",
"http://repository.ops4j.org/maven2/"),

mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.fileinstall").version("3.0.0"),
mavenBundle().groupId("org.apache.geronimo.blueprint").artifactId("geronimo-blueprint").version("1.0.0"),

scanFeatures(getCamelKarafFeatureUrl(), "camel-core", "camel-osgi",
"camel-spring", "camel-test", "camel-jaxb", "camel-cxf"),
...
{code}

And now it works, without the error message in the log.

Thanks for helping me,
Christian
-- 
View this message in context: http://camel.465427.n5.nabble.com/Pax-Exam-test-for-Camel-tp2799729p2805134.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Pax Exam test for Camel

Posted by Willem Jiang <wi...@gmail.com>.
It looks there are some bundle which exports the package 
"org.apache.felix.fileinstall" is not installed. It's Apache Felix File 
Install (3.0.0)

You may need to go through the karaf etc/startup.properties to check if 
there are some basic bundle is missing.

Servicemix features are based on karaf stared up rightly, you may need 
to install the karaf basic bundles at the first time.

BTW, From Camel 2.3.0, we removed the dependency of karaf feature from 
camel feature, so you can deploy the camel feature into different 
version of karaf.


Willem

Christian Mueller wrote:
> Inspired from Camels OSGiIntegrationTestSupport, I plan also to test my
> routes with Pax Exam, because all our routes will be deployed into
> ServiceMix (FUSE ESB 4.2.0-fuse-02-00 - Camel 2.2.0-fuse-02-00).
> 
> My first Pax Exam test
> 
> {code:java}
> @RunWith(JUnit4TestRunner.class)
> public class OsgiPaxExamIntegrationTest extends CamelTestSupport {
> 
> 	@Inject
> 	protected BundleContext bundleContext;
> 
> 	@EndpointInject(uri = "mock:result")
> 	private MockEndpoint resultEndpoint;
> 
> 	@Test
> 	public void testSendMessage() throws Exception {
> 		resultEndpoint.expectedBodiesReceived("Hello World");
> 
> 		template.sendBody("seda:foo", "Hello World");
> 
> 		assertMockEndpointsSatisfied();
> 	}
> 
> 	protected RouteBuilder createRouteBuilder() throws Exception {
> 		return new RouteBuilder() {
> 			public void configure() {
> 				from("seda:foo").to("mock:result");
> 			}
> 		};
> 	}
> 
> 	protected CamelContext createCamelContext() throws Exception {
> 		setThreadContextClassLoader();
> 
> 		CamelContextFactory factory = new CamelContextFactory();
> 		factory.setBundleContext(bundleContext);
> 		return factory.createContext();
> 	}
> 
> 	protected void setThreadContextClassLoader() {
> 		// set the thread context classloader current bundle classloader
> 		Thread.currentThread().setContextClassLoader(
> 				this.getClass().getClassLoader());
> 	}
> 
> 	public static UrlReference getCamelKarafFeatureUrl() {
> 		return mavenBundle().groupId("org.apache.camel.karaf")
> 				.artifactId("apache-camel").type("xml").classifier("features")
> 				.version("2.2.0-fuse-02-00");
> 	}
> 
> 	public static UrlReference getServicemixFeatureUrl() {
> 		return mavenBundle().groupId("org.apache.servicemix")
> 				.artifactId("apache-servicemix").type("xml")
> 				.classifier("features").version("4.2.0-fuse-02-00");
> 	}
> 
> 	@Configuration
> 	public static Option[] configure() throws Exception {
> 		Option[] options = options(
> 				// install the spring dm profile
> 				profile("spring.dm").version("1.2.0"),
> 				org.ops4j.pax.exam.CoreOptions.systemProperty(
> 						"org.ops4j.pax.logging.DefaultServiceLog.level").value(
> 						"INFO"),
> 				org.ops4j.pax.exam.CoreOptions.systemProperty(
> 						"org.apache.camel.jmx.disable").value("true"),
> 				repositories("http://repo.fusesource.com/maven2/",
> 						"http://repository.ops4j.org/maven2/"),
> 				scanFeatures(getCamelKarafFeatureUrl(), "camel-core",
> 						"camel-osgi", "camel-spring", "camel-test",
> 						"camel-jaxb", "camel-cxf"),
> 				/*
> 				 * scanFeatures(getServicemixFeatureUrl(), "camel-activemq"),
> 				 */
> 				workingDirectory("target/paxrunner/"), felix(),
> 
> 				waitForFrameworkStartupFor(30000));
> 
> 		return options;
> 	}
> }
> {code}
> 
> The test succeed, but in the log I see the following error message:
> 
> {code}
> ERROR: Error starting
> file:bundles/org.apache.felix.karaf.deployer.spring_1.4.0.fuse-02-00.jar
> (org.osgi.framework.BundleException: Unresolved constraint in bundle
> org.apache.felix.karaf.deployer.spring [21]: package;
> (&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0))))
> org.osgi.framework.BundleException: Unresolved constraint in bundle
> org.apache.felix.karaf.deployer.spring [21]: package;
> (&(package=org.apache.felix.fileinstall)(version>=3.0.0)(!(version>=4.0.0)))
> 	at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3263)
> 	at org.apache.felix.framework.Felix.startBundle(Felix.java:1597)
> 	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
> 	at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
> 	at java.lang.Thread.run(Thread.java:637)
> {code}
>