use of org.apache.camel.spi.RouteStartupOrder in project camel by apache.
the class JmsDirectStartupOrderIssueTest method testJmsDirectStartupOrderIssue.
@Test
public void testJmsDirectStartupOrderIssue() throws Exception {
// send messages to queue so there is messages on the queue before we start the route
template.sendBody("activemq:queue:foo", "Hello World");
template.sendBody("activemq:queue:foo", "Hello Camel");
template.sendBody("activemq:queue:foo", "Bye World");
template.sendBody("activemq:queue:foo", "Bye Camel");
context.startRoute("amq");
getMockEndpoint("mock:result").expectedMessageCount(4);
assertMockEndpointsSatisfied();
DefaultCamelContext dcc = (DefaultCamelContext) context;
List<RouteStartupOrder> order = dcc.getRouteStartupOrder();
assertEquals(2, order.size());
assertEquals(1, order.get(0).getStartupOrder());
assertEquals("direct", order.get(0).getRoute().getId());
assertEquals(100, order.get(1).getStartupOrder());
assertEquals("amq", order.get(1).getRoute().getId());
}
use of org.apache.camel.spi.RouteStartupOrder in project camel by apache.
the class RouteServicesStartupOrderTest method testRouteServiceStartupOrder.
public void testRouteServiceStartupOrder() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
// assert correct order
DefaultCamelContext dcc = (DefaultCamelContext) context;
List<RouteStartupOrder> order = dcc.getRouteStartupOrder();
assertEquals(4, order.size());
assertEquals("seda://foo", order.get(0).getRoute().getEndpoint().getEndpointUri());
assertEquals("direct://start", order.get(1).getRoute().getEndpoint().getEndpointUri());
assertEquals("seda://bar", order.get(2).getRoute().getEndpoint().getEndpointUri());
assertEquals("direct://bar", order.get(3).getRoute().getEndpoint().getEndpointUri());
// assert route service was started in order as well
assertEquals("2143", startOrder);
}
use of org.apache.camel.spi.RouteStartupOrder in project camel by apache.
the class RouteShutdownNotReverseOrderTest method testRouteShutdownNotReverseOrder.
public void testRouteShutdownNotReverseOrder() throws Exception {
// flip to not reverse
context.getShutdownStrategy().setShutdownRoutesInReverseOrder(false);
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
template.sendBody("direct:bar", "Hello World");
assertMockEndpointsSatisfied();
// assert correct startup order
DefaultCamelContext dcc = (DefaultCamelContext) context;
List<RouteStartupOrder> order = dcc.getRouteStartupOrder();
assertEquals(2, order.size());
assertEquals("direct://bar", order.get(0).getRoute().getEndpoint().getEndpointUri());
assertEquals("direct://foo", order.get(1).getRoute().getEndpoint().getEndpointUri());
// assert correct shutdown order
context.stop();
}
use of org.apache.camel.spi.RouteStartupOrder in project camel by apache.
the class RouteShutdownReverseOrderTest method testRouteShutdownReverseOrder.
public void testRouteShutdownReverseOrder() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
template.sendBody("direct:bar", "Hello World");
assertMockEndpointsSatisfied();
// assert correct startup order
DefaultCamelContext dcc = (DefaultCamelContext) context;
List<RouteStartupOrder> order = dcc.getRouteStartupOrder();
assertEquals(2, order.size());
assertEquals("direct://bar", order.get(0).getRoute().getEndpoint().getEndpointUri());
assertEquals("direct://foo", order.get(1).getRoute().getEndpoint().getEndpointUri());
// assert correct shutdown order
context.stop();
}
use of org.apache.camel.spi.RouteStartupOrder in project camel by apache.
the class RouteStartupOrderSimpleTest method testRouteStartupOrder.
public void testRouteStartupOrder() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
template.sendBody("direct:start", "Hello World");
assertMockEndpointsSatisfied();
// assert correct order
DefaultCamelContext dcc = (DefaultCamelContext) context;
List<RouteStartupOrder> order = dcc.getRouteStartupOrder();
assertEquals(2, order.size());
assertEquals("direct://start", order.get(0).getRoute().getEndpoint().getEndpointUri());
assertEquals("seda://foo", order.get(1).getRoute().getEndpoint().getEndpointUri());
}
Aggregations