}
public void basicTest() {
final GraphExecutionPlan plan = create9JobPlan();
final ExecutingGraph executing = new ExecutingGraph(plan, UniqueId.of("Cycle", "Test"), Instant.now(), VersionCorrection.LATEST);
final CalculationJob job6 = executing.nextExecutableJob();
assertJob(job6, 6);
final CalculationJob job1 = executing.nextExecutableJob();
assertJob(job1, 1);
assertNull(executing.nextExecutableJob());
executing.jobCompleted(job1.getSpecification());
assertNull(executing.nextExecutableJob());
executing.jobCompleted(job6.getSpecification());
final CalculationJob job2 = executing.nextExecutableJob();
assertJob(job2, 2);
assertNull(executing.nextExecutableJob());
executing.jobCompleted(job6.getSpecification()); // Duplicate notification
assertNull(executing.nextExecutableJob());
assertNotNull(job2.getTail());
assertEquals(job2.getTail().size(), 2);
final Iterator<CalculationJob> itr = job2.getTail().iterator();
final CalculationJob job3 = itr.next();
assertJob(job3, 3);
assertNull(job3.getTail());
final CalculationJob job4 = itr.next();
assertFalse(itr.hasNext());
assertJob(job4, 4);
assertNotNull(job4.getTail());
assertEquals(job4.getTail().size(), 1);
final CalculationJob job5 = job4.getTail().iterator().next();
assertJob(job5, 5);
assertNotNull(job5.getRequiredJobIds());
assertEquals(job5.getRequiredJobIds().length, 2);
assertEquals(job5.getRequiredJobIds()[0], job3.getSpecification().getJobId());
assertEquals(job5.getRequiredJobIds()[1], job4.getSpecification().getJobId());
assertNotNull(job5.getTail());
assertEquals(job5.getTail().size(), 1);
final CalculationJob job8 = job5.getTail().iterator().next();
assertJob(job8, 8);
executing.jobCompleted(job2.getSpecification());
assertNull(executing.nextExecutableJob());
executing.jobCompleted(job3.getSpecification());
assertNull(executing.nextExecutableJob());
executing.jobCompleted(job4.getSpecification());
final CalculationJob job7 = executing.nextExecutableJob();
assertJob(job7, 7);
executing.jobCompleted(job5.getSpecification());
assertNull(executing.nextExecutableJob());
executing.jobCompleted(job8.getSpecification());
assertNull(executing.nextExecutableJob());
executing.jobCompleted(job7.getSpecification());
final CalculationJob job9 = executing.nextExecutableJob();
assertJob(job9, 9);
assertNull(executing.nextExecutableJob());
assertFalse(executing.isFinished());
executing.jobCompleted(job9.getSpecification());
assertNull(executing.nextExecutableJob());
assertTrue(executing.isFinished());
}