AdhocQueryTransformHelper { public static CheckPolicyRequestType transformAdhocQueryResponseToCheckPolicy(AdhocQueryResultEventType event) { LOG.debug("begin transformAdhocQueryResponseToCheckPolicy"); CheckPolicyRequestType result = null; if (event != null && InboundOutboundChecker.isInbound(event.getDirection())) { result = transformAdhocQueryResponseInboundToCheckPolicy(event); } if (event != null && InboundOutboundChecker.isOutbound(event.getDirection())) { result = transformAdhocQueryResponseOutboundToCheckPolicy(event); } LOG.debug("end transformAdhocQueryToCheckPolicy"); return result; }  static CheckPolicyRequestType transformAdhocQueryToCheckPolicy(AdhocQueryRequestEventType event); static CheckPolicyRequestType transformAdhocQueryResponseToCheckPolicy(AdhocQueryResultEventType event); static String extractPatientIdentifierId(AdhocQueryRequest docQuery); static String extractPatientIdentifierAssigningAuthority(AdhocQueryRequest docQuery);  }
@Test public void testTransformAdhocQueryToCheckPolicy_ResponseInbound() { AdhocQueryResultEventType eventA = new AdhocQueryResultEventType(); eventA.setDirection("inbound"); String direction = "DocumentQueryIn"; AdhocQueryResponseMessageType msg = new AdhocQueryResponseMessageType(); AdhocQueryRequest adhocQueryRequest = new AdhocQueryRequest(); SlotType1 slotType1 = new SlotType1(); slotType1.setName("$XDSDocumentEntryPatientId"); ValueListType valueListType = new ValueListType(); valueListType.getValue().add("1111.4444^^^&amp;26.489.22&amp;ISO"); slotType1.setValueList(valueListType); AdhocQueryType adhocQueryType = new AdhocQueryType(); adhocQueryType.getSlot().add(slotType1); AdhocQueryResponse adhocQueryResponse = new AdhocQueryResponse(); adhocQueryRequest.setAdhocQuery(adhocQueryType); adhocQueryResponse.setRequestId("100"); msg.setAdhocQueryResponse(adhocQueryResponse); AssertionType assertionTypeTest = new AssertionType(); assertionTypeTest.setMessageId(MESSAGE_ID); HomeCommunityType homeCom = new HomeCommunityType(); homeCom.setHomeCommunityId(TEST_HC_VAL); assertionTypeTest.setHomeCommunity(homeCom); msg.setAssertion(assertionTypeTest); eventA.setMessage(msg); CheckPolicyRequestType result = adhocQueryTransformHelp.transformAdhocQueryResponseToCheckPolicy(eventA); verifycheckInboundPolicy_Response(result, direction); }
@Test public void testTransformAdhocQueryToCheckPolicy_ResponseOutbound() { AdhocQueryResultEventType eventA = new AdhocQueryResultEventType(); eventA.setDirection("outbound"); String direction = "DocumentQueryOut"; AdhocQueryResponseMessageType msg = new AdhocQueryResponseMessageType(); AdhocQueryRequest adhocQueryRequest = new AdhocQueryRequest(); SlotType1 slotType1 = new SlotType1(); slotType1.setName("$XDSDocumentEntryPatientId"); ValueListType valueListType = new ValueListType(); valueListType.getValue().add("1111.4444^^^&amp;26.489.22&amp;ISO"); slotType1.setValueList(valueListType); AdhocQueryType adhocQueryType = new AdhocQueryType(); adhocQueryType.getSlot().add(slotType1); AdhocQueryResponse adhocQueryResponse = new AdhocQueryResponse(); adhocQueryRequest.setAdhocQuery(adhocQueryType); adhocQueryResponse.setRequestId("100"); msg.setAdhocQueryResponse(adhocQueryResponse); AssertionType assertionTypeTest = new AssertionType(); assertionTypeTest.setMessageId(MESSAGE_ID); HomeCommunityType homeCom = new HomeCommunityType(); homeCom.setHomeCommunityId(TEST_HC_VAL); assertionTypeTest.setHomeCommunity(homeCom); msg.setAssertion(assertionTypeTest); eventA.setMessage(msg); CheckPolicyRequestType result = adhocQueryTransformHelp.transformAdhocQueryResponseToCheckPolicy(eventA); verifycheckInboundPolicy_Response(result, direction); }