@Test public void getPipelinesForProvider() { ProviderType providerType1 = mockProviderTypeSPI("providerType1"); ProviderType providerType2 = mockProviderTypeSPI("providerType2"); List<Pipeline> result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertTrue(result.isEmpty()); List<Pipeline> pipelines = mockPipelineList("providerType", ELEMENTS_COUNT); registerPipelinesForProviderType(pipelines, providerType); registerPipelinesForProviderType(mockPipelineList("providerType1", ELEMENTS_COUNT), providerType1); registerPipelinesForProviderType(mockPipelineList("providerType2", ELEMENTS_COUNT), providerType2); result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertEquals(3 * ELEMENTS_COUNT, result.size()); result = pipelineRegistry.getPipelines(providerType.getProviderTypeName(), providerType.getVersion(), 0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertEquals(pipelines.size(), result.size()); for (Pipeline pipeline : result) { assertTrue(result.contains(pipeline)); } }
@Override public List<Pipeline> getPipelines(final int page, final int pageSize, final String sort, final boolean sortOrder) { final List<Pipeline> values = pipelineByName.values() .stream() .map(PipelineRegistryEntry::getPipeline).collect(Collectors.toList()); return sortPagedResult(values, page, pageSize, sort, sortOrder); }
InMemoryPipelineRegistry implements PipelineRegistry { @Override public List<Pipeline> getPipelines(final int page, final int pageSize, final String sort, final boolean sortOrder) { final List<Pipeline> values = pipelineByName.values() .stream() .map(PipelineRegistryEntry::getPipeline).collect(Collectors.toList()); return sortPagedResult(values, page, pageSize, sort, sortOrder); } }
InMemoryPipelineRegistry implements PipelineRegistry { @Override public List<Pipeline> getPipelines(final int page, final int pageSize, final String sort, final boolean sortOrder) { final List<Pipeline> values = pipelineByName.values() .stream() .map(PipelineRegistryEntry::getPipeline).collect(Collectors.toList()); return sortPagedResult(values, page, pageSize, sort, sortOrder); } InMemoryPipelineRegistry(); }
InMemoryPipelineRegistry implements PipelineRegistry { @Override public List<Pipeline> getPipelines(final int page, final int pageSize, final String sort, final boolean sortOrder) { final List<Pipeline> values = pipelineByName.values() .stream() .map(PipelineRegistryEntry::getPipeline).collect(Collectors.toList()); return sortPagedResult(values, page, pageSize, sort, sortOrder); } InMemoryPipelineRegistry(); @Override void registerPipeline(final Pipeline pipeline); @Override void registerPipeline(final Pipeline pipeline,
                                 final ProviderType providerType); @Override Pipeline getPipelineByName(final String pipelineId); @Override List<Pipeline> getPipelines(final int page,
                                       final int pageSize,
                                       final String sort,
                                       final boolean sortOrder); @Override List<Pipeline> getPipelines(final String providerType,
                                       final String version,
                                       final int page,
                                       final int pageSize,
                                       final String sort,
                                       final boolean sortOrder); @Override ProviderType getProviderType(final String pipelineId); }
InMemoryPipelineRegistry implements PipelineRegistry { @Override public List<Pipeline> getPipelines(final int page, final int pageSize, final String sort, final boolean sortOrder) { final List<Pipeline> values = pipelineByName.values() .stream() .map(PipelineRegistryEntry::getPipeline).collect(Collectors.toList()); return sortPagedResult(values, page, pageSize, sort, sortOrder); } InMemoryPipelineRegistry(); @Override void registerPipeline(final Pipeline pipeline); @Override void registerPipeline(final Pipeline pipeline,
                                 final ProviderType providerType); @Override Pipeline getPipelineByName(final String pipelineId); @Override List<Pipeline> getPipelines(final int page,
                                       final int pageSize,
                                       final String sort,
                                       final boolean sortOrder); @Override List<Pipeline> getPipelines(final String providerType,
                                       final String version,
                                       final int page,
                                       final int pageSize,
                                       final String sort,
                                       final boolean sortOrder); @Override ProviderType getProviderType(final String pipelineId);  }