use of com.hazelcast.client.util.RandomLB in project hazelcast by hazelcast.
the class ClientRandomLBTest method testRandomLB_withMembers.
@Test
public void testRandomLB_withMembers() {
RandomLB randomLB = new RandomLB();
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory();
HazelcastInstance server = factory.newHazelcastInstance();
Cluster cluster = server.getCluster();
ClientConfig clientConfig = new ClientConfig();
clientConfig.setLoadBalancer(randomLB);
randomLB.init(cluster, clientConfig);
Member member = cluster.getLocalMember();
Member nextMember = randomLB.next();
assertEquals(member, nextMember);
factory.terminateAll();
}
use of com.hazelcast.client.util.RandomLB in project hazelcast by hazelcast.
the class ClientRandomLBTest method testRandomLB_withoutMembers.
@Test
public void testRandomLB_withoutMembers() {
RandomLB lb = new RandomLB();
Member m = lb.next();
assertNull(m);
}
Aggregations