java - NPE when using CamelBlueprintTestSupport -


i want create integration test camelblueprinttestsupport. start camelcontext looks ok @ first:

[ main] ingrestjobadvertapioffirstbird info skipping starting camelcontext system property skipstartingcamelcontext set true. [ main] blueprintcamelcontext info apache camel 2.15.1.redhat-620133 (camelcontext: camel-1) starting

routes starting. message within console:

in main loop, have serious trouble: java.lang.nullpointerexception java.lang.nullpointerexception @ org.apache.felix.fileinstall.internal.directorywatcher.run(directorywatcher.java:303)

camel version: 2.15.1.redhat-620133

the unit test:

public class whenusingrestjobadvertapiofdemo extends camelblueprinttestsupport {  @override protected string getblueprintdescriptor() {     return "osgi-inf/blueprint/blueprint.xml"; }  @override protected string[] loadconfigadminconfigurationfile() {     return new string[]{"src/test/resources/jobwebsite.connector.properties", "jobwebsite.connector"}; }  @test public void testroute() throws exception {      context.addroutes(new mockserviceendpoints());     jobrequest jobrequest = readjodata();     template.sendbody("direct:createjobindemo", jobrequest);      string expectedbody = "<matched/>";     template.sendbodyandheader(expectedbody, "foo", "bar"); }  public  jobrequest readjodata() throws ioexception {      objectmapper mapper = new objectmapper();      jobrequest jobrequest = mapper.readvalue(new file("src/test/resources/demo-data/job-advert/job-123.json"), jobrequest.class);      return jobrequest; } 

}

there known issue in camel: https://issues.apache.org/jira/browse/camel-7985

solution, works me posted here: https://issues.jboss.org/browse/entesb-2225. let's copy useful comment here:

when stepping projects 6.2 ga - camel-test-blueprint unit tests throw nullpointerexception excessively. looked @ resolution of bug report , applied poms, , cleared npes. here did:

    <dependency>         <groupid>org.apache.camel</groupid>         <artifactid>camel-test-blueprint</artifactid>         <scope>test</scope>         <!-- exclude in order prevent -->         <!-- java.lang.nullpointerexception @ org.apache.felix.fileinstall.internal.directorywatcher.run(directorywatcher.java:303) -->         <exclusions>             <exclusion>                 <groupid>org.apache.felix</groupid>                 <artifactid>org.apache.felix.fileinstall</artifactid>             </exclusion>         </exclusions>     </dependency> 

additionally, had add following dependency:

<dependency>     <groupid>org.apache.felix</groupid>     <artifactid>org.apache.felix.utils</artifactid>     <scope>test</scope> </dependency> 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

c# - MSDN OneNote Api: Navigate to never before opened page without opening a OneNote Application Window -