Search in sources :

Example 26 with WildFlyCamelContext

use of org.wildfly.extension.camel.WildFlyCamelContext in project wildfly-camel by wildfly-extras.

the class GuavaEventIntegrationTest method shouldForwardMessageToCamel.

@Test
public void shouldForwardMessageToCamel() throws Exception {
    WildFlyCamelContext camelctx = new WildFlyCamelContext();
    camelctx.getNamingContext().bind("eventBusA", eventBus);
    camelctx.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("guava-eventbus:eventBusA").to("mock:allEvents");
        }
    });
    camelctx.start();
    try {
        String message = "message";
        eventBus.post(message);
        MockEndpoint mockAll = camelctx.getEndpoint("mock:allEvents", MockEndpoint.class);
        mockAll.setExpectedMessageCount(1);
        mockAll.assertIsSatisfied();
        Assert.assertEquals(message, mockAll.getExchanges().get(0).getIn().getBody());
    } finally {
        camelctx.stop();
    }
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) WildFlyCamelContext(org.wildfly.extension.camel.WildFlyCamelContext) Test(org.junit.Test)

Aggregations

WildFlyCamelContext (org.wildfly.extension.camel.WildFlyCamelContext)26 Test (org.junit.Test)20 RouteBuilder (org.apache.camel.builder.RouteBuilder)18 ProducerTemplate (org.apache.camel.ProducerTemplate)14 Exchange (org.apache.camel.Exchange)8 Context (javax.naming.Context)6 Processor (org.apache.camel.Processor)6 HashMap (java.util.HashMap)4 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)4 CamelContext (org.apache.camel.CamelContext)3 Before (org.junit.Before)3 AmazonDynamoDBClient (com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient)2 AttributeValue (com.amazonaws.services.dynamodbv2.model.AttributeValue)2 TableDescription (com.amazonaws.services.dynamodbv2.model.TableDescription)2 AmazonSNSClient (com.amazonaws.services.sns.AmazonSNSClient)2 List (java.util.List)2 InitialContext (javax.naming.InitialContext)2 CamelContextFactory (org.wildfly.extension.camel.CamelContextFactory)2 AmazonCloudWatchClient (com.amazonaws.services.cloudwatch.AmazonCloudWatchClient)1 DimensionFilter (com.amazonaws.services.cloudwatch.model.DimensionFilter)1