use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class Invocation_NestedRemoteTest method invokeOnPartition_outerRemote_innerDifferentInstance_forbidden.
@Test
public void invokeOnPartition_outerRemote_innerDifferentInstance_forbidden() {
HazelcastInstance[] cluster = createHazelcastInstanceFactory(2).newInstances();
HazelcastInstance local = cluster[0];
HazelcastInstance remote = cluster[1];
OperationService operationService = getOperationService(local);
int outerPartitionId = getPartitionId(remote);
int innerPartitionId = getPartitionId(local);
assertNotEquals("partitions should be different", innerPartitionId, outerPartitionId);
InnerOperation innerOperation = new InnerOperation(RESPONSE, innerPartitionId);
OuterOperation outerOperation = new OuterOperation(innerOperation, outerPartitionId);
InternalCompletableFuture future = operationService.invokeOnPartition(null, outerOperation, outerPartitionId);
expected.expect(CompletionException.class);
expected.expect(new RootCauseMatcher(IllegalThreadStateException.class));
expected.expectMessage("cannot make remote call");
future.join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class Invocation_NestedRemoteTest method invokeOnPartition_outerLocal_innerDifferentInstance_forbidden.
@Test
public void invokeOnPartition_outerLocal_innerDifferentInstance_forbidden() {
HazelcastInstance[] cluster = createHazelcastInstanceFactory(2).newInstances();
HazelcastInstance local = cluster[0];
HazelcastInstance remote = cluster[1];
OperationService operationService = getOperationService(local);
int outerPartitionId = getPartitionId(local);
int innerPartitionId = getPartitionId(remote);
assertNotEquals("partitions should be different", innerPartitionId, outerPartitionId);
InnerOperation innerOperation = new InnerOperation(RESPONSE, innerPartitionId);
OuterOperation outerOperation = new OuterOperation(innerOperation, outerPartitionId);
InternalCompletableFuture future = operationService.invokeOnPartition(null, outerOperation, outerPartitionId);
expected.expect(CompletionException.class);
expected.expect(new RootCauseMatcher(IllegalThreadStateException.class));
expected.expectMessage("cannot make remote call");
future.join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class Invocation_NestedRemoteTest method invokeOnPartition_outerRemote_innerSameInstance_callsDifferentPartition_mappedToSameThread.
@Test
public void invokeOnPartition_outerRemote_innerSameInstance_callsDifferentPartition_mappedToSameThread() {
HazelcastInstance[] cluster = createHazelcastInstanceFactory(2).newInstances();
HazelcastInstance local = cluster[0];
HazelcastInstance remote = cluster[1];
OperationService operationService = getOperationService(local);
int outerPartitionId = getPartitionId(remote);
int innerPartitionId = randomPartitionIdMappedToSameThreadAsGivenPartitionIdOnInstance(outerPartitionId, remote, operationService);
InnerOperation innerOperation = new InnerOperation(RESPONSE, innerPartitionId);
OuterOperation outerOperation = new OuterOperation(innerOperation, outerPartitionId);
InternalCompletableFuture future = operationService.invokeOnPartition(null, outerOperation, outerPartitionId);
expected.expect(CompletionException.class);
expected.expect(new RootCauseMatcher(IllegalThreadStateException.class));
expected.expectMessage("cannot make remote call");
future.join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenCompose_whenExceptionFromFirstStageAndUserFunction_thenFirstStageExceptionBubbles.
@Test
public void thenCompose_whenExceptionFromFirstStageAndUserFunction_thenFirstStageExceptionBubbles() {
CompletableFuture<Object> future = newCompletableFuture(true, 0L);
expectedException.expect(CompletionException.class);
// expect the exception thrown from first future
expectedException.expectCause(new RootCauseMatcher(ExpectedRuntimeException.class));
future.thenCompose(v -> {
throw new IllegalStateException();
}).join();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CompletableFutureAbstractTest method thenComposeAsync_onIncompleteFuture_whenExecutionRejected.
@Test
public void thenComposeAsync_onIncompleteFuture_whenExecutionRejected() {
CompletableFuture<Object> future = newCompletableFuture(false, 1000L);
expectedException.expect(CompletionException.class);
expectedException.expectCause(new RootCauseMatcher(RejectedExecutionException.class));
future.thenComposeAsync(v -> newCompletedFuture(null), REJECTING_EXECUTOR).join();
}
Aggregations