AdminDistributionTransformHelper { public CheckPolicyRequestType transformNhinAlertToCheckPolicy(EDXLDistribution message, AssertionType assertion) { CheckPolicyRequestType result = new CheckPolicyRequestType(); RequestType request = new RequestType(); if (assertion == null) { LOG.error("Missing Assertion"); return result; } if (message == null) { LOG.error("Missing message"); return result; } LOG.debug("transformAdminDistributionNhincToCheckPolicy - adding assertion data"); AssertionHelper assertHelp = new AssertionHelper(); assertHelp.appendAssertionDataToRequest(request, assertion); request.setAction(ActionHelper.actionFactory(ActionInValue)); result.setAssertion(assertion); result.setRequest(request); return result; }  CheckPolicyRequestType transformNhinAlertToCheckPolicy(EDXLDistribution message, AssertionType assertion); CheckPolicyRequestType transformEntityAlertToCheckPolicy(RespondingGatewaySendAlertMessageType message,
            String target);  }
@Test public void transformNhinAlertToCheckPolicy_Valid() { final AssertionType assertion = new AssertionType(); AdminDistributionTransformHelper instance = new AdminDistributionTransformHelper() { @Override protected oasis.names.tc.xacml._2_0.context.schema.os.SubjectType createSubject(HomeCommunityType hc, AssertionType assertion) { return new oasis.names.tc.xacml._2_0.context.schema.os.SubjectType(); } }; RespondingGatewaySendAlertMessageType message = new RespondingGatewaySendAlertMessageType(); message.setAssertion(new AssertionType()); message.setEDXLDistribution(new EDXLDistribution()); CheckPolicyRequestType result = instance.transformNhinAlertToCheckPolicy(new EDXLDistribution(), assertion); assertNotNull(result); assertNotNull(result.getAssertion()); assertNotNull(result.getRequest()); assertNotNull(result.getRequest().getAction()); assertEquals(assertion, result.getAssertion()); assertEquals(1, result.getRequest().getAction().getAttribute().size()); }
@Test public void transformNhinAlertToCheckPolicy_NoBody() { final AssertionType assertion = new AssertionType(); AdminDistributionTransformHelper instance = new AdminDistributionTransformHelper() { @Override protected oasis.names.tc.xacml._2_0.context.schema.os.SubjectType createSubject(HomeCommunityType hc, AssertionType assertion) { return new oasis.names.tc.xacml._2_0.context.schema.os.SubjectType(); } }; CheckPolicyRequestType result = instance.transformNhinAlertToCheckPolicy(null, assertion); assertNotNull(result); assertNull(result.getRequest()); }
@Test public void transformNhinAlertToCheckPolicy_NoAssertion() { AdminDistributionTransformHelper instance = new AdminDistributionTransformHelper() { @Override protected oasis.names.tc.xacml._2_0.context.schema.os.SubjectType createSubject(HomeCommunityType hc, AssertionType assertion) { return new oasis.names.tc.xacml._2_0.context.schema.os.SubjectType(); } }; CheckPolicyRequestType result = instance.transformNhinAlertToCheckPolicy(new EDXLDistribution(), null); assertNotNull(result); assertNull(result.getRequest()); }