AdminDistTransforms { public LogEventRequestType transformEDXLDistributionRequestToAuditMsg(EDXLDistribution body, AssertionType assertion, NhinTargetSystemType target, String direction, String _interface) { return getLogEventRequestType(body, assertion, direction, target, _interface); }  LogEventRequestType transformEDXLDistributionRequestToAuditMsg(EDXLDistribution body,
            AssertionType assertion, NhinTargetSystemType target, String direction, String _interface); LogEventRequestType transformEDXLDistributionRequestToAuditMsg(EDXLDistribution body,
            AssertionType assertion, String direction, String _interface); String getAdminDistributionMessageCommunityID(AssertionType assertion, String direction, String _interface,
            NhinTargetSystemType target);  }
@Test public void testTransformEDXLDistributionRequestToAuditMsg_Empty() { EDXLDistribution message = new EDXLDistribution(); AssertionType assertion = new AssertionType(); AdminDistTransforms instance = new AdminDistTransforms(); LogEventRequestType expResult = null; LogEventRequestType result = instance.transformEDXLDistributionRequestToAuditMsg(message, assertion, NhincConstants.AUDIT_LOG_INBOUND_DIRECTION, NhincConstants.AUDIT_LOG_ENTITY_INTERFACE); assertEquals(expResult, result); }
@Test public void testTransformEDXLDistributionRequestToAuditMsg_Good_HCIDfromLocalHCID() { final String LOCAL_HCID = "1.1"; EDXLDistribution message = new EDXLDistribution(); AssertionType assertion = new AssertionType(); setUserForAssertion(assertion, LOCAL_HCID); AdminDistTransforms instance = new AdminDistTransforms() { @Override protected String getHomeCommunityFromMapping() { return LOCAL_HCID; } }; LogEventRequestType result = instance.transformEDXLDistributionRequestToAuditMsg(message, assertion, NhincConstants.AUDIT_LOG_INBOUND_DIRECTION, NhincConstants.AUDIT_LOG_ENTITY_INTERFACE); assertNotNull(result); assertEquals(NhincConstants.AUDIT_LOG_ENTITY_INTERFACE + " " + NhincConstants.AUDIT_LOG_INBOUND_DIRECTION, result.getDirection()); assertNotNull(result.getAuditMessage()); assertEquals(1, result.getAuditMessage().getActiveParticipant().size()); assertNotNull(result.getAuditMessage().getEventIdentification()); assertEquals(AuditDataTransformConstants.EVENT_ID_CODE_SYS_NAME_T63, result.getAuditMessage() .getEventIdentification().getEventID().getCode()); assertEquals(AuditDataTransformConstants.EVENT_ID_CODE_SYS_NAME_T63, result.getAuditMessage() .getEventIdentification().getEventID().getCodeSystemName()); assertEquals(result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditSourceID(), LOCAL_HCID); }
@Test public void testTransformEDXLDistributionRequestToAuditMsg_Good_HCIDfromAssertion() { final String LOCAL_HCID = "1.1"; EDXLDistribution message = new EDXLDistribution(); AssertionType assertion = new AssertionType(); HomeCommunityType homeCommunity = new HomeCommunityType(); homeCommunity.setHomeCommunityId(LOCAL_HCID); assertion.setHomeCommunity(homeCommunity); setUserForAssertion(assertion, LOCAL_HCID); AdminDistTransforms instance = new AdminDistTransforms(); LogEventRequestType result = instance.transformEDXLDistributionRequestToAuditMsg(message, assertion, NhincConstants.AUDIT_LOG_INBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE); assertNotNull(result); assertEquals(NhincConstants.AUDIT_LOG_NHIN_INTERFACE + " " + NhincConstants.AUDIT_LOG_INBOUND_DIRECTION, result.getDirection()); assertNotNull(result.getAuditMessage()); assertEquals(1, result.getAuditMessage().getActiveParticipant().size()); assertNotNull(result.getAuditMessage().getEventIdentification()); assertEquals(AuditDataTransformConstants.EVENT_ID_CODE_SYS_NAME_T63, result.getAuditMessage() .getEventIdentification().getEventID().getCode()); assertEquals(AuditDataTransformConstants.EVENT_ID_CODE_SYS_NAME_T63, result.getAuditMessage() .getEventIdentification().getEventID().getCodeSystemName()); assertEquals(result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditSourceID(), LOCAL_HCID); }
@Test public void testTransformEDXLDistributionRequestToAuditMsg_Good_HCIDfromTarget() { final String LOCAL_HCID = "2.2"; EDXLDistribution message = new EDXLDistribution(); AssertionType assertion = new AssertionType(); setUserForAssertion(assertion, LOCAL_HCID); NhinTargetSystemType target = new NhinTargetSystemType(); HomeCommunityType homeCommunity = new HomeCommunityType(); homeCommunity.setHomeCommunityId(LOCAL_HCID); target.setHomeCommunity(homeCommunity); AdminDistTransforms instance = new AdminDistTransforms(); LogEventRequestType result = instance.transformEDXLDistributionRequestToAuditMsg(message, assertion, target, NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE); assertNotNull(result); assertEquals(NhincConstants.AUDIT_LOG_NHIN_INTERFACE + " " + NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, result.getDirection()); assertNotNull(result.getAuditMessage()); assertEquals(1, result.getAuditMessage().getActiveParticipant().size()); assertNotNull(result.getAuditMessage().getEventIdentification()); assertEquals(AuditDataTransformConstants.EVENT_ID_CODE_SYS_NAME_T63, result.getAuditMessage() .getEventIdentification().getEventID().getCode()); assertEquals(AuditDataTransformConstants.EVENT_ID_CODE_SYS_NAME_T63, result.getAuditMessage() .getEventIdentification().getEventID().getCodeSystemName()); assertEquals(result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditSourceID(), LOCAL_HCID); }