Search in sources :

Example 51 with HazelcastInstance

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

the class AntiEntropyCorrectnessTest method testPartitionData.

@Test
public void testPartitionData() throws InterruptedException {
    HazelcastInstance[] instances = factory.newInstances(getConfig(true, true), nodeCount);
    for (HazelcastInstance instance : instances) {
        setBackupPacketDropFilter(instance, BACKUP_BLOCK_RATIO);
    }
    warmUpPartitions(instances);
    for (HazelcastInstance instance : instances) {
        fillData(instance);
    }
    assertSizeAndDataEventually();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 52 with HazelcastInstance

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

the class GracefulShutdownTest method shutdownMemberAndCluster_concurrently.

private void shutdownMemberAndCluster_concurrently(boolean initializePartitions) throws Exception {
    Config config = new Config();
    final HazelcastInstance master = factory.newHazelcastInstance(config);
    final HazelcastInstance[] slaves = factory.newInstances(config, 3);
    if (initializePartitions) {
        warmUpPartitions(master);
    }
    Future f1 = spawn(new Runnable() {

        @Override
        public void run() {
            master.shutdown();
        }
    });
    Future f2 = spawn(new Runnable() {

        @Override
        public void run() {
            changeClusterStateEventually(slaves[0], ClusterState.PASSIVE);
            slaves[0].getCluster().shutdown();
        }
    });
    f1.get();
    f2.get();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) Future(java.util.concurrent.Future)

Example 53 with HazelcastInstance

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

the class GracefulShutdownTest method shutdownMemberAndCluster.

private void shutdownMemberAndCluster(boolean initializePartitions) throws Exception {
    Config config = new Config();
    HazelcastInstance master = factory.newHazelcastInstance(config);
    HazelcastInstance[] slaves = factory.newInstances(config, 3);
    if (initializePartitions) {
        warmUpPartitions(master);
    }
    master.shutdown();
    changeClusterStateEventually(slaves[0], ClusterState.PASSIVE);
    slaves[0].getCluster().shutdown();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config)

Example 54 with HazelcastInstance

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

the class GracefulShutdownTest method shutdownSlaveAndTerminateMasterMember_concurrently.

@Test
public void shutdownSlaveAndTerminateMasterMember_concurrently() {
    HazelcastInstance[] instances = factory.newInstances(new Config(), 5);
    int shutdownIndex = RandomPicker.getInt(1, instances.length);
    int terminateIndex = 0;
    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 55 with HazelcastInstance

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

the class GracefulShutdownTest method shutdownSlaveLiteMember.

@Test
public void shutdownSlaveLiteMember() {
    HazelcastInstance hz1 = factory.newHazelcastInstance();
    HazelcastInstance hz2 = factory.newHazelcastInstance(new Config().setLiteMember(true));
    HazelcastInstance hz3 = factory.newHazelcastInstance();
    warmUpPartitions(hz1, hz2, hz3);
    hz2.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