use of com.hazelcast.client.executor.tasks.MapPutRunnable in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecuteOnAllMembers.
@Test
public void testExecuteOnAllMembers() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
service.executeOnAllMembers(new MapPutRunnable(mapName));
IMap map = client.getMap(mapName);
assertSizeEventually(CLUSTER_SIZE, map);
}
use of com.hazelcast.client.executor.tasks.MapPutRunnable 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.client.executor.tasks.MapPutRunnable in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitRunnable_WithResult.
@Test
public void testSubmitRunnable_WithResult() throws ExecutionException, InterruptedException {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
Object givenResult = "givenResult";
Future future = service.submit(new MapPutRunnable(mapName), givenResult);
Object result = future.get();
IMap map = client.getMap(mapName);
assertEquals(givenResult, result);
assertEquals(1, map.size());
}
use of com.hazelcast.client.executor.tasks.MapPutRunnable in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method submitRunnable.
@Test
public void submitRunnable() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
Runnable runnable = new MapPutRunnable(mapName);
service.submit(runnable);
IMap map = client.getMap(mapName);
assertSizeEventually(1, map);
}
use of com.hazelcast.client.executor.tasks.MapPutRunnable in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method submitRunnable_withExecutionCallback.
@Test
public void submitRunnable_withExecutionCallback() {
IExecutorService service = client.getExecutorService(randomString());
final CountDownLatch responseLatch = new CountDownLatch(1);
String mapName = randomString();
Runnable runnable = new MapPutRunnable(mapName);
MemberSelector selector = new SelectAllMembers();
service.submit(runnable, selector, new ExecutionCallback() {
public void onResponse(Object response) {
responseLatch.countDown();
}
public void onFailure(Throwable t) {
}
});
IMap map = client.getMap(mapName);
assertOpenEventually("responseLatch", responseLatch);
assertEquals(1, map.size());
}
Aggregations