* | |--service2--| |
* |-- splitter2 --| |--aggregator1--|
* |--service3--|
*/
public void test_nested_split() throws RegistryException, ConfigurationException, ActionProcessingException, MessageDeliverException, IOException, SAXException, ParserConfigurationException {
Message messageIn = MessageFactory.getInstance().getMessage();
// Manually deliver the message to the splitter1 service...
splitter1.process(messageIn);
AggregationDetails service1Message = Aggregator.getAggregatorDetails(service1Courier.messages.get(0), 0, false);
assertNotNull(service1Message);
// Manually deliver the message in service1Courier into service1...
service1.process(service1Courier.messages.get(0));
// Manually deliver the message in splitter2Courier into splitter2...
splitter2.process(splitter2Courier.messages.get(0));
AggregationDetails service2Message = Aggregator.getAggregatorDetails(service2Courier.messages.get(0), 0, false);
assertNotNull(service2Message);
// Manually deliver the message in aggregator2Courier into aggregator2 (this is the message from service1)...
aggregator2.process(aggregator2Courier.messages.get(0));
// Manually deliver the message in service2Courier into service2...
service2.process(service2Courier.messages.get(0));
// Manually deliver the message in service3Courier into service3...
service3.process(service3Courier.messages.get(0));
// aggregator1Courier should have 2 messages in it... one from service2
// and one from service3...
assertEquals(2, aggregator1Courier.messages.size());
// Should be 2 aggrTags before aggregation...
List<String> aggrTags = Aggregator.getAggregatorTags(aggregator1Courier.messages.get(1), false);
assertEquals(2, aggrTags.size());
// Manually deliver the 2 messages to aggregator1...
aggregator1.process(aggregator1Courier.messages.get(0));
Message aggregator1Message = aggregator1.process(aggregator1Courier.messages.get(1));
assertNoAggregationTags(aggregator1Courier.messages.get(0));
assertNoAggregationTags(aggregator1Courier.messages.get(1));
aggrTags = Aggregator.getAggregatorTags(aggregator1Message, false);
assertEquals(1, aggrTags.size());
AggregationDetails aggregator1MessageAggrDetails = Aggregator.getAggregatorDetails(aggregator1Message, 0, false);
assertEquals(service1Message.getSeriesUuid(), aggregator1MessageAggrDetails.getSeriesUuid());
// Manually deliver the aggregator1Message to aggregator2...
Message aggregator2Message = aggregator2.process(aggregator1Message);
assertNoAggregationTags(aggregator1Message);
assertEquals(2, aggregator2Message.getAttachment().getUnnamedCount());
Message message1 = Util.deserialize((Serializable) aggregator2Message.getAttachment().itemAt(0));
assertNoAggregationTags(message1);
Message message2 = Util.deserialize((Serializable) aggregator2Message.getAttachment().itemAt(1));
assertNoAggregationTags(message2);
}