use of com.hazelcast.client.executor.tasks.MapPutRunnable in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceSubmitTest method submitRunnableToKeyOwner.
@Test
public void submitRunnableToKeyOwner() {
DurableExecutorService service = client.getDurableExecutorService(randomString());
String mapName = randomString();
Runnable runnable = new MapPutRunnable(mapName);
final CountDownLatch responseLatch = new CountDownLatch(1);
service.submitToKeyOwner(runnable, "key").thenRun(() -> responseLatch.countDown());
IMap map = client.getMap(mapName);
assertOpenEventually("responseLatch", responseLatch);
assertEquals(1, map.size());
}
use of com.hazelcast.client.executor.tasks.MapPutRunnable in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceSubmitTest method submitRunnable.
@Test
public void submitRunnable() {
DurableExecutorService service = client.getDurableExecutorService(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 ClientDurableExecutorServiceSubmitTest method testSubmitRunnable_WithResult.
@Test
public void testSubmitRunnable_WithResult() throws Exception {
DurableExecutorService service = client.getDurableExecutorService(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 ClientDurableExecutorServiceSubmitTest method testSubmitRunnable_withExecutionCallback.
@Test
public void testSubmitRunnable_withExecutionCallback() {
DurableExecutorService service = client.getDurableExecutorService(randomString());
String mapName = randomString();
Runnable runnable = new MapPutRunnable(mapName);
final CountDownLatch responseLatch = new CountDownLatch(1);
service.submit(runnable).thenRun(() -> responseLatch.countDown());
IMap map = client.getMap(mapName);
assertOpenEventually("responseLatch", responseLatch);
assertEquals(1, map.size());
}
use of com.hazelcast.client.executor.tasks.MapPutRunnable in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecuteOnKeyOwner_whenKeyNull.
@Test(expected = NullPointerException.class)
public void testExecuteOnKeyOwner_whenKeyNull() {
IExecutorService service = client.getExecutorService(randomString());
service.executeOnKeyOwner(new MapPutRunnable("map"), null);
}
Aggregations