@Override public PipelineConfigsList getPipelineConfigs(Integer page, Integer pageSize, String sort, boolean sortOrder) throws BusinessException { final List<PipelineConfig> configs = pipelineRegistry.getPipelines(page, pageSize, sort, sortOrder).stream() .filter(p -> p.getConfig() != null) .map(Pipeline::getConfig) .collect(Collectors.toList()); return new PipelineConfigsList(configs); }
@Override public PipelineConfigsList getPipelineConfigs(String providerTypeName, String providerTypeVersion, Integer page, Integer pageSize, String sort, boolean sortOrder) throws BusinessException { final List<PipelineConfig> configs = pipelineRegistry.getPipelines(providerTypeName, providerTypeVersion, page, pageSize, sort, sortOrder) .stream() .filter(p -> p.getConfig() != null) .map(Pipeline::getConfig) .collect(Collectors.toList()); return new PipelineConfigsList(configs); }
@Test public void testGetPipelineConfigs() { List<PipelineConfig> values = mockList(PipelineConfig.class, ELEMENTS_COUNT); PipelineConfigsList list = new PipelineConfigsList(values); when(pipelineService.getPipelineConfigs(PAGE, PAGE_SIZE, SORT, SORT_ORDER)).thenReturn(list); List<PipelineConfig> result = pipelineServiceBackend.getPipelineConfigs(PAGE, PAGE_SIZE, SORT, SORT_ORDER); verify(pipelineService, times(1)).getPipelineConfigs(PAGE, PAGE_SIZE, SORT, SORT_ORDER); assertEquals(result, values); }
@Test public void testGetPipelineConfigsForProviderType() { List<PipelineConfig> values = mockList(PipelineConfig.class, ELEMENTS_COUNT); PipelineConfigsList list = new PipelineConfigsList(values); when(pipelineService.getPipelineConfigs(PROVIDER_TYPE_NAME, PROVIDER_TYPE_VERSION, PAGE, PAGE_SIZE, SORT, SORT_ORDER)).thenReturn(list); List<PipelineConfig> result = pipelineServiceBackend.getPipelineConfigs(providerType, PAGE, PAGE_SIZE, SORT, SORT_ORDER); verify(pipelineService, times(1)).getPipelineConfigs(PROVIDER_TYPE_NAME, PROVIDER_TYPE_VERSION, PAGE, PAGE_SIZE, SORT, SORT_ORDER); assertEquals(result, values); }