Search in sources :

Example 16 with Message

use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.

the class MessageValidatorTest method testDefaultValidationContext.

@Test
public void testDefaultValidationContext() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:test1");
    mock.expectedMessageCount(1);
    Message msg = createADT01Message();
    template.sendBody("direct:test1", msg);
    assertMockEndpointsSatisfied();
}
Also used : Message(ca.uhn.hl7v2.model.Message) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 17 with Message

use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.

the class MessageValidatorTest method testDynamicDefaultHapiContext.

@Test
public void testDynamicDefaultHapiContext() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:test6");
    mock.expectedMessageCount(1);
    Message msg = createADT01Message();
    msg.setParser(defaultContext.getPipeParser());
    template.sendBody("direct:test6", msg);
    assertMockEndpointsSatisfied();
}
Also used : Message(ca.uhn.hl7v2.model.Message) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 18 with Message

use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.

the class HL7MLLPCodecTest method createRouteBuilder.

protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        public void configure() throws Exception {
            from("mina2:tcp://127.0.0.1:" + getPort() + "?sync=true&codec=#hl7codec").process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    Message input = exchange.getIn().getBody(Message.class);
                    assertEquals("2.4", input.getVersion());
                    QRD qrd = (QRD) input.get("QRD");
                    assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
                    Message response = createHL7AsMessage();
                    exchange.getOut().setBody(response);
                }
            }).to("mock:result");
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) QRD(ca.uhn.hl7v2.model.v24.segment.QRD) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) Message(ca.uhn.hl7v2.model.Message)

Example 19 with Message

use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.

the class HL7MLLPNettyCodecTest method createRouteBuilder.

protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        public void configure() throws Exception {
            from("netty4:tcp://127.0.0.1:" + getPort() + "?sync=true&decoder=#hl7decoder&encoder=#hl7encoder").process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    Message input = exchange.getIn().getBody(Message.class);
                    assertEquals("2.4", input.getVersion());
                    QRD qrd = (QRD) input.get("QRD");
                    assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
                    Message response = createHL7AsMessage();
                    exchange.getOut().setBody(response);
                }
            }).to("mock:result");
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) QRD(ca.uhn.hl7v2.model.v24.segment.QRD) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) Message(ca.uhn.hl7v2.model.Message)

Example 20 with Message

use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.

the class HL7MLLPNettyDecoderResourceLeakTest method createRouteBuilder.

protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        public void configure() throws Exception {
            from("netty4:tcp://127.0.0.1:" + getPort() + "?decoder=#hl7decoder&encoder=#hl7encoder").process(new Processor() {

                public void process(Exchange exchange) throws Exception {
                    Message input = exchange.getIn().getBody(Message.class);
                    exchange.getOut().setBody(input.generateACK());
                }
            }).to("mock:result");
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) Message(ca.uhn.hl7v2.model.Message)

Aggregations

Message (ca.uhn.hl7v2.model.Message)114 Test (org.junit.Test)81 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)60 ORU_R01 (ca.uhn.hl7v2.model.v25.message.ORU_R01)30 NK1 (ca.uhn.hl7v2.model.v25.segment.NK1)21 Patient (org.openmrs.Patient)21 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)17 ORUR01Handler (org.openmrs.hl7.handler.ORUR01Handler)15 Person (org.openmrs.Person)14 ArrayList (java.util.ArrayList)13 HL7Exception (ca.uhn.hl7v2.HL7Exception)12 Concept (org.openmrs.Concept)12 Obs (org.openmrs.Obs)12 ObsService (org.openmrs.api.ObsService)11 QRD (ca.uhn.hl7v2.model.v24.segment.QRD)9 IOException (java.io.IOException)8 Encounter (org.openmrs.Encounter)8 RouteBuilder (org.apache.camel.builder.RouteBuilder)7 Structure (ca.uhn.hl7v2.model.Structure)5 CX (ca.uhn.hl7v2.model.v25.datatype.CX)5