public boolean hasDependent(String pipelineName) { return dependencies.find(pipelineName) != null; }
public PipelineDependencyGraphOld pipelineGraphByNameAndCounter(String pipelineName, int pipelineCounter) { PipelineInstanceModels instanceModels = null; try { instanceModels = PipelineInstanceModels.createPipelineInstanceModels((List<PipelineInstanceModel>) getSqlMapClientTemplate().queryForList("pipelineAndItsDepedenciesByNameAndCounter", arguments("pipelineName", pipelineName).and("pipelineCounter", pipelineCounter) .and("stageLocator", pipelineName + "/" + pipelineCounter + "/%/%") .asMap())); } catch (Exception e) { throw new RuntimeException(e); } if (instanceModels.isEmpty()) { return null; } PipelineInstanceModel upstreamPipeline = instanceModels.find(pipelineName); loadPipelineHistoryBuildCause(upstreamPipeline); return new PipelineDependencyGraphOld(upstreamPipeline, dependentPipelines(upstreamPipeline, instanceModels)); }
private void assertThatTriggerIsPossibleOnlyIfUpStreamPassed(StageResult upstreamResult) { StageInstanceModels stages = new StageInstanceModels(); stages.add(new StageInstanceModel("stage-0","21", upstreamResult, new StageIdentifier("blahUpStream",23,"stage-0","21"))); PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages); PipelineInstanceModel down1 = pim("blahDown1"); down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-0"))); PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1)); assertThat(graph.hasUpStreamRevisionFor(graph.dependencies().find("blahDown1")),is(upstreamResult== StageResult.Passed)); }