@Test public void testExecuteOnShutdown() throws InterruptedException { BatchedTaskExecutorService service = newService(new BatchedTaskExecutorServiceConfig(2, 0)); service.schedule(newTask()); service.shutdown(); assertEquals(service.getTotalTasksExecuted(), 1); }
@Test public void testMaxPendingTime() throws InterruptedException { BatchedTaskExecutorService service = newService(new BatchedTaskExecutorServiceConfig(2, 1)); service.schedule(newTask()); Thread.sleep(1500); assertEquals(service.getTotalTasksExecuted(), 1); }
@Test public void testMaxBufferSize() { BatchedTaskExecutorService service = newService(new BatchedTaskExecutorServiceConfig(2, 0)); service.schedule(newTask()); assertEquals(service.getTotalTasksExecuted(), 0); service.schedule(newTask()); assertEquals(service.getTotalTasksExecuted(), 2); service.schedule(newTask()); assertEquals(service.getTotalTasksExecuted(), 2); }