Search in sources :

Example 6 with StageInstanceModels

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

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

the class PipelineHistoryMother method singlePipeline.

public static PipelineInstanceModel singlePipeline(String pipelineName, StageInstanceModel stage) {
    StageInstanceModels stageInstanceModels = new StageInstanceModels();
    stageInstanceModels.add(stage);
    return singlePipeline(pipelineName, stageInstanceModels, new Date());
}
Also used : StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) Date(java.util.Date)

Example 8 with StageInstanceModels

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

the class PipelineHistoryItemMother method custom.

public static PipelineInstanceModel custom(String... stageNames) {
    PipelineInstanceModel pipelineInstanceModel = PipelineInstanceModel.createEmptyModel();
    pipelineInstanceModel.setStageHistory(new StageInstanceModels());
    for (String stageName : stageNames) {
        StageInstanceModel stageHistoryItem = new StageInstanceModel();
        stageHistoryItem.setName(stageName);
        pipelineInstanceModel.getStageHistory().add(stageHistoryItem);
    }
    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 9 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 10 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)

Aggregations

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