PassthroughOutboundPatientDiscovery implements OutboundPatientDiscovery { @Override public RespondingGatewayPRPAIN201306UV02ResponseType respondingGatewayPRPAIN201305UV02( RespondingGatewayPRPAIN201305UV02RequestType request, AssertionType assertion) { logInfoServiceProcess(this.getClass()); auditRequest(request, assertion, msgUtils.convertFirstToNhinTargetSystemType(request.getNhinTargetCommunities())); RespondingGatewayPRPAIN201306UV02ResponseType response = sendToNhin(request.getPRPAIN201305UV02(), PDMessageGeneratorUtils.getInstance().generateMessageId(assertion), msgUtils.convertFirstToNhinTargetSystemType(request.getNhinTargetCommunities())); return response; } PassthroughOutboundPatientDiscovery();  PassthroughOutboundPatientDiscovery(OutboundPatientDiscoveryDelegate delegate,
        PatientDiscoveryAuditLogger auditLogger); @Override RespondingGatewayPRPAIN201306UV02ResponseType respondingGatewayPRPAIN201305UV02(
        RespondingGatewayPRPAIN201305UV02RequestType request, AssertionType assertion); @Override void setExecutorService(ExecutorService regularExecutor, ExecutorService largeJobExecutor);  }
@Test public void invoke() { RespondingGatewayPRPAIN201305UV02RequestType request = new RespondingGatewayPRPAIN201305UV02RequestType(); request.setPRPAIN201305UV02(new PRPAIN201305UV02()); request.setNhinTargetCommunities(createNhinTargetCommunitiesType(TARGET_HCID)); AssertionType assertion = new AssertionType(); OutboundPatientDiscoveryOrchestratable outOrchestratable = new OutboundPatientDiscoveryOrchestratable(); outOrchestratable.setResponse(new PRPAIN201306UV02()); PatientDiscoveryAuditLogger auditLogger = getAuditLogger(true); when(delegate.process(any(OutboundPatientDiscoveryOrchestratable.class))).thenReturn(outOrchestratable); PassthroughOutboundPatientDiscovery passthroughPatientDiscovery = new PassthroughOutboundPatientDiscovery( delegate, auditLogger); RespondingGatewayPRPAIN201306UV02ResponseType actualMessage = passthroughPatientDiscovery .respondingGatewayPRPAIN201305UV02(request, assertion); assertSame(outOrchestratable.getResponse(), actualMessage.getCommunityResponse().get(0).getPRPAIN201306UV02()); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger).auditRequestMessage(eq(request.getPRPAIN201305UV02()), any(AssertionType.class), any( NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.PATIENT_DISCOVERY_SERVICE_NAME), any(PatientDiscoveryAuditTransforms.class)); }
@Test public void auditLoggingTurnedOffForPD() { RespondingGatewayPRPAIN201305UV02RequestType request = new RespondingGatewayPRPAIN201305UV02RequestType(); request.setPRPAIN201305UV02(new PRPAIN201305UV02()); request.setNhinTargetCommunities(createNhinTargetCommunitiesType(TARGET_HCID)); AssertionType assertion = new AssertionType(); OutboundPatientDiscoveryOrchestratable outOrchestratable = new OutboundPatientDiscoveryOrchestratable(); outOrchestratable.setResponse(new PRPAIN201306UV02()); PatientDiscoveryAuditLogger auditLogger = getAuditLogger(false); when(delegate.process(any(OutboundPatientDiscoveryOrchestratable.class))).thenReturn(outOrchestratable); PassthroughOutboundPatientDiscovery passthroughPatientDiscovery = new PassthroughOutboundPatientDiscovery( delegate, auditLogger); RespondingGatewayPRPAIN201306UV02ResponseType actualMessage = passthroughPatientDiscovery .respondingGatewayPRPAIN201305UV02(request, assertion); assertSame(outOrchestratable.getResponse(), actualMessage.getCommunityResponse().get(0).getPRPAIN201306UV02()); assertNotNull("Assertion MessageId is null", assertion.getMessageId()); verify(mockEJBLogger, never()).auditRequestMessage(eq(request.getPRPAIN201305UV02()), any(AssertionType.class), any(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.TRUE), isNull(Properties.class), eq(NhincConstants.PATIENT_DISCOVERY_SERVICE_NAME), any(PatientDiscoveryAuditTransforms.class)); }