/** * Convenience constructor to help convert a queue item into an exception */ public HL7InError(HL7InQueue hl7InQueue) { setHL7Source(hl7InQueue.getHL7Source()); setHL7SourceKey(hl7InQueue.getHL7SourceKey()); setHL7Data(hl7InQueue.getHL7Data()); }
/** * Convenience constructor to build archive from an existing queue entry * * @param hl7InQueue queue entry from which archive entry will be constructed */ public HL7InArchive(HL7InQueue hl7InQueue) { setHL7Source(hl7InQueue.getHL7Source()); setHL7SourceKey(hl7InQueue.getHL7SourceKey()); setHL7Data(hl7InQueue.getHL7Data()); setMessageState(HL7Constants.HL7_STATUS_PROCESSED); }
String hl7Message = hl7InQueue.getHL7Data(); try {
/** * Creates new {@link HL7InQueue} instance from hl7 in queue message */ public IncomingHl7Message1_8(HL7InQueue message) { setSource(message.getHL7Source()); setSourceKey(message.getHL7SourceKey()); setData(message.getHL7Data()); setMessageState(message.getMessageState()); setUuid(message.getUuid()); }
@Test public void enqueHl7Message_shouldEnqueueHl7InQueueMessageInPlainFormat() throws Exception { int before = service.getAllHL7InQueues().size(); MockHttpServletRequest req = newPostRequest(getURI(), hl7Data); SimpleObject newHl7Message = deserialize(handle(req)); Util.log("Enqued hl7 message", newHl7Message); Assert.assertEquals(before + 1, service.getAllHL7InQueues().size()); for (HL7InQueue hl7InQueue : service.getAllHL7InQueues()) { if (hl7InQueue.getUuid().equals(newHl7Message.get("uuid"))) { Assert.assertEquals(hl7InQueue.getHL7Data(), hl7Data); } } }
@Test public void enqueHl7Message_shouldEnqueueHl7InQueueMessageInJSONFormat() throws Exception { int before = service.getAllHL7InQueues().size(); SimpleObject hl7Message = new SimpleObject(); hl7Message.add("hl7", hl7Data); MockHttpServletRequest req = newPostRequest(getURI(), hl7Message); SimpleObject newHl7Message = deserialize(handle(req)); Assert.assertEquals(before + 1, service.getAllHL7InQueues().size()); for (HL7InQueue hl7InQueue : service.getAllHL7InQueues()) { if (hl7InQueue.getUuid().equals(newHl7Message.get("uuid"))) { Assert.assertEquals(hl7InQueue.getHL7Data(), hl7Data); } } }