Search in sources :

Example 21 with StageInstanceModels

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

the class PipelineSqlMapDaoIntegrationTest method shouldLoadPipelineHistories.

@Test
public void shouldLoadPipelineHistories() throws Exception {
    String dev = "dev";
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", dev);
    Pipeline mingle = schedulePipelineWithStages(mingleConfig);
    Stage firstStage = mingle.getFirstStage();
    Pipeline mingle2 = schedulePipelineWithStages(mingleConfig);
    JobInstance instance = firstStage.getJobInstances().first();
    jobInstanceDao.ignore(instance);
    PipelineInstanceModels pipelineHistories = pipelineDao.loadHistory(mingle.getName(), 10, 0);
    assertThat(pipelineHistories.size(), is(2));
    StageInstanceModels stageHistories = pipelineHistories.first().getStageHistory();
    assertThat(stageHistories.size(), is(1));
    StageInstanceModel history = stageHistories.first();
    assertThat(history.getName(), is(dev));
    assertThat(history.getApprovalType(), is(GoConstants.APPROVAL_SUCCESS));
    assertThat(history.getBuildHistory().size(), is(2));
    assertThat(pipelineHistories.get(1).getName(), is("mingle"));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) Test(org.junit.Test)

Example 22 with StageInstanceModels

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

the class PipelineSqlMapDaoIntegrationTest method shouldMaintainStageOrderAndHistoryAfterGettingPipelineDependencyGraph.

@Test
public void shouldMaintainStageOrderAndHistoryAfterGettingPipelineDependencyGraph() throws Exception {
    PipelineConfig shineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("shine", "1stStage", "2ndStage");
    Pipeline shineInstance = dbHelper.newPipelineWithFirstStageFailed(shineConfig);
    dbHelper.scheduleStage(shineInstance, shineConfig.get(1), 1);
    PipelineDependencyGraphOld dependencyGraph = pipelineDao.pipelineGraphByNameAndCounter("shine", 1);
    assertPipelineEquals(shineInstance, dependencyGraph.pipeline());
    StageInstanceModels models = dependencyGraph.pipeline().getStageHistory();
    assertThat(models.size(), is(2));
    assertThat(models.get(0).getName(), is("1stStage"));
    assertThat(models.get(1).getName(), is("2ndStage"));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) Test(org.junit.Test)

Example 23 with StageInstanceModels

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

the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithEmptyDefaultIfNone.

@Test
public void shouldLoadPipelineHistoryWithEmptyDefaultIfNone() throws Exception {
    configHelper.setViewPermissionForGroup("group1", "jez");
    PipelineInstanceModels history = pipelineHistoryService.loadWithEmptyAsDefault(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 1), "jez");
    assertThat(history.size(), is(1));
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat(stageHistory.size(), is(3));
    assertStageHistory(stageHistory.get(0), false, true);
    assertStageHistory(stageHistory.get(1), false, false);
    assertStageHistory(stageHistory.get(2), false, false);
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) Test(org.junit.Test)

Example 24 with StageInstanceModels

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

the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithPlaceholderStagesPopulated.

@Test
public void shouldLoadPipelineHistoryWithPlaceholderStagesPopulated() throws Exception {
    pipelineOne.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
    PipelineInstanceModels history = pipelineHistoryService.load(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), "jez", true);
    StageInstanceModels stageHistory = history.first().getStageHistory();
    assertThat("Should populate 2 placeholder stages from config", stageHistory.size(), is(3));
    assertThat(stageHistory.first().isScheduled(), is(true));
    assertThat(stageHistory.first().isAutoApproved(), is(true));
    assertThat(stageHistory.first().getCanRun(), is(true));
    assertThat(stageHistory.get(1).isScheduled(), is(false));
    assertThat(stageHistory.get(1).isAutoApproved(), is(false));
    assertThat("The first future stage should can run", stageHistory.get(1).getCanRun(), is(true));
    assertThat(stageHistory.get(2).isScheduled(), is(false));
    assertThat(stageHistory.get(2).isAutoApproved(), is(true));
    assertThat("The second future stage should can not run", stageHistory.get(2).getCanRun(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) Test(org.junit.Test)

Example 25 with StageInstanceModels

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

the class PipelineHistoryServiceIntegrationTest method shouldLoadPipelineHistoryWithPlaceholderStagesPopulated_loadMinimalData.

@Test
public void shouldLoadPipelineHistoryWithPlaceholderStagesPopulated_loadMinimalData() throws Exception {
    pipelineOne.createPipelineWithFirstStagePassedAndSecondStageHasNotStarted();
    HttpOperationResult result = new HttpOperationResult();
    PipelineInstanceModels pipelineInstanceModels = pipelineHistoryService.loadMinimalData(pipelineOne.pipelineName, Pagination.pageStartingAt(0, 1, 10), new Username(new CaseInsensitiveString("admin1")), result);
    StageInstanceModels stageHistory = pipelineInstanceModels.first().getStageHistory();
    assertThat("Should populate 2 placeholder stages from config", stageHistory.size(), is(3));
    assertThat(stageHistory.first().isScheduled(), is(true));
    assertThat(stageHistory.first().isAutoApproved(), is(true));
    assertThat(stageHistory.first().getCanRun(), is(true));
    assertThat(stageHistory.get(1).isScheduled(), is(false));
    assertThat(stageHistory.get(1).isAutoApproved(), is(false));
    assertThat("The first future stage should can run", stageHistory.get(1).getCanRun(), is(true));
    assertThat(stageHistory.get(2).isScheduled(), is(false));
    assertThat(stageHistory.get(2).isAutoApproved(), is(true));
    assertThat("The second future stage should can not run", stageHistory.get(2).getCanRun(), is(false));
}
Also used : HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Username(com.thoughtworks.go.server.domain.Username) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) 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