use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class ManagedStreamCachingStrategyTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
DefaultCamelContext dcc = (DefaultCamelContext) context;
dcc.setName("myCamel");
context.setStreamCaching(true);
context.getStreamCachingStrategy().setSpoolDirectory("target/cachedir/#name#/");
from("direct:start").routeId("foo").convertBodyTo(int.class).to("mock:a");
}
};
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class AbstractJsseParametersTest method createPropertiesPlaceholderAwareContext.
protected CamelContext createPropertiesPlaceholderAwareContext(Properties supplementalProperties) throws IOException {
Properties properties = new Properties(supplementalProperties);
properties.load(AbstractJsseParametersTest.class.getResourceAsStream("test.properties"));
if (supplementalProperties != null) {
Properties mergedProps = new Properties();
Set<String> keys = new HashSet<String>();
keys.addAll(properties.stringPropertyNames());
keys.addAll(supplementalProperties.stringPropertyNames());
for (String key : keys) {
mergedProps.setProperty(key, properties.getProperty(key));
}
properties = mergedProps;
}
properties.store(new FileOutputStream("target/jsse-test.properties"), "Generated by " + AbstractJsseParametersTest.class.getName());
PropertiesComponent pc = new PropertiesComponent();
pc.setLocation("file:./target/jsse-test.properties");
CamelContext context = new DefaultCamelContext();
context.addComponent("properties", pc);
return context;
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class GroupTokenIteratorTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
context = new DefaultCamelContext();
context.start();
exchange = new DefaultExchange(context);
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class MessageHelperTest method testCopyHeadersWithHeaderFilterStrategy.
public void testCopyHeadersWithHeaderFilterStrategy() throws Exception {
CamelContext context = new DefaultCamelContext();
context.start();
message = new DefaultExchange(context).getIn();
Message source = message;
Message target = message.getExchange().getOut();
DefaultHeaderFilterStrategy headerFilterStrategy = new DefaultHeaderFilterStrategy();
headerFilterStrategy.setInFilterPattern("foo");
source.setHeader("foo", 123);
source.setHeader("bar", 456);
target.setHeader("bar", "yes");
MessageHelper.copyHeaders(source, target, headerFilterStrategy, true);
assertEquals(null, target.getHeader("foo"));
assertEquals(456, target.getHeader("bar"));
context.stop();
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class MessageHelperTest method testDumpAsXmlPlainBody.
public void testDumpAsXmlPlainBody() throws Exception {
CamelContext context = new DefaultCamelContext();
context.start();
message = new DefaultExchange(context).getIn();
// xml message body
message.setBody("Hello World");
message.setHeader("foo", 123);
String out = MessageHelper.dumpAsXml(message);
assertTrue("Should contain body", out.contains("<body type=\"java.lang.String\">Hello World</body>"));
context.stop();
}
Aggregations