Search in sources :

Example 1 with ProxyManager

use of com.hazelcast.client.spi.ProxyManager in project hazelcast by hazelcast.

the class ProxyManagerTest method testNextAddressToSendCreateRequestOnMultipleLiteMembers.

@Test
public void testNextAddressToSendCreateRequestOnMultipleLiteMembers() {
    final List<HazelcastInstance> instances = createNodes(3, 0);
    final HazelcastInstance client = factory.newHazelcastClient();
    final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
    Set<Address> addresses = new HashSet<Address>();
    final ProxyManager proxyManager = clientInstanceImpl.getProxyManager();
    for (int i = 0; i < instances.size() * 100; i++) {
        addresses.add(proxyManager.findNextAddressToSendCreateRequest());
    }
    assertEquals(1, addresses.size());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) ProxyManager(com.hazelcast.client.spi.ProxyManager) HazelcastClientInstanceImpl(com.hazelcast.client.impl.HazelcastClientInstanceImpl) ClientTestUtil.getHazelcastClientInstanceImpl(com.hazelcast.client.impl.ClientTestUtil.getHazelcastClientInstanceImpl) HashSet(java.util.HashSet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 2 with ProxyManager

use of com.hazelcast.client.spi.ProxyManager in project hazelcast by hazelcast.

the class ProxyManagerTest method testNextAddressToSendCreateRequestOnMultipleDataMembers.

@Test
public void testNextAddressToSendCreateRequestOnMultipleDataMembers() {
    final List<HazelcastInstance> instances = createNodes(3, 3);
    final HazelcastInstance client = factory.newHazelcastClient();
    final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
    Set<Address> addresses = new HashSet<Address>();
    final ProxyManager proxyManager = clientInstanceImpl.getProxyManager();
    for (int i = 0; i < instances.size() * 100; i++) {
        addresses.add(proxyManager.findNextAddressToSendCreateRequest());
    }
    assertEquals(3, addresses.size());
    for (HazelcastInstance lite : instances.subList(3, 6)) {
        assertContains(addresses, getAddress(lite));
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) ProxyManager(com.hazelcast.client.spi.ProxyManager) HazelcastClientInstanceImpl(com.hazelcast.client.impl.HazelcastClientInstanceImpl) ClientTestUtil.getHazelcastClientInstanceImpl(com.hazelcast.client.impl.ClientTestUtil.getHazelcastClientInstanceImpl) HashSet(java.util.HashSet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 3 with ProxyManager

use of com.hazelcast.client.spi.ProxyManager in project hazelcast by hazelcast.

the class ProxyManagerTest method testNextAddressToSendCreateRequestOnSingleDataMember.

@Test
public void testNextAddressToSendCreateRequestOnSingleDataMember() {
    final List<HazelcastInstance> instances = createNodes(3, 1);
    final Address dataInstanceAddress = getAddress(instances.get(3));
    final HazelcastInstance client = factory.newHazelcastClient();
    final HazelcastClientInstanceImpl clientInstanceImpl = getHazelcastClientInstanceImpl(client);
    final ProxyManager proxyManager = clientInstanceImpl.getProxyManager();
    for (int i = 0; i < instances.size(); i++) {
        assertEquals(dataInstanceAddress, proxyManager.findNextAddressToSendCreateRequest());
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) ProxyManager(com.hazelcast.client.spi.ProxyManager) HazelcastClientInstanceImpl(com.hazelcast.client.impl.HazelcastClientInstanceImpl) ClientTestUtil.getHazelcastClientInstanceImpl(com.hazelcast.client.impl.ClientTestUtil.getHazelcastClientInstanceImpl) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

ClientTestUtil.getHazelcastClientInstanceImpl (com.hazelcast.client.impl.ClientTestUtil.getHazelcastClientInstanceImpl)3 HazelcastClientInstanceImpl (com.hazelcast.client.impl.HazelcastClientInstanceImpl)3 ProxyManager (com.hazelcast.client.spi.ProxyManager)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 Address (com.hazelcast.nio.Address)3 ParallelTest (com.hazelcast.test.annotation.ParallelTest)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 Test (org.junit.Test)3 HashSet (java.util.HashSet)2