SCADefinitions scaDefns = scaDefnDocProcessor.read(null, uri, url);
CompositeProcessor compositeProcessor = new CompositeProcessor(new ContributionFactoryImpl(), assemblyFactory, policyFactory, mapper, staxProcessor);
InputStream is = getClass().getResourceAsStream("Calculator.composite");
XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
Composite composite = compositeProcessor.read(reader);
assertNotNull(composite);
staxProcessor.resolve(scaDefns, resolver);
staxProcessor.resolve(composite, resolver);
CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, intentAttachPointTypeFactory, mapper, scaDefns.getPolicySets(), null);
compositeUtil.build(composite);
//intents are computed and aggregate intents from ancestor elements
assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getRequiredIntents().size(), 3);
assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents().size(), 3);
//assertEquals(((OperationsConfigurator)composite.getComponents().get(0)).getConfiguredOperations().isEmpty(), true);
//assertEquals(((OperationsConfigurator)composite.getComponents().get(5)).getConfiguredOperations().isEmpty(), false);
//test for proper aggregation of policy intents on implementation elements
for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getRequiredIntents() ) {
String intentName = intent.getName().getLocalPart();
if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_2") ||
intentName.equals("tuscanyIntent_3")) ) {
fail();
}
}
for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents() ) {
String intentName = intent.getName().getLocalPart();
if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
intentName.equals("tuscanyIntent_5")) ) {
fail();
}
}
//test for proper aggregation of policy intents and policysets on operations of implementation
OperationsConfigurator opConf = (OperationsConfigurator)composite.getComponents().get(5);
assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 4);
for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
String intentName = intent.getName().getLocalPart();
if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
intentName.equals("tuscanyIntent_5") || intentName.equals("tuscanyIntent_6") ) ) {
fail();
}
}
opConf = (OperationsConfigurator)composite.getComponents().get(6);
assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 3);
for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
String intentName = intent.getName().getLocalPart();
if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
intentName.equals("tuscanyIntent_6.qualified2") ) ) {