Search in sources :

Example 56 with Exchange

use of org.apache.camel.Exchange in project camel by apache.

the class MinaUdpUsingTemplateTest method testSendingRawByteMessage.

@Test
public void testSendingRawByteMessage() throws Exception {
    MockEndpoint endpoint = getMockEndpoint("mock:result");
    endpoint.expectedMessageCount(1);
    String toSend = "ef3e00559f5faf0262f5ff0962d9008daa91001cd46b0fa9330ef0f3030fff250e46f72444d1cc501678c351e04b8004c" + "4000002080000fe850bbe011030000008031b031bfe9251305441593830354720020800050440ff";
    byte[] in = fromHexString(toSend);
    template.sendBody("mina:udp://127.0.0.1:{{port}}?sync=false", in);
    assertMockEndpointsSatisfied();
    List<Exchange> list = endpoint.getReceivedExchanges();
    byte[] out = list.get(0).getIn().getBody(byte[].class);
    for (int i = 0; i < in.length; i++) {
        assertEquals("The bytes should be the same", in[i], out[i]);
    }
    assertEquals("The strings should be the same", toSend, byteArrayToHex(out));
}
Also used : Exchange(org.apache.camel.Exchange) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 57 with Exchange

use of org.apache.camel.Exchange in project camel by apache.

the class MinaVMTransferExchangeOptionTest method testMinaTransferExchangeOptionWithoutException.

@Test
public void testMinaTransferExchangeOptionWithoutException() throws Exception {
    Exchange exchange = sendExchange(false);
    assertExchange(exchange, false);
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Example 58 with Exchange

use of org.apache.camel.Exchange in project camel by apache.

the class MinaVMTransferExchangeOptionTest method testMinaTransferExchangeOptionWithException.

@Test
public void testMinaTransferExchangeOptionWithException() throws Exception {
    Exchange exchange = sendExchange(true);
    assertExchange(exchange, true);
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Example 59 with Exchange

use of org.apache.camel.Exchange in project camel by apache.

the class MinaTransferExchangeOptionTest method testMinaTransferExchangeOptionWithoutException.

@Test
public void testMinaTransferExchangeOptionWithoutException() throws Exception {
    Exchange exchange = sendExchange(false);
    assertExchange(exchange, false);
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Example 60 with Exchange

use of org.apache.camel.Exchange in project camel by apache.

the class MinaTransferExchangeOptionTest method testMinaTransferExchangeOptionWithException.

@Test
public void testMinaTransferExchangeOptionWithException() throws Exception {
    Exchange exchange = sendExchange(true);
    assertExchange(exchange, true);
}
Also used : Exchange(org.apache.camel.Exchange) Test(org.junit.Test)

Aggregations

Exchange (org.apache.camel.Exchange)3446 Test (org.junit.Test)1735 Processor (org.apache.camel.Processor)1405 RouteBuilder (org.apache.camel.builder.RouteBuilder)666 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)640 DefaultExchange (org.apache.camel.impl.DefaultExchange)473 Message (org.apache.camel.Message)379 Endpoint (org.apache.camel.Endpoint)235 HashMap (java.util.HashMap)190 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)155 Producer (org.apache.camel.Producer)150 File (java.io.File)120 ArrayList (java.util.ArrayList)117 CamelContext (org.apache.camel.CamelContext)117 List (java.util.List)99 Map (java.util.Map)96 ProducerTemplate (org.apache.camel.ProducerTemplate)94 IOException (java.io.IOException)92 Tx (org.nhindirect.common.tx.model.Tx)83 Predicate (org.apache.camel.Predicate)78