use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method autoUpdateShouldBeTrueByDefault.
@Test
public void autoUpdateShouldBeTrueByDefault() throws Exception {
MaterialConfig hgMaterial = xmlLoader.fromXmlPartial("<hg url=\"file:///tmp/testSvnRepo/project1/trunk\"/>", HgMaterialConfig.class);
assertThat(hgMaterial.isAutoUpdate(), is(true));
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldLoadMaterialWithAutoUpdate.
@Test
public void shouldLoadMaterialWithAutoUpdate() throws Exception {
MaterialConfig material = xmlLoader.fromXmlPartial("<hg url=\"file:///tmp/testSvnRepo/project1/trunk\" autoUpdate=\"false\"/>", HgMaterialConfig.class);
assertThat(material.isAutoUpdate(), is(false));
material = xmlLoader.fromXmlPartial("<git url=\"file:///tmp/testSvnRepo/project1/trunk\" autoUpdate=\"false\"/>", GitMaterialConfig.class);
assertThat(material.isAutoUpdate(), is(false));
material = xmlLoader.fromXmlPartial("<svn url=\"file:///tmp/testSvnRepo/project1/trunk\" autoUpdate=\"false\"/>", SvnMaterialConfig.class);
assertThat(material.isAutoUpdate(), is(false));
material = xmlLoader.fromXmlPartial("<p4 port='localhost:1666' autoUpdate='false' ><view/></p4>", P4MaterialConfig.class);
assertThat(material.isAutoUpdate(), is(false));
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class MagicalGoConfigXmlLoaderTest method shouldLoadIgnoresFromP4Partial.
@Test
public void shouldLoadIgnoresFromP4Partial() throws Exception {
String gitPartial = "<p4 port=\"localhost:8080\">\n" + " <filter>\n" + " <ignore pattern=\"x\"/>\n" + " </filter>\n" + " <view></view>\n" + "</p4>";
MaterialConfig p4Material = xmlLoader.fromXmlPartial(toInputStream(gitPartial), P4MaterialConfig.class);
Filter parsedFilter = p4Material.filter();
Filter expectedFilter = new Filter();
expectedFilter.add(new IgnoredFiles("x"));
assertThat(parsedFilter, is(expectedFilter));
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class SCMConfigXmlWriterTest method shouldAllowSCMTypeMaterialForPipeline.
@Test
public void shouldAllowSCMTypeMaterialForPipeline() throws Exception {
CruiseConfig configToSave = new BasicCruiseConfig();
SCM scm = new SCM();
String scmId = "scm-id";
scm.setId(scmId);
scm.setName("name");
scm.setPluginConfiguration(new PluginConfiguration("plugin-id", "1.0"));
scm.setConfiguration(new Configuration(getConfigurationProperty("url", false, "http://go")));
configToSave.getSCMs().add(scm);
PluggableSCMMaterialConfig pluggableSCMMaterialConfig = new PluggableSCMMaterialConfig(scmId);
pluggableSCMMaterialConfig.setSCMConfig(scm);
configToSave.addPipeline("default", PipelineConfigMother.pipelineConfig("test", new MaterialConfigs(pluggableSCMMaterialConfig), new JobConfigs(new JobConfig("ls"))));
xmlWriter.write(configToSave, output, false);
GoConfigHolder goConfigHolder = xmlLoader.loadConfigHolder(output.toString());
PipelineConfig pipelineConfig = goConfigHolder.config.pipelineConfigByName(new CaseInsensitiveString("test"));
MaterialConfig materialConfig = pipelineConfig.materialConfigs().get(0);
assertThat(materialConfig instanceof PluggableSCMMaterialConfig, is(true));
assertThat(((PluggableSCMMaterialConfig) materialConfig).getScmId(), is(scmId));
assertThat(((PluggableSCMMaterialConfig) materialConfig).getSCMConfig(), is(scm));
assertThat(materialConfig.getFolder(), is(nullValue()));
assertThat(materialConfig.filter(), is(new Filter()));
}
use of com.thoughtworks.go.domain.materials.MaterialConfig in project gocd by gocd.
the class BuildCause method assertPipelineConfigAndMaterialRevisionMatch.
public void assertPipelineConfigAndMaterialRevisionMatch(PipelineConfig pipelineConfig) {
if (!pipelineConfig.isConfigOriginSameAsOneOfMaterials()) {
return;
}
// then config and code revision must both match
if (this.trigger.isForced()) {
// and possibility to specify revisions to run with
return;
}
RepoConfigOrigin repoConfigOrigin = (RepoConfigOrigin) pipelineConfig.getOrigin();
MaterialConfig configAndCodeMaterial = repoConfigOrigin.getMaterial();
// TODO if revision in any of the pipelines match
MaterialRevision revision = this.getMaterialRevisions().findRevisionForFingerPrint(configAndCodeMaterial.getFingerprint());
String revisionString = revision.getRevision().getRevision();
if (pipelineConfig.isConfigOriginFromRevision(revisionString)) {
return;
}
invalidRevision(repoConfigOrigin.getRevision(), revisionString);
}
Aggregations