Search in sources :

Example 1 with NullStageHistoryItem

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"));
}
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 2 with NullStageHistoryItem

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

Example 3 with NullStageHistoryItem

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"));
}
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 4 with NullStageHistoryItem

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));
}
Also used : NullStageHistoryItem(com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) Test(org.junit.jupiter.api.Test)

Example 5 with NullStageHistoryItem

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

Aggregations

NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)9 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)7 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)6 Test (org.junit.Test)6 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)5 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)3 PipelineTimelineEntry (com.thoughtworks.go.domain.PipelineTimelineEntry)2 Document (org.dom4j.Document)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)1 PipelinePauseInfo (com.thoughtworks.go.domain.PipelinePauseInfo)1 XmlRepresentable (com.thoughtworks.go.domain.XmlRepresentable)1 XmlWriterContext (com.thoughtworks.go.domain.XmlWriterContext)1 Modification (com.thoughtworks.go.domain.materials.Modification)1 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)1 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)1 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)1 DocumentBuilder (com.thoughtworks.go.server.domain.xml.builder.DocumentBuilder)1 ElementBuilder (com.thoughtworks.go.server.domain.xml.builder.ElementBuilder)1 MaterialXmlRepresenter (com.thoughtworks.go.server.domain.xml.materials.MaterialXmlRepresenter)1