use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldHaveUrlInGitMaterials.
@Test
public void shouldHaveUrlInGitMaterials() throws SQLException {
Materials gitMaterials = MaterialsMother.gitMaterials("gitUrl");
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(gitMaterials.convertToConfigs());
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();
GitMaterial gitMaterial = (GitMaterial) materials.get(0);
assertThat(gitMaterial.getUrl(), is("gitUrl"));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldUnPauseAPausedPipeline.
@Test
public void shouldUnPauseAPausedPipeline() throws Exception {
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("some-pipeline", "dev");
schedulePipelineWithStages(mingleConfig);
pipelineDao.pause(mingleConfig.name().toString(), "cause", "by");
pipelineDao.unpause(mingleConfig.name().toString());
PipelinePauseInfo actual = pipelineDao.pauseState(mingleConfig.name().toString());
PipelinePauseInfo expected = new PipelinePauseInfo(false, null, null);
assertThat(actual, is(expected));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldThrowExceptionWhenBuildCauseIsAskedForAPipelineWithInvalidCounter.
@Test
public void shouldThrowExceptionWhenBuildCauseIsAskedForAPipelineWithInvalidCounter() {
String pipelineName = "P1";
PipelineConfig pipelineConfig = PipelineConfigMother.createPipelineConfigWithStages(pipelineName, "S1");
String username = "username";
BuildCause manualForced = BuildCause.createManualForced(modifyOneFile(pipelineConfig), new Username(new CaseInsensitiveString(username)));
Pipeline pipeline = dbHelper.schedulePipeline(pipelineConfig, manualForced, username, new TimeProvider());
dbHelper.pass(pipeline);
BuildCause buildCause = pipelineDao.findBuildCauseOfPipelineByNameAndCounter(pipelineName, 1);
assertThat(buildCause, is(notNullValue()));
try {
pipelineDao.findBuildCauseOfPipelineByNameAndCounter(pipelineName, 10);
fail("should have thrown RecordNotFoundException");
} catch (Exception e) {
assertThat(e instanceof RecordNotFoundException, is(true));
assertThat(e.getMessage(), is("Pipeline P1 with counter 10 was not found"));
}
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldStoreAndRetrieveHgMaterialsFromDatabase.
@Test
public void shouldStoreAndRetrieveHgMaterialsFromDatabase() throws SQLException {
Materials materials = MaterialsMother.hgMaterials("hgUrl", "hgdir");
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(materials.convertToConfigs());
final MaterialRevisions originalMaterialRevision = multipleModificationsInHg(pipelineConfig);
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(originalMaterialRevision, Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
save(pipeline);
Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
final MaterialRevisions materialRevisions = pipelineFromDB.getBuildCause().getMaterialRevisions();
assertEquals(originalMaterialRevision, materialRevisions);
assertThat(materialRevisions.getMaterialRevision(0).getRevision().getRevision(), is("9fdcf27f16eadc362733328dd481d8a2c29915e1"));
assertThat(pipelineFromDB.getMaterials(), is(materials));
}
use of com.thoughtworks.go.config.PipelineConfig in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldReturnPageNumberOfThePageInWhichThePIMWouldBePresent.
@Test
public void shouldReturnPageNumberOfThePageInWhichThePIMWouldBePresent() throws Exception {
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("some-pipeline", "dev");
Pipeline pipeline1 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline2 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline3 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline4 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline5 = schedulePipelineWithStages(mingleConfig);
assertThat(pipelineDao.getPageNumberForCounter("some-pipeline", pipeline4.getCounter(), 1), is(2));
assertThat(pipelineDao.getPageNumberForCounter("some-pipeline", pipeline5.getCounter(), 1), is(1));
assertThat(pipelineDao.getPageNumberForCounter("some-pipeline", pipeline1.getCounter(), 2), is(3));
assertThat(pipelineDao.getPageNumberForCounter("some-pipeline", pipeline2.getCounter(), 3), is(2));
assertThat(pipelineDao.getPageNumberForCounter("some-pipeline", pipeline3.getCounter(), 10), is(1));
}
Aggregations