Search in sources :

Example 16 with PipelineInstanceModels

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

the class PipelineSqlMapDaoIntegrationTest method loadAllActivePipelinesPresentInConfigOnlyShouldBeCaseInsensitive.

@Test
public void loadAllActivePipelinesPresentInConfigOnlyShouldBeCaseInsensitive() throws Exception {
    PipelineConfig twistConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("twist", "dev", "ft");
    Pipeline twistPipeline = dbHelper.newPipelineWithAllStagesPassed(twistConfig);
    List<CaseInsensitiveString> allPipelineNames = goConfigDao.load().getAllPipelineNames();
    if (!allPipelineNames.contains(new CaseInsensitiveString("twist"))) {
        PipelineConfig pipelineConfigWithDifferentCase = PipelineMother.createPipelineConfig("TWIST", twistConfig.materialConfigs(), "dev", "ft");
        goConfigDao.addPipeline(pipelineConfigWithDifferentCase, "pipelinesqlmapdaotest");
    }
    PipelineInstanceModels pipelineHistories = pipelineDao.loadActivePipelines();
    assertThat(pipelineHistories.size(), is(1));
    assertThat(pipelineHistories.get(0).getId(), is(twistPipeline.getId()));
    assertThat(pipelineHistories.get(0).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 17 with PipelineInstanceModels

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

the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelinesPresentInConfigAndAlsoTheScheduledStagesOfPipelinesNotInConfig.

@Test
public void shouldLoadAllActivePipelinesPresentInConfigAndAlsoTheScheduledStagesOfPipelinesNotInConfig() throws Exception {
    PipelineConfig twistConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("twist", "dev", "ft");
    Pipeline twistPipeline = dbHelper.newPipelineWithAllStagesPassed(twistConfig);
    List<CaseInsensitiveString> allPipelineNames = goConfigDao.load().getAllPipelineNames();
    if (!allPipelineNames.contains(new CaseInsensitiveString("twist"))) {
        goConfigDao.addPipeline(twistConfig, "pipelinesqlmapdaotest");
    }
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev", "ft");
    if (!allPipelineNames.contains(new CaseInsensitiveString("mingle"))) {
        goConfigDao.addPipeline(mingleConfig, "pipelinesqlmapdaotest");
    }
    dbHelper.newPipelineWithAllStagesPassed(mingleConfig);
    Pipeline secondPipeline = dbHelper.newPipelineWithFirstStagePassed(mingleConfig);
    dbHelper.scheduleStage(secondPipeline, mingleConfig.get(1));
    Pipeline thirdPipeline = dbHelper.newPipelineWithFirstStageScheduled(mingleConfig);
    PipelineInstanceModels pipelineHistories = pipelineDao.loadActivePipelines();
    assertThat(pipelineHistories.size(), is(3));
    assertThat(pipelineHistories.get(0).getId(), is(thirdPipeline.getId()));
    assertThat(pipelineHistories.get(1).getId(), is(secondPipeline.getId()));
    assertThat(pipelineHistories.get(2).getId(), is(twistPipeline.getId()));
    assertThat(pipelineHistories.get(0).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 18 with PipelineInstanceModels

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

the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelinesEvenWhenThereIsStageStatusChange.

@Test
public void shouldLoadAllActivePipelinesEvenWhenThereIsStageStatusChange() throws Exception {
    PipelineConfig twistConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("twist", "dev", "ft");
    goConfigDao.addPipeline(twistConfig, "pipelinesqlmapdaotest");
    Pipeline twistPipeline = dbHelper.newPipelineWithAllStagesPassed(twistConfig);
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev", "ft");
    goConfigDao.addPipeline(mingleConfig, "pipelinesqlmapdaotest");
    final Pipeline firstPipeline = dbHelper.newPipelineWithAllStagesPassed(mingleConfig);
    final Pipeline secondPipeline = dbHelper.newPipelineWithFirstStagePassed(mingleConfig);
    dbHelper.scheduleStage(secondPipeline, mingleConfig.get(1));
    Pipeline thirdPipeline = dbHelper.newPipelineWithFirstStageScheduled(mingleConfig);
    Thread stageStatusChanger = new Thread() {

        @Override
        public void run() {
            for (; ; ) {
                pipelineDao.stageStatusChanged(secondPipeline.findStage("dev"));
                if (super.isInterrupted()) {
                    break;
                }
            }
        }
    };
    stageStatusChanger.setDaemon(true);
    stageStatusChanger.start();
    PipelineInstanceModels pipelineHistories = pipelineDao.loadActivePipelines();
    assertThat(pipelineHistories.size(), is(3));
    assertThat(pipelineHistories.get(0).getId(), is(thirdPipeline.getId()));
    assertThat(pipelineHistories.get(1).getId(), is(secondPipeline.getId()));
    assertThat(pipelineHistories.get(2).getId(), is(twistPipeline.getId()));
    assertThat(pipelineHistories.get(0).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
    stageStatusChanger.interrupt();
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 19 with PipelineInstanceModels

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

the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelines.

@Test
public void shouldLoadAllActivePipelines() throws Exception {
    PipelineConfig twistConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("twist", "dev", "ft");
    Pipeline twistPipeline = dbHelper.newPipelineWithAllStagesPassed(twistConfig);
    List<CaseInsensitiveString> allPipelineNames = goConfigDao.load().getAllPipelineNames();
    if (!allPipelineNames.contains(new CaseInsensitiveString("twist"))) {
        goConfigDao.addPipeline(twistConfig, "pipelinesqlmapdaotest");
    }
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev", "ft");
    if (!allPipelineNames.contains(new CaseInsensitiveString("mingle"))) {
        goConfigDao.addPipeline(mingleConfig, "pipelinesqlmapdaotest");
    }
    Pipeline firstPipeline = dbHelper.newPipelineWithAllStagesPassed(mingleConfig);
    Pipeline secondPipeline = dbHelper.newPipelineWithFirstStagePassed(mingleConfig);
    dbHelper.scheduleStage(secondPipeline, mingleConfig.get(1));
    Pipeline thirdPipeline = dbHelper.newPipelineWithFirstStageScheduled(mingleConfig);
    PipelineInstanceModels pipelineHistories = pipelineDao.loadActivePipelines();
    assertThat(pipelineHistories.size(), is(3));
    assertThat(pipelineHistories.get(0).getId(), is(thirdPipeline.getId()));
    assertThat(pipelineHistories.get(1).getId(), is(secondPipeline.getId()));
    assertThat(pipelineHistories.get(2).getId(), is(twistPipeline.getId()));
    assertThat(pipelineHistories.get(0).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 20 with PipelineInstanceModels

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

the class PipelineSqlMapDaoIntegrationTest method shouldLoadAllActivePipelinesPresentInConfigOnly.

@Test
public void shouldLoadAllActivePipelinesPresentInConfigOnly() throws Exception {
    PipelineConfig twistConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("twist", "dev", "ft");
    Pipeline twistPipeline = dbHelper.newPipelineWithAllStagesPassed(twistConfig);
    List<CaseInsensitiveString> allPipelineNames = goConfigDao.load().getAllPipelineNames();
    if (!allPipelineNames.contains(new CaseInsensitiveString("twist"))) {
        goConfigDao.addPipeline(twistConfig, "pipelinesqlmapdaotest");
    }
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev", "ft");
    dbHelper.newPipelineWithAllStagesPassed(mingleConfig);
    Pipeline minglePipeline = dbHelper.newPipelineWithFirstStagePassed(mingleConfig);
    PipelineInstanceModels pipelineHistories = pipelineDao.loadActivePipelines();
    assertThat(pipelineHistories.size(), is(1));
    assertThat(pipelineHistories.get(0).getId(), is(twistPipeline.getId()));
    assertThat(pipelineHistories.get(0).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
    if (!allPipelineNames.contains(new CaseInsensitiveString("mingle"))) {
        goConfigDao.addPipeline(mingleConfig, "pipelinesqlmapdaotest");
    }
    pipelineHistories = pipelineDao.loadActivePipelines();
    assertThat(pipelineHistories.size(), is(2));
    assertThat(pipelineHistories.get(0).getId(), is(minglePipeline.getId()));
    assertThat(pipelineHistories.get(1).getId(), is(twistPipeline.getId()));
    assertThat(pipelineHistories.get(1).getBuildCause().getMaterialRevisions().isEmpty(), is(false));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Aggregations

PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)45 Test (org.junit.Test)37 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)12 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)8 PipelineInstanceModels.createPipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels)4 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 PipelineNotFoundException (com.thoughtworks.go.config.PipelineNotFoundException)2 Permissions (com.thoughtworks.go.config.security.Permissions)2 Modification (com.thoughtworks.go.domain.materials.Modification)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Matchers.anyString (org.mockito.Matchers.anyString)2 SqlMapClientTemplate (org.springframework.orm.ibatis.SqlMapClientTemplate)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)1 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)1 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)1