use of org.apache.commons.jexl3.parser.Parser in project camel by apache.
the class HL7XmlDataFormatTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() throws Exception {
HapiContext hapiContext = new DefaultHapiContext();
hapiContext.setValidationContext(new NoValidation());
Parser p = new GenericParser(hapiContext);
hl7 = new HL7DataFormat();
hl7.setParser(p);
return new RouteBuilder() {
public void configure() throws Exception {
from("direct:unmarshalOk").unmarshal().hl7(false).to("mock:unmarshal");
from("direct:unmarshalOkXml").unmarshal(hl7).to("mock:unmarshal");
}
};
}
use of org.apache.commons.jexl3.parser.Parser in project wildfly-camel by wildfly-extras.
the class HL7IntegrationTest method testMarshalUnmarshal.
@Test
@SuppressWarnings("resource")
public void testMarshalUnmarshal() throws Exception {
final String msg = "MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4\r";
final HL7DataFormat format = new HL7DataFormat();
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").marshal(format).unmarshal(format).to("mock:result");
}
});
camelctx.start();
try {
HapiContext context = new DefaultHapiContext();
Parser p = context.getGenericParser();
Message hapimsg = p.parse(msg);
ProducerTemplate producer = camelctx.createProducerTemplate();
Message result = (Message) producer.requestBody("direct:start", hapimsg);
Assert.assertEquals(hapimsg.toString(), result.toString());
} finally {
camelctx.stop();
}
}
Aggregations