use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class EventNotifierExchangeSentTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
DefaultCamelContext context = new DefaultCamelContext(createRegistry());
context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {
public void notify(EventObject event) throws Exception {
events.add(event);
}
public boolean isEnabled(EventObject event) {
return true;
}
@Override
protected void doStart() throws Exception {
// filter out unwanted events
setIgnoreCamelContextEvents(true);
setIgnoreServiceEvents(true);
setIgnoreRouteEvents(true);
setIgnoreExchangeCreatedEvent(true);
setIgnoreExchangeCompletedEvent(true);
setIgnoreExchangeFailedEvents(true);
setIgnoreExchangeRedeliveryEvents(true);
}
@Override
protected void doStop() throws Exception {
}
});
return context;
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class LoggingEventNotifierTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
LoggingEventNotifier notifier = new LoggingEventNotifier();
notifier.setLogName("org.apache.camel.EventLog");
notifier.setIgnoreCamelContextEvents(true);
notifier.setIgnoreRouteEvents(true);
notifier.setIgnoreServiceEvents(true);
CamelContext context = new DefaultCamelContext(createRegistry());
context.getManagementStrategy().addEventNotifier(notifier);
return context;
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class SimpleWithPropertiesTest method testProperty.
/**
* A property from the property component in a expression
* is processed when the expression is evaluated with exchange
* See https://issues.apache.org/jira/browse/CAMEL-4843
* Now camel doesn't support the properties expression of {{test}}
*/
@Test
public void testProperty() throws Exception {
System.setProperty("test", "testValue");
PropertiesComponent pc = new PropertiesComponent();
CamelContext context = new DefaultCamelContext();
context.addComponent("properties", pc);
// try to setup the property
Exchange exchange = new DefaultExchange(context);
String result = SimpleBuilder.simple("${properties:test}").evaluate(exchange, String.class);
Assert.assertEquals("testValue", result);
System.clearProperty("test");
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class JmxNotificationEventNotifierTest method createCamelContext.
@Override
protected CamelContext createCamelContext() throws Exception {
// START SNIPPET: e1
// Set up the JmxNotificationEventNotifier
notifier = new JmxNotificationEventNotifier();
notifier.setSource("MyCamel");
notifier.setIgnoreCamelContextEvents(true);
notifier.setIgnoreRouteEvents(true);
notifier.setIgnoreServiceEvents(true);
CamelContext context = new DefaultCamelContext(createRegistry());
context.getManagementStrategy().addEventNotifier(notifier);
// END SNIPPET: e1
return context;
}
use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.
the class CamelContextDisableJmxTest method testDisableJmx.
public void testDisableJmx() throws Exception {
CamelContext context = new DefaultCamelContext();
context.disableJMX();
context.start();
// JMX should be disabled and therefore not a ManagedManagementStrategy instance
assertFalse(context.getManagementStrategy() instanceof ManagedManagementStrategy);
context.stop();
}
Aggregations