StandardInboundAdminDistribution extends AbstractInboundAdminDistribution { @Override @InboundProcessingEvent(serviceType = "Admin Distribution", version = "", afterReturningBuilder = EDXLDistributionEventDescriptionBuilder.class, beforeBuilder = EDXLDistributionEventDescriptionBuilder.class) public void sendAlertMessage(EDXLDistribution body, AssertionType assertion) { auditRequestFromNhin(body, assertion); processAdminDistribution(body, assertion); } StandardInboundAdminDistribution();  StandardInboundAdminDistribution(AdminDistributionPolicyChecker policyChecker,
        AdminDistributionAuditLogger auditLogger, AdapterAdminDistributionProxyObjectFactory adapterFactory,
        AdminDistributionUtils adminUtils); @Override void processAdminDistribution(EDXLDistribution body, AssertionType assertion); @Override @InboundProcessingEvent(serviceType = "Admin Distribution", version = "", afterReturningBuilder = EDXLDistributionEventDescriptionBuilder.class, beforeBuilder = EDXLDistributionEventDescriptionBuilder.class) void sendAlertMessage(EDXLDistribution body, AssertionType assertion);  }
@Test public void standardInboundAdminDist() { EDXLDistribution request = new EDXLDistribution(); AssertionType assertion = new AssertionType(); NhinTargetSystemType target = null; AdminDistributionAuditLogger auditLogger = mock(AdminDistributionAuditLogger.class); AdminDistributionUtils adminUtils = mock(AdminDistributionUtils.class); AdapterAdminDistributionProxyObjectFactory adapterFactory = mock( AdapterAdminDistributionProxyObjectFactory.class); AdapterAdminDistributionProxy adapterProxy = mock(AdapterAdminDistributionProxy.class); when(adapterFactory.getAdapterAdminDistProxy()).thenReturn(adapterProxy); AdminDistributionPolicyChecker policyChecker = mock(AdminDistributionPolicyChecker.class); when(policyChecker.checkIncomingPolicy(request, assertion)).thenReturn(true); StandardInboundAdminDistribution standardAdminDist = new StandardInboundAdminDistribution(policyChecker, auditLogger, adapterFactory, adminUtils); standardAdminDist.sendAlertMessage(request, assertion); verify(adapterProxy).sendAlertMessage(eq(request), eq(assertion)); verify(auditLogger).auditNhinAdminDist(eq(request), eq(assertion), eq(NhincConstants.AUDIT_LOG_INBOUND_DIRECTION), eq(target), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE)); verify(auditLogger, times(2)).auditNhinAdminDist(any(EDXLDistribution.class), any(AssertionType.class), any(String.class), any(NhinTargetSystemType.class), any(String.class)); }
@Test public void failedPolicyCheck() { EDXLDistribution request = new EDXLDistribution(); AssertionType assertion = new AssertionType(); AdminDistributionAuditLogger auditLogger = mock(AdminDistributionAuditLogger.class); AdminDistributionUtils adminUtils = mock(AdminDistributionUtils.class); AdapterAdminDistributionProxyObjectFactory adapterFactory = mock( AdapterAdminDistributionProxyObjectFactory.class); AdminDistributionPolicyChecker policyChecker = mock(AdminDistributionPolicyChecker.class); when(policyChecker.checkIncomingPolicy(request, assertion)).thenReturn(false); StandardInboundAdminDistribution standardAdminDist = new StandardInboundAdminDistribution(policyChecker, auditLogger, adapterFactory, adminUtils); standardAdminDist.sendAlertMessage(request, assertion); verify(auditLogger, times(1)).auditNhinAdminDist(any(EDXLDistribution.class), any(AssertionType.class), any(String.class), any(NhinTargetSystemType.class), any(String.class)); }