}
@Test
public void testResolution() throws Exception {
assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent);
ProfileIntent profileIntent = (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 QualifiedIntent);
QualifiedIntent qualifiedIntent =
(QualifiedIntent)intentTable.get(new QName(namespace, "confidentiality.transport"));
assertNull(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(securityPolicySet.getMappedPolicies().size(), 5);
//testing to ensure that inclusion of referred policy sets has not happened
PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
List<Intent> simpleIntents = new ArrayList<Intent>();
List<ProfileIntent> profileIntents = new ArrayList<ProfileIntent>();
List<QualifiedIntent> qualifiedIntents = new ArrayList<QualifiedIntent>();
for (Intent intent : intentTable.values()) {
if (intent instanceof ProfileIntent)
profileIntents.add((ProfileIntent)intent);
else if (intent instanceof QualifiedIntent)
qualifiedIntents.add((QualifiedIntent)intent);
else
simpleIntents.add(intent);
}
for (Intent intent : simpleIntents)
staxProcessor.resolve(intent, resolver);
for (ProfileIntent intent : profileIntents)
staxProcessor.resolve(intent, resolver);
for (QualifiedIntent intent : qualifiedIntents)
staxProcessor.resolve(intent, resolver);
for (PolicySet policySet : policySetTable.values()) {
if (policySet.getReferencedPolicySets().isEmpty())
staxProcessor.resolve(policySet, resolver);
}
for (PolicySet policySet : policySetTable.values()) {
if (!policySet.getReferencedPolicySets().isEmpty())
staxProcessor.resolve(policySet, resolver);
}
for (IntentAttachPointType bindingType : bindingTypesTable.values()) {
staxProcessor.resolve(bindingType, resolver);
}
for (IntentAttachPointType implType : implTypesTable.values()) {
staxProcessor.resolve(implType, resolver);
}
//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