@Test public void getEffectiveOutputPipelines() { Pipeline pipe1 = new Pipeline( "pipe1", null, null, false, null, Arrays.asList("T1.1", "T1.2")); Pipeline pipe2 = new Pipeline( "pipe2", null, null, false, "pipe1", Arrays.asList("T2.1", "T2.2")); Pipeline pipe3 = new Pipeline( "pipe3", null, "p3", true, "pipe2", Arrays.asList("T3.1", "T3.2")); Pipeline pipe4 = new Pipeline( "pipe4", null, "p4", true, "pipe3", Arrays.asList("T4.1", "T4.2")); Pipeline pipe5 = new Pipeline( "pipe5", null, "p5", true, null, Arrays.asList("T5.1", "T5.2")); Configuration configuration = new Configuration(Arrays.asList(pipe2, pipe1, pipe4, pipe3, pipe5)); assertThat(configuration.getPipelines()).containsExactly(pipe2, pipe1, pipe4, pipe3, pipe5); List<Pipeline> effectiveOutputPipelines = configuration.getEffectiveOutputPipelines(); assertThat(effectiveOutputPipelines).hasSize(3); assertThat( effectiveOutputPipelines.stream() .map(Pipeline::getPipelineName)) .containsExactly("pipe4", "pipe3", "pipe5"); final Map<String, Pipeline> effectivePipelineMap = effectiveOutputPipelines.stream() .collect(Collectors.toMap(Pipeline::getPipelineName, Function.identity())); Pipeline effectivePipe3 = effectivePipelineMap.get("pipe3"); Pipeline effectivePipe4 = effectivePipelineMap.get("pipe4"); Pipeline effectivePipe5 = effectivePipelineMap.get("pipe5"); assertThat(effectivePipe3.getPipelineName()).isEqualTo("pipe3"); assertThat(effectivePipe3.getOutputSuffix().get()).isEqualTo("p3"); assertThat(effectivePipe3.hasOutput()).isTrue(); assertThat(effectivePipe3.getBasePipelineName()).isEmpty(); assertThat(effectivePipe3.getTransformations()) .containsExactly("T1.1", "T1.2", "T2.1", "T2.2", "T3.1", "T3.2"); assertThat(effectivePipe4.getPipelineName()).isEqualTo("pipe4"); assertThat(effectivePipe4.getOutputSuffix().get()).isEqualTo("p4"); assertThat(effectivePipe4.hasOutput()).isTrue(); assertThat(effectivePipe4.getBasePipelineName()).isEmpty(); assertThat(effectivePipe4.getTransformations()) .containsExactly("T1.1", "T1.2", "T2.1", "T2.2", "T3.1", "T3.2", "T4.1", "T4.2"); assertThat(effectivePipe5.getPipelineName()).isEqualTo("pipe5"); assertThat(effectivePipe5.getOutputSuffix().get()).isEqualTo("p5"); assertThat(effectivePipe5.hasOutput()).isTrue(); assertThat(effectivePipe5.getBasePipelineName()).isEmpty(); assertThat(effectivePipe5.getTransformations()) .containsExactly("T5.1", "T5.2"); }
public List<Pipeline> getEffectiveOutputPipelines() { final Map<String, Pipeline> pipelineMap = pipelines.stream() .collect(Collectors.toMap(Pipeline::getPipelineName, Function.identity())); final List<Pipeline> effectivePipelines = pipelines.stream() .filter(Pipeline::hasOutput) .map(pipeline -> getEffectivePipeline(pipeline, pipelineMap)) .collect(Collectors.toList()); return effectivePipelines; }
Configuration { public List<Pipeline> getEffectiveOutputPipelines() { final Map<String, Pipeline> pipelineMap = pipelines.stream() .collect(Collectors.toMap(Pipeline::getPipelineName, Function.identity())); final List<Pipeline> effectivePipelines = pipelines.stream() .filter(Pipeline::hasOutput) .map(pipeline -> getEffectivePipeline(pipeline, pipelineMap)) .collect(Collectors.toList()); return effectivePipelines; } }
Configuration { public List<Pipeline> getEffectiveOutputPipelines() { final Map<String, Pipeline> pipelineMap = pipelines.stream() .collect(Collectors.toMap(Pipeline::getPipelineName, Function.identity())); final List<Pipeline> effectivePipelines = pipelines.stream() .filter(Pipeline::hasOutput) .map(pipeline -> getEffectivePipeline(pipeline, pipelineMap)) .collect(Collectors.toList()); return effectivePipelines; } Configuration();  Configuration(final List<Pipeline> pipelines); }
Configuration { public List<Pipeline> getEffectiveOutputPipelines() { final Map<String, Pipeline> pipelineMap = pipelines.stream() .collect(Collectors.toMap(Pipeline::getPipelineName, Function.identity())); final List<Pipeline> effectivePipelines = pipelines.stream() .filter(Pipeline::hasOutput) .map(pipeline -> getEffectivePipeline(pipeline, pipelineMap)) .collect(Collectors.toList()); return effectivePipelines; } Configuration();  Configuration(final List<Pipeline> pipelines); List<Pipeline> getPipelines(); List<Pipeline> getEffectiveOutputPipelines(); }
Configuration { public List<Pipeline> getEffectiveOutputPipelines() { final Map<String, Pipeline> pipelineMap = pipelines.stream() .collect(Collectors.toMap(Pipeline::getPipelineName, Function.identity())); final List<Pipeline> effectivePipelines = pipelines.stream() .filter(Pipeline::hasOutput) .map(pipeline -> getEffectivePipeline(pipeline, pipelineMap)) .collect(Collectors.toList()); return effectivePipelines; } Configuration();  Configuration(final List<Pipeline> pipelines); List<Pipeline> getPipelines(); List<Pipeline> getEffectiveOutputPipelines();  }