use of com.hazelcast.internal.partition.service.TestGetOperation in project hazelcast by hazelcast.
the class AbstractGracefulShutdownCorrectnessTest method testPartitionData_whenNodesStartedShutdown_whileOperationsOngoing.
@Test(timeout = 6000 * 10 * 10)
public void testPartitionData_whenNodesStartedShutdown_whileOperationsOngoing() throws InterruptedException {
final Config config = getConfig(true, false);
Future future = spawn(new Runnable() {
@Override
public void run() {
LinkedList<HazelcastInstance> instances = new LinkedList<HazelcastInstance>(Arrays.asList(factory.newInstances(config, nodeCount)));
try {
for (int i = 0; i < 3; i++) {
shutdownNodes(instances, shutdownNodeCount);
Collection<HazelcastInstance> startedInstances = startNodes(config, shutdownNodeCount);
instances.addAll(startedInstances);
}
shutdownNodes(instances, shutdownNodeCount);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
HazelcastInstance hz = factory.newHazelcastInstance(config);
NodeEngine nodeEngine = getNodeEngineImpl(hz);
OperationService operationService = nodeEngine.getOperationService();
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
int value = 0;
while (!future.isDone()) {
value++;
for (int p = 0; p < partitionCount; p++) {
operationService.invokeOnPartition(null, new TestPutOperation(value), p).join();
}
}
for (int p = 0; p < partitionCount; p++) {
Integer actual = (Integer) operationService.invokeOnPartition(null, new TestGetOperation(), p).join();
assertEquals(value, actual.intValue());
}
}
Aggregations