Package org.apache.camel.impl

Examples of org.apache.camel.impl.DefaultCamelContext


        assertTrue(json.contains("\"sendToAll\": { \"type\": \"boolean\""));
    }

    @Test
    public void testComponentDocumentation() throws Exception {
        CamelContext context = new DefaultCamelContext();
        String html = context.getComponentDocumentation("atmosphere-websocket");
        assertNotNull("Should have found some auto-generated HTML", html);
    }
View Full Code Here


  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();
    this.camelContext = new DefaultCamelContext();
    this.camelContext.addRoutes(new RouteBuilder() {
      @Override
      public void configure() throws Exception {
        from("jetty:http://localhost:1148/?matchOnUriPrefix=true").process(
            new Processor() {
View Full Code Here

        Context context = new JndiContext();
        context.bind("testnode", node);
        node.set("ksession", session);

        CamelContext camelContext = new DefaultCamelContext(context);
        camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {         
                JaxbDataFormat jdf = new JaxbDataFormat();
                jdf.setContextPath("org.drools.camel.testdomain");
                jdf.setPrettyPrint(true);
View Full Code Here

        GridNode node = grid.createGridNode("testnode");
        Context context = new JndiContext();
        context.bind("testnode", node);
        node.set("ksession", session);
       
        CamelContext camelContext = new DefaultCamelContext(context);
        camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:test-session").policy(new DroolsPolicy()).unmarshal("json").to("drools://testnode/ksession").marshal("json");
                from("direct:unmarshall").policy(new DroolsPolicy()).unmarshal("json");
                from("direct:marshall").policy(new DroolsPolicy()).marshal("json");
View Full Code Here

        fos.write(s.getBytes());
        fos.close();
    }

    protected void startCamel() throws Exception {
        camel = new DefaultCamelContext();

        // add properties component
        camel.addComponent("properties", new PropertiesComponent("classpath:incident.properties,file:target/custom.properties"));

        ReportIncidentRoutes routes = new ReportIncidentRoutes();
View Full Code Here

    @Before
    public void startServices() throws Exception {
        deleteDirectory("activemq-data");

        camelContext = new DefaultCamelContext();
        broker = new JmsBroker("vm://localhost");
        broker.start();
        // Set up the ActiveMQ JMS Components
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost");
View Full Code Here

    }

    @Test
    public void testRmi() throws Exception {
        // Create a new camel context to send the request so we can test the service which is deployed into a container
        CamelContext myContext = new DefaultCamelContext();
        ProducerTemplate myTemplate = myContext.createProducerTemplate();
        myTemplate.start();
        try {
            System.out.println("Calling on port " + port);
            String out = myTemplate.requestBody("rmi://localhost:" + port + "/helloServiceBean", "Camel", String.class);
            assertEquals("Hello Camel", out);
        } finally {
            myTemplate.stop();
            myContext.stop();
        }
    }
View Full Code Here

        // lets populate the context with the services we need
        // note that we could just use a spring.xml file to avoid this step
        JndiContext context = new JndiContext();
        context.bind("bye", new SayService("Good Bye!"));

        CamelContext camelContext = new DefaultCamelContext(context);
        // END SNIPPET: register

        // START SNIPPET: route
        // lets add simple route
        camelContext.addRoutes(new RouteBuilder() {
            public void configure() {
                from("direct:hello").to("pojo:bye");
            }
        });
        // END SNIPPET: route

        camelContext.start();

        // START SNIPPET: invoke
        Endpoint endpoint = camelContext.getEndpoint("direct:hello");
        ISay proxy = ProxyHelper.createProxy(endpoint, ISay.class);
        String rc = proxy.say();
        assertEquals("Good Bye!", rc);
        // END SNIPPET: invoke

        camelContext.stop();
    }
View Full Code Here


    public void testSedaQueue() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);

        CamelContext context = new DefaultCamelContext();

        // lets add some routes
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("seda:test.a").to("seda:test.b");
                from("seda:test.b").process(new Processor() {
                    public void process(Exchange e) {
                        log.debug("Received exchange: " + e.getIn());
                        latch.countDown();
                    }
                });
            }
        });

       
        context.start();

        // now lets fire in a message
        Endpoint<Exchange> endpoint = context.getEndpoint("seda:test.a");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader("cheese", 123);

        Producer<Exchange> producer = endpoint.createProducer();
        producer.process(exchange);

        // now lets sleep for a while
        boolean received = latch.await(5, TimeUnit.SECONDS);
        assertTrue("Did not receive the message!", received);

        context.stop();
    }
View Full Code Here


    public void testThatShowsEndpointResolutionIsNotConsistent() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);

        CamelContext context = new DefaultCamelContext();

        // lets add some routes
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("seda:test.a").to("seda:test.b");
                from("seda:test.b").process(new Processor() {
                    public void process(Exchange e) {
                        log.debug("Received exchange: " + e.getIn());
                        latch.countDown();
                    }
                });
            }
        });


        context.start();

        // now lets fire in a message
        Endpoint<Exchange> endpoint = context.getEndpoint("seda:test.a");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader("cheese", 123);

        Producer<Exchange> producer = endpoint.createProducer();
        producer.process(exchange);

        // now lets sleep for a while
        boolean received = latch.await(5, TimeUnit.SECONDS);
        assertTrue("Did not receive the message!", received);

        context.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.impl.DefaultCamelContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.