Search in sources :

Example 11 with Message

use of ca.uhn.hl7v2.model.Message in project camel by apache.

the class MessageValidatorTest method createADT01Message.

private static Message createADT01Message() throws Exception {
    ADT_A01 adt = new ADT_A01();
    adt.initQuickstart("ADT", "A01", "P");
    // Populate the PID Segment
    PID pid = adt.getPID();
    pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe");
    pid.getPatientName(0).getGivenName().setValue("John");
    pid.getPatientIdentifierList(0).getID().setValue("123456");
    return adt;
}
Also used : PID(ca.uhn.hl7v2.model.v24.segment.PID) ADT_A01(ca.uhn.hl7v2.model.v24.message.ADT_A01)

Example 12 with Message

use of ca.uhn.hl7v2.model.Message in project camel by apache.

the class MessageValidatorTest method testDynamicCustomHapiContext.

@Test(expected = CamelExecutionException.class)
public void testDynamicCustomHapiContext() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:test6");
    mock.expectedMessageCount(0);
    Message msg = createADT01Message();
    msg.setParser(customContext.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 13 with Message

use of ca.uhn.hl7v2.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 14 with Message

use of ca.uhn.hl7v2.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 15 with Message

use of ca.uhn.hl7v2.model.Message in project camel by apache.

the class TerserExpressionTest method createADT01Message.

private static Message createADT01Message() throws Exception {
    ADT_A01 adt = new ADT_A01();
    adt.initQuickstart("ADT", "A01", "P");
    // Populate the PID Segment
    PID pid = adt.getPID();
    pid.getPatientName(0).getFamilyName().getSurname().setValue("Doe");
    pid.getPatientName(0).getGivenName().setValue("John");
    pid.getPatientIdentifierList(0).getID().setValue(PATIENT_ID);
    return adt;
}
Also used : PID(ca.uhn.hl7v2.model.v24.segment.PID) ADT_A01(ca.uhn.hl7v2.model.v24.message.ADT_A01)

Aggregations

Message (ca.uhn.hl7v2.model.Message)44 QRD (ca.uhn.hl7v2.model.v24.segment.QRD)19 Test (org.junit.Test)19 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)18 MSH (ca.uhn.hl7v2.model.v24.segment.MSH)13 ArrayList (java.util.ArrayList)12 HL7Exception (ca.uhn.hl7v2.HL7Exception)11 ADR_A19 (ca.uhn.hl7v2.model.v24.message.ADR_A19)9 MSA (ca.uhn.hl7v2.model.v24.segment.MSA)9 ADT_A01 (ca.uhn.hl7v2.model.v24.message.ADT_A01)7 PID (ca.uhn.hl7v2.model.v24.segment.PID)7 Exchange (org.apache.camel.Exchange)7 Processor (org.apache.camel.Processor)7 RouteBuilder (org.apache.camel.builder.RouteBuilder)7 Structure (ca.uhn.hl7v2.model.Structure)5 IOException (java.io.IOException)5 Group (ca.uhn.hl7v2.model.Group)4 Segment (ca.uhn.hl7v2.model.Segment)4 File (java.io.File)4 SegmentModel (org.talend.designer.hl7.model.SegmentModel)4