Package org.apache.camel

Examples of org.apache.camel.Endpoint.createExchange()


    }

    public void testCreateTempFileName() throws Exception {
        Endpoint endpoint = context.getEndpoint(fileUrl);
        GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");

        String tempFileName = producer.createTempFileName(exchange, "target/tempandrename/claus.txt");
        assertDirectoryEquals("target/tempandrename/inprogress.claus.txt", tempFileName);
    }
View Full Code Here


    }

    public void testCreateTempFileNameUsingComplexName() throws Exception {
        Endpoint endpoint = context.getEndpoint(fileUrl);
        GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader(Exchange.FILE_NAME, "foo/claus.txt");

        String tempFileName = producer.createTempFileName(exchange, "target/tempandrename/foo/claus.txt");
        assertDirectoryEquals("target/tempandrename/foo/inprogress.claus.txt", tempFileName);
    }
View Full Code Here

    }

    public void testNoPathCreateTempFileName() throws Exception {
        Endpoint endpoint = context.getEndpoint(fileUrl);
        GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");

        String tempFileName = producer.createTempFileName(exchange, "./");
        assertDirectoryEquals("./inprogress.claus.txt", tempFileName);
    }
View Full Code Here

    @Test
    public void testJdbcRoutes() throws Exception {
        // START SNIPPET: invoke
        // first we create our exchange using the endpoint
        Endpoint endpoint = context.getEndpoint("direct:hello");
        Exchange exchange = endpoint.createExchange();
        // then we set the SQL on the in body
        exchange.getIn().setBody("select id as identifier, name from customer order by ID");

        // now we send the exchange to the endpoint, and receives the response from Camel
        Exchange out = template.send(endpoint, exchange);
View Full Code Here

        // first we create our exchange using the endpoint
        Endpoint endpoint = context.getEndpoint("direct:hello");
       
        // repeat the test often enough to make sure preserved ordering is not a fluke
        for (int i = 0; i < 10; i++) {
            Exchange exchange = endpoint.createExchange();
            // then we set the SQL on the in body
            exchange.getIn().setBody("select * from customer order by ID");

            // now we send the exchange to the endpoint, and receives the response from Camel
            Exchange out = template.send(endpoint, exchange);
View Full Code Here

    @Test
    public void testJdbcRoutes() throws Exception {
        // START SNIPPET: invoke
        // first we create our exchange using the endpoint
        Endpoint endpoint = context.getEndpoint("direct:hello");
        Exchange exchange = endpoint.createExchange();
        // then we set the SQL on the in body
        exchange.getIn().setBody("select * from customer order by ID");

        // now we send the exchange to the endpoint, and receives the response from Camel
        Exchange out = template.send(endpoint, exchange);
View Full Code Here

    }

    public void testCreateTempFileName() throws Exception {
        Endpoint endpoint = context.getEndpoint(fileUrl);
        GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");

        String tempFileName = producer.createTempFileName(exchange, "target/tempandrename/claus.txt");
        assertDirectoryEquals("target/tempandrename/inprogress-claus.tmp", tempFileName);
    }
View Full Code Here

    }

    public void testNoPathCreateTempFileName() throws Exception {
        Endpoint endpoint = context.getEndpoint(fileUrl);
        GenericFileProducer producer = (GenericFileProducer) endpoint.createProducer();
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader(Exchange.FILE_NAME, "claus.txt");

        String tempFileName = producer.createTempFileName(exchange, "./");
        assertDirectoryEquals("./inprogress-claus.tmp", tempFileName);
    }
View Full Code Here

        });
        context.start();

        // now lets fire in a message
        Endpoint endpoint = context.getEndpoint("direct:x");
        Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
        Message message = exchange.getIn();
        message.setBody("Hello!");
        message.setHeader("cheese", 123);

        Producer producer = endpoint.createProducer();
View Full Code Here

        });
        context.start();

        // now lets fire in a message
        Endpoint endpoint = context.getEndpoint("direct:x");
        Exchange exchange = endpoint.createExchange(ExchangePattern.InOut);
        Message message = exchange.getIn();
        message.setBody("Hello!");
        message.setHeader("cheese", 123);

        Producer producer = endpoint.createProducer();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.