use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class SqsEndpointTest method setUp.
@Before
public void setUp() throws Exception {
amazonSQSClient = EasyMock.createMock(AmazonSQSClient.class);
SqsConfiguration config = new SqsConfiguration();
config.setQueueName("test-queue");
config.setAmazonSQSClient(amazonSQSClient);
endpoint = new SqsEndpoint("aws-sqs://test-queue", new SqsComponent(new DefaultCamelContext()), config);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class RouteBuilderTest method createCamelContext.
protected CamelContext createCamelContext() {
// disable stream cache otherwise to much hazzle in this unit test to filter the stream cache
// in all the assertion codes
DefaultCamelContext ctx = new DefaultCamelContext();
ctx.setStreamCaching(Boolean.FALSE);
return ctx;
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class BuilderWithScopesTest method runTest.
protected void runTest(RouteBuilder builder, List<String> expected, String header) throws Exception {
order.clear();
CamelContext container = new DefaultCamelContext();
container.disableJMX();
container.addRoutes(builder);
container.start();
Endpoint endpoint = container.getEndpoint("direct:a");
Exchange exchange = endpoint.createExchange();
if (header != null) {
exchange.getIn().setHeader("foo", header);
}
Producer producer = endpoint.createProducer();
producer.process(exchange);
log.debug("Invocation order:" + order);
assertEquals(expected, order);
container.stop();
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class TransformerBuilderTest method testCustomTransformer.
public void testCustomTransformer() throws Exception {
CamelContext ctx = new DefaultCamelContext();
RouteBuilder builder = new RouteBuilder() {
@Override
public void configure() throws Exception {
transformer().scheme("other").withJava(MyTransformer.class);
from("direct:input").log("test");
}
};
ctx.addRoutes(builder);
ctx.start();
Transformer transformer = ctx.resolveTransformer("other");
assertNotNull(transformer);
assertEquals(MyTransformer.class, transformer.getClass());
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class TransformerBuilderTest method testDataFormatTransformer.
public void testDataFormatTransformer() throws Exception {
CamelContext ctx = new DefaultCamelContext();
RouteBuilder builder = new RouteBuilder() {
@Override
public void configure() throws Exception {
transformer().fromType("xml:foo").toType("json:bar").withDataFormat(new StringDataFormat());
from("direct:input").log("test");
}
};
ctx.addRoutes(builder);
ctx.start();
Transformer transformer = ctx.resolveTransformer(new DataType("xml:foo"), new DataType("json:bar"));
assertNotNull(transformer);
assertEquals(DataFormatTransformer.class, transformer.getClass());
DataFormatTransformer dft = (DataFormatTransformer) transformer;
Field f = DataFormatTransformer.class.getDeclaredField("dataFormatType");
f.setAccessible(true);
Object dataFormatType = f.get(dft);
assertEquals(StringDataFormat.class, dataFormatType.getClass());
}
Aggregations