Search in sources :

Example 6 with PipelineModel

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"));
}
Also used : Username(com.thoughtworks.go.server.domain.Username) PipelineGroupModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel) Test(org.junit.Test)

Example 7 with PipelineModel

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"));
}
Also used : NullStageHistoryItem(com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel) Test(org.junit.Test)

Example 8 with PipelineModel

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"));
}
Also used : NullStageHistoryItem(com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel) Test(org.junit.Test)

Example 9 with PipelineModel

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;
}
Also used : PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)

Example 10 with 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;
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) MaterialRevisions(com.thoughtworks.go.domain.MaterialRevisions) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)

Aggregations

PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)17 Test (org.junit.Test)12 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)10 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)8 Username (com.thoughtworks.go.server.domain.Username)7 NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)5 PipelineGroupModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)3 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)2 Environment (com.thoughtworks.go.presentation.pipelinehistory.Environment)2 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)2 ArrayList (java.util.ArrayList)2 MingleConfig (com.thoughtworks.go.config.MingleConfig)1 TrackingTool (com.thoughtworks.go.config.TrackingTool)1 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)1 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)1 PipelinePauseInfo (com.thoughtworks.go.domain.PipelinePauseInfo)1 Modification (com.thoughtworks.go.domain.materials.Modification)1 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)1 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)1