}
@Test
public void testResolution() throws Exception {
assertTrue(!intentTable.get(messageProtection).getRequiredIntents().isEmpty());
Intent profileIntent = intentTable.get(new QName(namespace, "messageProtection"));
assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
assertTrue(intentTable.get(confidentiality_transport) instanceof Intent);
Intent qualifiedIntent = (Intent)intentTable.get(new QName(namespace, "confidentiality.transport"));
assertNull(qualifiedIntent.getDescription());
assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
PolicySet securityPolicySet = policySetTable.get(securityPolicy);
assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
assertTrue(secureMessagingPolicySet.isUnresolved());
assertEquals(2, getNumberOfQualifiedPolicies(securityPolicySet));
//testing to ensure that inclusion of referred policy sets has not happened
PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
assertTrue(basicAuthMsgProtSecurityPolicySet.getIntentMaps().isEmpty());
ExtensionType wsBindingType = bindingTypesTable.get(wsBinding);
assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
assertNull(wsBindingType.getMayProvidedIntents().get(0).getDescription());
ExtensionType javaImplType = implTypesTable.get(javaImpl);
assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
assertNull(javaImplType.getMayProvidedIntents().get(0).getDescription());
ExternalAttachment attachment = attachmentsTable.values().iterator().next();
PolicySet psOne = policySetTable.get(testPolicySetOne);
assertEquals(psOne, attachment.getPolicySets().get(0));
List<Intent> intents = new ArrayList<Intent>(intentTable.values());
for (Intent intent : intents) {
staxProcessor.resolve(intent, resolver, context);
}
for (PolicySet policySet : policySetTable.values()) {
if (policySet.getReferencedPolicySets().isEmpty())
staxProcessor.resolve(policySet, resolver, context);
}
for (PolicySet policySet : policySetTable.values()) {
if (!policySet.getReferencedPolicySets().isEmpty())
staxProcessor.resolve(policySet, resolver, context);
}
for (ExtensionType bindingType : bindingTypesTable.values()) {
staxProcessor.resolve(bindingType, resolver, context);
}
for (ExtensionType implType : implTypesTable.values()) {
staxProcessor.resolve(implType, resolver, context);
}
for ( ExternalAttachment ea : attachmentsTable.values()) {
staxProcessor.resolve(ea, resolver, context);
}
//testing if policy intents have been linked have property been linked up
assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
//testing if policysets have been properly linked up with intents
assertFalse(secureMessagingPolicySet.isUnresolved());