int count = 0;
while (alternativeIterator.hasNext()) {
List<Assertion> alternative = alternativeIterator.next();
assertEquals(1, alternative.size());
assertTrue(alternative.get(0) instanceof AsymmetricBinding);
AsymmetricBinding asymmetricBinding = (AsymmetricBinding) alternative.get(0);
assertFalse(asymmetricBinding.isNormalized());
assertTrue(asymmetricBinding.isIgnorable());
assertTrue(asymmetricBinding.isOptional());
assertEquals(Constants.TYPE_ASSERTION, asymmetricBinding.getType());
assertEquals(SP12Constants.ASYMMETRIC_BINDING, asymmetricBinding.getName());
assertNotNull(asymmetricBinding.getInitiatorEncryptionToken());
assertNotNull(asymmetricBinding.getInitiatorSignatureToken());
assertNull(asymmetricBinding.getInitiatorToken());
assertNotNull(asymmetricBinding.getRecipientEncryptionToken());
assertNotNull(asymmetricBinding.getRecipientSignatureToken());
assertNull(asymmetricBinding.getRecipientToken());
assertNotNull(asymmetricBinding.getAlgorithmSuite());
assertNotNull(asymmetricBinding.getLayout());
assertEquals(AbstractSymmetricAsymmetricBinding.ProtectionOrder.EncryptBeforeSigning, asymmetricBinding.getProtectionOrder());
assertTrue(asymmetricBinding.isEncryptSignature());
assertTrue(asymmetricBinding.isIncludeTimestamp());
assertTrue(asymmetricBinding.isOnlySignEntireHeadersAndBody());
assertTrue(asymmetricBinding.isProtectTokens());
count++;
}
assertEquals(1, count);
policy = policy.normalize(true);
serializedPolicy = serializePolicy(policy);
assertXMLisEqual(serializedPolicy, normalizedPolicyReferenceFile);
alternativeIterator = policy.getAlternatives();
List<Assertion> alternative = alternativeIterator.next();
assertEquals(0, alternative.size());
List<PolicyComponent> policyComponents = policy.getPolicyComponents();
assertEquals(1, policyComponents.size());
PolicyOperator policyOperator = (PolicyOperator) policyComponents.get(0);
policyComponents = policyOperator.getPolicyComponents();
assertEquals(2, policyComponents.size());
All all = (All) policyComponents.get(0);
List<PolicyComponent> policyComponentsAll = all.getAssertions();
assertEquals(0, policyComponentsAll.size());
all = (All) policyComponents.get(1);
policyComponentsAll = all.getAssertions();
assertEquals(1, policyComponentsAll.size());
Iterator<PolicyComponent> policyComponentIterator = policyComponentsAll.iterator();
AsymmetricBinding asymmetricBinding = (AsymmetricBinding) policyComponentIterator.next();
assertTrue(asymmetricBinding.isNormalized());
assertTrue(asymmetricBinding.isIgnorable());
assertFalse(asymmetricBinding.isOptional());
assertEquals(Constants.TYPE_ASSERTION, asymmetricBinding.getType());
assertEquals(SP12Constants.ASYMMETRIC_BINDING, asymmetricBinding.getName());
assertNotNull(asymmetricBinding.getInitiatorEncryptionToken());
assertNotNull(asymmetricBinding.getInitiatorSignatureToken());
assertNull(asymmetricBinding.getInitiatorToken());
assertNotNull(asymmetricBinding.getRecipientEncryptionToken());
assertNotNull(asymmetricBinding.getRecipientSignatureToken());
assertNull(asymmetricBinding.getRecipientToken());
assertNotNull(asymmetricBinding.getAlgorithmSuite());
assertNotNull(asymmetricBinding.getLayout());
assertEquals(AbstractSymmetricAsymmetricBinding.ProtectionOrder.EncryptBeforeSigning, asymmetricBinding.getProtectionOrder());
assertTrue(asymmetricBinding.isEncryptSignature());
assertTrue(asymmetricBinding.isIncludeTimestamp());
assertTrue(asymmetricBinding.isOnlySignEntireHeadersAndBody());
assertTrue(asymmetricBinding.isProtectTokens());
}