use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldStoreAndRetrieveDependencyMaterialsWithMaxAllowedRevision.
@Test
public void shouldStoreAndRetrieveDependencyMaterialsWithMaxAllowedRevision() throws SQLException {
char[] name = new char[255];
for (int i = 0; i < 255; i++) {
name[i] = 'a';
}
final String s = new String(name);
final String s1 = new String(name);
DependencyMaterial dependencyMaterial = new DependencyMaterial(new CaseInsensitiveString(s), new CaseInsensitiveString(s1));
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(new MaterialConfigs(dependencyMaterial.config()));
MaterialRevisions materialRevisions = new MaterialRevisions();
DependencyMaterialRevision revision = DependencyMaterialRevision.create(new String(name), -10, new String(name), new String(name), Integer.MAX_VALUE);
materialRevisions.addRevision(revision.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 shouldSupportMultipleP4Materials.
@Test
public void shouldSupportMultipleP4Materials() throws SQLException {
String p4view1 = "//depot1/... //localhost1/...";
String p4view2 = "//depot2/... //localhost2/...";
Material p4Material1 = MaterialsMother.p4Materials(p4view1).get(0);
Material p4Material2 = MaterialsMother.p4Materials(p4view2).get(0);
Materials materials = new Materials(p4Material1, p4Material2);
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(materials.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());
final Materials loaded = pipelineFromDB.getMaterials();
assertThat(loaded.get(0), is(p4Material1));
assertThat(loaded.get(1), is(p4Material2));
}
use of com.thoughtworks.go.config.materials.Materials in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldSupportBranchInGitMaterials.
@Test
public void shouldSupportBranchInGitMaterials() throws Exception {
Materials branchedMaterials = MaterialsMother.gitMaterials("gitUrl", "foo");
PipelineConfig pipelineConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
pipelineConfig.setMaterialConfigs(branchedMaterials.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.getBranch(), is("foo"));
}
Aggregations