use of org.apache.camel.model.MulticastDefinition in project camel by apache.
the class DualPipelineTest method testDualPipeline.
public void testDualPipeline() throws Exception {
getMockEndpoint("mock:a").expectedBodiesReceived("Hello World");
getMockEndpoint("mock:b").expectedBodiesReceived("After A");
getMockEndpoint("mock:c").expectedBodiesReceived("Hello World");
getMockEndpoint("mock:d").expectedBodiesReceived("After C");
getMockEndpoint("mock:e").expectedBodiesReceived("After C");
getMockEndpoint("mock:result").expectedMessageCount(1);
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
// now check the route
MulticastDefinition mc = assertIsInstanceOf(MulticastDefinition.class, context.getRouteDefinitions().get(0).getOutputs().get(0));
PipelineDefinition pd1 = assertIsInstanceOf(PipelineDefinition.class, mc.getOutputs().get(0));
PipelineDefinition pd2 = assertIsInstanceOf(PipelineDefinition.class, mc.getOutputs().get(1));
assertEquals(3, pd1.getOutputs().size());
assertEquals(4, pd2.getOutputs().size());
SendDefinition<?> send1 = assertIsInstanceOf(SendDefinition.class, pd1.getOutputs().get(2));
assertEquals("mock:b", send1.getUri());
SendDefinition<?> send2 = assertIsInstanceOf(SendDefinition.class, pd2.getOutputs().get(3));
assertEquals("mock:e", send2.getUri());
SendDefinition<?> send = assertIsInstanceOf(SendDefinition.class, context.getRouteDefinitions().get(0).getOutputs().get(1));
assertEquals("mock:result", send.getUri());
}
Aggregations