use of com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem 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.NullStageHistoryItem in project gocd by gocd.
the class ViewCacheKeyTest method shouldGenerateKeyForEnvironmentPipelineFragment.
@Test
public void shouldGenerateKeyForEnvironmentPipelineFragment() {
MaterialRevisions materialRevisions = ModificationsMother.createHgMaterialRevisions();
Modification latestModification = materialRevisions.getMaterialRevision(0).getModifications().remove(0);
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.createWithModifications(materialRevisions, "someone"), stages);
pipelineInstance.setMaterialConfigs(materialRevisions.getMaterials().convertToConfigs());
pipelineInstance.setLatestRevisions(new MaterialRevisions(new MaterialRevision(materialRevisions.getMaterialRevision(0).getMaterial(), latestModification)));
pipelineInstance.setId(12);
model.addPipelineInstance(pipelineInstance);
assertThat(model.hasNewRevisions(), is(true));
assertThat(viewCacheKey.forEnvironmentPipelineBox(model), is("view_environmentPipelineFragment_pipelineName{false|false|false}[12|stageName|13|Building|stage2|0|Unknown|]true|true|false|||true|true"));
model.updateAdministrability(false);
assertThat(viewCacheKey.forEnvironmentPipelineBox(model), is("view_environmentPipelineFragment_pipelineName{false|false|false}[12|stageName|13|Building|stage2|0|Unknown|]true|true|false|||false|true"));
}
use of com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem 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.NullStageHistoryItem in project gocd by gocd.
the class StageInfoCollectionTest method shouldEqualForDifferentImplementations.
@Test
public void shouldEqualForDifferentImplementations() throws Exception {
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages("cruise", "ut", "ft");
StageConfigurationModels twoAutoStages = new StageConfigurationModels(pipelineConfig);
StageConfigurationModels infoCollection = new StageConfigurationModels();
infoCollection.add(new NullStageHistoryItem("ut", true));
infoCollection.add(new NullStageHistoryItem("ft", true));
assertThat(twoAutoStages.equals(infoCollection), is(true));
}
use of com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem in project gocd by gocd.
the class PipelineHistoryServiceIntegrationTest method shouldNotLoadDuplicatPlaceholderStages.
@Test
public void shouldNotLoadDuplicatPlaceholderStages() throws Exception {
goConfigService.addPipeline(PipelineConfigMother.createPipelineConfig("pipeline", "stage", "job"), "pipeline-group");
PipelineInstanceModels history = pipelineHistoryService.load("pipeline", Pagination.pageStartingAt(0, 1, 10), "anyone", true);
PipelineInstanceModel instanceModel = history.first();
assertThat(instanceModel instanceof EmptyPipelineInstanceModel, is(true));
StageInstanceModels stageHistory = instanceModel.getStageHistory();
assertThat(stageHistory.size(), is(1));
assertThat(stageHistory.first() instanceof NullStageHistoryItem, is(true));
}
Aggregations