Search in sources :

Example 1 with StageInstanceModels

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

the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistory.

@Test
public void shouldLoadPipelineHistory() throws Exception {
    pipelineOne.createdPipelineWithAllStagesPassed();
    PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
    assertThat(history.size(), is(1));
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat(stageHistory.size(), is(3));
    for (StageInstanceModel stageHistoryItem : stageHistory) {
        assertThat(stageHistoryItem.isScheduled(), is(true));
        assertThat(stageHistoryItem.getCanRun(), is(true));
    }
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) Test(org.junit.Test)

Example 2 with StageInstanceModels

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

the class EnvironmentServiceTest method stubPipelineHistoryServiceToReturnPipelines.

private PipelineInstanceModel stubPipelineHistoryServiceToReturnPipelines(final String pipelineName) {
    PipelineInstanceModel pipelineInstanceModel = PipelineInstanceModel.createPipeline(pipelineName, -1, "1", BuildCause.createManualForced(), new StageInstanceModels());
    PipelineModel pipelineModel = new PipelineModel(pipelineInstanceModel.getName(), true, true, PipelinePauseInfo.notPaused());
    pipelineModel.addPipelineInstance(pipelineInstanceModel);
    when(pipelineHistoryService.latestPipelineModel(new Username(new CaseInsensitiveString("Foo")), pipelineName)).thenReturn(pipelineModel);
    return pipelineInstanceModel;
}
Also used : Username(com.thoughtworks.go.server.domain.Username) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) PipelineModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)

Example 3 with StageInstanceModels

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

the class PipelineDependencyGraphOldTest method shouldProvideMaterialRevisionForAGivenDownStreamPipeline.

@Test
public void shouldProvideMaterialRevisionForAGivenDownStreamPipeline() throws Exception {
    StageInstanceModels stages = new StageInstanceModels();
    stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
    stages.add(new StageInstanceModel("stage-1", "2", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-1", "2")));
    PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
    PipelineInstanceModel down1 = pim("blahDown1");
    down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-0")));
    PipelineInstanceModel down2 = pim("blahDown2");
    down2.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
    PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1, down2));
    assertThat(graph.dependencyRevisionFor(down1), is("blahUpStream/23/stage-0/21"));
    assertThat(graph.dependencyRevisionFor(down2), is("blahUpStream/23/stage-1/2"));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) PipelineDependencyGraphOld(com.thoughtworks.go.domain.PipelineDependencyGraphOld) Test(org.junit.Test)

Example 4 with StageInstanceModels

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

the class PipelineDependencyGraphOldTest method shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger.

@Test
public void shouldShouldbeAbleToTellIfUpStreamMaterialIsAvailableForTrigger() throws Exception {
    StageInstanceModels stages = new StageInstanceModels();
    stages.add(new StageInstanceModel("stage-0", "21", StageResult.Cancelled, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
    PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
    PipelineInstanceModel down1 = pim("blahDown1");
    down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-1")));
    PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
    assertThat(graph.hasUpStreamRevisionFor(down1), is(false));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) PipelineDependencyGraphOld(com.thoughtworks.go.domain.PipelineDependencyGraphOld) Test(org.junit.Test)

Example 5 with StageInstanceModels

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

the class PipelineDependencyGraphOldTest method assertThatTriggerIsPossibleOnlyIfUpStreamPassed.

private void assertThatTriggerIsPossibleOnlyIfUpStreamPassed(StageResult upstreamResult) {
    StageInstanceModels stages = new StageInstanceModels();
    stages.add(new StageInstanceModel("stage-0", "21", upstreamResult, new StageIdentifier("blahUpStream", 23, "stage-0", "21")));
    PipelineInstanceModel upStream = PipelineHistoryMother.singlePipeline("blahUpStream", stages);
    PipelineInstanceModel down1 = pim("blahDown1");
    down1.setMaterialConfigs(new MaterialConfigs(dependencyMaterialConfig("blahUpStream", "stage-0")));
    PipelineDependencyGraphOld graph = new PipelineDependencyGraphOld(upStream, PipelineInstanceModels.createPipelineInstanceModels(down1));
    assertThat(graph.hasUpStreamRevisionFor(graph.dependencies().find("blahDown1")), is(upstreamResult == StageResult.Passed));
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) PipelineDependencyGraphOld(com.thoughtworks.go.domain.PipelineDependencyGraphOld)

Aggregations

StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)41 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)14 Test (org.junit.Test)14 Test (org.junit.jupiter.api.Test)14 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)13 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)9 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)8 PipelineModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineModel)7 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)6 NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)6 ScheduleTestUtil (com.thoughtworks.go.server.service.ScheduleTestUtil)6 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)5 Username (com.thoughtworks.go.server.domain.Username)4 Pagination (com.thoughtworks.go.server.util.Pagination)4 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)3 StageHistoryEntry (com.thoughtworks.go.presentation.pipelinehistory.StageHistoryEntry)3 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)2 StageStatusCache (com.thoughtworks.go.domain.activity.StageStatusCache)2 StageStatusTopic (com.thoughtworks.go.server.messaging.StageStatusTopic)2