Search in sources :

Example 11 with WildFlyCamelContext

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

the class AS400IntegrationTest method testToString.

@Test
public void testToString() throws Exception {
    String endpointUri = "jt400://user:password@host/qsys.lib/library.lib/queue.dtaq?ccsid=500&format=binary&connectionPool=#mockPool";
    WildFlyCamelContext camelctx = new WildFlyCamelContext();
    camelctx.getNamingContext().bind("mockPool", new AS400ConnectionPool());
    camelctx.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from(endpointUri).to("mock:end");
        }
    });
    Jt400Endpoint endpoint = camelctx.getEndpoint(endpointUri, Jt400Endpoint.class);
    Assert.assertEquals("host", endpoint.getSystemName());
}
Also used : Jt400Endpoint(org.apache.camel.component.jt400.Jt400Endpoint) AS400ConnectionPool(com.ibm.as400.access.AS400ConnectionPool) RouteBuilder(org.apache.camel.builder.RouteBuilder) WildFlyCamelContext(org.wildfly.extension.camel.WildFlyCamelContext) Test(org.junit.Test)

Example 12 with WildFlyCamelContext

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

the class JcrIntegrationTest method testJcrProducer.

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

        @Override
        public void configure() throws Exception {
            getContext().setUseBreadcrumb(false);
            from("direct:a").to("jcr://user:pass@repository/home/test");
        }
    });
    camelctx.start();
    try {
        String content = "<hello>world!</hello>";
        HashMap<String, Object> headers = new HashMap<>();
        headers.put(JcrConstants.JCR_NODE_NAME, "node");
        headers.put("my.contents.property", content);
        ProducerTemplate template = camelctx.createProducerTemplate();
        String result = template.requestBodyAndHeaders("direct:a", null, headers, String.class);
        Assert.assertNotNull(result);
        Session session = openSession();
        try {
            Node node = session.getNodeByIdentifier(result);
            Assert.assertEquals("/home/test/node", node.getPath());
            Assert.assertEquals(content, node.getProperty("my.contents.property").getString());
        } finally {
            session.logout();
        }
    } finally {
        camelctx.stop();
    }
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) RouteBuilder(org.apache.camel.builder.RouteBuilder) HashMap(java.util.HashMap) Node(javax.jcr.Node) WildFlyCamelContext(org.wildfly.extension.camel.WildFlyCamelContext) RepositoryException(javax.jcr.RepositoryException) Session(javax.jcr.Session) Test(org.junit.Test)

Example 13 with WildFlyCamelContext

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

the class JNDIIntegrationTest method testArquillianResource.

@Test
public void testArquillianResource(@ArquillianResource CamelContextFactory contextFactory) throws Exception {
    WildFlyCamelContext camelctx = contextFactory.createCamelContext();
    assertBeanBinding(camelctx);
}
Also used : WildFlyCamelContext(org.wildfly.extension.camel.WildFlyCamelContext) Test(org.junit.Test)

Example 14 with WildFlyCamelContext

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

the class JNDIIntegrationTest method testCamelContextFactoryLookup.

@Test
public void testCamelContextFactoryLookup() throws Exception {
    InitialContext inicxt = new InitialContext();
    CamelContextFactory factory = (CamelContextFactory) inicxt.lookup(CamelConstants.CAMEL_CONTEXT_FACTORY_BINDING_NAME);
    WildFlyCamelContext camelctx = factory.createCamelContext();
    assertBeanBinding(camelctx);
}
Also used : CamelContextFactory(org.wildfly.extension.camel.CamelContextFactory) WildFlyCamelContext(org.wildfly.extension.camel.WildFlyCamelContext) InitialContext(javax.naming.InitialContext) Test(org.junit.Test)

Example 15 with WildFlyCamelContext

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

the class JNDIIntegrationTest method testCamelContextFactoryService.

@Test
public void testCamelContextFactoryService() throws Exception {
    CamelContextFactory contextFactory = ServiceLocator.getRequiredService(CamelContextFactory.class);
    WildFlyCamelContext camelctx = contextFactory.createCamelContext(getClass().getClassLoader());
    assertBeanBinding(camelctx);
}
Also used : CamelContextFactory(org.wildfly.extension.camel.CamelContextFactory) 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