use of com.hazelcast.client.test.executor.tasks.SelectAllMembers in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecuteOnMembers_withSelector.
@Test
public void testExecuteOnMembers_withSelector() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
MemberSelector selector = new SelectAllMembers();
service.executeOnMembers(new MapPutRunnable(mapName), selector);
IMap map = client.getMap(mapName);
assertSizeEventually(CLUSTER_SIZE, map);
}
use of com.hazelcast.client.test.executor.tasks.SelectAllMembers in project hazelcast by hazelcast.
the class ClientExecutorServiceExecuteTest method testExecute_withMemberSelector.
@Test
public void testExecute_withMemberSelector() {
IExecutorService service = client.getExecutorService(randomString());
String mapName = randomString();
MemberSelector selector = new SelectAllMembers();
service.execute(new MapPutRunnable(mapName), selector);
IMap map = client.getMap(mapName);
assertSizeEventually(1, map);
}
use of com.hazelcast.client.test.executor.tasks.SelectAllMembers in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMembers_withMemberSelector.
@Test
public void testSubmitCallableToMembers_withMemberSelector() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable<UUID> getUuidCallable = new GetMemberUuidTask();
MemberSelector selectAll = new SelectAllMembers();
Map<Member, Future<UUID>> map = service.submitToMembers(getUuidCallable, selectAll);
for (Member member : map.keySet()) {
Future<UUID> result = map.get(member);
UUID uuid = result.get();
assertEquals(member.getUuid(), uuid);
}
}
use of com.hazelcast.client.test.executor.tasks.SelectAllMembers 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());
}
use of com.hazelcast.client.test.executor.tasks.SelectAllMembers in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallable_withMemberSelector.
@Test
public void testSubmitCallable_withMemberSelector() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
String msg = randomString();
Callable<String> callable = new AppendCallable(msg);
MemberSelector selectAll = new SelectAllMembers();
Future<String> f = service.submit(callable, selectAll);
assertEquals(msg + AppendCallable.APPENDAGE, f.get());
}
Aggregations