Search in sources :

Example 1 with HttpClientRibbonCommand

use of org.springframework.cloud.netflix.zuul.filters.route.apache.HttpClientRibbonCommand in project spring-cloud-netflix by spring-cloud.

the class ZuulApacheHttpClientConfigurationTests method testRibbonLoadBalancingHttpClient.

@Test
public void testRibbonLoadBalancingHttpClient() {
    RibbonCommandContext context = new RibbonCommandContext("foo", " GET", "http://localhost", false, new LinkedMultiValueMap<>(), new LinkedMultiValueMap<>(), null, new ArrayList<>(), 0l);
    HttpClientRibbonCommand command = httpClientRibbonCommandFactory.create(context);
    RibbonLoadBalancingHttpClient ribbonClient = command.getClient();
    CloseableHttpClient httpClient = getField(ribbonClient, "delegate");
    MockingDetails httpClientDetails = mockingDetails(httpClient);
    assertTrue(httpClientDetails.isMock());
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) RibbonCommandContext(org.springframework.cloud.netflix.ribbon.support.RibbonCommandContext) RibbonLoadBalancingHttpClient(org.springframework.cloud.netflix.ribbon.apache.RibbonLoadBalancingHttpClient) HttpClientRibbonCommand(org.springframework.cloud.netflix.zuul.filters.route.apache.HttpClientRibbonCommand) MockingDetails(org.mockito.MockingDetails) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 Test (org.junit.Test)1 MockingDetails (org.mockito.MockingDetails)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 RibbonLoadBalancingHttpClient (org.springframework.cloud.netflix.ribbon.apache.RibbonLoadBalancingHttpClient)1 RibbonCommandContext (org.springframework.cloud.netflix.ribbon.support.RibbonCommandContext)1 HttpClientRibbonCommand (org.springframework.cloud.netflix.zuul.filters.route.apache.HttpClientRibbonCommand)1