use of org.apache.camel.CamelContext in project camel by apache.
the class RouteBuilderRefTest method testUsingRouteBuilderRefInCamelXml.
public void testUsingRouteBuilderRefInCamelXml() throws Exception {
AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/config/routeBuilderRef.xml");
CamelContext context = applicationContext.getBean("camel5", CamelContext.class);
assertValidContext(context);
// we're done so let's properly close the application context
IOHelper.close(applicationContext);
}
use of org.apache.camel.CamelContext in project camel by apache.
the class RouteRefPropertyPlaceholderMultipleCamelContextRefsTest method testSpringTwoCamelContextDirectEndpoint.
public void testSpringTwoCamelContextDirectEndpoint() throws Exception {
AbstractXmlApplicationContext ac = createApplicationContext();
ac.start();
CamelContext camel1 = ac.getBean("myCamel-1", CamelContext.class);
CamelContext camel2 = ac.getBean("myCamel-2", CamelContext.class);
Endpoint start1 = camel1.getEndpoint("direct:start");
Endpoint start2 = camel2.getEndpoint("direct:start");
assertNotSame(start1, start2);
MockEndpoint mock1 = camel1.getEndpoint("mock:end-1", MockEndpoint.class);
mock1.expectedBodiesReceived("Hello World");
MockEndpoint mock2 = camel2.getEndpoint("mock:end-2", MockEndpoint.class);
mock2.expectedBodiesReceived("Bye World");
camel1.createProducerTemplate().sendBody("direct:start", "Hello World");
camel2.createProducerTemplate().sendBody("direct:start", "Bye World");
mock1.assertIsSatisfied();
mock2.assertIsSatisfied();
ac.stop();
}
use of org.apache.camel.CamelContext in project camel by apache.
the class SpringCamelContextThreadPoolProfilesTest method testBigProfile.
public void testBigProfile() throws Exception {
CamelContext context = getMandatoryBean(CamelContext.class, "camel-C");
ThreadPoolProfile profile = context.getExecutorServiceManager().getThreadPoolProfile("big");
assertEquals(50, profile.getPoolSize().intValue());
assertEquals(100, profile.getMaxPoolSize().intValue());
assertEquals(ThreadPoolRejectedPolicy.DiscardOldest, profile.getRejectedPolicy());
assertEquals(null, profile.getKeepAliveTime());
assertEquals(null, profile.getMaxQueueSize());
// create a thread pool from big
ExecutorService executor = context.getExecutorServiceManager().newThreadPool(this, "MyBig", "big");
ThreadPoolExecutor tp = assertIsInstanceOf(ThreadPoolExecutor.class, executor);
assertEquals(50, tp.getCorePoolSize());
assertEquals(100, tp.getMaximumPoolSize());
// should inherit default options
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
assertEquals("DiscardOldest", tp.getRejectedExecutionHandler().toString());
}
use of org.apache.camel.CamelContext in project camel by apache.
the class SpringCamelContextThreadPoolProfilesTest method testLowProfile.
public void testLowProfile() throws Exception {
CamelContext context = getMandatoryBean(CamelContext.class, "camel-C");
ThreadPoolProfile profile = context.getExecutorServiceManager().getThreadPoolProfile("low");
assertEquals(1, profile.getPoolSize().intValue());
assertEquals(5, profile.getMaxPoolSize().intValue());
assertEquals(null, profile.getKeepAliveTime());
assertEquals(null, profile.getMaxQueueSize());
assertEquals(null, profile.getRejectedPolicy());
// create a thread pool from low
ExecutorService executor = context.getExecutorServiceManager().newThreadPool(this, "MyLow", "low");
ThreadPoolExecutor tp = assertIsInstanceOf(ThreadPoolExecutor.class, executor);
assertEquals(1, tp.getCorePoolSize());
assertEquals(5, tp.getMaximumPoolSize());
// should inherit default options
assertEquals(60, tp.getKeepAliveTime(TimeUnit.SECONDS));
assertEquals("CallerRuns", tp.getRejectedExecutionHandler().toString());
}
use of org.apache.camel.CamelContext in project camel by apache.
the class JMXAgentPropertiesTest method testEnableUseHostIPAddress.
public void testEnableUseHostIPAddress() throws Exception {
CamelContext ctx = createCamelContext();
ManagementAgent agent = ctx.getManagementStrategy().getManagementAgent();
agent.start();
assertTrue(agent.getUseHostIPAddress());
}
Aggregations