Search in sources :

Example 81 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class UnitOfWorkProducerTest 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 event instanceof ExchangeCompletedEvent;
        }

        @Override
        protected void doStart() throws Exception {
        }

        @Override
        protected void doStop() throws Exception {
        }
    });
    return context;
}
Also used : EventNotifierSupport(org.apache.camel.support.EventNotifierSupport) ExchangeCompletedEvent(org.apache.camel.management.event.ExchangeCompletedEvent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) EventObject(java.util.EventObject)

Example 82 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class AbstractDistributedTest method setUp.

public void setUp() throws Exception {
    super.setUp();
    context.setUseMDCLogging(true);
    context2 = new DefaultCamelContext();
    context2.setUseMDCLogging(true);
    template2 = context2.createProducerTemplate();
    ServiceHelper.startServices(template2, context2);
    // add routes after CamelContext has been started
    context2.addRoutes(createRouteBuilder2());
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 83 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class UnmarshalProcessorTest method testDataFormatReturnsSameExchange.

public void testDataFormatReturnsSameExchange() throws Exception {
    Exchange exchange = createExchangeWithBody(new DefaultCamelContext(), "body");
    Processor processor = new UnmarshalProcessor(new MyDataFormat(exchange));
    processor.process(exchange);
    assertEquals("UnmarshalProcessor did not copy OUT from IN message", "body", exchange.getOut().getBody());
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 84 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class UnmarshalProcessorTest method testDataFormatReturnsAnotherExchange.

public void testDataFormatReturnsAnotherExchange() throws Exception {
    CamelContext context = new DefaultCamelContext();
    Exchange exchange = createExchangeWithBody(context, "body");
    Exchange exchange2 = createExchangeWithBody(context, "body2");
    Processor processor = new UnmarshalProcessor(new MyDataFormat(exchange2));
    processor.process(exchange);
    Exception e = exchange.getException();
    assertNotNull(e);
    assertEquals("The returned exchange " + exchange2 + " is not the same as " + exchange + " provided to the DataFormat", e.getMessage());
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Example 85 with DefaultCamelContext

use of org.apache.camel.impl.DefaultCamelContext in project camel by apache.

the class HttpHeaderFilterStrategyTest method setUp.

@Before
public void setUp() {
    filter = new HttpHeaderFilterStrategy();
    exchange = new DefaultExchange(new DefaultCamelContext());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Before(org.junit.Before)

Aggregations

DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)474 CamelContext (org.apache.camel.CamelContext)206 Test (org.junit.Test)183 DefaultExchange (org.apache.camel.impl.DefaultExchange)128 RouteBuilder (org.apache.camel.builder.RouteBuilder)101 Exchange (org.apache.camel.Exchange)91 Before (org.junit.Before)70 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)61 RegisteredDelivery (org.jsmpp.bean.RegisteredDelivery)39 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)38 ESMClass (org.jsmpp.bean.ESMClass)30 ProducerTemplate (org.apache.camel.ProducerTemplate)27 CountDownLatch (java.util.concurrent.CountDownLatch)15 Endpoint (org.apache.camel.Endpoint)13 FailedToCreateRouteException (org.apache.camel.FailedToCreateRouteException)13 Processor (org.apache.camel.Processor)12 RouteStartupOrder (org.apache.camel.spi.RouteStartupOrder)12 Address (org.jsmpp.bean.Address)11 SubmitMultiResult (org.jsmpp.bean.SubmitMultiResult)11 Date (java.util.Date)10