Search in sources :

Example 1 with LoadBalancerProvider

use of io.grpc.LoadBalancerProvider in project grpc-java by grpc.

the class GracefulSwitchLoadBalancerTest method setUp.

@Before
public void setUp() {
    for (String lbPolicy : lbPolicies) {
        LoadBalancerProvider lbProvider = new FakeLoadBalancerProvider(lbPolicy);
        lbProviders.put(lbPolicy, lbProvider);
        lbRegistry.register(lbProvider);
    }
}
Also used : LoadBalancerProvider(io.grpc.LoadBalancerProvider) Before(org.junit.Before)

Example 2 with LoadBalancerProvider

use of io.grpc.LoadBalancerProvider in project grpc-java by grpc.

the class ClusterImplLoadBalancerProviderTest method provided.

@Test
public void provided() {
    LoadBalancerProvider provider = LoadBalancerRegistry.getDefaultRegistry().getProvider(XdsLbPolicies.CLUSTER_IMPL_POLICY_NAME);
    assertThat(provider).isInstanceOf(ClusterImplLoadBalancerProvider.class);
}
Also used : LoadBalancerProvider(io.grpc.LoadBalancerProvider) Test(org.junit.Test)

Example 3 with LoadBalancerProvider

use of io.grpc.LoadBalancerProvider in project grpc-java by grpc.

the class ClusterImplLoadBalancerProviderTest method providesLoadBalancer.

@Test
public void providesLoadBalancer() {
    Helper helper = mock(Helper.class);
    when(helper.getAuthority()).thenReturn("api.google.com");
    LoadBalancerProvider provider = new ClusterImplLoadBalancerProvider();
    LoadBalancer loadBalancer = provider.newLoadBalancer(helper);
    assertThat(loadBalancer).isInstanceOf(ClusterImplLoadBalancer.class);
}
Also used : Helper(io.grpc.LoadBalancer.Helper) LoadBalancerProvider(io.grpc.LoadBalancerProvider) LoadBalancer(io.grpc.LoadBalancer) Test(org.junit.Test)

Example 4 with LoadBalancerProvider

use of io.grpc.LoadBalancerProvider in project grpc-java by grpc.

the class ClusterManagerLoadBalancerProviderTest method registered.

@Test
public void registered() {
    LoadBalancerProvider provider = LoadBalancerRegistry.getDefaultRegistry().getProvider("cluster_manager_experimental");
    assertThat(provider).isInstanceOf(ClusterManagerLoadBalancerProvider.class);
}
Also used : LoadBalancerProvider(io.grpc.LoadBalancerProvider) Test(org.junit.Test)

Example 5 with LoadBalancerProvider

use of io.grpc.LoadBalancerProvider in project grpc-java by grpc.

the class ClusterResolverLoadBalancerProviderTest method provided.

@Test
public void provided() {
    LoadBalancerProvider provider = LoadBalancerRegistry.getDefaultRegistry().getProvider(XdsLbPolicies.CLUSTER_RESOLVER_POLICY_NAME);
    assertThat(provider).isInstanceOf(ClusterResolverLoadBalancerProvider.class);
}
Also used : LoadBalancerProvider(io.grpc.LoadBalancerProvider) Test(org.junit.Test)

Aggregations

LoadBalancerProvider (io.grpc.LoadBalancerProvider)25 Test (org.junit.Test)17 PolicySelection (io.grpc.internal.ServiceConfigUtil.PolicySelection)11 WeightedPolicySelection (io.grpc.xds.WeightedTargetLoadBalancerProvider.WeightedPolicySelection)9 ClusterImplConfig (io.grpc.xds.ClusterImplLoadBalancerProvider.ClusterImplConfig)8 WeightedTargetConfig (io.grpc.xds.WeightedTargetLoadBalancerProvider.WeightedTargetConfig)8 EquivalentAddressGroup (io.grpc.EquivalentAddressGroup)6 Subchannel (io.grpc.LoadBalancer.Subchannel)6 Helper (io.grpc.LoadBalancer.Helper)5 LoadBalancer (io.grpc.LoadBalancer)4 PickResult (io.grpc.LoadBalancer.PickResult)4 PickSubchannelArgs (io.grpc.LoadBalancer.PickSubchannelArgs)4 ClusterStats (io.grpc.xds.Stats.ClusterStats)4 ClientStreamTracer (io.grpc.ClientStreamTracer)3 Metadata (io.grpc.Metadata)3 ConfigOrError (io.grpc.NameResolver.ConfigOrError)3 Map (java.util.Map)3 CreateSubchannelArgs (io.grpc.LoadBalancer.CreateSubchannelArgs)2 SynchronizationContext (io.grpc.SynchronizationContext)2 ClusterManagerConfig (io.grpc.xds.ClusterManagerLoadBalancerProvider.ClusterManagerConfig)2