use of org.apache.camel.CamelContext in project camel by apache.
the class CamelPublisherConversionVerificationTest method createPublisher.
@Override
public Publisher<Long> createPublisher(long l) {
CamelContext context = new DefaultCamelContext();
RouteBuilder builder = new RouteBuilder() {
@Override
public void configure() throws Exception {
from("timer:tick?delay=500&period=50&repeatCount=" + l).setBody().simple("random(1000)").to("reactive-streams:prod");
}
};
Publisher<Long> pub = CamelReactiveStreams.get(context).fromStream("prod", Long.class);
try {
builder.addRoutesToCamelContext(context);
context.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
return pub;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class CamelPublisherVerificationTest method createPublisher.
@Override
public Publisher<Exchange> createPublisher(long l) {
CamelContext context = new DefaultCamelContext();
RouteBuilder builder = new RouteBuilder() {
@Override
public void configure() throws Exception {
from("timer:tick?delay=500&period=50&repeatCount=" + l).to("reactive-streams:prod");
}
};
Publisher<Exchange> pub = CamelReactiveStreams.get(context).fromStream("prod");
try {
builder.addRoutesToCamelContext(context);
context.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
return pub;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class SalesforceComponentConfigurationIntegrationTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
final CamelContext camelContext = super.createCamelContext();
final SalesforceLoginConfig loginConfig = LoginConfigHelper.getLoginConfig();
final SalesforceComponent component = new SalesforceComponent();
component.setLoginConfig(loginConfig);
// set DTO package
component.setPackages(new String[] { Merchandise__c.class.getPackage().getName() });
camelContext.addComponent(componentName, component);
return camelContext;
}
use of org.apache.camel.CamelContext in project camel by apache.
the class PropertyPlaceholderRouteTest method testCamelContext.
@Test
public void testCamelContext() throws Exception {
CamelContext context = getCamelContext();
assertNotNull(context);
assertEquals("MyCamel", context.getName());
ProducerTemplate template = context.createProducerTemplate();
MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
mock.expectedBodiesReceived("Hello World");
template.sendBody("direct:foo", "World");
mock.assertIsSatisfied();
template.stop();
}
use of org.apache.camel.CamelContext in project camel by apache.
the class SjmsEndpointTest method createCamelContext.
protected CamelContext createCamelContext() throws Exception {
CamelContext camelContext = super.createCamelContext();
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useJmx=false");
SjmsComponent component = new SjmsComponent();
component.setConnectionCount(3);
component.setConnectionFactory(connectionFactory);
camelContext.addComponent("sjms", component);
return camelContext;
}
Aggregations