Search in sources :

Example 31 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig 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 : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Example 32 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldStoreAndRetrieveMultipleSvnMaterials.

@Test
public void shouldStoreAndRetrieveMultipleSvnMaterials() throws SQLException {
    SvnMaterial svnMaterial1 = svnMaterial("svnUrl1", "folder1");
    SvnMaterial svnMaterial2 = svnMaterial("svnUrl2", "folder2");
    PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
    pipelineConfig.setMaterialConfigs(new MaterialConfigs(svnMaterial1.config(), svnMaterial2.config()));
    Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(modifyOneFile(pipelineConfig), Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
    assertNotInserted(pipeline.getId());
    savePipeline(pipeline);
    Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
    Materials materials = pipelineFromDB.getMaterials();
    assertThat(materials, hasItem((Material) svnMaterial1));
    assertThat(materials, hasItem((Material) svnMaterial2));
}
Also used : MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) PipelineConfig(com.thoughtworks.go.config.PipelineConfig) TimeProvider(com.thoughtworks.go.util.TimeProvider) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Materials(com.thoughtworks.go.config.materials.Materials) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) MaterialsMother.svnMaterial(com.thoughtworks.go.helper.MaterialsMother.svnMaterial) ScmMaterial(com.thoughtworks.go.config.materials.ScmMaterial) Material(com.thoughtworks.go.domain.materials.Material) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) Test(org.junit.jupiter.api.Test)

Example 33 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldReturnCurrentPauseStateOfPipeline.

@Test
public void shouldReturnCurrentPauseStateOfPipeline() throws Exception {
    PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("some-pipeline", "dev");
    schedulePipelineWithStages(mingleConfig);
    PipelinePauseInfo expected = new PipelinePauseInfo(false, null, null);
    PipelinePauseInfo actual = pipelineDao.pauseState(mingleConfig.name().toString());
    assertThat(actual, is(expected));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) Test(org.junit.jupiter.api.Test)

Example 34 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig 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 : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Example 35 with PipelineConfig

use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.

the class PipelineSqlMapDaoIntegrationTest method shouldReturnStageIdIfAStageOfPipelineIdPassed.

@Test
public void shouldReturnStageIdIfAStageOfPipelineIdPassed() throws SQLException {
    String pipelineName = "some-pipeline";
    PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig(pipelineName);
    Pipeline pipeline = dbHelper.schedulePipelineWithAllStages(pipelineConfig, ModificationsMother.modifySomeFiles(pipelineConfig));
    dbHelper.pass(pipeline);
    String stage = pipelineConfig.get(0).name().toString();
    assertThat(pipelineDao.latestPassedStageIdentifier(pipeline.getId(), stage), is(new StageIdentifier(pipelineName, pipeline.getCounter(), pipeline.getLabel(), stage, "1")));
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Test(org.junit.jupiter.api.Test)

Aggregations

PipelineConfig (com.thoughtworks.go.config.PipelineConfig)285 Test (org.junit.jupiter.api.Test)185 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)142 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)52 TimeProvider (com.thoughtworks.go.util.TimeProvider)33 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)24 Test (org.junit.Test)23 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)21 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)19 PipelineConfigs (com.thoughtworks.go.config.PipelineConfigs)17 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)16 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)15 Materials (com.thoughtworks.go.config.materials.Materials)14 Date (java.util.Date)14 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)13 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)13 StageConfig (com.thoughtworks.go.config.StageConfig)12 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)12 Pipeline (com.thoughtworks.go.domain.Pipeline)12 Modification (com.thoughtworks.go.domain.materials.Modification)12