@Override public boolean test(PipelineExecutorTrace pipelineExecutorTrace) { if (pipelineExecutionId != null) { return pipelineExecutionId.equals(pipelineExecutorTrace.getTaskId()); } if (runtimeId != null) { return (pipelineExecutorTrace.getTask().getOutput() instanceof RuntimeId) && runtimeId.equals(((RuntimeId) pipelineExecutorTrace.getTask().getOutput()).getId()); } if (runtimeName != null) { return (pipelineExecutorTrace.getTask().getOutput() instanceof RuntimeId) && runtimeName.equals(((RuntimeId) pipelineExecutorTrace.getTask().getOutput()).getName()); } if (providerId != null) { if (pipelineExecutorTrace.getTask().getTaskDef().getProviderId() == null) { return false; } else if (!providerId.equals(pipelineExecutorTrace.getTask().getTaskDef().getProviderId().getId())) { return false; } } if (pipelineId != null) { if (!pipelineId.equals(pipelineExecutorTrace.getPipelineId())) { return false; } } return true; } }
@Test public void testExecuteSync() { when(taskManagerHelper.generateTaskId()).thenReturn(TASK_ID); taskManager.init(); //prepare the input parameters. prepareExecution(); String result = taskManager.execute(taskDef, PipelineExecutorTaskManager.ExecutionMode.SYNCHRONOUS); assertEquals(TASK_ID, result); //verify the task to execute was properly initialized. verify(taskManagerHelper, times(1)).createTask(taskDef); //verify the pipeline was properly executed. verify(pipelineExecutor, times(1)).execute(eq(taskDef.getInput()), eq(pipeline), any(Consumer.class), eq(taskManager.localListener)); //verify the pipeline executor registry was properly updated. verify(pipelineExecutorRegistry, times(1)).register(pipelineExecutorTraceCaptor.capture()); assertEquals(PIPELINE_ID, pipelineExecutorTraceCaptor.getValue().getPipelineId()); assertEquals(TASK_ID, pipelineExecutorTraceCaptor.getValue().getTaskId()); }
@Test public void testExecuteSync() { when(taskManagerHelper.generateTaskId()).thenReturn(TASK_ID); taskManager.init(); //prepare the input parameters. prepareExecution(); String result = taskManager.execute(taskDef, PipelineExecutorTaskManager.ExecutionMode.SYNCHRONOUS); assertEquals(TASK_ID, result); //verify the task to execute was properly initialized. verify(taskManagerHelper, times(1)).createTask(taskDef); //verify the pipeline was properly executed. verify(pipelineExecutor, times(1)).execute(eq(taskDef.getInput()), eq(pipeline), any(Consumer.class), eq(taskManager.localListener)); //verify the pipeline executor registry was properly updated. verify(pipelineExecutorRegistry, times(1)).register(pipelineExecutorTraceCaptor.capture()); assertEquals(PIPELINE_ID, pipelineExecutorTraceCaptor.getValue().getPipelineId()); assertEquals(TASK_ID, pipelineExecutorTraceCaptor.getValue().getTaskId()); }
pipelineExecutorTraceCaptor.getValue().getPipelineId()); assertEquals(TASK_ID, pipelineExecutorTraceCaptor.getValue().getTaskId());
pipelineExecutorTraceCaptor.getValue().getPipelineId()); assertEquals(TASK_ID, pipelineExecutorTraceCaptor.getValue().getTaskId());
item.setPipelineId(pipelineExecutorTrace.getPipelineId()); item.setPipelineExecutionId(pipelineExecutorTrace.getTaskId()); item.setPipelineStatus(pipelineExecutorTrace.getTask().getPipelineStatus().name());