Hi, at last I arrived to run a camel test in karaf, thanks to you. My next issue is, that the test is running.
1. I get a NPE when creating the MockEndpoint int the test method: test(ch.eugster.ingest.sip.identification.KarafContainerTest) Time elapsed: 73.953 sec <<< ERROR! java.lang.NullPointerException: null at org.apache.camel.test.junit4.TestSupport.resolveMandatoryEndpoint(TestSupport.java:287) at org.apache.camel.test.junit4.CamelTestSupport.resolveMandatoryEndpoint(CamelTestSupport.java:549) at org.apache.camel.test.junit4.CamelTestSupport.getMockEndpoint(CamelTestSupport.java:573) at org.apache.camel.test.junit4.CamelTestSupport.getMockEndpoint(CamelTestSupport.java:559) at ch.eugster.ingest.sip.identification.KarafContainerTest.test(KarafContainerTest.java:112) 2. The route is not executed. Do you have an idea, what this could be? Thank you very much! Regard Christian Following (hopefully) all necessery information: The error in log is: 2015-03-13 12:58:30,899 | WARN | ce Proxy Creator | GuardProxyCatalog | 5 - org.apache.karaf.service.guard - 3.0.3 | Problem creating secured service proxy java.lang.NullPointerException at org.apache.karaf.service.guard.impl.GuardProxyCatalog$1.run(GuardProxyCatalog.java:251)[5:org.apache.karaf.service.guard:3.0.3] at org.apache.karaf.service.guard.impl.GuardProxyCatalog$ServiceProxyCreatorCustomizer$1.run(GuardProxyCatalog.java:566)[5:org.apache.karaf.service.guard:3.0.3] at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] 2015-03-13 12:58:30,904 | WARN | ce Proxy Creator | GuardProxyCatalog | 5 - org.apache.karaf.service.guard - 3.0.3 | Problem creating secured service proxy java.lang.NullPointerException at org.apache.karaf.service.guard.impl.GuardProxyCatalog$1.run(GuardProxyCatalog.java:251)[5:org.apache.karaf.service.guard:3.0.3] at org.apache.karaf.service.guard.impl.GuardProxyCatalog$ServiceProxyCreatorCustomizer$1.run(GuardProxyCatalog.java:566)[5:org.apache.karaf.service.guard:3.0.3] at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] 2015-03-13 12:58:30,916 | WARN | ce Proxy Creator | GuardProxyCatalog | 5 - org.apache.karaf.service.guard - 3.0.3 | Problem creating secured service proxy java.lang.NullPointerException at org.apache.karaf.service.guard.impl.GuardProxyCatalog$1.run(GuardProxyCatalog.java:251)[5:org.apache.karaf.service.guard:3.0.3] at org.apache.karaf.service.guard.impl.GuardProxyCatalog$ServiceProxyCreatorCustomizer$1.run(GuardProxyCatalog.java:566)[5:org.apache.karaf.service.guard:3.0.3] at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] 2015-03-13 12:58:30,920 | WARN | ce Proxy Creator | GuardProxyCatalog | 5 - org.apache.karaf.service.guard - 3.0.3 | Problem creating secured service proxy java.lang.NullPointerException at org.apache.karaf.service.guard.impl.GuardProxyCatalog$1.run(GuardProxyCatalog.java:251)[5:org.apache.karaf.service.guard:3.0.3] at org.apache.karaf.service.guard.impl.GuardProxyCatalog$ServiceProxyCreatorCustomizer$1.run(GuardProxyCatalog.java:566)[5:org.apache.karaf.service.guard:3.0.3] at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] 2015-03-13 12:58:30,921 | WARN | ce Proxy Creator | GuardProxyCatalog | 5 - org.apache.karaf.service.guard - 3.0.3 | Problem creating secured service proxy java.lang.NullPointerException at org.apache.karaf.service.guard.impl.GuardProxyCatalog$1.run(GuardProxyCatalog.java:251)[5:org.apache.karaf.service.guard:3.0.3] at org.apache.karaf.service.guard.impl.GuardProxyCatalog$ServiceProxyCreatorCustomizer$1.run(GuardProxyCatalog.java:566)[5:org.apache.karaf.service.guard:3.0.3] at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] 2015-03-13 12:58:30,921 | WARN | ce Proxy Creator | GuardProxyCatalog | 5 - org.apache.karaf.service.guard - 3.0.3 | Problem creating secured service proxy java.lang.NullPointerException at org.apache.karaf.service.guard.impl.GuardProxyCatalog$1.run(GuardProxyCatalog.java:251)[5:org.apache.karaf.service.guard:3.0.3] at org.apache.karaf.service.guard.impl.GuardProxyCatalog$ServiceProxyCreatorCustomizer$1.run(GuardProxyCatalog.java:566)[5:org.apache.karaf.service.guard:3.0.3] at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] 2015-03-13 12:58:30,922 | WARN | ce Proxy Creator | GuardProxyCatalog | 5 - org.apache.karaf.service.guard - 3.0.3 | Problem creating secured service proxy java.lang.NullPointerException at org.apache.karaf.service.guard.impl.GuardProxyCatalog$1.run(GuardProxyCatalog.java:251)[5:org.apache.karaf.service.guard:3.0.3] at org.apache.karaf.service.guard.impl.GuardProxyCatalog$ServiceProxyCreatorCustomizer$1.run(GuardProxyCatalog.java:566)[5:org.apache.karaf.service.guard:3.0.3] at java.lang.Thread.run(Thread.java:745)[:1.8.0_40] 2015-03-13 12:58:31,044 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.camel.karaf.camel-karaf-commands 2015-03-13 12:58:31,112 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.package.command 2015-03-13 12:58:31,125 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.shell.commands 2015-03-13 12:58:31,297 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.system.command 2015-03-13 12:58:31,322 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.shell.help 2015-03-13 12:58:31,329 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.bundle.command 2015-03-13 12:58:31,470 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.jaas.modules 2015-03-13 12:58:31,492 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.features.command 2015-03-13 12:58:31,542 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.deployer.wrap 2015-03-13 12:58:31,553 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.system.core 2015-03-13 12:58:31,560 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.bundle.core 2015-03-13 12:58:31,566 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.deployer.features 2015-03-13 12:58:31,570 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.features.core 2015-03-13 12:58:31,583 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.deployer.kar 2015-03-13 12:58:31,584 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.kar.core 2015-03-13 12:58:31,586 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle sip-identification-processor 2015-03-13 12:58:31,590 | INFO | FelixShutdown | BlueprintCamelContext | 46 - org.apache.camel.camel-core - 2.14.2 | Apache Camel 2.14.2 (CamelContext: blueprintContext) is shutting down 2015-03-13 12:58:31,593 | INFO | FelixShutdown | DefaultShutdownStrategy | 46 - org.apache.camel.camel-core - 2.14.2 | Starting to graceful shutdown 1 routes (timeout 300 seconds) 2015-03-13 12:58:31,598 | INFO | 1 - ShutdownTask | DefaultShutdownStrategy | 46 - org.apache.camel.camel-core - 2.14.2 | Route: route1 shutdown complete, was consuming from: Endpoint[file://target/inbox] 2015-03-13 12:58:31,599 | INFO | FelixShutdown | DefaultShutdownStrategy | 46 - org.apache.camel.camel-core - 2.14.2 | Graceful shutdown of 1 routes completed in 0 seconds 2015-03-13 12:58:31,605 | INFO | FelixShutdown | BlueprintCamelContext | 46 - org.apache.camel.camel-core - 2.14.2 | Apache Camel 2.14.2 (CamelContext: blueprintContext) uptime 2.376 seconds 2015-03-13 12:58:31,605 | INFO | FelixShutdown | BlueprintCamelContext | 46 - org.apache.camel.camel-core - 2.14.2 | Apache Camel 2.14.2 (CamelContext: blueprintContext) is shutdown in 0.014 seconds 2015-03-13 12:58:31,607 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.camel.camel-blueprint 2015-03-13 12:58:31,610 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.config.command 2015-03-13 12:58:31,668 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.config.core 2015-03-13 12:58:31,671 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.management.server 2015-03-13 12:58:31,681 | INFO | FelixShutdown | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Unregistering org.osgi.jmx.framework.BundleStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@263ee920 with name osgi.core:type=bundleState,version=1.7,framework=org.apache.felix.framework,uuid=be4d8555-a13f-46a1-8b68-18c813031c36 2015-03-13 12:58:31,681 | INFO | FelixShutdown | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Unregistering org.osgi.jmx.framework.wiring.BundleWiringStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@263ee920 with name osgi.core:type=wiringState,version=1.1,framework=org.apache.felix.framework,uuid=be4d8555-a13f-46a1-8b68-18c813031c36 2015-03-13 12:58:31,701 | INFO | FelixShutdown | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Unregistering org.osgi.jmx.framework.PackageStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@263ee920 with name osgi.core:type=packageState,version=1.5,framework=org.apache.felix.framework,uuid=be4d8555-a13f-46a1-8b68-18c813031c36 2015-03-13 12:58:31,701 | INFO | FelixShutdown | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Unregistering org.osgi.jmx.service.cm.ConfigurationAdminMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@263ee920 with name osgi.compendium:service=cm,version=1.3,framework=org.apache.felix.framework,uuid=be4d8555-a13f-46a1-8b68-18c813031c36 2015-03-13 12:58:31,702 | INFO | FelixShutdown | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Unregistering org.osgi.jmx.framework.FrameworkMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@263ee920 with name osgi.core:type=framework,version=1.7,framework=org.apache.felix.framework,uuid=be4d8555-a13f-46a1-8b68-18c813031c36 2015-03-13 12:58:31,703 | INFO | FelixShutdown | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Unregistering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@263ee920 with name osgi.core:type=serviceState,version=1.7,framework=org.apache.felix.framework,uuid=be4d8555-a13f-46a1-8b68-18c813031c36 2015-03-13 12:58:31,710 | WARN | FelixShutdown | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Task rejected for JMX Notification dispatch of event [org.osgi.framework.ServiceEvent[source=[javax.management.MBeanServer]]] - Dispatcher may have been shutdown 2015-03-13 12:58:31,723 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.service.core 2015-03-13 12:58:31,726 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.log.core 2015-03-13 12:58:31,730 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.diagnostic.core 2015-03-13 12:58:31,755 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.instance.core 2015-03-13 12:58:31,756 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.package.core 2015-03-13 12:58:31,758 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.jaas.config 2015-03-13 12:58:31,760 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.shell.console 2015-03-13 12:58:31,766 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.deployer.blueprint 2015-03-13 12:58:31,768 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.karaf.deployer.spring 2015-03-13 12:58:31,769 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.aries.blueprint.core 2015-03-13 12:58:31,772 | INFO | FelixShutdown | BlueprintExtender | 15 - org.apache.aries.blueprint.core - 1.4.2 | Destroying BlueprintContainer for bundle org.apache.aries.blueprint.cm 2015-03-13 12:58:31,776 | INFO | FelixShutdown | ContextLoaderListener | 91 - org.springframework.osgi.extender - 1.2.1 | Stopping [org.springframework.osgi.extender] bundle v.[1.2.1] 2015-03-13 12:58:31,793 | INFO | FelixShutdown | TimerTaskExecutor | 86 - org.apache.servicemix.bundles.spring-context - 3.2.11.RELEASE_1 | Cancelling Timer 2015-03-13 12:58:31,815 | INFO | FelixStartLevel | Activator | 46 - org.apache.camel.camel-core - 2.14.2 | Camel activator stopping 2015-03-13 12:58:31,815 | INFO | FelixStartLevel | Activator | 46 - org.apache.camel.camel-core - 2.14.2 | Camel activator stopped 2015-03-13 12:58:31,817 | INFO | FelixStartLevel | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Stopping JMX OSGi agent 2015-03-13 12:58:31,818 | INFO | FelixStartLevel | core | 110 - org.apache.aries.jmx.core - 1.1.2 | Unregistering MBean with ObjectName [osgi.compendium:service=cm,version=1.3,framework=org.apache.felix.framework,uuid=be4d8555-a13f-46a1-8b68-18c813031c36] for service with service.id [14] [ main] ReactorManager INFO suite finished Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 74.048 sec <<< FAILURE! - in ch.eugster.ingest.sip.identification.KarafContainerTest test(ch.eugster.ingest.sip.identification.KarafContainerTest) Time elapsed: 73.953 sec <<< ERROR! java.lang.NullPointerException: null at org.apache.camel.test.junit4.TestSupport.resolveMandatoryEndpoint(TestSupport.java:287) at org.apache.camel.test.junit4.CamelTestSupport.resolveMandatoryEndpoint(CamelTestSupport.java:549) at org.apache.camel.test.junit4.CamelTestSupport.getMockEndpoint(CamelTestSupport.java:573) at org.apache.camel.test.junit4.CamelTestSupport.getMockEndpoint(CamelTestSupport.java:559) at ch.eugster.ingest.sip.identification.KarafContainerTest.test(KarafContainerTest.java:112) Results : Tests in error: KarafContainerTest.test:112->CamelTestSupport.getMockEndpoint:559->CamelTestSupport.getMockEndpoint:573->CamelTestSupport.resolveMandatoryEndpoint:549->TestSupport.resolveMandatoryEndpoint:287 » NullPointer Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:19 min [INFO] Finished at: 2015-03-13T12:58:32+01:00 [INFO] Final Memory: 18M/225M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18:test (default-test) on project sip-identification-processor: There are test failures. [ERROR] [ERROR] Please refer to /Users/christian/Projekte/ceugster/Entwicklung/Test/Workspace-4.4/ingest-engine/sip-identification-processor/target/surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException My route builder is built from blueprint: <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/blueprint" xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd"> <reference-list id="sipConnectors" interface="ch.eugster.ingest.sip.connector.api.SipConnector" availability="mandatory"> <reference-listener bind-method="bindSipConnector" unbind-method="unbindSipConnector"> <bean class="ch.eugster.ingest.sip.identification.SipIdentificationProcessor"/> </reference-listener> </reference-list> <bean id="fileroute" class="ch.eugster.ingest.sip.identification.KarafContainerRouteBuilder"/> <camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint"> <routeBuilder ref="fileroute"/> </camelContext> </blueprint> and the KarafContainerRouteBuilder looks like: package ch.eugster.ingest.sip.identification; import org.apache.camel.builder.RouteBuilder; /** * A Camel Java DSL Router */ public class KarafContainerRouteBuilder extends RouteBuilder { /** * Let's configure the Camel routing rules using Java code... */ public void configure() { System.out.println("Route configured"); SipIdentificationProcessor processor = new SipIdentificationProcessor(); from("file://target/inbox").process(processor).to("mock:file"); } } while the test class is: package ch.eugster.ingest.sip.identification; import static org.ops4j.pax.exam.CoreOptions.maven; import static org.ops4j.pax.exam.CoreOptions.mavenBundle; import static org.ops4j.pax.exam.CoreOptions.streamBundle; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel; import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle; import java.io.File; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.StandardCopyOption; import javax.inject.Inject; import org.apache.camel.CamelContext; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.apache.karaf.features.FeaturesService; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel; import org.ops4j.pax.exam.util.Filter; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; @RunWith(PaxExam.class) public class KarafContainerTest extends CamelTestSupport { private static final String templatePath = new File("../../../../src/test/resources/SIP_20150306_Matterhorn.zip").getAbsolutePath(); private static final String sourcePath = new File("../../../inbox/SIP_20150306_Matterhorn.zip").getAbsolutePath(); private static final String targetPath = new File("../../../outbox/SIP_20150306_Matterhorn.zip").getAbsolutePath(); @Inject protected BundleContext bundleContext; @Inject protected FeaturesService featuresService; @Inject @Filter(value="(camel.context.name=blueprintContext)", timeout=10000) protected CamelContext testContext; @Configuration public static Option[] configuration() throws Exception { System.out.println("Configuring container"); return new Option[] { karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf") .type("zip").versionAsInProject()) .unpackDirectory(new File("target/paxexam/unpack/")) .useDeployFolder(false), configureConsole().ignoreLocalConsole(), logLevel(LogLevel.INFO), keepRuntimeFolder(), features( maven().groupId("org.apache.camel.karaf").artifactId("apache-camel").type("xml") .classifier("features").versionAsInProject(), "camel-blueprint", "camel-test"), features( maven().groupId("org.apache.karaf.features") .artifactId("standard").type("xml") .classifier("features").versionAsInProject(), "eventadmin"), mavenBundle().groupId("ch.eugster.ingest") .artifactId("sip-connector-api") .version("0.0.1-SNAPSHOT"), mavenBundle().groupId("ch.eugster.ingest") .artifactId("checksum-api") .version("0.0.1-SNAPSHOT"), mavenBundle().groupId("ch.eugster.ingest") .artifactId("sip-connector-matterhorn") .version("0.0.1-SNAPSHOT"), streamBundle( bundle() .add(SipIdentificationProcessor.class) .add(KarafContainerRouteBuilder.class) .add("OSGI-INF/blueprint/camel-context.xml", new File("src/main/resources/OSGI-INF/blueprint/blueprint.xml") .toURL()) .set(Constants.BUNDLE_SYMBOLICNAME, "sip-identification-processor") .set(Constants.DYNAMICIMPORT_PACKAGE, "*").build()) .start() }; } @Override public boolean isCreateCamelContextPerClass() { // we override this method and return true, to tell Camel test-kit that // it should only create CamelContext once (per class), so we will // re-use the CamelContext between each test method in this class return true; } @Test public void test() throws Exception { System.out.println("test running"); assertTrue(featuresService.isInstalled(featuresService.getFeature("eventadmin"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("camel-core"))); assertTrue(featuresService.isInstalled(featuresService.getFeature("camel-blueprint"))); MockEndpoint mock = getMockEndpoint("mock:file"); System.out.println(mock.toString()); mock.expectedFileExists(targetPath); // Files.copy(FileSystems.getDefault().getPath(templatePath), FileSystems.getDefault().getPath(sourcePath), StandardCopyOption.REPLACE_EXISTING); assertTrue(new File(sourcePath).exists()); System.out.println(sourcePath); Thread.sleep(5000); assertMockEndpointsSatisfied(); } } Christian Eugster Docuteam GmbH Langacker 16 Postfach CH-5405 Baden-Dättwil +41 (0)56 470 03 37 c.eugs...@docuteam.ch