use of com.hazelcast.client.test.CustomLoadBalancer in project hazelcast by hazelcast.
the class TestCustomLoadBalancerContext method testCustomLoadBalancer.
@Test
public void testCustomLoadBalancer() {
ClientConfig config1 = client1.getClientConfig();
LoadBalancer loadBalancer1 = config1.getLoadBalancer();
assertTrue(loadBalancer1 instanceof CustomLoadBalancer);
assertEquals("default-name", ((CustomLoadBalancer) loadBalancer1).getName());
ClientConfig config2 = client2.getClientConfig();
LoadBalancer loadBalancer2 = config2.getLoadBalancer();
assertTrue(loadBalancer2 instanceof CustomLoadBalancer);
assertEquals("custom-balancer-name", ((CustomLoadBalancer) loadBalancer2).getName());
}
use of com.hazelcast.client.test.CustomLoadBalancer in project hazelcast by hazelcast.
the class ClientConfigXmlGeneratorTest method loadBalancerCustom.
@Test
public void loadBalancerCustom() {
clientConfig.setLoadBalancer(new CustomLoadBalancer());
ClientConfig newClientConfig = newConfigViaGenerator();
LoadBalancer actual = newClientConfig.getLoadBalancer();
assertNull(actual);
String actualClassName = newClientConfig.getLoadBalancerClassName();
assertEquals("com.hazelcast.client.test.CustomLoadBalancer", actualClassName);
}
use of com.hazelcast.client.test.CustomLoadBalancer in project hazelcast by hazelcast.
the class ClientConfigLoadBalancerTest method shouldCreateCustomLoadBalancerWhenConfigInstanceNotProvidedAndClassNameSpecified.
@Test
public void shouldCreateCustomLoadBalancerWhenConfigInstanceNotProvidedAndClassNameSpecified() {
hazelcastFactory.newHazelcastInstance();
ClientConfig clientConfig = new ClientConfig();
clientConfig.setLoadBalancerClassName("com.hazelcast.client.test.CustomLoadBalancer");
HazelcastInstance instance = hazelcastFactory.newHazelcastClient(clientConfig);
HazelcastClientInstanceImpl client = ClientTestUtil.getHazelcastClientInstanceImpl(instance);
LoadBalancer actual = client.getLoadBalancer();
assertTrue(actual instanceof CustomLoadBalancer);
}
Aggregations