StandardOutboundDocRetrieve extends AbstractOutboundDocRetrieve implements OutboundDocRetrieve { @Override @OutboundProcessingEvent(beforeBuilder = RetrieveDocumentSetRequestTypeDescriptionBuilder.class, afterReturningBuilder = RetrieveDocumentSetResponseTypeDescriptionBuilder.class, serviceType = "Retrieve Document", version = "") public RetrieveDocumentSetResponseType respondingGatewayCrossGatewayRetrieve(RetrieveDocumentSetRequestType request, AssertionType assertion, NhinTargetCommunitiesType targets, ADAPTER_API_LEVEL entityAPILevel) { logInfoServiceProcess(this.getClass()); assertion = MessageGeneratorUtils.getInstance().generateMessageId(assertion); RetrieveDocumentSetResponseType response; if (validateGuidance(targets, entityAPILevel)) { PolicyTransformer pt = new OutboundDocRetrievePolicyTransformer_a0(); OutboundDelegate nd = new OutboundDocRetrieveDelegate(); NhinAggregator na = new OutboundDocRetrieveAggregator_a0(); auditRequest(request, assertion, getTarget(targets)); OutboundDocRetrieveOrchestratable orchestratable = new OutboundStandardDocRetrieveOrchestratable(pt, nd, na, request, assertion, getTarget(targets)); OutboundDocRetrieveOrchestratable orchResponse = (OutboundDocRetrieveOrchestratable) orchestrator .process(orchestratable); response = orchResponse.getResponse(); } else { auditRequest(request, assertion, getTarget(targets)); response = createGuidanceErrorResponse(entityAPILevel); } return response; } StandardOutboundDocRetrieve();  StandardOutboundDocRetrieve(CONNECTOutboundOrchestrator orchestrator, DocRetrieveAuditLogger auditLogger); @Override @OutboundProcessingEvent(beforeBuilder = RetrieveDocumentSetRequestTypeDescriptionBuilder.class, afterReturningBuilder = RetrieveDocumentSetResponseTypeDescriptionBuilder.class, serviceType = "Retrieve Document", version = "") RetrieveDocumentSetResponseType respondingGatewayCrossGatewayRetrieve(RetrieveDocumentSetRequestType request,
        AssertionType assertion, NhinTargetCommunitiesType targets, ADAPTER_API_LEVEL entityAPILevel); @Override DocRetrieveAuditLogger getAuditLogger();  }
@Test public void invoke() { RetrieveDocumentSetRequestType request = new RetrieveDocumentSetRequestType(); AssertionType assertion = new AssertionType(); NhinTargetCommunitiesType targets = new NhinTargetCommunitiesType(); targets.setUseSpecVersion("2.0"); RetrieveDocumentSetResponseType expectedResponse = new RetrieveDocumentSetResponseType(); CONNECTOutboundOrchestrator orchestrator = mock(CONNECTOutboundOrchestrator.class); OutboundDocRetrieveOrchestratable orchResponse = mock(OutboundDocRetrieveOrchestratable.class); when(orchestrator.process(any(OutboundDocRetrieveOrchestratable.class))).thenReturn(orchResponse); when(orchResponse.getResponse()).thenReturn(expectedResponse); StandardOutboundDocRetrieve outboundDocRetrieve = (StandardOutboundDocRetrieve) getOutboundDocRetrieve( orchestrator, true); RetrieveDocumentSetResponseType actualResponse = outboundDocRetrieve.respondingGatewayCrossGatewayRetrieve( request, assertion, targets, ADAPTER_API_LEVEL.LEVEL_a0); assertSame(expectedResponse, actualResponse); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.DOC_RETRIEVE_SERVICE_NAME), any(DocRetrieveAuditTransforms.class)); }
@Test public void auditLoggingOffForOutboundDR() { RetrieveDocumentSetRequestType request = new RetrieveDocumentSetRequestType(); AssertionType assertion = new AssertionType(); NhinTargetCommunitiesType targets = new NhinTargetCommunitiesType(); targets.setUseSpecVersion("2.0"); RetrieveDocumentSetResponseType expectedResponse = new RetrieveDocumentSetResponseType(); CONNECTOutboundOrchestrator orchestrator = mock(CONNECTOutboundOrchestrator.class); OutboundDocRetrieveOrchestratable orchResponse = mock(OutboundDocRetrieveOrchestratable.class); when(orchestrator.process(any(OutboundDocRetrieveOrchestratable.class))).thenReturn(orchResponse); when(orchResponse.getResponse()).thenReturn(expectedResponse); StandardOutboundDocRetrieve outboundDocRetrieve = (StandardOutboundDocRetrieve) getOutboundDocRetrieve( orchestrator, false); RetrieveDocumentSetResponseType actualResponse = outboundDocRetrieve.respondingGatewayCrossGatewayRetrieve( request, assertion, targets, ADAPTER_API_LEVEL.LEVEL_a0); assertSame(expectedResponse, actualResponse); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger, never()).auditRequestMessage(eq(request), eq(assertion), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.DOC_RETRIEVE_SERVICE_NAME), any(DocRetrieveAuditTransforms.class)); }