Search in sources :

Example 66 with PipelineInstanceModel

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

the class PipelineDependencyGraphOldTest method shouldGroupPiplineInstancesByName.

@Test
public void shouldGroupPiplineInstancesByName() throws Exception {
    PipelineInstanceModel raghu1 = pim("raghu");
    raghu1.setCounter(1);
    PipelineInstanceModel raghu2 = pim("raghu");
    raghu2.setCounter(2);
    PipelineInstanceModel phavan = pim("pavan");
    PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(pim("upstream"), PipelineInstanceModels.createPipelineInstanceModels(raghu2, phavan, raghu1));
    Map<String, TreeSet<PipelineInstanceModel>> map = graph.groupedDependencies();
    assertThat(map.size(), is(2));
    assertOrderIsMainted(map);
    assertThat(map.get("pavan").size(), is(1));
    assertThat(map.get("pavan"), hasItem(phavan));
    assertThat(map.get("raghu").size(), is(2));
    assertThat(map.get("raghu").first(), is(raghu2));
    assertThat(map.get("raghu").last(), is(raghu1));
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) TreeSet(java.util.TreeSet) PipelineDependencyGraphOld(com.thoughtworks.go.domain.PipelineDependencyGraphOld) Test(org.junit.Test)

Example 67 with PipelineInstanceModel

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

the class ViewCacheKeyTest method shouldGenerateKeyForBuildCause.

@Test
public void shouldGenerateKeyForBuildCause() {
    PipelineModel model = new PipelineModel("pipelineName", true, true, PipelinePauseInfo.notPaused());
    PipelineInstanceModel pipelineInstance = PipelineInstanceModel.createPipeline("pipelineName", 10, "label-10", BuildCause.createExternal(), new StageInstanceModels());
    pipelineInstance.setId(12);
    TrackingTool trackingTool = new TrackingTool("link", "regex");
    pipelineInstance.setTrackingTool(trackingTool);
    model.addPipelineInstance(pipelineInstance);
    PipelineInstanceModel pipelineInstance2 = PipelineInstanceModel.createPipeline("pipelineName", 7, "label-7", BuildCause.createExternal(), new StageInstanceModels());
    pipelineInstance2.setId(14);
    MingleConfig mingleConfig = new MingleConfig("mingle", "project", "mql");
    pipelineInstance2.setMingleConfig(mingleConfig);
    model.addPipelineInstance(pipelineInstance2);
    assertThat(viewCacheKey.forPipelineModelBuildCauses(model), is(String.format("view_buildCausesForPipelineModel_pipelineName[12|%s|%s][14|%s|%s]", trackingTool.hashCode(), -1, -1, mingleConfig.hashCode())));
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) MingleConfig(com.thoughtworks.go.config.MingleConfig) TrackingTool(com.thoughtworks.go.config.TrackingTool) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel) Test(org.junit.Test)

Example 68 with PipelineInstanceModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel 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 69 with PipelineInstanceModel

use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel 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

PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)69 Test (org.junit.Test)46 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)20 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)15 Username (com.thoughtworks.go.server.domain.Username)15 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)14 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)11 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)10 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)8 Modification (com.thoughtworks.go.domain.materials.Modification)7 HttpOperationResult (com.thoughtworks.go.server.service.result.HttpOperationResult)7 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)6 NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)6 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)5 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)4 Material (com.thoughtworks.go.domain.materials.Material)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 Date (java.util.Date)4 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)3 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)3