Package org.apache.camel.component.http4.handler

Examples of org.apache.camel.component.http4.handler.BasicValidationHandler


*/
public class HttpProducerSelectMethodTest extends BaseHttpTest {

    @Test
    public void noDataDefaultIsGet() throws Exception {
        localServer.register("/", new BasicValidationHandler("GET", null, null, getExpectedContent()));

        HttpComponent component = context.getComponent("http4", HttpComponent.class);
       
        HttpEndpoint endpoiont = (HttpEndpoint) component.createEndpoint("http4://" + getHostName() + ":" + getPort());
        HttpProducer producer = new HttpProducer(endpoiont);
View Full Code Here


        assertExchange(exchange);
    }

    @Test
    public void dataDefaultIsPost() throws Exception {
        localServer.register("/", new BasicValidationHandler("POST", null, null, getExpectedContent()));

        HttpComponent component = context.getComponent("http4", HttpComponent.class);

        HttpEndpoint endpoiont = (HttpEndpoint) component.createEndpoint("http4://" + getHostName() + ":" + getPort());
        HttpProducer producer = new HttpProducer(endpoiont);
View Full Code Here

        assertExchange(exchange);
    }

    @Test
    public void withMethodPostInHeader() throws Exception {
        localServer.register("/", new BasicValidationHandler("POST", null, null, getExpectedContent()));

        HttpComponent component = context.getComponent("http4", HttpComponent.class);

        HttpEndpoint endpoiont = (HttpEndpoint) component.createEndpoint("http4://" + getHostName() + ":" + getPort());
        HttpProducer producer = new HttpProducer(endpoiont);
View Full Code Here

        producer.stop();
    }

    @Test
    public void withMethodGetInHeader() throws Exception {
        localServer.register("/", new BasicValidationHandler("GET", null, null, getExpectedContent()));

        HttpComponent component = context.getComponent("http4", HttpComponent.class);

        HttpEndpoint endpoiont = (HttpEndpoint) component.createEndpoint("http4://" + getHostName() + ":" + getPort());
        HttpProducer producer = new HttpProducer(endpoiont);
View Full Code Here

        producer.stop();
    }

    @Test
    public void withEndpointQuery() throws Exception {
        localServer.register("/", new BasicValidationHandler("GET", "q=Camel", null, getExpectedContent()));

        HttpComponent component = context.getComponent("http4", HttpComponent.class);

        HttpEndpoint endpoiont = (HttpEndpoint) component.createEndpoint("http4://" + getHostName() + ":" + getPort() + "?q=Camel");
        HttpProducer producer = new HttpProducer(endpoiont);
View Full Code Here

        producer.stop();
    }

    @Test
    public void withQueryInHeader() throws Exception {
        localServer.register("/", new BasicValidationHandler("GET", "q=Camel", null, getExpectedContent()));

        HttpComponent component = context.getComponent("http4", HttpComponent.class);

        HttpEndpoint endpoiont = (HttpEndpoint) component.createEndpoint("http4://" + getHostName() + ":" + getPort());
        HttpProducer producer = new HttpProducer(endpoiont);
View Full Code Here

        producer.stop();
    }

    @Test
    public void withQueryInHeaderOverrideEndpoint() throws Exception {
        localServer.register("/", new BasicValidationHandler("GET", "q=Camel", null, getExpectedContent()));

        HttpComponent component = context.getComponent("http4", HttpComponent.class);

        HttpEndpoint endpoiont = (HttpEndpoint) component.createEndpoint("http4://" + getHostName() + ":" + getPort() + "?q=Donkey");
        HttpProducer producer = new HttpProducer(endpoiont);
View Full Code Here

        assertIsInstanceOf(ConnectException.class, cause.getCause());
    }

    @Override
    protected void registerHandler(LocalTestServer server) {
        server.register("/search", new BasicValidationHandler("GET", null, null, getExpectedContent()));
    }
View Full Code Here

        assertExchange(exchange);
    }

    @Test
    public void httpHead() throws Exception {
        localServer.register("/", new BasicValidationHandler("HEAD", null, null, getExpectedContent()));

        Exchange exchange = template.request("http4://" + getHostName() + ":" + getPort() + "/", new Processor() {
            public void process(Exchange exchange) throws Exception {
                exchange.getIn().setHeader(Exchange.HTTP_METHOD, "HEAD");
            }
View Full Code Here

    @Test
    public void httpHandleRedirect() throws Exception {
        // force a 301 redirect
        localServer.register("/test", new RedirectHandler(HttpStatus.SC_MOVED_PERMANENTLY));
        localServer.register("/someplaceelse", new BasicValidationHandler("GET", null, null, "Bye World"));

        String uri = "http4://" + getHostName() + ":" + getPort()
                + "/test?httpClient.socketTimeout=60000&httpClient.connectTimeout=60000"
                + "&httpClient.staleConnectionCheckEnabled=false";
        Exchange out = template.request(uri, new Processor() {
View Full Code Here

TOP

Related Classes of org.apache.camel.component.http4.handler.BasicValidationHandler

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.