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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations