private void verifyPipelineIsNotRegistered(Pipeline pipeline) { List<Pipeline> pipelines = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertFalse(pipelines.contains(pipeline)); }
@Test public void testGetProviderType() { ProviderType result = pipelineRegistry.getProviderType(PIPELINE_ID); assertNull(result); pipelineRegistry.registerPipeline(pipeline, providerType); result = pipelineRegistry.getProviderType(PIPELINE_ID); assertEquals(providerType, result); }
@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); }
@Test public void testGetPipelineByName() { verifyPipelineIsNotRegistered(pipeline); pipelineRegistry.registerPipeline(pipeline); Pipeline result = pipelineRegistry.getPipelineByName(PIPELINE_ID); assertEquals(pipeline, result); }
@Test public void testGetPipelines() { List<Pipeline> result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertTrue(result.isEmpty()); List<Pipeline> pipelines = mockPipelineList("", ELEMENTS_COUNT); pipelines.forEach(pipeline -> pipelineRegistry.registerPipeline(pipeline)); result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); for (Pipeline pipeline : pipelines) { assertTrue(result.contains(pipeline)); } }
private void registerPipelinesForProviderType(List<Pipeline> pipelines, ProviderType providerType) { pipelines.forEach(pipeline -> pipelineRegistry.registerPipeline(pipeline, providerType)); } }
@Before public void setUp() { when(pipeline.getName()).thenReturn(PIPELINE_ID); providerType = mockProviderTypeSPI(""); pipelineRegistry = new InMemoryPipelineRegistry(); }
@Test public void testGetPipelineByName() { verifyPipelineIsNotRegistered(pipeline); pipelineRegistry.registerPipeline(pipeline); Pipeline result = pipelineRegistry.getPipelineByName(PIPELINE_ID); assertEquals(pipeline, result); }
@Test public void testGetPipelines() { List<Pipeline> result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertTrue(result.isEmpty()); List<Pipeline> pipelines = mockPipelineList("", ELEMENTS_COUNT); pipelines.forEach(pipeline -> pipelineRegistry.registerPipeline(pipeline)); result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); for (Pipeline pipeline : pipelines) { assertTrue(result.contains(pipeline)); } }
private void registerPipelinesForProviderType(List<Pipeline> pipelines, ProviderType providerType) { pipelines.forEach(pipeline -> pipelineRegistry.registerPipeline(pipeline, providerType)); } }
@Before public void setUp() { when(pipeline.getName()).thenReturn(PIPELINE_ID); providerType = mockProviderTypeSPI(""); pipelineRegistry = new InMemoryPipelineRegistry(); }
private void verifyPipelineIsRegistered(Pipeline pipeline) { List<Pipeline> pipelines = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertTrue(pipelines.contains(pipeline)); }
@Test public void testGetProviderType() { ProviderType result = pipelineRegistry.getProviderType(PIPELINE_ID); assertNull(result); pipelineRegistry.registerPipeline(pipeline, providerType); result = pipelineRegistry.getProviderType(PIPELINE_ID); assertEquals(providerType, result); }
@Test public void testRegisterPipeline() { verifyPipelineIsNotRegistered(pipeline); pipelineRegistry.registerPipeline(pipeline); verifyPipelineIsRegistered(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); }
private void verifyPipelineIsNotRegistered(Pipeline pipeline) { List<Pipeline> pipelines = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertFalse(pipelines.contains(pipeline)); }
@Test public void testRegisterPipelineForProviderType() { verifyPipelineIsNotRegistered(pipeline); pipelineRegistry.registerPipeline(pipeline, providerType); verifyPipelineIsRegisteredForProviderType(pipeline, providerType); }
@Override public List<Pipeline> getPipelines(final String providerType, final String version, final int page, final int pageSize, final String sort, final boolean sortOrder) { final ProviderTypeFilter filter = ProviderTypeFilter.newInstance() .withProviderTypeName(providerType) .withVersion(version); final List<Pipeline> values = pipelineByName.values() .stream() .filter(entry -> filter.test(entry.getProviderType())) .map(PipelineRegistryEntry::getPipeline) .collect(Collectors.toList()); return sortPagedResult(values, page, pageSize, sort, sortOrder); }
private void verifyPipelineIsRegistered(Pipeline pipeline) { List<Pipeline> pipelines = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true); assertTrue(pipelines.contains(pipeline)); }
@Test public void testRegisterPipelineForProviderType() { verifyPipelineIsNotRegistered(pipeline); pipelineRegistry.registerPipeline(pipeline, providerType); verifyPipelineIsRegisteredForProviderType(pipeline, providerType); }