use of com.thoughtworks.go.config.materials.Materials 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.materials.Materials 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));
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldHaveServerAndPortAndViewAndUseTicketsInP4Materials.
@Test
public void shouldHaveServerAndPortAndViewAndUseTicketsInP4Materials() throws SQLException {
String p4view = "//depot/... //localhost/...";
Materials p4Materials = MaterialsMother.p4Materials(p4view);
P4Material p4Material = (P4Material) p4Materials.first();
p4Material.setUseTickets(true);
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(p4Materials.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();
assertThat(materials.get(0), is(p4Material));
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldStoreAndRetrieveDependencyMaterials.
@Test
public void shouldStoreAndRetrieveDependencyMaterials() throws SQLException {
DependencyMaterial dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString("pipeline-name"), new CaseInsensitiveString("stage-name"));
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(new MaterialConfigs(dependencyMaterial.config()));
MaterialRevisions materialRevisions = new MaterialRevisions();
materialRevisions.addRevision(DependencyMaterialRevision.create("pipeline-name", -12, "1234", "stage-name", 1).convert(dependencyMaterial, new Date()));
Pipeline pipeline = instanceFactory.createPipelineInstance(pipelineConfig, BuildCause.createManualForced(materialRevisions, Username.ANONYMOUS), new DefaultSchedulingContext(DEFAULT_APPROVED_BY), md5, new TimeProvider());
assertNotInserted(pipeline.getId());
savePipeline(pipeline);
Pipeline pipelineFromDB = pipelineDao.loadPipeline(pipeline.getId());
final Materials materials = pipelineFromDB.getMaterials();
assertThat(materials.get(0), is(dependencyMaterial));
}
use of com.thoughtworks.go.config.materials.Materials 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"));
}
Aggregations