use of com.hazelcast.client.test.executor.tasks.AppendCallable in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method submitCallableToAllMembers.
@Test
public void submitCallableToAllMembers() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
String msg = randomString();
Callable<String> callable = new AppendCallable(msg);
Map<Member, Future<String>> map = service.submitToAllMembers(callable);
for (Member member : map.keySet()) {
Future<String> result = map.get(member);
assertEquals(msg + AppendCallable.APPENDAGE, result.get());
}
}
use of com.hazelcast.client.test.executor.tasks.AppendCallable in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method submitCallableToKeyOwner.
@Test
public void submitCallableToKeyOwner() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
String msg = randomString();
Callable<String> callable = new AppendCallable(msg);
Future<String> result = service.submitToKeyOwner(callable, "key");
assertEquals(msg + AppendCallable.APPENDAGE, result.get());
}
use of com.hazelcast.client.test.executor.tasks.AppendCallable 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());
}
use of com.hazelcast.client.test.executor.tasks.AppendCallable in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method submitCallableToMembers_withExecutionCallback.
@Test
public void submitCallableToMembers_withExecutionCallback() {
IExecutorService service = client.getExecutorService(randomString());
final CountDownLatch responseLatch = new CountDownLatch(CLUSTER_SIZE);
final CountDownLatch completeLatch = new CountDownLatch(1);
final String msg = randomString();
Callable callable = new AppendCallable(msg);
MemberSelector selector = new SelectAllMembers();
service.submitToMembers(callable, selector, new MultiExecutionCallback() {
public void onResponse(Member member, Object value) {
if (value.equals(msg + AppendCallable.APPENDAGE)) {
responseLatch.countDown();
}
}
public void onComplete(Map<Member, Object> values) {
completeLatch.countDown();
}
});
assertOpenEventually("responseLatch", responseLatch);
assertOpenEventually("completeLatch", completeLatch);
}
use of com.hazelcast.client.test.executor.tasks.AppendCallable in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallable.
@Test
public void testSubmitCallable() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
String msg = randomString();
Callable callable = new AppendCallable(msg);
Future result = service.submit(callable);
assertEquals(msg + AppendCallable.APPENDAGE, result.get());
}
Aggregations