use of com.hazelcast.client.executor.tasks.FailingCallable in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceTest method testSubmitFailingCallableException_withExecutionCallback.
@Test
public void testSubmitFailingCallableException_withExecutionCallback() throws Exception {
DurableExecutorService service = client.getDurableExecutorService(randomString());
final CountDownLatch latch = new CountDownLatch(1);
service.submit(new FailingCallable()).andThen(new ExecutionCallback<String>() {
@Override
public void onResponse(String response) {
}
@Override
public void onFailure(Throwable t) {
latch.countDown();
}
});
assertTrue(latch.await(10, TimeUnit.SECONDS));
}
use of com.hazelcast.client.executor.tasks.FailingCallable in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testSubmitFailingCallableReasonExceptionCause.
@Test(expected = IllegalStateException.class)
public void testSubmitFailingCallableReasonExceptionCause() throws Throwable {
IExecutorService service = client.getExecutorService(randomString());
Future<String> failingFuture = service.submit(new FailingCallable());
try {
failingFuture.get();
} catch (ExecutionException e) {
throw e.getCause();
}
}
use of com.hazelcast.client.executor.tasks.FailingCallable in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceTest method testSubmitFailingCallableException.
@Test
public void testSubmitFailingCallableException() throws Exception {
DurableExecutorService service = client.getDurableExecutorService(randomString());
Future<String> failingFuture = service.submit(new FailingCallable());
expectedException.expect(ExecutionException.class);
failingFuture.get();
}
use of com.hazelcast.client.executor.tasks.FailingCallable in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceTest method testSubmitFailingCallableReasonExceptionCause.
@Test
public void testSubmitFailingCallableReasonExceptionCause() throws Exception {
DurableExecutorService service = client.getDurableExecutorService(randomString());
Future<String> future = service.submit(new FailingCallable());
expectedException.expect(new RootCauseMatcher(IllegalStateException.class));
future.get();
}
use of com.hazelcast.client.executor.tasks.FailingCallable in project hazelcast by hazelcast.
the class ClientExecutorServiceTest method testSubmitFailingCallableException.
@Test(expected = ExecutionException.class)
public void testSubmitFailingCallableException() throws ExecutionException, InterruptedException {
IExecutorService service = client.getExecutorService(randomString());
Future<String> failingFuture = service.submit(new FailingCallable());
failingFuture.get();
}
Aggregations