use of org.bboxdb.network.client.tools.FixedSizeFutureStore in project bboxdb by jnidzwetzki.
the class TestFixedFutureStore method testTupleStore3.
/**
* Add more futures in failed state and count failed callbacks
* @throws InterruptedException
*/
@Test(timeout = 5000)
public void testTupleStore3() throws InterruptedException {
final FixedSizeFutureStore futureStore = new FixedSizeFutureStore(10);
final AtomicInteger atomicInteger = new AtomicInteger(0);
futureStore.addFailedFutureCallback(c -> {
atomicInteger.incrementAndGet();
});
for (int i = 0; i < 20; i++) {
final NetworkOperationFuture networkOperationFuture = TestFuture.getFailingNetworkFuture();
final EmptyResultFuture future = new EmptyResultFuture(networkOperationFuture);
futureStore.put(future);
}
futureStore.waitForCompletion();
Assert.assertTrue(true);
Assert.assertEquals(20, atomicInteger.get());
}
use of org.bboxdb.network.client.tools.FixedSizeFutureStore in project bboxdb by jnidzwetzki.
the class TestFixedFutureStore method testTupleStore2.
/**
* Add more futures in done state
*/
@Test(timeout = 5000)
public void testTupleStore2() {
final FixedSizeFutureStore futureStore = new FixedSizeFutureStore(10);
// Fail test on failed callback
futureStore.addFailedFutureCallback(c -> {
Assert.assertTrue(false);
});
for (int i = 0; i < 20; i++) {
final EmptyResultFuture future = new EmptyResultFuture(() -> (new ArrayList<>()));
futureStore.put(future);
}
Assert.assertTrue(true);
}
use of org.bboxdb.network.client.tools.FixedSizeFutureStore in project bboxdb by jnidzwetzki.
the class TestFixedFutureStore method testTupleStore1.
/**
* Add more futures in failed state
*/
@Test(timeout = 5000)
public void testTupleStore1() {
final FixedSizeFutureStore futureStore = new FixedSizeFutureStore(10);
for (int i = 0; i < 20; i++) {
final EmptyResultFuture future = new EmptyResultFuture(() -> (new ArrayList<>()));
futureStore.put(future);
}
}
Aggregations