Search in sources :

Example 1 with StageInstanceModel

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

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

Example 3 with StageInstanceModel

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

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

the class ViewCacheKey method keyForPipelineModelFragment.

private String keyForPipelineModelFragment(PipelineModel model, String name) {
    StringBuilder s = new StringBuilder();
    s.append(name);
    //FIXME: use the delimiter, the two values appended at this point can combine to get something completely different (ALWAYS USE DELIMITER.)!!! - Sara & JJ
    s.append(model.getName());
    appendLockStatus(model, s);
    for (PipelineInstanceModel pim : model.getActivePipelineInstances()) {
        s.append("[");
        s.append(pim.getId()).append(DELIMITER);
        for (StageInstanceModel stageInstanceModel : pim.getStageHistory()) {
            s.append(stageInstanceModel.getName()).append(DELIMITER);
            s.append(stageInstanceModel.getId()).append(DELIMITER);
            s.append(stageInstanceModel.getState()).append(DELIMITER);
        }
        s.append("]");
    }
    s.append(model.canOperate()).append(DELIMITER);
    s.append(model.canForce()).append(DELIMITER);
    PipelinePauseInfo pauseInfo = model.getPausedInfo();
    s.append(pauseInfo.isPaused()).append(DELIMITER).append(pauseInfo.getPauseCause().replaceAll("\\W", "")).append(DELIMITER).append(pauseInfo.getPauseBy());
    s.append(DELIMITER).append(model.canAdminister());
    return key(s.toString());
}
Also used : PipelinePauseInfo(com.thoughtworks.go.domain.PipelinePauseInfo) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)

Example 5 with StageInstanceModel

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

the class PipelineHistoryMother method pipelineHistoryItemWithOneStage.

public static PipelineInstanceModel pipelineHistoryItemWithOneStage(String pipelineName, String stageName, Date modifiedDate) {
    StageInstanceModels stageHistory = new StageInstanceModels();
    stageHistory.add(new StageInstanceModel(stageName, "1", StageResult.Passed, new StageIdentifier(pipelineName, 1, "1", stageName, "1")));
    return singlePipeline(pipelineName, stageHistory, modifiedDate);
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)

Aggregations

StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)21 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)13 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)8 Test (org.junit.Test)8 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)6 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)5 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)4 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)3 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)2 JobHistory (com.thoughtworks.go.presentation.pipelinehistory.JobHistory)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 StageConfig (com.thoughtworks.go.config.StageConfig)1 DefaultSchedulingContext (com.thoughtworks.go.domain.DefaultSchedulingContext)1 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)1 PipelinePauseInfo (com.thoughtworks.go.domain.PipelinePauseInfo)1 PipelineTimelineEntry (com.thoughtworks.go.domain.PipelineTimelineEntry)1 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)1 NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)1 PipelineGroupModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineGroupModel)1