use of ca.uhn.hl7v2.model.Message in project camel by apache.
the class HL7MLLPCodecTest method createHL7AsMessage.
// START SNIPPET: e3
private static Message createHL7AsMessage() throws Exception {
ADR_A19 adr = new ADR_A19();
adr.initQuickstart("ADR", "A19", "P");
// Populate the MSH Segment
MSH mshSegment = adr.getMSH();
mshSegment.getDateTimeOfMessage().getTimeOfAnEvent().setValue("200701011539");
mshSegment.getSendingApplication().getNamespaceID().setValue("MYSENDER");
mshSegment.getMessageControlID().setValue("456");
// Populate the PID Segment
MSA msa = adr.getMSA();
msa.getAcknowledgementCode().setValue("AA");
msa.getMessageControlID().setValue("123");
QRD qrd = adr.getQRD();
qrd.getQueryDateTime().getTimeOfAnEvent().setValue("20080805120000");
return adr;
}
use of ca.uhn.hl7v2.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");
}
};
}
use of ca.uhn.hl7v2.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");
}
};
}
use of ca.uhn.hl7v2.model.Message in project camel by apache.
the class HL7MLLPNettyCodecTest method createHL7AsMessage.
// START SNIPPET: e3
private static Message createHL7AsMessage() throws Exception {
ADR_A19 adr = new ADR_A19();
adr.initQuickstart("ADR", "A19", "P");
// Populate the MSH Segment
MSH mshSegment = adr.getMSH();
mshSegment.getDateTimeOfMessage().getTimeOfAnEvent().setValue("200701011539");
mshSegment.getSendingApplication().getNamespaceID().setValue("MYSENDER");
mshSegment.getMessageControlID().setValue("456");
// Populate the PID Segment
MSA msa = adr.getMSA();
msa.getAcknowledgementCode().setValue("AA");
msa.getMessageControlID().setValue("123");
QRD qrd = adr.getQRD();
qrd.getQueryDateTime().getTimeOfAnEvent().setValue("20080805120000");
return adr;
}
use of ca.uhn.hl7v2.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");
}
};
}
Aggregations