use of org.bboxdb.network.client.future.OperationFutureImpl in project bboxdb by jnidzwetzki.
the class TestFuture method testOneRetry1.
@Test(timeout = 60000)
public void testOneRetry1() throws InterruptedException {
final NetworkOperationFuture networkFuture = getFailingNetworkFuture();
final OperationFutureImpl<Boolean> future = new OperationFutureImpl<>(networkFuture, FutureRetryPolicy.RETRY_POLICY_ONE_FUTURE);
future.waitForAll();
Assert.assertTrue(future.isDone());
Assert.assertTrue(future.isFailed());
Assert.assertEquals(OperationFuture.TOTAL_RETRIES + 1, networkFuture.getExecutions());
}
use of org.bboxdb.network.client.future.OperationFutureImpl in project bboxdb by jnidzwetzki.
the class TestFuture method testNoRetry2.
@Test(timeout = 60000)
public void testNoRetry2() 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_NONE);
future.waitForAll();
Assert.assertTrue(future.isDone());
Assert.assertTrue(future.isFailed());
Assert.assertEquals(1, networkFuture1.getExecutions());
Assert.assertEquals(1, networkFuture2.getExecutions());
}
use of org.bboxdb.network.client.future.OperationFutureImpl in project bboxdb by jnidzwetzki.
the class TestFuture method testAllRetry1.
@Test(timeout = 60000)
public void testAllRetry1() throws InterruptedException {
final NetworkOperationFuture networkFuture = getFailingNetworkFuture();
final Supplier<List<NetworkOperationFuture>> supplier = () -> (Arrays.asList(networkFuture));
final OperationFutureImpl<Boolean> future = new OperationFutureImpl<>(supplier, FutureRetryPolicy.RETRY_POLICY_ALL_FUTURES);
future.waitForAll();
Assert.assertTrue(future.isDone());
Assert.assertTrue(future.isFailed());
Assert.assertEquals(OperationFuture.TOTAL_RETRIES + 1, networkFuture.getExecutions());
}
use of org.bboxdb.network.client.future.OperationFutureImpl in project bboxdb by jnidzwetzki.
the class TestFuture method testAllRetry2.
@Test(timeout = 60000)
public void testAllRetry2() 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_ALL_FUTURES);
future.waitForAll();
Assert.assertTrue(future.isDone());
Assert.assertTrue(future.isFailed());
final int totalRetries = OperationFuture.TOTAL_RETRIES + 1;
final int executions1 = networkFuture1.getExecutions();
final int executions2 = networkFuture2.getExecutions();
Assert.assertTrue(executions1 == totalRetries || executions2 == totalRetries);
}
use of org.bboxdb.network.client.future.OperationFutureImpl in project bboxdb by jnidzwetzki.
the class TestFuture method testNoRetry1.
@Test(timeout = 60000)
public void testNoRetry1() throws InterruptedException {
final NetworkOperationFuture networkFuture = getFailingNetworkFuture();
final OperationFutureImpl<Boolean> future = new OperationFutureImpl<>(networkFuture, FutureRetryPolicy.RETRY_POLICY_NONE);
future.waitForAll();
Assert.assertTrue(future.isDone());
Assert.assertTrue(future.isFailed());
Assert.assertEquals(1, networkFuture.getExecutions());
}
Aggregations