use of org.apache.camel.CamelContext in project camel by apache.
the class TestSupport method getRouteList.
/**
* A helper method to create a list of Route objects for a given route builder
*/
public static List<Route> getRouteList(RouteBuilder builder) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(builder);
context.start();
List<Route> answer = context.getRoutes();
context.stop();
return answer;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class TestSupport method getRouteList.
/**
* A helper method to create a list of Route objects for a given route builder
*/
public static List<Route> getRouteList(RouteBuilder builder) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(builder);
context.start();
List<Route> answer = context.getRoutes();
context.stop();
return answer;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class SignatureAlgorithmTest method doSignatureRouteTest.
public Exchange doSignatureRouteTest(RouteBuilder builder, Exchange e, Map<String, Object> headers) throws Exception {
CamelContext context = new DefaultCamelContext();
try {
context.addRoutes(builder);
context.start();
MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
mock.setExpectedMessageCount(1);
ProducerTemplate template = context.createProducerTemplate();
if (e != null) {
template.send("direct:in", e);
} else {
template.sendBodyAndHeaders("direct:in", payload, headers);
}
assertMockEndpointsSatisfied();
return mock.getReceivedExchanges().get(0);
} finally {
context.stop();
}
}
use of org.apache.camel.CamelContext in project camel by apache.
the class SignatureDigestMethodTest method doSignatureRouteTest.
public Exchange doSignatureRouteTest(RouteBuilder builder, Exchange e, Map<String, Object> headers) throws Exception {
CamelContext context = new DefaultCamelContext();
try {
context.addRoutes(builder);
context.start();
MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
mock.setExpectedMessageCount(1);
ProducerTemplate template = context.createProducerTemplate();
if (e != null) {
template.send("direct:in", e);
} else {
template.sendBodyAndHeaders("direct:in", payload, headers);
}
assertMockEndpointsSatisfied();
return mock.getReceivedExchanges().get(0);
} finally {
context.stop();
}
}
use of org.apache.camel.CamelContext in project camel by apache.
the class XmlRpcConverterTest method testToXmlRpcRequestWithoutOperationName.
@Test(expected = TypeConversionException.class)
public void testToXmlRpcRequestWithoutOperationName() throws Exception {
CamelContext context = new DefaultCamelContext();
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody(new Object[] { "me", "you" });
exchange.getIn().getBody(XmlRpcRequest.class);
fail("Expect the exception is throw");
}
Aggregations