Search in sources :

Example 56 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.

the class GracefulShutdownTest method shutdownAndTerminateSlaveMembers_concurrently.

@Test
public void shutdownAndTerminateSlaveMembers_concurrently() {
    HazelcastInstance[] instances = factory.newInstances(new Config(), 5);
    int shutdownIndex = RandomPicker.getInt(1, instances.length);
    int terminateIndex;
    do {
        terminateIndex = RandomPicker.getInt(1, instances.length);
    } while (terminateIndex == shutdownIndex);
    shutdownAndTerminateMembers_concurrently(instances, shutdownIndex, terminateIndex);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 57 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.

the class GracefulShutdownTest method shutdownMultipleMembers.

private void shutdownMultipleMembers(boolean includeMaster, boolean initializePartitions) {
    final HazelcastInstance[] instances = factory.newInstances(new Config(), 6);
    if (initializePartitions) {
        warmUpPartitions(instances);
    }
    final CountDownLatch latch = new CountDownLatch(instances.length / 2);
    int startIndex = includeMaster ? 0 : 1;
    for (int i = startIndex; i < instances.length; i += 2) {
        final int index = i;
        new Thread() {

            public void run() {
                instances[index].shutdown();
                latch.countDown();
            }
        }.start();
    }
    assertOpenEventually(latch);
    if (initializePartitions) {
        assertPartitionAssignments();
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) CountDownLatch(java.util.concurrent.CountDownLatch)

Example 58 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.

the class GracefulShutdownTest method shutdownMasterMember_withoutPartitionInitialization.

@Test
public void shutdownMasterMember_withoutPartitionInitialization() {
    HazelcastInstance hz1 = factory.newHazelcastInstance();
    HazelcastInstance hz2 = factory.newHazelcastInstance();
    HazelcastInstance hz3 = factory.newHazelcastInstance();
    hz1.shutdown();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 59 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.

the class GracefulShutdownTest method shutdownSingleMember_withPartitionInitialization.

@Test
public void shutdownSingleMember_withPartitionInitialization() {
    HazelcastInstance hz = factory.newHazelcastInstance();
    warmUpPartitions(hz);
    hz.shutdown();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 60 with HazelcastInstance

use of com.hazelcast.core.HazelcastInstance in project hazelcast by hazelcast.

the class GracefulShutdownTest method shutdownMasterLiteMember.

@Test
public void shutdownMasterLiteMember() {
    HazelcastInstance hz1 = factory.newHazelcastInstance(new Config().setLiteMember(true));
    HazelcastInstance hz2 = factory.newHazelcastInstance();
    HazelcastInstance hz3 = factory.newHazelcastInstance();
    warmUpPartitions(hz1, hz2, hz3);
    hz1.shutdown();
    assertPartitionAssignments();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

HazelcastInstance (com.hazelcast.core.HazelcastInstance)2084 Test (org.junit.Test)1684 QuickTest (com.hazelcast.test.annotation.QuickTest)1466 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1389 Config (com.hazelcast.config.Config)815 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)665 AssertTask (com.hazelcast.test.AssertTask)263 MapConfig (com.hazelcast.config.MapConfig)254 CountDownLatch (java.util.concurrent.CountDownLatch)251 NightlyTest (com.hazelcast.test.annotation.NightlyTest)230 MapStoreConfig (com.hazelcast.config.MapStoreConfig)169 IMap (com.hazelcast.core.IMap)149 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)144 ClientConfig (com.hazelcast.client.config.ClientConfig)137 Before (org.junit.Before)111 NearCacheConfig (com.hazelcast.config.NearCacheConfig)106 Member (com.hazelcast.core.Member)99 Map (java.util.Map)96 SlowTest (com.hazelcast.test.annotation.SlowTest)94 SqlPredicate (com.hazelcast.query.SqlPredicate)83