Search in sources :

Example 16 with PartitionService

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

the class PartitionLostListenerRegistrationTest method test_addPartitionLostListener_whenNullListener.

@Test(expected = NullPointerException.class)
public void test_addPartitionLostListener_whenNullListener() {
    HazelcastInstance hz = createHazelcastInstance();
    PartitionService partitionService = hz.getPartitionService();
    partitionService.addPartitionLostListener(null);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.core.PartitionService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 17 with PartitionService

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

the class PartitionLostListenerRegistrationTest method test_addPartitionLostListener_whenListenerRegisteredTwice.

@Test
public void test_addPartitionLostListener_whenListenerRegisteredTwice() {
    final HazelcastInstance instance = createHazelcastInstance();
    final PartitionService partitionService = instance.getPartitionService();
    final PartitionLostListener listener = mock(PartitionLostListener.class);
    final String id1 = partitionService.addPartitionLostListener(listener);
    final String id2 = partitionService.addPartitionLostListener(listener);
    assertNotEquals(id1, id2);
    assertRegistrationsSizeEventually(instance, 2);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.core.PartitionService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 18 with PartitionService

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

the class PartitionLostListenerRegistrationTest method test_removeMigrationListener_whenNullRegistrationIdRemoved.

@Test(expected = NullPointerException.class)
public void test_removeMigrationListener_whenNullRegistrationIdRemoved() {
    final HazelcastInstance instance = createHazelcastInstance();
    final PartitionService partitionService = instance.getPartitionService();
    partitionService.removePartitionLostListener(null);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.core.PartitionService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 19 with PartitionService

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

the class PartitionLostListenerRegistrationTest method test_removeMigrationListener_whenNonExistingRegistrationIdRemoved.

@Test
public void test_removeMigrationListener_whenNonExistingRegistrationIdRemoved() {
    final HazelcastInstance instance = createHazelcastInstance();
    final PartitionService partitionService = instance.getPartitionService();
    final boolean result = partitionService.removePartitionLostListener("notexist");
    assertFalse(result);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.core.PartitionService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 20 with PartitionService

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

the class PartitionLostListenerRegistrationTest method test_removeMigrationListener_whenRegisteredListenerRemovedSuccessfully.

@Test
public void test_removeMigrationListener_whenRegisteredListenerRemovedSuccessfully() {
    final HazelcastInstance instance = createHazelcastInstance();
    final PartitionService partitionService = instance.getPartitionService();
    final PartitionLostListener listener = mock(PartitionLostListener.class);
    final String id1 = partitionService.addPartitionLostListener(listener);
    final boolean result = partitionService.removePartitionLostListener(id1);
    assertTrue(result);
    assertRegistrationsSizeEventually(instance, 0);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) PartitionService(com.hazelcast.core.PartitionService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

PartitionService (com.hazelcast.core.PartitionService)22 ParallelTest (com.hazelcast.test.annotation.ParallelTest)17 QuickTest (com.hazelcast.test.annotation.QuickTest)17 Test (org.junit.Test)17 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 Partition (com.hazelcast.core.Partition)7 Member (com.hazelcast.core.Member)4 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)4 IPartition (com.hazelcast.spi.partition.IPartition)4 Cluster (com.hazelcast.core.Cluster)2 MigrationListener (com.hazelcast.core.MigrationListener)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 Config (com.hazelcast.config.Config)1 MigrationEvent (com.hazelcast.core.MigrationEvent)1 AssertTask (com.hazelcast.test.AssertTask)1