Source:
public void transformRequestToAuditMsg() throws ConnectionManagerException, UnknownHostException, JAXBException { DocSubmissionAuditTransforms transforms = new DocSubmissionAuditTransforms() { @Override protected String getLocalHostAddress() { return LOCAL_IP; } @Override protected String getRemoteHostAddress(Properties webContextProeprties) { if (webContextProeprties != null && !webContextProeprties.isEmpty() && webContextProeprties. getProperty(NhincConstants.REMOTE_HOST_ADDRESS) != null) { return webContextProeprties.getProperty(NhincConstants.REMOTE_HOST_ADDRESS); } return AuditTransformsConstants.ACTIVE_PARTICIPANT_UNKNOWN_IP_ADDRESS; } @Override protected String getWebServiceUrlFromRemoteObject(NhinTargetSystemType target, String serviceName) { return WS_REQUEST_URL; } }; ProvideAndRegisterDocumentSetRequestType request = createProvideAndRegisterDocumentSetRequestType(); AssertionType assertion = createAssertion(); LogEventRequestType auditRequest = transforms.transformRequestToAuditMsg(request, assertion, createNhinTarget(), NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE, Boolean.TRUE, null, NhincConstants.NHINC_XDR_REQUEST_SERVICE_NAME); testGetEventIdentificationType(auditRequest, NhincConstants.NHINC_XDR_REQUEST_SERVICE_NAME, Boolean.TRUE); testCreateActiveParticipantFromUser(auditRequest, Boolean.TRUE, assertion); testGetActiveParticipantDestination(auditRequest, Boolean.TRUE, null, WS_REQUEST_URL, REMOTE_IP); testAuditSourceIdentification(auditRequest.getAuditMessage().getAuditSourceIdentification(), assertion); testGetActiveParticipantSource(auditRequest, Boolean.TRUE, null, LOCAL_IP); assertParticipantObjectIdentification(auditRequest.getAuditMessage()); assertEquals("AuditMessage.Request direction mismatch", auditRequest.getDirection(), NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION); assertEquals("AuditMessage.Request interface mismatch", auditRequest.getInterface(), NhincConstants.AUDIT_LOG_NHIN_INTERFACE); }

Target:
public void transformRequestToAuditMsg() throws ConnectionManagerException, UnknownHostException, JAXBException { DocSubmissionAuditTransforms transforms = new DocSubmissionAuditTransforms() { @Override protected String getLocalHostAddress() { return LOCAL_IP; } @Override protected String getRemoteHostAddress(Properties webContextProperties) { if (webContextProperties != null && !webContextProperties.isEmpty() && webContextProperties. getProperty(NhincConstants.REMOTE_HOST_ADDRESS) != null) { return webContextProperties.getProperty(NhincConstants.REMOTE_HOST_ADDRESS); } return AuditTransformsConstants.ACTIVE_PARTICIPANT_UNKNOWN_IP_ADDRESS; } @Override protected String getWebServiceUrlFromRemoteObject(NhinTargetSystemType target, String serviceName) { return WS_REQUEST_URL; } }; ProvideAndRegisterDocumentSetRequestType request = createProvideAndRegisterDocumentSetRequestType(); AssertionType assertion = createAssertion(); LogEventRequestType auditRequest = transforms.transformRequestToAuditMsg(request, assertion, createNhinTarget(), NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION, NhincConstants.AUDIT_LOG_NHIN_INTERFACE, Boolean.TRUE, null, NhincConstants.NHINC_XDR_REQUEST_SERVICE_NAME); testGetEventIdentificationType(auditRequest, NhincConstants.NHINC_XDR_REQUEST_SERVICE_NAME, Boolean.TRUE); testCreateActiveParticipantFromUser(auditRequest, Boolean.TRUE, assertion); testGetActiveParticipantDestination(auditRequest, Boolean.TRUE, null, WS_REQUEST_URL, REMOTE_IP); testAuditSourceIdentification(auditRequest.getAuditMessage().getAuditSourceIdentification(), assertion); testGetActiveParticipantSource(auditRequest, Boolean.TRUE, null, LOCAL_IP); assertParticipantObjectIdentification(auditRequest.getAuditMessage()); assertEquals("AuditMessage.Request direction mismatch", auditRequest.getDirection(), NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION); assertEquals("AuditMessage.Request interface mismatch", auditRequest.getInterface(), NhincConstants.AUDIT_LOG_NHIN_INTERFACE); }