Search in sources :

Example 66 with DefaultExchange

use of org.apache.camel.impl.DefaultExchange 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");
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) PropertiesComponent(org.apache.camel.component.properties.PropertiesComponent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 67 with DefaultExchange

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

the class DefaultTraceEventMessageTest method testDefaultTraceEventMessageBody.

public void testDefaultTraceEventMessageBody() throws Exception {
    Exchange exchange = new DefaultExchange(context);
    exchange.getIn().setBody(new File("target/test"));
    DefaultTraceEventMessage em = new DefaultTraceEventMessage(new Date(), null, exchange);
    assertEquals("Get a wrong body string", "[Body is file based: target" + File.separator + "test]", em.getBody());
    exchange.getIn().setBody(new ByteArrayInputStream("target/test".getBytes()));
    em = new DefaultTraceEventMessage(new Date(), null, exchange);
    assertEquals("Get a wrong body string", "[Body is instance of java.io.InputStream]", em.getBody());
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) ByteArrayInputStream(java.io.ByteArrayInputStream) File(java.io.File) Date(java.util.Date)

Example 68 with DefaultExchange

use of org.apache.camel.impl.DefaultExchange 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)

Example 69 with DefaultExchange

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

the class SelectCommandTest method setUp.

@Before
public void setUp() {
    sdbClient = new AmazonSDBClientMock();
    configuration = new SdbConfiguration();
    configuration.setDomainName("DOMAIN1");
    configuration.setConsistentRead(Boolean.TRUE);
    exchange = new DefaultExchange(new DefaultCamelContext());
    command = new SelectCommand(sdbClient, configuration, exchange);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Before(org.junit.Before)

Example 70 with DefaultExchange

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

the class BatchPutAttributesCommandTest method setUp.

@Before
public void setUp() {
    sdbClient = new AmazonSDBClientMock();
    configuration = new SdbConfiguration();
    configuration.setDomainName("DOMAIN1");
    exchange = new DefaultExchange(new DefaultCamelContext());
    command = new BatchPutAttributesCommand(sdbClient, configuration, exchange);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Before(org.junit.Before)

Aggregations

DefaultExchange (org.apache.camel.impl.DefaultExchange)473 Exchange (org.apache.camel.Exchange)381 Test (org.junit.Test)254 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)127 CamelContext (org.apache.camel.CamelContext)54 RegisteredDelivery (org.jsmpp.bean.RegisteredDelivery)39 HashMap (java.util.HashMap)33 Message (org.apache.camel.Message)32 Before (org.junit.Before)32 Tx (org.nhindirect.common.tx.model.Tx)31 ESMClass (org.jsmpp.bean.ESMClass)30 Processor (org.apache.camel.Processor)22 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)22 Expression (org.apache.camel.Expression)21 File (java.io.File)20 DefaultMessage (org.apache.camel.impl.DefaultMessage)20 ArrayList (java.util.ArrayList)18 ByteArrayInputStream (java.io.ByteArrayInputStream)17 URL (java.net.URL)16 Date (java.util.Date)16