Search in sources :

Example 81 with CPGroupId

use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.

the class RaftInvocationFailureTest method test_invocationFailsWithFirstMemberLeftException_when_thereAreIndeterminateOperationStateExceptionsAfterwards.

@Test
public void test_invocationFailsWithFirstMemberLeftException_when_thereAreIndeterminateOperationStateExceptionsAfterwards() throws ExecutionException, InterruptedException {
    CPGroupId groupId = getRaftInvocationManager(instances[0]).createRaftGroup(groupName).get();
    waitAllForLeaderElection(instances, groupId);
    HazelcastInstance leader = getLeaderInstance(instances, groupId);
    Future f = new RaftInvocation(getOperationService(leader).invocationContext, getRaftInvocationManager(leader).getRaftInvocationContext(), groupId, new DefaultRaftReplicateOp(groupId, new CustomResponseOp4()), 10, 50, 60000).invoke();
    try {
        f.get(60, TimeUnit.SECONDS);
        fail();
    } catch (Exception e) {
        assertInstanceOf(IndeterminateOperationStateException.class, e.getCause());
    }
    assertTrue(COMMIT_COUNT.get() > groupSize);
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Future(java.util.concurrent.Future) IndeterminateOperationStateException(com.hazelcast.core.IndeterminateOperationStateException) DefaultRaftReplicateOp(com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp) StaleAppendRequestException(com.hazelcast.cp.exception.StaleAppendRequestException) CallerNotMemberException(com.hazelcast.spi.exception.CallerNotMemberException) IndeterminateOperationStateException(com.hazelcast.core.IndeterminateOperationStateException) MemberLeftException(com.hazelcast.core.MemberLeftException) ExecutionException(java.util.concurrent.ExecutionException) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

CPGroupId (com.hazelcast.cp.CPGroupId)81 Test (org.junit.Test)50 HazelcastInstance (com.hazelcast.core.HazelcastInstance)42 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)37 QuickTest (com.hazelcast.test.annotation.QuickTest)31 CPGroup (com.hazelcast.cp.CPGroup)14 CPMember (com.hazelcast.cp.CPMember)13 RaftEndpoint (com.hazelcast.cp.internal.raft.impl.RaftEndpoint)11 RaftNodeImpl (com.hazelcast.cp.internal.raft.impl.RaftNodeImpl)9 ArrayList (java.util.ArrayList)8 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)7 CountDownLatch (java.util.concurrent.CountDownLatch)7 ExecutionException (java.util.concurrent.ExecutionException)7 HazelcastInstanceFactory.newHazelcastInstance (com.hazelcast.instance.impl.HazelcastInstanceFactory.newHazelcastInstance)6 SlowTest (com.hazelcast.test.annotation.SlowTest)6 IndeterminateOperationStateException (com.hazelcast.core.IndeterminateOperationStateException)5 MemberLeftException (com.hazelcast.core.MemberLeftException)5 StaleAppendRequestException (com.hazelcast.cp.exception.StaleAppendRequestException)5 DefaultRaftReplicateOp (com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp)5 CallerNotMemberException (com.hazelcast.spi.exception.CallerNotMemberException)5