Search in sources :

Example 1 with OkHttpRibbonCommand

use of org.springframework.cloud.netflix.zuul.filters.route.okhttp.OkHttpRibbonCommand in project spring-cloud-netflix by spring-cloud.

the class ZuulOkHttpClientConfigurationTests method testOkHttpLoadBalancingHttpClient.

@Test
public void testOkHttpLoadBalancingHttpClient() {
    RibbonCommandContext context = new RibbonCommandContext("foo", " GET", "http://localhost", false, new LinkedMultiValueMap<>(), new LinkedMultiValueMap<>(), null, new ArrayList<>(), 0l);
    OkHttpRibbonCommand command = okHttpRibbonCommandFactory.create(context);
    OkHttpLoadBalancingClient ribbonClient = command.getClient();
    OkHttpClient httpClient = getField(ribbonClient, "delegate");
    MockingDetails httpClientDetails = mockingDetails(httpClient);
    assertTrue(httpClientDetails.isMock());
}
Also used : OkHttpClient(okhttp3.OkHttpClient) OkHttpLoadBalancingClient(org.springframework.cloud.netflix.ribbon.okhttp.OkHttpLoadBalancingClient) RibbonCommandContext(org.springframework.cloud.netflix.ribbon.support.RibbonCommandContext) OkHttpRibbonCommand(org.springframework.cloud.netflix.zuul.filters.route.okhttp.OkHttpRibbonCommand) MockingDetails(org.mockito.MockingDetails) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

OkHttpClient (okhttp3.OkHttpClient)1 Test (org.junit.Test)1 MockingDetails (org.mockito.MockingDetails)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 OkHttpLoadBalancingClient (org.springframework.cloud.netflix.ribbon.okhttp.OkHttpLoadBalancingClient)1 RibbonCommandContext (org.springframework.cloud.netflix.ribbon.support.RibbonCommandContext)1 OkHttpRibbonCommand (org.springframework.cloud.netflix.zuul.filters.route.okhttp.OkHttpRibbonCommand)1