use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class Invocation_NestedLocalTest method invokeOnPartition_outerLocal_innerSameInstance_callsDifferentPartition.
@Test
public void invokeOnPartition_outerLocal_innerSameInstance_callsDifferentPartition() {
HazelcastInstance local = createHazelcastInstance();
OperationService operationService = getOperationService(local);
int outerPartitionId = getPartitionId(local);
int innerPartitionId = randomPartitionIdNotMappedToSameThreadAsGivenPartitionIdOnInstance(local, outerPartitionId);
InnerOperation innerOperation = new InnerOperation(RESPONSE, innerPartitionId);
OuterOperation outerOperation = new OuterOperation(innerOperation, outerPartitionId);
InternalCompletableFuture future = operationService.invokeOnPartition(null, outerOperation, outerPartitionId);
expected.expect(IllegalThreadStateException.class);
expected.expectMessage("cannot make remote call");
future.join();
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class Invocation_NestedLocalTest method invokeOnPartition_outerGeneric_innerGeneric_forbidden.
@Test
public void invokeOnPartition_outerGeneric_innerGeneric_forbidden() {
HazelcastInstance local = createHazelcastInstance();
OperationService operationService = getOperationService(local);
InnerOperation innerOperation = new InnerOperation(RESPONSE, GENERIC_OPERATION);
OuterOperation outerOperation = new OuterOperation(innerOperation, GENERIC_OPERATION);
expected.expect(Exception.class);
operationService.invokeOnPartition(null, outerOperation, outerOperation.getPartitionId());
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class Invocation_NestedLocalTest method invokeOnPartition_outerLocal_innerGeneric.
@Test
public void invokeOnPartition_outerLocal_innerGeneric() {
HazelcastInstance local = createHazelcastInstance();
OperationService operationService = getOperationService(local);
int partitionId = getPartitionId(local);
InnerOperation innerOperation = new InnerOperation(RESPONSE, GENERIC_OPERATION);
OuterOperation outerOperation = new OuterOperation(innerOperation, partitionId);
InternalCompletableFuture future = operationService.invokeOnPartition(null, outerOperation, partitionId);
assertEquals(RESPONSE, future.join());
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class Invocation_NestedRemoteTest method invokeOnPartition_outerRemote_innerSameInstance_samePartition.
@Test
public void invokeOnPartition_outerRemote_innerSameInstance_samePartition() {
HazelcastInstance[] cluster = createHazelcastInstanceFactory(2).newInstances();
HazelcastInstance local = cluster[0];
HazelcastInstance remote = cluster[1];
OperationService operationService = getOperationService(local);
int partitionId = getPartitionId(remote);
InnerOperation innerOperation = new InnerOperation(RESPONSE, partitionId);
OuterOperation outerOperation = new OuterOperation(innerOperation, partitionId);
InternalCompletableFuture future = operationService.invokeOnPartition(null, outerOperation, partitionId);
assertEquals(RESPONSE, future.join());
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class Invocation_NestedRemoteTest method invokeOnTarget_outerGeneric_innerSameInstance.
@Test
public void invokeOnTarget_outerGeneric_innerSameInstance() {
HazelcastInstance[] cluster = createHazelcastInstanceFactory(2).newInstances();
HazelcastInstance local = cluster[0];
HazelcastInstance remote = cluster[1];
OperationService operationService = getOperationService(local);
InnerOperation innerOperation = new InnerOperation(RESPONSE, 0);
OuterOperation outerOperation = new OuterOperation(innerOperation, GENERIC_OPERATION);
InternalCompletableFuture future = operationService.invokeOnTarget(null, outerOperation, getAddress(remote));
assertEquals(RESPONSE, future.join());
}
Aggregations