Search in sources :

Example 16 with PipelineModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineModel in project gocd by gocd.

the class ViewCacheKeyTest method shouldGenerateKeyForPipelineModelViewFragment.

@Test
public void shouldGenerateKeyForPipelineModelViewFragment() {
    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);
    model.addPipelineInstance(pipelineInstance);
    StageInstanceModels stages2 = new StageInstanceModels();
    stages2.add(stageInstance("stageName", 7, JobState.Completed, JobResult.Passed));
    stages2.add(stageInstance("stage2", 10, JobState.Assigned, JobResult.Unknown));
    PipelineInstanceModel pipelineInstance2 = PipelineInstanceModel.createPipeline("pipelineName", 7, "label-7", BuildCause.createExternal(), stages2);
    pipelineInstance2.setId(14);
    model.addPipelineInstance(pipelineInstance2);
    assertThat(viewCacheKey.forPipelineModelBox(model), is("view_dashboardPipelineFragment_pipelineName{false|false|false}[12|stageName|13|Building|stage2|0|Unknown|][14|stageName|7|Passed|stage2|10|Building|]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 17 with PipelineModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineModel in project gocd by gocd.

the class ViewCacheKeyTest method shouldGenerateKeyForPipelineModelViewFragmentWithoutSpecialCharactersInPauseCause.

@Test
public void shouldGenerateKeyForPipelineModelViewFragmentWithoutSpecialCharactersInPauseCause() {
    PipelinePauseInfo pauseInfo = new PipelinePauseInfo(true, "pause& @Cause #with $special %char &*(){';/.,<>?", "admin");
    PipelineModel model = new PipelineModel("pipelineName", true, true, pauseInfo).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);
    model.addPipelineInstance(pipelineInstance);
    StageInstanceModels stages2 = new StageInstanceModels();
    stages2.add(stageInstance("stageName", 7, JobState.Completed, JobResult.Passed));
    stages2.add(stageInstance("stage2", 10, JobState.Assigned, JobResult.Unknown));
    PipelineInstanceModel pipelineInstance2 = PipelineInstanceModel.createPipeline("pipelineName", 7, "label-7", BuildCause.createExternal(), stages2);
    pipelineInstance2.setId(14);
    model.addPipelineInstance(pipelineInstance2);
    assertThat(viewCacheKey.forPipelineModelBox(model), is("view_dashboardPipelineFragment_pipelineName{false|false|false}[12|stageName|13|Building|stage2|0|Unknown|][14|stageName|7|Passed|stage2|10|Building|]true|true|true|pauseCausewithspecialchar|admin|true"));
}
Also used : NullStageHistoryItem(com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem) PipelinePauseInfo(com.thoughtworks.go.domain.PipelinePauseInfo) 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)

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