Search in sources :

Example 46 with Parser

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");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) DefaultHapiContext(ca.uhn.hl7v2.DefaultHapiContext) NoValidation(ca.uhn.hl7v2.validation.impl.NoValidation) HapiContext(ca.uhn.hl7v2.HapiContext) DefaultHapiContext(ca.uhn.hl7v2.DefaultHapiContext) Parser(ca.uhn.hl7v2.parser.Parser) GenericParser(ca.uhn.hl7v2.parser.GenericParser) GenericParser(ca.uhn.hl7v2.parser.GenericParser)

Example 47 with Parser

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();
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) ProducerTemplate(org.apache.camel.ProducerTemplate) RouteBuilder(org.apache.camel.builder.RouteBuilder) Message(ca.uhn.hl7v2.model.Message) HL7DataFormat(org.apache.camel.model.dataformat.HL7DataFormat) DefaultHapiContext(ca.uhn.hl7v2.DefaultHapiContext) HapiContext(ca.uhn.hl7v2.HapiContext) DefaultHapiContext(ca.uhn.hl7v2.DefaultHapiContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Parser(ca.uhn.hl7v2.parser.Parser) Test(org.junit.Test)

Aggregations

Parser (org.eclipse.jetty.http2.parser.Parser)37 ByteBufferPool (org.eclipse.jetty.io.ByteBufferPool)37 ByteBuffer (java.nio.ByteBuffer)36 Test (org.junit.Test)34 MappedByteBufferPool (org.eclipse.jetty.io.MappedByteBufferPool)25 ArrayList (java.util.ArrayList)22 HeaderGenerator (org.eclipse.jetty.http2.generator.HeaderGenerator)21 HttpFields (org.eclipse.jetty.http.HttpFields)17 MetaData (org.eclipse.jetty.http.MetaData)17 HashMap (java.util.HashMap)15 OutputStream (java.io.OutputStream)13 Socket (java.net.Socket)13 ServerSessionListener (org.eclipse.jetty.http2.api.server.ServerSessionListener)13 PrefaceFrame (org.eclipse.jetty.http2.frames.PrefaceFrame)13 SettingsFrame (org.eclipse.jetty.http2.frames.SettingsFrame)13 CountDownLatch (java.util.concurrent.CountDownLatch)12 HeadersFrame (org.eclipse.jetty.http2.frames.HeadersFrame)12 AtomicReference (java.util.concurrent.atomic.AtomicReference)8 HttpServlet (javax.servlet.http.HttpServlet)7 HostPortHttpField (org.eclipse.jetty.http.HostPortHttpField)6