Search in sources :

Example 36 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_partitionsNotAssigned_withLiteMember.

/**
     * PARTITION ASSIGNMENT
     **/
@Test
public void test_partitionsNotAssigned_withLiteMember() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
    final HazelcastInstance instance = factory.newHazelcastInstance(liteMemberConfig);
    final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(instance);
    partitionService.firstArrangement();
    for (int i = 0; i < partitionService.getPartitionCount(); i++) {
        assertNull(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 37 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_getPartitionOwner_onMasterLiteMember.

/**
     * GET PARTITION OWNER
     **/
@Test
public void test_getPartitionOwner_onMasterLiteMember() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
    final HazelcastInstance instance = factory.newHazelcastInstance(liteMemberConfig);
    final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(instance);
    assertNull(partitionService.getPartitionOwner(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 38 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_getPartitionOwnerOrWait_onMasterLiteMember.

@Test(expected = NoDataMemberInClusterException.class)
public void test_getPartitionOwnerOrWait_onMasterLiteMember() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
    final HazelcastInstance instance = factory.newHazelcastInstance(liteMemberConfig);
    final InternalPartitionServiceImpl partitionService = getInternalPartitionServiceImpl(instance);
    partitionService.getPartitionOwnerOrWait(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 39 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_liteMemberCanTerminate_whenDataMemberExistsInCluster.

@Test(timeout = 120000)
public void test_liteMemberCanTerminate_whenDataMemberExistsInCluster() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
    final HazelcastInstance other = factory.newHazelcastInstance();
    warmUpPartitions(lite, other);
    lite.getLifecycleService().terminate();
}
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 40 with HazelcastInstance

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

the class InternalPartitionServiceLiteMemberTest method test_dataMemberCanTerminate_whenOnlyLiteMemberExistsInCluster.

@Test(timeout = 120000)
public void test_dataMemberCanTerminate_whenOnlyLiteMemberExistsInCluster() {
    final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
    final HazelcastInstance master = factory.newHazelcastInstance();
    final HazelcastInstance lite = factory.newHazelcastInstance(liteMemberConfig);
    warmUpPartitions(master, lite);
    master.getLifecycleService().terminate();
}
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)

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