@Test public void getExecutorTraceByRuntimeId() { RuntimeIdMock runtimeId = mock(RuntimeIdMock.class); when(runtimeId.getId()).thenReturn(RUNTIME_ID); PipelineExecutorTask task = mock(PipelineExecutorTask.class); when(task.getOutput()).thenReturn(runtimeId); when(trace.getTask()).thenReturn(task); pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(runtimeId); assertEquals(trace, result); }
@Test public void getExecutorTraceByRuntimeId() { RuntimeIdMock runtimeId = mock(RuntimeIdMock.class); when(runtimeId.getId()).thenReturn(RUNTIME_ID); PipelineExecutorTask task = mock(PipelineExecutorTask.class); when(task.getOutput()).thenReturn(runtimeId); when(trace.getTask()).thenReturn(task); pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(runtimeId); assertEquals(trace, result); }
@Test @Override public void testDeregister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); pipelineExecutorRegistry.deregister(PIPELINE_EXECUTION_ID); verify(registryHelper, times(1)).deleteBatch(traceTargetPath); result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertNull(result); }
@Test public void testGetExecutorTrace() { pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }
@Test @Override public void testDeregister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); pipelineExecutorRegistry.deregister(PIPELINE_EXECUTION_ID); verify(registryHelper, times(1)).deleteBatch(traceTargetPath); result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertNull(result); }
@Test public void testRegister() { pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }
@Test public void testDeregister() { pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); pipelineExecutorRegistry.deregister(trace.getTaskId()); result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertNull(result); }
@Test public void testGetExecutorTrace() { pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }
@Test public void testDeregister() { pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); pipelineExecutorRegistry.deregister(trace.getTaskId()); result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertNull(result); }
@Test public void testRegister() { pipelineExecutorRegistry.register(trace); PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }
@Test public void testInit() throws Exception { traces = new ArrayList<>(); for (int i = 0; i < TRACES_COUNT; i++) { PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class); when(trace.getTaskId()).thenReturn(PIPELINE_EXECUTION_ID + Integer.toString(i)); traces.add(trace); } when(registryHelper.readEntries(registryRoot, VFSRegistryHelper.BySuffixFilter.newFilter(TRACE_SUFFIX))).thenReturn(traces); ((VFSPipelineExecutorRegistry) pipelineExecutorRegistry).init(); verify(registryHelper, times(2)).ensureDirectory(PIPELINE_EXECUTOR_REGISTRY_PATH); verify(registryHelper, times(2)).readEntries(registryRoot, VFSRegistryHelper.BySuffixFilter.newFilter(TRACE_SUFFIX)); for (Object trace : traces) { PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(((PipelineExecutorTrace) trace).getTaskId()); assertNotNull(result); assertEquals(trace, result); } }
@Test public void testInit() throws Exception { traces = new ArrayList<>(); for (int i = 0; i < TRACES_COUNT; i++) { PipelineExecutorTrace trace = mock(PipelineExecutorTrace.class); when(trace.getTaskId()).thenReturn(PIPELINE_EXECUTION_ID + Integer.toString(i)); traces.add(trace); } when(registryHelper.readEntries(registryRoot, VFSRegistryHelper.BySuffixFilter.newFilter(TRACE_SUFFIX))).thenReturn(traces); ((VFSPipelineExecutorRegistry) pipelineExecutorRegistry).init(); verify(registryHelper, times(2)).ensureDirectory(PIPELINE_EXECUTOR_REGISTRY_PATH); verify(registryHelper, times(2)).readEntries(registryRoot, VFSRegistryHelper.BySuffixFilter.newFilter(TRACE_SUFFIX)); for (Object trace : traces) { PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(((PipelineExecutorTrace) trace).getTaskId()); assertNotNull(result); assertEquals(trace, result); } }
@Test @Override public void testRegister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); try { verify(registryHelper, times(1)).storeEntry(traceTargetPath, trace); } catch (Exception e) { //need to catch this exception because parent class method don't throws exceptions, //but this will never happen in this scenario. fail(e.getMessage()); } PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }
@Test @Override public void testRegister() { prepareTargetPath(); pipelineExecutorRegistry.register(trace); try { verify(registryHelper, times(1)).storeEntry(traceTargetPath, trace); } catch (Exception e) { //need to catch this exception because parent class method don't throws exceptions, //but this will never happen in this scenario. fail(e.getMessage()); } PipelineExecutorTrace result = pipelineExecutorRegistry.getExecutorTrace(PIPELINE_EXECUTION_ID); assertEquals(trace, result); }