@Override protected void init() { super.init(); super.futureTaskMap = spy(super.futureTaskMap); } });
@Override protected void init() { super.init(); super.futureTaskMap = spy(super.futureTaskMap); } });
@Test public void testPipelineExecutorInitialization() { taskManager.init(); verify(taskManagerHelper, times(1)).createPipelineExecutor(); }
@Test public void testPipelineExecutorInitialization() { taskManager.init(); verify(taskManagerHelper, times(1)).createPipelineExecutor(); }
@Test public void testLocalListenerInitialization() { taskManager.init(); assertNotNull(taskManager.localListener); }
@Test public void testLocalListenerInitialization() { taskManager.init(); assertNotNull(taskManager.localListener); }
@Test public void testExternalListenersInitialization() { taskManager.init(); verify(eventListenersInstance, times(1)).iterator(); verify(taskManagerHelper, times(1)).createExternalListeners(); assertEquals(externalListeners, taskManager.externalListeners); } }
@Test public void testExecutorServiceInitialization() { taskManager.init(); verify(taskManagerHelper, times(1)).createExecutorService(); assertNotNull(taskManager.executor); }
@Test public void testExternalListenersInitialization() { taskManager.init(); verify(eventListenersInstance, times(1)).iterator(); verify(taskManagerHelper, times(1)).createExternalListeners(); assertEquals(externalListeners, taskManager.externalListeners); } }
@Test public void testStopSyncTask() throws PipelineExecutorException { PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(false); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage("Stop operation is not available for taskId: " + TASK_ID + " running in SYNCHRONOUS mode"); taskManager.stop(TASK_ID); }
@Test public void testDestroySyncTask() throws PipelineExecutorException { PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(false); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage("Destroy operation is not available for taskId: " + TASK_ID + " running in SYNCHRONOUS mode"); taskManager.destroy(TASK_ID); }
@Test public void testStopSyncTask() throws PipelineExecutorException { PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(false); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage("Stop operation is not available for taskId: " + TASK_ID + " running in SYNCHRONOUS mode"); taskManager.stop(TASK_ID); }
@Test public void testDestroySyncTask() throws PipelineExecutorException { PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(false); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage("Destroy operation is not available for taskId: " + TASK_ID + " running in SYNCHRONOUS mode"); taskManager.destroy(TASK_ID); }
@Test public void testExecutorServiceInitialization() { taskManager.init(); verify(taskManagerHelper, times(1)).createExecutorService(); assertNotNull(taskManager.executor); }
private void testStopTaskInNonStopeableState(PipelineExecutorTask.Status notStopeableStatus) throws PipelineExecutorException { PipelineExecutorTaskImpl task = mock(PipelineExecutorTaskImpl.class); when(task.getId()).thenReturn(TASK_ID); when(task.getPipelineStatus()).thenReturn(notStopeableStatus); PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(true); when(taskEntry.getTask()).thenReturn(task); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + notStopeableStatus.name() + " can not be stopped. Stop operation is available for the following status set:")); taskManager.stop(TASK_ID); }
private void testStopTaskInNonStopeableState(PipelineExecutorTask.Status notStopeableStatus) throws PipelineExecutorException { PipelineExecutorTaskImpl task = mock(PipelineExecutorTaskImpl.class); when(task.getId()).thenReturn(TASK_ID); when(task.getPipelineStatus()).thenReturn(notStopeableStatus); PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(true); when(taskEntry.getTask()).thenReturn(task); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + notStopeableStatus.name() + " can not be stopped. Stop operation is available for the following status set:")); taskManager.stop(TASK_ID); }
@Test public void testDestroyNonExistingTask() throws PipelineExecutorException { taskManager.init(); expectedException.expectMessage("No PipelineExecutorTask was found for taskId: " + TASK_ID); taskManager.destroy(TASK_ID); }
@Test public void testStopNonExistingTask() throws PipelineExecutorException { taskManager.init(); expectedException.expectMessage("No PipelineExecutorTask was found for taskId: " + TASK_ID); taskManager.stop(TASK_ID); }
@Test public void testDestroyNonExistingTask() throws PipelineExecutorException { taskManager.init(); expectedException.expectMessage("No PipelineExecutorTask was found for taskId: " + TASK_ID); taskManager.destroy(TASK_ID); }
@Test public void testStopNonExistingTask() throws PipelineExecutorException { taskManager.init(); expectedException.expectMessage("No PipelineExecutorTask was found for taskId: " + TASK_ID); taskManager.stop(TASK_ID); }