Search in sources :

Example 6 with OperationFutureImpl

use of org.bboxdb.network.client.future.OperationFutureImpl in project bboxdb by jnidzwetzki.

the class TestFuture method testOneRetry2.

@Test(timeout = 60000)
public void testOneRetry2() throws InterruptedException {
    final NetworkOperationFuture networkFuture1 = getFailingNetworkFuture();
    final NetworkOperationFuture networkFuture2 = getReadyNetworkFuture();
    final Supplier<List<NetworkOperationFuture>> supplier = () -> (Arrays.asList(networkFuture1, networkFuture2));
    final OperationFutureImpl<Boolean> future = new OperationFutureImpl<>(supplier, FutureRetryPolicy.RETRY_POLICY_ONE_FUTURE);
    future.waitForAll();
    Assert.assertTrue(future.isDone());
    Assert.assertTrue(future.isFailed());
    Assert.assertEquals(OperationFuture.TOTAL_RETRIES + 1, networkFuture1.getExecutions());
    Assert.assertEquals(1, networkFuture2.getExecutions());
}
Also used : NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) OperationFutureImpl(org.bboxdb.network.client.future.OperationFutureImpl) List(java.util.List) Test(org.junit.Test)

Aggregations

NetworkOperationFuture (org.bboxdb.network.client.future.NetworkOperationFuture)6 OperationFutureImpl (org.bboxdb.network.client.future.OperationFutureImpl)6 Test (org.junit.Test)6 List (java.util.List)4