use of com.thoughtworks.go.presentation.pipelinehistory.PipelineModel in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldIncludePauseInformationWhenGettingLatestPipelineInstanceFromAllPipelineGroups.
@Test
public void shouldIncludePauseInformationWhenGettingLatestPipelineInstanceFromAllPipelineGroups() throws Exception {
pipelineOne.createdPipelineWithAllStagesPassed();
configHelper.setOperatePermissionForGroup("group1", "chris", "raghu");
Username userNameChris = new Username(new CaseInsensitiveString("chris"));
pipelinePauseService.pause(pipelineOne.pipelineName, "paused", userNameChris);
Username userNameRaghu = new Username(new CaseInsensitiveString("raghu"));
pipelinePauseService.pause(pipelineTwo.pipelineName, "other paused", userNameRaghu);
configHelper.setViewPermissionForGroup("group1", "jez");
List<PipelineGroupModel> groupModels = pipelineHistoryService.allActivePipelineInstances(new Username(new CaseInsensitiveString("jez")), PipelineSelections.ALL);
assertThat(groupModels.size(), is(2));
List<PipelineModel> pipelineOneModels = groupModels.get(0).getPipelineModels();
assertThat(pipelineOneModels.size(), is(1));
PipelinePauseInfo pausedInfo = pipelineOneModels.get(0).getPausedInfo();
assertThat("isPaused", pausedInfo.isPaused(), is(true));
assertThat(pausedInfo.getPauseBy(), is("chris"));
assertThat(pausedInfo.getPauseCause(), is("paused"));
List<PipelineModel> pipelineTwoModels = groupModels.get(1).getPipelineModels();
assertThat(pipelineTwoModels.size(), is(1));
PipelinePauseInfo pipelineTwoPausedInfo = pipelineTwoModels.get(0).getPausedInfo();
assertThat("isPaused", pipelineTwoPausedInfo.isPaused(), is(true));
assertThat(pipelineTwoPausedInfo.getPauseBy(), is("raghu"));
assertThat(pipelineTwoPausedInfo.getPauseCause(), is("other paused"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineModel 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.PipelineModel 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.PipelineModel in project gocd by gocd.
the class PipelineHistoryMother method pipelineWithLatestRevision.
public static PipelineModel pipelineWithLatestRevision(MaterialRevisions latest) {
PipelineModel pipelineModel = pipeline();
pipelineModel.getLatestPipelineInstance().setLatestRevisions(latest);
return pipelineModel;
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineModel 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