use of com.hazelcast.client.test.executor.tasks.GetMemberUuidTask 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.GetMemberUuidTask in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMembers.
@Test
public void testSubmitCallableToMembers() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable<UUID> getUuidCallable = new GetMemberUuidTask();
Collection<Member> collection = server.getCluster().getMembers();
Map<Member, Future<UUID>> map = service.submitToMembers(getUuidCallable, collection);
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.GetMemberUuidTask in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMember_withExecutionCallback.
@Test
public void testSubmitCallableToMember_withExecutionCallback() {
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());
}
use of com.hazelcast.client.test.executor.tasks.GetMemberUuidTask in project hazelcast by hazelcast.
the class ClientExecutorServiceSubmitTest method testSubmitCallableToMember.
@Test
public void testSubmitCallableToMember() throws Exception {
IExecutorService service = client.getExecutorService(randomString());
Callable<UUID> getUuidCallable = new GetMemberUuidTask();
Member member = server.getCluster().getLocalMember();
Future<UUID> result = service.submitToMember(getUuidCallable, member);
assertEquals(member.getUuid(), result.get());
}
Aggregations