apache camel - cameltest case with bean -
apache camel - cameltest case with bean -
in java class have below:
from("direct:dcrm:input") .routeid("dcrm-route" .convertbodyto(message.class) .setheader( "recipientlistheader", simple("activemq:"+rdvrqueuename+ ".${body.controllerid}?jmsmessagetype=text&timetolive=" + rdvrmessagetimetolive + "&deliverypersistent=" + deliverypersistent)) .choice() .when(simple("${body.messagetype} == 'rdvr'")) .bean(new dcrmmessagehandler(), "process") .marshal(requestmessage) .recipientlist(header("recipientlistheader")) .onprepare(new messsageprocessor()).parallelprocessing() .end() .setbody(constant(statuscode.success)) .otherwise() .endchoice();
while writing junit doint :
@test public void testsendmatchingmessage() throws exception { string expectedbody = "<matched/>"; resultendpoint.expectedbodiesreceived(expectedbody); template.sendbodyandheader(expectedbody, "recipientlistheader", 0); resultendpoint.assertissatisfied(); } @override protected routebuilder createroutebuilder() throws exception { //return new dcrmoutboundroute(); homecoming new routebuilder() { @override public void configure() throws exception { // todo auto-generated method stub from("direct:dcrm:input") .filter(header("recipientlistheader").isequalto(constant(statuscode.success))) .bean(new dcrmmessagehandler(), "process").to("mock:result"); } }; }
but getting bellow error:
java.lang.classformaterror: absent code attribute in method not native or abstract in class file javax/persistence/noresultexception @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:800) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:449) @ java.net.urlclassloader.access$100(urlclassloader.java:71) @ java.net.urlclassloader$1.run(urlclassloader.java:361) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358)
check classpath or maven dependencies, in particular 1 referencing jpa (javax.persistence). should have dependency groupid javax.persistence , artifactid persistence-api, replace org.hibernate.javax.persistence or org.eclipse.persistence dependency.
apache-camel junit4 spring-batch
Comments
Post a Comment