Search in sources :

Example 31 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_memberGroupSize_withSingleLiteMember.

/**
     * MEMBER GROUP SIZE
     **/
@Test
public void test_memberGroupSize_withSingleLiteMember() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
    final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
    assertMemberGroupsSizeEventually(lite, 0);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 32 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_liteMemberCanShutdownSafely_whenDataMemberExistsInCluster.

@Test(timeout = 120000)
public void test_liteMemberCanShutdownSafely_whenDataMemberExistsInCluster() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
    final HazelcastInstance other = factory.newHazelcastInstance();
    warmUpPartitions(lite, other);
    lite.getLifecycleService().shutdown();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 33 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_partitionsAreAssigned_afterDataMemberJoins.

@Test
public void test_partitionsAreAssigned_afterDataMemberJoins() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    final HazelcastInstance liteInstance = factory.newHazelcastInstance(liteMemberConfig);
    final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(liteInstance);
    partitionService.firstArrangement();
    final HazelcastInstance dataInstance = factory.newHazelcastInstance();
    warmUpPartitions(liteInstance, dataInstance);
    for (int i = 0; i < partitionService.getPartitionCount(); i++) {
        assertEquals(getNode(dataInstance).getThisAddress(), partitionService.getPartition(i).getOwnerOrNull());
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 34 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_liteMemberCanShutdownSafely_withClusterSize1.

/**
     * GRACEFUL SHUTDOWN
     **/
@Test(timeout = 120000)
public void test_liteMemberCanShutdownSafely_withClusterSize1() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
    lite.getLifecycleService().shutdown();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 35 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_getPartition_afterDataMemberLeavesTheCluster.

@Test
public void test_getPartition_afterDataMemberLeavesTheCluster() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(3);
    final HazelcastInstance master = factory.newHazelcastInstance();
    final HazelcastInstance dataInstance = factory.newHazelcastInstance();
    final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
    warmUpPartitions(lite);
    dataInstance.getLifecycleService().shutdown();
    for (HazelcastInstance instance : asList(master, lite)) {
        final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(instance);
        assertTrueEventually(new AssertTask() {

            @Override
            public void run() throws Exception {
                for (int i = 0; i < partitionService.getPartitionCount(); i++) {
                    assertEquals(getNode(master).getThisAddress(), partitionService.getPartition(i).getOwnerOrNull());
                }
            }
        });
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) AssertTask(com.hazelcast.test.AssertTask) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) NoDataMemberInClusterException(com.hazelcast.partition.NoDataMemberInClusterException) 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