use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistory.
@Test
public void shouldLoadPipelineHistory() throws Exception {
pipelineOne.createdPipelineWithAllStagesPassed();
PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
assertThat(history.size(), is(1));
StageInstanceModels stageHistory = history.first().getStageHistory();
assertThat(stageHistory.size(), is(3));
for (StageInstanceModel stageHistoryItem : stageHistory) {
assertThat(stageHistoryItem.isScheduled(), is(true));
assertThat(stageHistoryItem.getCanRun(), is(true));
}
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class EnvironmentServiceTest method stubPipelineHistoryServiceToReturnPipelines.
private PipelineInstanceModel stubPipelineHistoryServiceToReturnPipelines(final String pipelineName) {
PipelineInstanceModel pipelineInstanceModel = PipelineInstanceModel.createPipeline(pipelineName, -1, "1", BuildCause.createManualForced(), new StageInstanceModels());
PipelineModel pipelineModel = new PipelineModel(pipelineInstanceModel.getName(), true, true, PipelinePauseInfo.notPaused());
pipelineModel.addPipelineInstance(pipelineInstanceModel);
when(pipelineHistoryService.latestPipelineModel(new Username(new CaseInsensitiveString("Foo")), pipelineName)).thenReturn(pipelineModel);
return pipelineInstanceModel;
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels 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.StageInstanceModels 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.StageInstanceModels 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