Search in sources :

Example 11 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)

Example 12 with StageInstanceModel

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

the class PipelineHistoryMother method stageHistory.

public static StageInstanceModels stageHistory(PipelineConfig pipelineConfig, Date modificationDate) {
    StageInstanceModels history = new StageInstanceModels();
    for (StageConfig stageConfig : pipelineConfig) {
        StageInstanceModel item = new StageInstanceModel(CaseInsensitiveString.str(stageConfig.name()), "1", buildHistory(stageConfig, modificationDate));
        item.setCounter("1");
        item.setApprovalType(new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext("anyone"), md5, new TimeProvider()).getApprovalType());
        if (stageConfig.requiresApproval()) {
            item.setApprovedBy(APPROVED_BY);
        } else {
            item.setApprovedBy(GoConstants.DEFAULT_APPROVED_BY);
        }
        history.add(item);
    }
    return history;
}
Also used : TimeProvider(com.thoughtworks.go.util.TimeProvider) InstanceFactory(com.thoughtworks.go.server.service.InstanceFactory) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) StageConfig(com.thoughtworks.go.config.StageConfig) DefaultSchedulingContext(com.thoughtworks.go.domain.DefaultSchedulingContext)

Example 13 with StageInstanceModel

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

the class PipelineHistoryServiceIntegrationTest method shouldMakePipelineInstanceCanRunFalseWhenDiskSpaceIsEmpty.

@Test
public void shouldMakePipelineInstanceCanRunFalseWhenDiskSpaceIsEmpty() throws Exception {
    diskIsFull.onSetUp();
    configHelper.updateArtifactRoot(TestFileUtil.createTempFolder("serverlogs").getAbsolutePath());
    pipelineOne.createdPipelineWithAllStagesPassed();
    PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
    assertThat(history.size(), is(1));
    assertThat(history.first().getCanRun(), is(false));
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat(stageHistory.size(), is(3));
    for (StageInstanceModel stageHistoryItem : stageHistory) {
        assertThat(stageHistoryItem.isScheduled(), is(true));
        assertThat(stageHistoryItem.getCanRun(), is(false));
    }
}
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 14 with StageInstanceModel

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

the class PipelineHistoryItemMother method custom.

public static PipelineInstanceModel custom(StageInstanceModel... stages) {
    PipelineInstanceModel pipelineInstanceModel = PipelineInstanceModel.createEmptyModel();
    pipelineInstanceModel.setStageHistory(new StageInstanceModels());
    for (StageInstanceModel stage : stages) {
        pipelineInstanceModel.getStageHistory().add(stage);
    }
    return pipelineInstanceModel;
}
Also used : PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)

Example 15 with StageInstanceModel

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

the class PipelineHistoryMother method stagePerJob.

public static StageInstanceModels stagePerJob(String baseName, List<JobHistory> histories) {
    StageInstanceModels stageInstanceModels = new StageInstanceModels();
    for (int i = 0; i < histories.size(); i++) {
        String stageName = baseName + "-" + i;
        StageInstanceModel stage = new StageInstanceModel(stageName, "1", StageResult.Passed, new StageIdentifier("pipeline", 1, "1", stageName, "1"));
        stage.setBuildHistory(histories.get(i));
        stageInstanceModels.add(stage);
        stageInstanceModels.latestStage().setApprovedBy("cruise");
    }
    return stageInstanceModels;
}
Also used : StageIdentifier(com.thoughtworks.go.domain.StageIdentifier) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)

Aggregations

StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)20 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)13 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)7 Test (org.junit.Test)7 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)6 PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)4 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 JobHistory (com.thoughtworks.go.presentation.pipelinehistory.JobHistory)2 TimeProvider (com.thoughtworks.go.util.TimeProvider)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 NullStageHistoryItem (com.thoughtworks.go.presentation.pipelinehistory.NullStageHistoryItem)1 InstanceFactory (com.thoughtworks.go.server.service.InstanceFactory)1 ArrayList (java.util.ArrayList)1