use of com.hazelcast.core.PartitionService in project hazelcast by hazelcast.
the class PartitionServiceProxyTest method testRandomPartitionKeyNotNull.
@Test
public void testRandomPartitionKeyNotNull() {
PartitionService p = client.getPartitionService();
String key = p.randomPartitionKey();
assertNotNull(key);
}
use of com.hazelcast.core.PartitionService in project hazelcast by hazelcast.
the class PartitionServiceProxyTest method testRemoveMigrationListener.
@Test(expected = UnsupportedOperationException.class)
public void testRemoveMigrationListener() throws Exception {
PartitionService p = client.getPartitionService();
p.removeMigrationListener("");
}
use of com.hazelcast.core.PartitionService in project hazelcast by hazelcast.
the class PartitionServiceSafetyCheckTest method clusterShouldNotBeSafe_whenBackupsBlocked_withoutAntiEntropy.
@Test
public void clusterShouldNotBeSafe_whenBackupsBlocked_withoutAntiEntropy() throws InterruptedException {
Config config = getConfig(true, false);
HazelcastInstance hz = factory.newHazelcastInstance(config);
startNodes(config, nodeCount - 1);
final Collection<HazelcastInstance> instances = factory.getAllHazelcastInstances();
warmUpPartitions(instances);
for (HazelcastInstance instance : instances) {
setBackupPacketDropFilter(instance, BLOCK_RATIO);
}
fillData(hz);
assertTrueFiveSeconds(new AssertTask() {
@Override
public void run() throws Exception {
assertFalse(isAllInSafeState(instances));
for (HazelcastInstance instance : instances) {
PartitionService ps = instance.getPartitionService();
assertFalse(ps.isClusterSafe());
}
}
});
}
use of com.hazelcast.core.PartitionService in project hazelcast by hazelcast.
the class HazelcastOSGiInstanceTest method getPartitionServiceCalledSuccessfullyOverOSGiInstance.
@Test
public void getPartitionServiceCalledSuccessfullyOverOSGiInstance() {
PartitionService mockPartitionService = mock(PartitionService.class);
HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
HazelcastOSGiInstance hazelcastOSGiInstance = HazelcastOSGiTestUtil.createHazelcastOSGiInstance(mockHazelcastInstance);
when(mockHazelcastInstance.getPartitionService()).thenReturn(mockPartitionService);
assertEquals(mockPartitionService, hazelcastOSGiInstance.getPartitionService());
verify(mockHazelcastInstance).getPartitionService();
}
use of com.hazelcast.core.PartitionService in project hazelcast by hazelcast.
the class WriteBehindOnBackupsTest method getOwnerNode.
private HazelcastInstance getOwnerNode(String key, HazelcastInstance[] nodes) {
PartitionService partitionService = nodes[0].getPartitionService();
Partition partition = partitionService.getPartition(key);
Member owner = partition.getOwner();
for (HazelcastInstance node : nodes) {
Member localMember = node.getCluster().getLocalMember();
if (localMember.equals(owner)) {
return node;
}
}
throw new IllegalStateException("This should not be happen...");
}
Aggregations