StandardOutboundDocSubmissionDeferredResponse implements OutboundDocSubmissionDeferredResponse { protected DSDeferredResponseAuditLogger getAuditLogger() { return new DSDeferredResponseAuditLogger(); } StandardOutboundDocSubmissionDeferredResponse(); @OutboundProcessingEvent(beforeBuilder = DeferredResponseDescriptionBuilder.class, afterReturningBuilder = DocSubmissionArgTransformerBuilder.class, serviceType = "Document Submission Deferred Response", version = "") @Override XDRAcknowledgementType provideAndRegisterDocumentSetBAsyncResponse(RegistryResponseType request,
        AssertionType assertion, NhinTargetCommunitiesType targets);  }
@Test public void testProvideAndRegisterDocumentSetB() { when(mockPolicyCheck.checkXDRResponsePolicy(Mockito.any(RegistryResponseType.class), Mockito.any(AssertionType.class), Mockito.any(String.class), Mockito.any(String.class), eq(NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION))).thenReturn(Boolean.TRUE); when(mockSubjectHelper.determineSendingHomeCommunityId(Mockito.any(HomeCommunityType.class), Mockito.any(AssertionType.class))).thenReturn("2.2"); when(mockDelegate.process(Mockito.any(OutboundDocSubmissionDeferredResponseOrchestratable.class))).thenReturn( createOutboundDocSubmissionDeferredResponseOrchestratable()); XDRAcknowledgementType response = runProvideAndRegisterDocumentSetBAsyncRequest(getAuditLogger(true)); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger).auditRequestMessage(eq(request), eq(assertion), isNotNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.NHINC_XDR_RESPONSE_SERVICE_NAME), any(DSDeferredResponseAuditTransforms.class)); assertNotNull(response); assertEquals(NhincConstants.XDR_RESP_ACK_STATUS_MSG, response.getMessage().getStatus()); }
@Test public void testProvideAndRegisterDocumentSetB_policyFailure() { when(mockPolicyCheck.checkXDRResponsePolicy(Mockito.any(RegistryResponseType.class), Mockito.any(AssertionType.class), Mockito.any(String.class), Mockito.any(String.class), eq(NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION))).thenReturn(Boolean.FALSE); when(mockSubjectHelper.determineSendingHomeCommunityId(Mockito.any(HomeCommunityType.class), Mockito.any(AssertionType.class))).thenReturn("2.2"); XDRAcknowledgementType response = runProvideAndRegisterDocumentSetBAsyncRequest(getAuditLogger(true)); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger).auditRequestMessage(eq(request), eq(assertion), isNotNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.NHINC_XDR_RESPONSE_SERVICE_NAME), any(DSDeferredResponseAuditTransforms.class)); assertNotNull(response); assertEquals(NhincConstants.XDR_ACK_FAILURE_STATUS_MSG, response.getMessage().getStatus()); }
@Test public void testProvideAndRegisterDocumentSetB_emptyTargets() { RegistryResponseType requestLocal = new RegistryResponseType(); AssertionType assertionLocal = new AssertionType(); XDRAcknowledgementType response = runProvideAndRegisterDocumentSetBAsyncRequest_emptyTargets(requestLocal, assertionLocal, getAuditLogger(true)); assertNotNull("Assertion MessageId is null", assertionLocal.getMessageId()); verify(mockEJBLogger).auditRequestMessage(eq(requestLocal), eq(assertionLocal), isNotNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.NHINC_XDR_RESPONSE_SERVICE_NAME), any(DSDeferredResponseAuditTransforms.class)); assertNotNull(response); assertEquals(NhincConstants.XDR_ACK_FAILURE_STATUS_MSG, response.getMessage().getStatus()); }
@Test public void testAuditLoggingOffForDSDeferredResponse() { when(mockPolicyCheck.checkXDRResponsePolicy(Mockito.any(RegistryResponseType.class), Mockito.any(AssertionType.class), Mockito.any(String.class), Mockito.any(String.class), eq(NhincConstants.POLICYENGINE_OUTBOUND_DIRECTION))).thenReturn(Boolean.TRUE); when(mockSubjectHelper.determineSendingHomeCommunityId(Mockito.any(HomeCommunityType.class), Mockito.any(AssertionType.class))).thenReturn("2.2"); when(mockDelegate.process(Mockito.any(OutboundDocSubmissionDeferredResponseOrchestratable.class))).thenReturn( createOutboundDocSubmissionDeferredResponseOrchestratable()); XDRAcknowledgementType response = runProvideAndRegisterDocumentSetBAsyncRequest(getAuditLogger(false)); verify(mockEJBLogger, never()).auditRequestMessage(eq(request), eq(assertion), isNotNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.NHINC_XDR_RESPONSE_SERVICE_NAME), any(DSDeferredResponseAuditTransforms.class)); assertNotNull(response); assertEquals(NhincConstants.XDR_RESP_ACK_STATUS_MSG, response.getMessage().getStatus()); }