Search in sources :

Example 6 with ICompletableFuture

use of com.hazelcast.core.ICompletableFuture in project hazelcast by hazelcast.

the class DelegatingFutureTest method test_andThen_Exception.

@Test(expected = RuntimeException.class)
public void test_andThen_Exception() {
    Throwable error = new RuntimeException();
    ICompletableFuture future = new DelegatingFuture(new FakeCompletableFuture(error), null);
    TestExecutionCallback callback = new TestExecutionCallback();
    future.andThen(callback, new CallerRunsExecutor());
}
Also used : ICompletableFuture(com.hazelcast.core.ICompletableFuture) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 7 with ICompletableFuture

use of com.hazelcast.core.ICompletableFuture in project hazelcast by hazelcast.

the class CompletedFutureTest method test_andThen_Exception.

@Test(expected = RuntimeException.class)
public void test_andThen_Exception() {
    Throwable error = new RuntimeException();
    ICompletableFuture future = new CompletedFuture(null, error, null);
    TestExecutionCallback callback = new TestExecutionCallback();
    future.andThen(callback, new CallerRunsExecutor());
}
Also used : ICompletableFuture(com.hazelcast.core.ICompletableFuture) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 8 with ICompletableFuture

use of com.hazelcast.core.ICompletableFuture in project hazelcast by hazelcast.

the class CompletedFutureTest method test_andThen_Object.

@Test
public void test_andThen_Object() {
    Object value = "value";
    ICompletableFuture future = new CompletedFuture(null, value, null);
    TestExecutionCallback callback = new TestExecutionCallback();
    future.andThen(callback, new CallerRunsExecutor());
    assertEquals(value, callback.value);
}
Also used : ICompletableFuture(com.hazelcast.core.ICompletableFuture) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 9 with ICompletableFuture

use of com.hazelcast.core.ICompletableFuture in project hazelcast by hazelcast.

the class CompletedFutureTest method test_andThen_Exception_Data.

@Test(expected = RuntimeException.class)
public void test_andThen_Exception_Data() {
    Throwable error = new RuntimeException();
    Data data = serializationService.toData(error);
    ICompletableFuture future = new CompletedFuture(serializationService, data, null);
    TestExecutionCallback callback = new TestExecutionCallback();
    future.andThen(callback, new CallerRunsExecutor());
}
Also used : ICompletableFuture(com.hazelcast.core.ICompletableFuture) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 10 with ICompletableFuture

use of com.hazelcast.core.ICompletableFuture in project hazelcast by hazelcast.

the class DelegatingFutureTest method test_andThen_Data.

@Test
public void test_andThen_Data() {
    Object value = "value";
    Data data = serializationService.toData(value);
    ICompletableFuture future = new DelegatingFuture(new FakeCompletableFuture(data), serializationService);
    TestExecutionCallback callback = new TestExecutionCallback();
    future.andThen(callback, new CallerRunsExecutor());
    assertEquals(value, callback.value);
}
Also used : ICompletableFuture(com.hazelcast.core.ICompletableFuture) Data(com.hazelcast.nio.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

ICompletableFuture (com.hazelcast.core.ICompletableFuture)21 Test (org.junit.Test)17 ParallelTest (com.hazelcast.test.annotation.ParallelTest)16 QuickTest (com.hazelcast.test.annotation.QuickTest)16 HazelcastInstance (com.hazelcast.core.HazelcastInstance)4 IExecutorService (com.hazelcast.core.IExecutorService)4 Data (com.hazelcast.nio.serialization.Data)3 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 Operation (com.hazelcast.spi.Operation)2 ExecutionException (java.util.concurrent.ExecutionException)2 ClientInvocationFuture (com.hazelcast.client.spi.impl.ClientInvocationFuture)1 IAtomicLong (com.hazelcast.core.IAtomicLong)1 NightlyTest (com.hazelcast.test.annotation.NightlyTest)1