FIFOScheduler extends AbstractScheduler { @Override public void stop() { super.stop(); executor.shutdownNow(); } FIFOScheduler(String name); @Override void runJobInScheduler(final Job job); @Override void stop();  }
@Test public void testRun() throws InterruptedException { Scheduler s = schedulerSvc.createOrGetFIFOScheduler("test"); Job job1 = new SleepingJob("job1", null, 500); Job job2 = new SleepingJob("job2", null, 500); s.submit(job1); s.submit(job2); Thread.sleep(200); assertEquals(Status.RUNNING, job1.getStatus()); assertEquals(Status.PENDING, job2.getStatus()); Thread.sleep(500); assertEquals(Status.FINISHED, job1.getStatus()); assertEquals(Status.RUNNING, job2.getStatus()); assertTrue((500 < (Long) job1.getReturn())); s.stop(); }
@Test public void testAbort() throws InterruptedException { Scheduler s = schedulerSvc.createOrGetFIFOScheduler("test"); Job job1 = new SleepingJob("job1", null, 500); Job job2 = new SleepingJob("job2", null, 500); s.submit(job1); s.submit(job2); Thread.sleep(200); job1.abort(); job2.abort(); Thread.sleep(200); assertEquals(Status.ABORT, job1.getStatus()); assertEquals(Status.ABORT, job2.getStatus()); assertTrue((500 > (Long) job1.getReturn())); assertEquals(null, job2.getReturn()); s.stop(); }