Search in sources :

Example 6 with MutableInteger

use of com.hazelcast.internal.util.MutableInteger in project hazelcast by hazelcast.

the class ClientClusterDiscoveryServiceTest method test_oneIteration.

@Test
public void test_oneIteration() {
    ArrayList<CandidateClusterContext> arrayList = new ArrayList<>();
    int numberOfCandidates = 10;
    for (int i = 0; i < numberOfCandidates; i++) {
        arrayList.add(createContext(i));
    }
    ClusterDiscoveryService discoveryService = new ClusterDiscoveryService(arrayList, 1, lifecycleService);
    MutableInteger count = new MutableInteger();
    discoveryService.tryNextCluster((o, o2) -> {
        count.value++;
        return false;
    });
    assertEquals(numberOfCandidates, count.value);
}
Also used : CandidateClusterContext(com.hazelcast.client.impl.clientside.CandidateClusterContext) MutableInteger(com.hazelcast.internal.util.MutableInteger) ArrayList(java.util.ArrayList) ClusterDiscoveryService(com.hazelcast.client.impl.clientside.ClusterDiscoveryService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MutableInteger (com.hazelcast.internal.util.MutableInteger)6 CandidateClusterContext (com.hazelcast.client.impl.clientside.CandidateClusterContext)3 ClusterDiscoveryService (com.hazelcast.client.impl.clientside.ClusterDiscoveryService)3 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 Data (com.hazelcast.internal.serialization.Data)2 EndpointConfig (com.hazelcast.config.EndpointConfig)1 InvalidConfigurationException (com.hazelcast.config.InvalidConfigurationException)1 ServerSocketEndpointConfig (com.hazelcast.config.ServerSocketEndpointConfig)1 WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)1 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)1 EndpointQualifier (com.hazelcast.instance.EndpointQualifier)1 ProtocolType (com.hazelcast.instance.ProtocolType)1 EnumMap (java.util.EnumMap)1