Search in sources :

Example 1 with LoadBalancerContext

use of com.netflix.loadbalancer.LoadBalancerContext in project ribbon by Netflix.

the class DiscoveryLoadBalancerTest method testLoadBalancer.

@Test
public void testLoadBalancer() {
    IClientConfig config = IClientConfig.Builder.newBuilder().withDefaultValues().withDeploymentContextBasedVipAddresses(getVipAddress()).build().set(IClientConfigKey.Keys.NIWSServerListClassName, DiscoveryEnabledNIWSServerList.class.getName());
    LoadBalancingHttpClient<ByteBuf, ByteBuf> client = RibbonTransport.newHttpClient(config);
    LoadBalancerContext lbContext = client.getLoadBalancerContext();
    List<Server> serverList = lbContext.getLoadBalancer().getAllServers();
    assertEquals(getMockServerList(), serverList);
}
Also used : LoadBalancerContext(com.netflix.loadbalancer.LoadBalancerContext) Server(com.netflix.loadbalancer.Server) DiscoveryEnabledNIWSServerList(com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList) IClientConfig(com.netflix.client.config.IClientConfig) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test) MockedDiscoveryServerListTest(com.netflix.ribbon.testutils.MockedDiscoveryServerListTest)

Aggregations

IClientConfig (com.netflix.client.config.IClientConfig)1 LoadBalancerContext (com.netflix.loadbalancer.LoadBalancerContext)1 Server (com.netflix.loadbalancer.Server)1 DiscoveryEnabledNIWSServerList (com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList)1 MockedDiscoveryServerListTest (com.netflix.ribbon.testutils.MockedDiscoveryServerListTest)1 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1