@Test public void merge() { final String parentName = "parent"; final String parentSuffix = "parentSuffix"; final String baseName = "base"; final String parentTransform1 = "parentTransform1"; final String parentTransform2 = "parentTransform2"; final String baseTransform1 = "parentTransform1"; final String baseTransform2 = "parentTransform2"; final List<String> parentTransformations = Arrays.asList(parentTransform1, parentTransform2); final List<String> baseTransformations = Arrays.asList(baseTransform1, baseTransform2); final Pipeline parent = new Pipeline( parentName, null, parentSuffix, true, baseName, parentTransformations); final Pipeline base = new Pipeline( baseName, null, null, true, null, baseTransformations); final Pipeline merged = parent.merge(base); Assertions.assertThat(merged.getPipelineName()).isEqualTo(parentName); Assertions.assertThat(merged.hasOutput()).isTrue(); Assertions.assertThat(merged.getOutputSuffix().get()).isEqualTo(parentSuffix); Assertions.assertThat(merged.getBasePipelineName()).isEmpty(); Assertions.assertThat(merged.getTransformations()).containsExactly( baseTransform1, baseTransform2, parentTransform1, parentTransform2); }
public Pipeline merge(final Pipeline basePipeline) { LOGGER.debug("Merging basePipeline {} into this {}", basePipeline, this); if (!this.getBasePipelineName().orElse("").equals(basePipeline.pipelineName)) { throw new RuntimeException(String.format("basePipelineName property [%s] of pipeline [%s] does not match " + "the pipelineName of the passed basePipeline [%s]", this.getBasePipelineName().orElse(""), this.pipelineName, basePipeline.pipelineName)); } List<String> combinedTransformations = new ArrayList<>(); combinedTransformations.addAll(basePipeline.getTransformations()); combinedTransformations.addAll(this.getTransformations()); return new Pipeline(this.getPipelineName(), this.outputBaseName, this.outputSuffix, this.hasOutput(), basePipeline.getBasePipelineName().orElse(null), combinedTransformations); }
Pipeline { public Pipeline merge(final Pipeline basePipeline) { LOGGER.debug("Merging basePipeline {} into this {}", basePipeline, this); if (!this.getBasePipelineName().orElse("").equals(basePipeline.pipelineName)) { throw new RuntimeException(String.format("basePipelineName property [%s] of pipeline [%s] does not match " + "the pipelineName of the passed basePipeline [%s]", this.getBasePipelineName().orElse(""), this.pipelineName, basePipeline.pipelineName)); } List<String> combinedTransformations = new ArrayList<>(); combinedTransformations.addAll(basePipeline.getTransformations()); combinedTransformations.addAll(this.getTransformations()); return new Pipeline(this.getPipelineName(), this.outputBaseName, this.outputSuffix, this.hasOutput(), basePipeline.getBasePipelineName().orElse(null), combinedTransformations); } }
Pipeline { public Pipeline merge(final Pipeline basePipeline) { LOGGER.debug("Merging basePipeline {} into this {}", basePipeline, this); if (!this.getBasePipelineName().orElse("").equals(basePipeline.pipelineName)) { throw new RuntimeException(String.format("basePipelineName property [%s] of pipeline [%s] does not match " + "the pipelineName of the passed basePipeline [%s]", this.getBasePipelineName().orElse(""), this.pipelineName, basePipeline.pipelineName)); } List<String> combinedTransformations = new ArrayList<>(); combinedTransformations.addAll(basePipeline.getTransformations()); combinedTransformations.addAll(this.getTransformations()); return new Pipeline(this.getPipelineName(), this.outputBaseName, this.outputSuffix, this.hasOutput(), basePipeline.getBasePipelineName().orElse(null), combinedTransformations); } Pipeline();  Pipeline(String pipelineName,
                    String outputBaseName,
                    String outputSuffix,
                    boolean hasOutput,
                    String basePipelineName,
                    List<String> transformations); }
Pipeline { public Pipeline merge(final Pipeline basePipeline) { LOGGER.debug("Merging basePipeline {} into this {}", basePipeline, this); if (!this.getBasePipelineName().orElse("").equals(basePipeline.pipelineName)) { throw new RuntimeException(String.format("basePipelineName property [%s] of pipeline [%s] does not match " + "the pipelineName of the passed basePipeline [%s]", this.getBasePipelineName().orElse(""), this.pipelineName, basePipeline.pipelineName)); } List<String> combinedTransformations = new ArrayList<>(); combinedTransformations.addAll(basePipeline.getTransformations()); combinedTransformations.addAll(this.getTransformations()); return new Pipeline(this.getPipelineName(), this.outputBaseName, this.outputSuffix, this.hasOutput(), basePipeline.getBasePipelineName().orElse(null), combinedTransformations); } Pipeline();  Pipeline(String pipelineName,
                    String outputBaseName,
                    String outputSuffix,
                    boolean hasOutput,
                    String basePipelineName,
                    List<String> transformations); String getPipelineName(); Optional<String> getOutputSuffix(); Optional<String> getOutputBaseName(); boolean hasOutput(); Optional<String> getBasePipelineName(); List<String> getTransformations(); Pipeline merge(final Pipeline basePipeline); @Override String toString(); }
Pipeline { public Pipeline merge(final Pipeline basePipeline) { LOGGER.debug("Merging basePipeline {} into this {}", basePipeline, this); if (!this.getBasePipelineName().orElse("").equals(basePipeline.pipelineName)) { throw new RuntimeException(String.format("basePipelineName property [%s] of pipeline [%s] does not match " + "the pipelineName of the passed basePipeline [%s]", this.getBasePipelineName().orElse(""), this.pipelineName, basePipeline.pipelineName)); } List<String> combinedTransformations = new ArrayList<>(); combinedTransformations.addAll(basePipeline.getTransformations()); combinedTransformations.addAll(this.getTransformations()); return new Pipeline(this.getPipelineName(), this.outputBaseName, this.outputSuffix, this.hasOutput(), basePipeline.getBasePipelineName().orElse(null), combinedTransformations); } Pipeline();  Pipeline(String pipelineName,
                    String outputBaseName,
                    String outputSuffix,
                    boolean hasOutput,
                    String basePipelineName,
                    List<String> transformations); String getPipelineName(); Optional<String> getOutputSuffix(); Optional<String> getOutputBaseName(); boolean hasOutput(); Optional<String> getBasePipelineName(); List<String> getTransformations(); Pipeline merge(final Pipeline basePipeline); @Override String toString();  }