Package com.consol.citrus.http.client

Examples of com.consol.citrus.http.client.HttpClient


        Map<String, HttpClient> clients = beanDefinitionContext.getBeansOfType(HttpClient.class);

        Assert.assertEquals(clients.size(), 4);

        // 1st message sender
        HttpClient httpClient = clients.get("httpClient1");
        Assert.assertNotNull(httpClient.getEndpointConfiguration().getRestTemplate());
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRequestUrl(), "http://localhost:8080/test");
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRestTemplate().getRequestFactory().getClass(), InterceptingClientHttpRequestFactory.class);
        Assert.assertNotNull(httpClient.getEndpointConfiguration().getClientInterceptors());
        Assert.assertEquals(httpClient.getEndpointConfiguration().getClientInterceptors().get(0).getClass(), LoggingClientInterceptor.class);
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRequestMethod(), HttpMethod.POST);
        Assert.assertEquals(httpClient.getEndpointConfiguration().getCorrelator().getClass(), DefaultMessageCorrelator.class);
        Assert.assertEquals(httpClient.getEndpointConfiguration().getTimeout(), 5000L);


        // 2nd message sender
        httpClient = clients.get("httpClient2");
        Assert.assertNotNull(httpClient.getEndpointConfiguration().getRestTemplate());
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRequestUrl(), "http://localhost:8080/test");
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRestTemplate().getRequestFactory().getClass(), InterceptingClientHttpRequestFactory.class);
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRequestMethod(), HttpMethod.GET);
        Assert.assertEquals(httpClient.getEndpointConfiguration().getCorrelator().getClass(), DefaultMessageCorrelator.class);
        Assert.assertEquals(httpClient.getEndpointConfiguration().getContentType(), "text/xml");
        Assert.assertEquals(httpClient.getEndpointConfiguration().getCharset(), "ISO-8859-1");
        Assert.assertEquals(httpClient.getEndpointConfiguration().getMessageConverter(), beanDefinitionContext.getBean("messageConverter"));
        Assert.assertEquals(httpClient.getEndpointConfiguration().getEndpointUriResolver(), beanDefinitionContext.getBean("endpointResolver"));
        Assert.assertEquals(httpClient.getEndpointConfiguration().getTimeout(), 10000L);

        // 3rd message sender
        httpClient = clients.get("httpClient3");
        Assert.assertNotNull(httpClient.getEndpointConfiguration().getRestTemplate());
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRestTemplate(), beanDefinitionContext.getBean("restTemplate"));
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRequestUrl(), "http://localhost:8080/test");
        Assert.assertNotNull(httpClient.getEndpointConfiguration().getCorrelator());
        Assert.assertEquals(httpClient.getEndpointConfiguration().getCorrelator(), beanDefinitionContext.getBean("replyMessageCorrelator"));

        // 4th message sender
        httpClient = clients.get("httpClient4");
        Assert.assertNotNull(httpClient.getActor());
        Assert.assertEquals(httpClient.getActor(), beanDefinitionContext.getBean("testActor", TestActor.class));
        Assert.assertEquals(httpClient.getEndpointConfiguration().getRestTemplate().getRequestFactory().getClass(), InterceptingClientHttpRequestFactory.class);
        Assert.assertNotNull(httpClient.getEndpointConfiguration().getClientInterceptors());
        Assert.assertEquals(httpClient.getEndpointConfiguration().getClientInterceptors().get(0), beanDefinitionContext.getBean("clientInterceptor"));
        Assert.assertEquals(httpClient.getEndpointConfiguration().getPollingInterval(), 250L);
    }
View Full Code Here

TOP

Related Classes of com.consol.citrus.http.client.HttpClient

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.