use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.
the class PipelineHistoryGroupingUtilTest method shouldCreateTwoGroupsWithMultiplePipelineHistoryItems.
@Test
public void shouldCreateTwoGroupsWithMultiplePipelineHistoryItems() throws Exception {
PipelineInstanceModel pipelineHistoryItem1 = PipelineHistoryItemMother.custom("stage1", "stage2");
PipelineInstanceModel pipelineHistoryItem2 = PipelineHistoryItemMother.custom("stage1", "stage3");
PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels(pipelineHistoryItem1, pipelineHistoryItem2);
PipelineHistoryGroups historyGroups = groupingUtil.createGroups(history);
assertThat(historyGroups.size(), is(2));
assertThat(historyGroups.first().hasSameStagesAs(pipelineHistoryItem1), is(true));
assertThat(historyGroups.get(1).hasSameStagesAs(pipelineHistoryItem2), is(true));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.
the class PipelineHistoryGroupTest method shouldNotMatchSpecifiedItemIfNameNotMatched.
@Test
public void shouldNotMatchSpecifiedItemIfNameNotMatched() throws Exception {
PipelineInstanceGroupModel group = new PipelineInstanceGroupModel();
group.getStages().addAll(asList(new SimpleInfo("stage1", true), new SimpleInfo("stage2", false)));
PipelineInstanceModel pipelineInstanceModel = PipelineHistoryItemMother.custom(StageHistoryItemMother.custom("stage1", true), StageHistoryItemMother.custom("stage3", false));
assertThat(group.hasSameStagesAs(pipelineInstanceModel), is(false));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel in project gocd by gocd.
the class ViewCacheKeyTest method shouldGenerateKeyForEnvironmentPipelineFragment.
@Test
public void shouldGenerateKeyForEnvironmentPipelineFragment() {
MaterialRevisions materialRevisions = ModificationsMother.createHgMaterialRevisions();
Modification latestModification = materialRevisions.getMaterialRevision(0).getModifications().remove(0);
PipelineModel model = new PipelineModel("pipelineName", true, true, PipelinePauseInfo.notPaused()).updateAdministrability(true);
StageInstanceModels stages = new StageInstanceModels();
stages.add(stageInstance("stageName", 13, JobState.Building, JobResult.Unknown));
stages.add(new NullStageHistoryItem("stage2", true));
PipelineInstanceModel pipelineInstance = PipelineInstanceModel.createPipeline("pipelineName", 10, "label-10", BuildCause.createWithModifications(materialRevisions, "someone"), stages);
pipelineInstance.setMaterialConfigs(materialRevisions.getMaterials().convertToConfigs());
pipelineInstance.setLatestRevisions(new MaterialRevisions(new MaterialRevision(materialRevisions.getMaterialRevision(0).getMaterial(), latestModification)));
pipelineInstance.setId(12);
model.addPipelineInstance(pipelineInstance);
assertThat(model.hasNewRevisions(), is(true));
assertThat(viewCacheKey.forEnvironmentPipelineBox(model), is("view_environmentPipelineFragment_pipelineName{false|false|false}[12|stageName|13|Building|stage2|0|Unknown|]true|true|false|||true|true"));
model.updateAdministrability(false);
assertThat(viewCacheKey.forEnvironmentPipelineBox(model), is("view_environmentPipelineFragment_pipelineName{false|false|false}[12|stageName|13|Building|stage2|0|Unknown|]true|true|false|||false|true"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel 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.PipelineInstanceModel 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));
}
Aggregations