private List<Pipeline> sortPagedResult(List<Pipeline> values, int page, int pageSize, String sort, boolean sortOrder) { return PageSortUtil.pageSort(values, (Pipeline p1, Pipeline p2) -> { switch (sort) { case PIPELINE_NAME_SORT: return p1.getName().compareTo(p2.getName()); default: return p1.toString().compareTo(p2.toString()); } }, page, pageSize, sort, sortOrder); }
private List<Pipeline> sortPagedResult(List<Pipeline> values, int page, int pageSize, String sort, boolean sortOrder) { return PageSortUtil.pageSort(values, (Pipeline p1, Pipeline p2) -> { switch (sort) { case PIPELINE_NAME_SORT: return p1.getName().compareTo(p2.getName()); default: return p1.toString().compareTo(p2.toString()); } }, page, pageSize, sort, sortOrder); }
private PipelineExecutorTaskDefImpl(final Pipeline pipeline) { this.pipeline = pipeline.getName(); pipeline.getStages().forEach(stage -> stages.add(stage.getName())); }
@Override public void registerPipeline(final Pipeline pipeline) { checkNotNull("pipeline", pipeline); pipelineByName.put(pipeline.getName(), new PipelineRegistryEntry(pipeline)); }
private PipelineExecutorTaskDefImpl(final Pipeline pipeline) { this.pipeline = pipeline.getName(); pipeline.getStages().forEach(stage -> stages.add(stage.getName())); }
@Override public void registerPipeline(final Pipeline pipeline) { checkNotNull("pipeline", pipeline); pipelineByName.put(pipeline.getName(), new PipelineRegistryEntry(pipeline)); }
@Override public void registerPipeline(final Pipeline pipeline, final ProviderType providerType) { checkNotNull("pipeline", pipeline); checkNotNull("providerType", providerType); pipelineByName.put(pipeline.getName(), new PipelineRegistryEntry(pipeline, providerType)); }
@Override public void registerPipeline(final Pipeline pipeline, final ProviderType providerType) { checkNotNull("pipeline", pipeline); checkNotNull("providerType", providerType); pipelineByName.put(pipeline.getName(), new PipelineRegistryEntry(pipeline, providerType)); }
private static List<Pipeline> mockPipelineList(String suffix, final int count) { List<Pipeline> pipelines = new ArrayList<>(); for (int i = 0; i < count; i++) { Pipeline pipeline = mock(Pipeline.class); when(pipeline.getName()).thenReturn("Pipeline.name." + suffix + Integer.toString(i)); pipelines.add(pipeline); } return pipelines; }
private static List<Pipeline> mockPipelineList(String suffix, final int count) { List<Pipeline> pipelines = new ArrayList<>(); for (int i = 0; i < count; i++) { Pipeline pipeline = mock(Pipeline.class); when(pipeline.getName()).thenReturn("Pipeline.name." + suffix + Integer.toString(i)); pipelines.add(pipeline); } return pipelines; }
private void prepareExecution() { //mock the execution inputs pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); }
private void prepareExecution() { //mock the execution inputs pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); }
@Before public void setUp() { when(pipeline.getName()).thenReturn(PIPELINE_ID); providerType = mockProviderTypeSPI(""); pipelineRegistry = new InMemoryPipelineRegistry(); }
@Before public void setUp() { when(pipeline.getName()).thenReturn(PIPELINE_ID); providerType = mockProviderTypeSPI(""); pipelineRegistry = new InMemoryPipelineRegistry(); }
@Before public void setUp() { super.setUp(); error = mock(Throwable.class); when(error.getMessage()).thenReturn(ERROR_MESSAGE); pipelineExecutorErrorCaptor = ArgumentCaptor.forClass(PipelineExecutorError.class); pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); //pick an arbitrary stage for events testing. stage = stages.get(0); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); task = spy(taskManagerHelper.createTask(taskDef, TASK_ID)); taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.getTask()).thenReturn(task); //emulate there's a running task. taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); }
@Before public void setUp() { super.setUp(); error = mock(Throwable.class); when(error.getMessage()).thenReturn(ERROR_MESSAGE); pipelineExecutorExceptionCaptor = ArgumentCaptor.forClass(PipelineExecutorException.class); pipeline = mock(Pipeline.class); stages = mockStages(PIPELINE_STAGES_SIZE); when(pipeline.getStages()).thenReturn(stages); when(pipeline.getName()).thenReturn(PIPELINE_ID); when(pipelineRegistry.getPipelineByName(PIPELINE_ID)).thenReturn(pipeline); //pick an arbitrary stage for events testing. stage = stages.get(0); taskDef = mock(PipelineExecutorTaskDef.class); input = mock(Input.class); when(taskDef.getInput()).thenReturn(input); when(taskDef.getPipeline()).thenReturn(PIPELINE_ID); task = spy(taskManagerHelper.createTask(taskDef, TASK_ID)); taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.getTask()).thenReturn(task); //emulate there's a running task. taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); }
@Test public void pipelinesPagingAndSorting() { Pipeline pipe1 = mock( Pipeline.class ); when( pipe1.getName() ).thenReturn( "pipeline 1" ); when( pipe2.getName() ).thenReturn( "pipeline 2" ); when( pipe3.getName() ).thenReturn( "pipeline 3" ); when( pipe4.getName() ).thenReturn( "pipeline 4" ); when( pipe5.getName() ).thenReturn( "pipeline 5" ); switch ( sort ) { case "name": return p1.getName().compareTo( p2.getName() ); default: return p1.toString().compareTo( p2.toString() ); assertEquals( "pipeline 1", pageSort.get( 0 ).getName() ); assertEquals( "pipeline 2", pageSort.get( 1 ).getName() ); switch ( sort ) { case "name": return p1.getName().compareTo( p2.getName() ); default: return p1.toString().compareTo( p2.toString() ); assertEquals( "pipeline 2", pageSort.get( 0 ).getName() ); assertEquals( "pipeline 1", pageSort.get( 1 ).getName() );
@Test public void pipelinesPagingAndSorting() { Pipeline pipe1 = mock(Pipeline.class); when(pipe1.getName()).thenReturn("pipeline 1"); when(pipe2.getName()).thenReturn("pipeline 2"); when(pipe3.getName()).thenReturn("pipeline 3"); when(pipe4.getName()).thenReturn("pipeline 4"); when(pipe5.getName()).thenReturn("pipeline 5"); switch (sort) { case "name": return p1.getName().compareTo(p2.getName()); default: return p1.toString().compareTo(p2.toString()); pageSort.size()); assertEquals("pipeline 1", pageSort.get(0).getName()); assertEquals("pipeline 2", pageSort.get(1).getName()); switch (sort) { case "name": return p1.getName().compareTo(p2.getName()); default: return p1.toString().compareTo(p2.toString());
@Test public void pipelinesPagingAndSorting() { Pipeline pipe1 = mock(Pipeline.class); when(pipe1.getName()).thenReturn("pipeline 1"); when(pipe2.getName()).thenReturn("pipeline 2"); when(pipe3.getName()).thenReturn("pipeline 3"); when(pipe4.getName()).thenReturn("pipeline 4"); when(pipe5.getName()).thenReturn("pipeline 5"); switch (sort) { case "name": return p1.getName().compareTo(p2.getName()); default: return p1.toString().compareTo(p2.toString()); pageSort.size()); assertEquals("pipeline 1", pageSort.get(0).getName()); assertEquals("pipeline 2", pageSort.get(1).getName()); switch (sort) { case "name": return p1.getName().compareTo(p2.getName()); default: return p1.toString().compareTo(p2.toString());