use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.
the class HL7MLLPNettyCodecStandAndEndBytesTest 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 com.google.api.services.healthcare.v1.model.Message in project camel by apache.
the class HL7DataFormatTest method testMarshalISO8859.
@Test
public void testMarshalISO8859() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:marshal");
mock.expectedMessageCount(1);
mock.message(0).body().isInstanceOf(byte[].class);
mock.message(0).body(String.class).contains("MSA|AA|123");
mock.message(0).body(String.class).contains("QRD|20080805120000");
mock.message(0).body(String.class).not().contains(NONE_ISO_8859_1);
Message message = createHL7AsMessage();
template.sendBodyAndProperty("direct:marshal", message, Exchange.CHARSET_NAME, "ISO-8859-1");
assertMockEndpointsSatisfied();
}
use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.
the class HL7DataFormatTest method testMarshalUTF16InMessage.
@Test
public void testMarshalUTF16InMessage() throws Exception {
String charsetName = "UTF-16";
MockEndpoint mock = getMockEndpoint("mock:marshal");
mock.expectedMessageCount(1);
Message message = createHL7WithCharsetAsMessage(HL7Charset.getHL7Charset(charsetName));
template.sendBodyAndProperty("direct:marshal", message, Exchange.CHARSET_NAME, charsetName);
assertMockEndpointsSatisfied();
byte[] body = (byte[]) mock.getExchanges().get(0).getIn().getBody();
String msg = new String(body, Charset.forName(charsetName));
assertTrue(msg.contains("MSA|AA|123"));
assertTrue(msg.contains("QRD|20080805120000"));
}
use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.
the class HL7DataFormatTest method testUnmarshal.
@Test
public void testUnmarshal() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:unmarshal");
mock.expectedMessageCount(1);
mock.message(0).body().isInstanceOf(Message.class);
mock.expectedHeaderReceived(HL7Constants.HL7_SENDING_APPLICATION, "MYSENDER");
mock.expectedHeaderReceived(HL7Constants.HL7_SENDING_FACILITY, "MYSENDERAPP");
mock.expectedHeaderReceived(HL7Constants.HL7_RECEIVING_APPLICATION, "MYCLIENT");
mock.expectedHeaderReceived(HL7Constants.HL7_RECEIVING_FACILITY, "MYCLIENTAPP");
mock.expectedHeaderReceived(HL7Constants.HL7_TIMESTAMP, "200612211200");
mock.expectedHeaderReceived(HL7Constants.HL7_SECURITY, null);
mock.expectedHeaderReceived(HL7Constants.HL7_MESSAGE_TYPE, "QRY");
mock.expectedHeaderReceived(HL7Constants.HL7_TRIGGER_EVENT, "A19");
mock.expectedHeaderReceived(HL7Constants.HL7_MESSAGE_CONTROL, "1234");
mock.expectedHeaderReceived(HL7Constants.HL7_PROCESSING_ID, "P");
mock.expectedHeaderReceived(HL7Constants.HL7_VERSION_ID, "2.4");
mock.expectedHeaderReceived(HL7Constants.HL7_CONTEXT, hl7.getHapiContext());
mock.expectedHeaderReceived(HL7Constants.HL7_CHARSET, null);
mock.expectedHeaderReceived(Exchange.CHARSET_NAME, "UTF-8");
String body = createHL7AsString();
template.sendBody("direct:unmarshal", body);
assertMockEndpointsSatisfied();
Message msg = mock.getExchanges().get(0).getIn().getBody(Message.class);
assertEquals("2.4", msg.getVersion());
QRD qrd = (QRD) msg.get("QRD");
assertEquals("0101701234", qrd.getWhoSubjectFilter(0).getIDNumber().getValue());
}
use of com.google.api.services.healthcare.v1.model.Message in project camel by apache.
the class HL7DataFormatTest method testMarshalUTF8.
@Test
public void testMarshalUTF8() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:marshal");
mock.expectedMessageCount(1);
mock.message(0).body().isInstanceOf(byte[].class);
mock.message(0).body(String.class).contains("MSA|AA|123");
mock.message(0).body(String.class).contains("QRD|20080805120000");
mock.message(0).body(String.class).contains(NONE_ISO_8859_1);
Message message = createHL7AsMessage();
template.sendBodyAndProperty("direct:marshal", message, Exchange.CHARSET_NAME, "UTF-8");
assertMockEndpointsSatisfied();
}
Aggregations