@Test public void testDeleteTask() throws Exception { PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class); PipelineExecutorTask task = mock(PipelineExecutorTask.class); PipelineExecutorTask.Status status = PipelineExecutorTask.Status.STOPPED; when(task.getPipelineStatus()).thenReturn(status); when(trace.getTask()).thenReturn(task); when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace); taskManager.delete(TASK_ID); verify(pipelineExecutorRegistry, times(1)).deregister(TASK_ID); }
private void testDeleteTaskInNonStopeableState(PipelineExecutorTask.Status nonStopeableStatus) throws Exception { PipelineExecutorTask task = mock(PipelineExecutorTask.class); when(task.getPipelineStatus()).thenReturn(nonStopeableStatus); PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class); when(trace.getTask()).thenReturn(task); when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace); expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + nonStopeableStatus + " can not" + " be deleted. Delete operation is available for the following status set:")); taskManager.delete(TASK_ID); }
private void testDeleteTaskInNonStopeableState(PipelineExecutorTask.Status nonStopeableStatus) throws Exception { PipelineExecutorTask task = mock(PipelineExecutorTask.class); when(task.getPipelineStatus()).thenReturn(nonStopeableStatus); PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class); when(trace.getTask()).thenReturn(task); when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace); expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + nonStopeableStatus + " can not" + " be deleted. Delete operation is available for the following status set:")); taskManager.delete(TASK_ID); }
@Test public void testDeleteTask() throws Exception { PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class); PipelineExecutorTask task = mock(PipelineExecutorTask.class); PipelineExecutorTask.Status status = PipelineExecutorTask.Status.STOPPED; when(task.getPipelineStatus()).thenReturn(status); when(trace.getTask()).thenReturn(task); when(pipelineExecutorRegistry.getExecutorTrace(TASK_ID)).thenReturn(trace); taskManager.delete(TASK_ID); verify(pipelineExecutorRegistry, times(1)).deregister(TASK_ID); }
@Test public void testDeleteActiveTask() throws Exception { PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); taskManager.currentTasks.put(TASK_ID, taskEntry); expectedException.expectMessage(new StartsWith("An active PipelineExecutorTask was found for taskId: " + TASK_ID)); taskManager.delete(TASK_ID); }
@Test public void testDeleteNonExistingTask() throws Exception { expectedException.expectMessage("No PipelineExecutorTask was found for taskId: " + TASK_ID); taskManager.delete(TASK_ID); }
@Test public void testDeleteActiveTask() throws Exception { PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); taskManager.currentTasks.put(TASK_ID, taskEntry); expectedException.expectMessage(new StartsWith("An active PipelineExecutorTask was found for taskId: " + TASK_ID)); taskManager.delete(TASK_ID); }
@Test public void testDeleteNonExistingTask() throws Exception { expectedException.expectMessage("No PipelineExecutorTask was found for taskId: " + TASK_ID); taskManager.delete(TASK_ID); }