use of com.hazelcast.cp.internal.raftop.metadata.TriggerDestroyRaftGroupOp in project hazelcast by hazelcast.
the class AtomicLongBasicTest method testRecreate_afterGroupDestroy.
@Test
public void testRecreate_afterGroupDestroy() throws Exception {
atomicLong.destroy();
CPGroupId groupId = getGroupId(atomicLong);
RaftInvocationManager invocationManager = getRaftInvocationManager(instances[0]);
invocationManager.invoke(getRaftService(instances[0]).getMetadataGroupId(), new TriggerDestroyRaftGroupOp(groupId)).get();
assertTrueEventually(() -> {
CPGroup group = invocationManager.<CPGroup>query(getMetadataGroupId(instances[0]), new GetRaftGroupOp(groupId), LINEARIZABLE).join();
assertEquals(CPGroupStatus.DESTROYED, group.status());
});
try {
atomicLong.incrementAndGet();
fail();
} catch (CPGroupDestroyedException ignored) {
}
atomicLong = createAtomicLong(name);
CPGroupId newGroupId = getGroupId(atomicLong);
assertNotEquals(groupId, newGroupId);
atomicLong.incrementAndGet();
}
use of com.hazelcast.cp.internal.raftop.metadata.TriggerDestroyRaftGroupOp in project hazelcast by hazelcast.
the class RaftInvocationManagerTest method when_raftGroupIsDestroyed_then_operationsEventuallyFail.
@Test
public void when_raftGroupIsDestroyed_then_operationsEventuallyFail() throws ExecutionException, InterruptedException {
int nodeCount = 3;
instances = newInstances(nodeCount);
RaftInvocationManager invocationManager = getRaftInvocationManager(instances[0]);
CPGroupId groupId = invocationManager.createRaftGroup("test", nodeCount).get();
invocationManager.invoke(groupId, new RaftTestApplyOp("val")).get();
invocationManager.invoke(getRaftService(instances[0]).getMetadataGroupId(), new TriggerDestroyRaftGroupOp(groupId)).get();
assertTrueEventually(() -> {
try {
invocationManager.invoke(groupId, new RaftTestApplyOp("val")).get();
fail();
} catch (ExecutionException e) {
assertInstanceOf(CPGroupDestroyedException.class, e.getCause());
}
});
}
use of com.hazelcast.cp.internal.raftop.metadata.TriggerDestroyRaftGroupOp in project hazelcast by hazelcast.
the class AtomicRefBasicTest method testRecreate_afterGroupDestroy.
@Test
public void testRecreate_afterGroupDestroy() throws Exception {
atomicRef.destroy();
CPGroupId groupId = getGroupId(atomicRef);
RaftInvocationManager invocationManager = getRaftInvocationManager(instances[0]);
invocationManager.invoke(getRaftService(instances[0]).getMetadataGroupId(), new TriggerDestroyRaftGroupOp(groupId)).get();
assertTrueEventually(() -> {
CPGroup group = invocationManager.<CPGroup>invoke(getMetadataGroupId(instances[0]), new GetRaftGroupOp(groupId)).join();
assertEquals(CPGroupStatus.DESTROYED, group.status());
});
try {
atomicRef.get();
fail();
} catch (CPGroupDestroyedException ignored) {
}
atomicRef = createAtomicRef(name);
assertNotEquals(groupId, getGroupId(atomicRef));
atomicRef.set("str1");
}
Aggregations