use of org.neo4j.bolt.runtime.BoltConnection in project neo4j by neo4j.
the class ExecutorBoltSchedulerTest method successfulJobsShouldTriggerSchedulingOfPendingJobs.
@Test
void successfulJobsShouldTriggerSchedulingOfPendingJobs() throws Throwable {
AtomicInteger counter = new AtomicInteger();
String id = UUID.randomUUID().toString();
BoltConnection connection = newConnection(id);
when(connection.processNextBatch()).thenAnswer(inv -> counter.incrementAndGet() > 0);
when(connection.hasPendingJobs()).thenReturn(true).thenReturn(false);
boltScheduler.init();
boltScheduler.start();
boltScheduler.created(connection);
boltScheduler.enqueued(connection, Jobs.noop());
Predicates.await(() -> counter.get() > 1, 1, MINUTES);
verify(connection, times(2)).processNextBatch();
}
Aggregations