use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class PipelineDependencyGraphOldTest method shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger.
@Test
public void shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger() throws Exception {
StageInstanceModels stages = new StageInstanceModels();
stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
PipelineInstanceModel down1 = pim("blahDown1");
down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
assertThat(graph.hasUpStreamRevisionFor(down1), is(false));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class PipelineDependencyGraphOldTest method assertThatTriggerIsPossibleOnlyIfUpStreamPassed.
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));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class PipelineDependencyGraphOldTest method shouldProvideMaterialRevisionForAGivenDownStreamPipeline.
@Test
public void shouldProvideMaterialRevisionForAGivenDownStreamPipeline() throws Exception {
StageInstanceModels stages = new StageInstanceModels();
stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
stages.add(new StageInstanceModel("stage-1", "2", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-1", "2")));
PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
PipelineInstanceModel down1 = pim("blahDown1");
down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-0")));
PipelineInstanceModel down2 = pim("blahDown2");
down2.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1, down2));
assertThat(graph.dependencyRevisionFor(down1), is("blahUpStream/23/stage-0/21"));
assertThat(graph.dependencyRevisionFor(down2), is("blahUpStream/23/stage-1/2"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class ViewCacheKey method keyForPipelineModelFragment.
private String keyForPipelineModelFragment(PipelineModel model, String name) {
StringBuilder s = new StringBuilder();
s.append(name);
//FIXME: use the delimiter, the two values appended at this point can combine to get something completely different (ALWAYS USE DELIMITER.)!!! - Sara & JJ
s.append(model.getName());
appendLockStatus(model, s);
for (PipelineInstanceModel pim : model.getActivePipelineInstances()) {
s.append("[");
s.append(pim.getId()).append(DELIMITER);
for (StageInstanceModel stageInstanceModel : pim.getStageHistory()) {
s.append(stageInstanceModel.getName()).append(DELIMITER);
s.append(stageInstanceModel.getId()).append(DELIMITER);
s.append(stageInstanceModel.getState()).append(DELIMITER);
}
s.append("]");
}
s.append(model.canOperate()).append(DELIMITER);
s.append(model.canForce()).append(DELIMITER);
PipelinePauseInfo pauseInfo = model.getPausedInfo();
s.append(pauseInfo.isPaused()).append(DELIMITER).append(pauseInfo.getPauseCause().replaceAll("\\W", "")).append(DELIMITER).append(pauseInfo.getPauseBy());
s.append(DELIMITER).append(model.canAdminister());
return key(s.toString());
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel in project gocd by gocd.
the class PipelineHistoryMother method pipelineHistoryItemWithOneStage.
public static PipelineInstanceModel pipelineHistoryItemWithOneStage(String pipelineName, String stageName, Date modifiedDate) {
StageInstanceModels stageHistory = new StageInstanceModels();
stageHistory.add(new StageInstanceModel(stageName, "1", StageResult.Passed, new StageIdentifier(pipelineName, 1, "1", stageName, "1")));
return singlePipeline(pipelineName, stageHistory, modifiedDate);
}
Aggregations