use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecuteOnMember_WhenMemberNull.
@Test(expected = NullPointerException.class)
public void testExecuteOnMember_WhenMemberNull() {
IExecutorService service = client.getExecutorService(randomString());
service.executeOnMember(new MapPutRunnable("map"), null);
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecuteOnKeyOwner.
@Test
public void testExecuteOnKeyOwner() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
Member member = server1.getCluster().getLocalMember();
final String targetUuid = member.getUuid();
String key = generateKeyOwnedBy(server1);
service.executeOnKeyOwner(new MapPutRunnable(mapName), key);
final IMap map = client.getMap(mapName);
assertTrueEventually(new AssertTask() {
public void run() throws Exception {
assertTrue(map.containsKey(targetUuid));
}
});
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecute.
@Test
public void testExecute() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
service.execute(new MapPutRunnable(mapName));
IMap map = client.getMap(mapName);
assertSizeEventually(1, map);
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceInvokeTest method testInvokeAll_withTimeOut.
@Test(expected = UnsupportedOperationException.class)
public void testInvokeAll_withTimeOut() throws Throwable {
IExecutorService service = client.getExecutorService(randomString());
Collection<Callable<String>> collection = new ArrayList<Callable<String>>();
collection.add(new AppendCallable());
collection.add(new AppendCallable());
service.invokeAll(collection, 1, TimeUnit.MINUTES);
}
use of com.hazelcast.core.IExecutorService in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMember_withExecutionCallback.
@Test
public void testSubmitCallableToMember_withExecutionCallback() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable getUuidCallable = new GetMemberUuidTask();
Member member = server.getCluster().getLocalMember();
final CountDownLatch responseLatch = new CountDownLatch(1);
final AtomicReference<Object> result = new AtomicReference<Object>();
service.submitToMember(getUuidCallable, member, new ExecutionCallback() {
@Override
public void onResponse(Object response) {
result.set(response);
responseLatch.countDown();
}
@Override
public void onFailure(Throwable t) {
}
});
assertOpenEventually("responseLatch", responseLatch);
assertEquals(member.getUuid(), result.get());
}
Aggregations