use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class ViewCacheKeyTest method shouldGenerateKeyForPipelineModelViewFragmentWithLockStatus.
@Test
public void shouldGenerateKeyForPipelineModelViewFragmentWithLockStatus() {
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.createExternal(), stages);
pipelineInstance.setId(12);
pipelineInstance.setCanUnlock(false);
pipelineInstance.setIsLockable(true);
pipelineInstance.setCurrentlyLocked(true);
model.addPipelineInstance(pipelineInstance);
assertThat(viewCacheKey.forPipelineModelBox(model), is("view_dashboardPipelineFragment_pipelineName{true|true|false}[12|stageName|13|Building|stage2|0|Unknown|]true|true|false|||true"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class ViewCacheKeyTest method shouldGenerateKeyForPipelineModelViewIncludingUserAdminStatus.
@Test
public void shouldGenerateKeyForPipelineModelViewIncludingUserAdminStatus() {
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.createExternal(), stages);
pipelineInstance.setId(12);
pipelineInstance.setCanUnlock(false);
pipelineInstance.setIsLockable(true);
pipelineInstance.setCurrentlyLocked(true);
model.addPipelineInstance(pipelineInstance);
assertThat(viewCacheKey.forPipelineModelBox(model), is("view_dashboardPipelineFragment_pipelineName{true|true|false}[12|stageName|13|Building|stage2|0|Unknown|]true|true|false|||true"));
model.updateAdministrability(false);
assertThat(viewCacheKey.forPipelineModelBox(model), is("view_dashboardPipelineFragment_pipelineName{true|true|false}[12|stageName|13|Building|stage2|0|Unknown|]true|true|false|||false"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadPipelineHistoriesWithMultipleSameStage.
@Test
public void shouldLoadPipelineHistoriesWithMultipleSameStage() throws Exception {
String stageName = "dev";
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", stageName);
Pipeline mingle = schedulePipelineWithStages(mingleConfig);
Stage newInstance = rescheduleStage(stageName, mingleConfig, mingle);
PipelineInstanceModels pipelineHistories = pipelineDao.loadHistory(mingle.getName(), 10, 0);
assertThat(pipelineHistories.size(), is(1));
StageInstanceModels stageHistories = pipelineHistories.first().getStageHistory();
assertThat(stageHistories.size(), is(1));
StageInstanceModel history = stageHistories.first();
assertThat(history.getName(), is(stageName));
assertThat(history.getId(), is(newInstance.getId()));
assertThat(history.getBuildHistory().size(), is(2));
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryMother method stagePerJob.
public static StageInstanceModels stagePerJob(String baseName, List<JobHistory> histories) {
StageInstanceModels stageInstanceModels = new StageInstanceModels();
for (int i = 0; i < histories.size(); i++) {
String stageName = baseName + "-" + i;
StageInstanceModel stage = new StageInstanceModel(stageName, "1", StageResult.Passed, new StageIdentifier("pipeline", 1, "1", stageName, "1"));
stage.setBuildHistory(histories.get(i));
stageInstanceModels.add(stage);
stageInstanceModels.latestStage().setApprovedBy("cruise");
}
return stageInstanceModels;
}
use of com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels in project gocd by gocd.
the class PipelineHistoryMother method pipeline.
public static PipelineModel pipeline() {
PipelineModel pipelineModel = new PipelineModel("pipe1", true, true, PipelinePauseInfo.notPaused());
MaterialRevisions materialRevisions = ModificationsMother.createHgMaterialRevisions();
PipelineInstanceModel instanceModel = PipelineInstanceModel.createPipeline("pipe1", -1, "label1", BuildCause.createWithModifications(materialRevisions, "foo-bar"), new StageInstanceModels());
instanceModel.setMaterialConfigs(new MaterialConfigs(materialRevisions.getMaterialRevision(0).getMaterial().config()));
instanceModel.setLatestRevisions(materialRevisions);
pipelineModel.addPipelineInstance(instanceModel);
return pipelineModel;
}
Aggregations