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));
}
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())));
}
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"));
}
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"));
}
Aggregations