Search in sources :

Example 16 with MaterialConfig

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));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) Test(org.junit.Test)

Example 17 with MaterialConfig

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));
}
Also used : GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 18 with MaterialConfig

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));
}
Also used : Filter(com.thoughtworks.go.config.materials.Filter) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) Test(org.junit.Test)

Example 19 with MaterialConfig

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()));
}
Also used : Filter(com.thoughtworks.go.config.materials.Filter) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) SCM(com.thoughtworks.go.domain.scm.SCM) Test(org.junit.Test)

Example 20 with MaterialConfig

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);
}
Also used : MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Aggregations

MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)133 Test (org.junit.Test)81 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)72 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)61 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)46 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)42 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)33 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)32 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)32 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)29 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)29 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)21 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)16 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)14 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)13 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)13 Filter (com.thoughtworks.go.config.materials.Filter)11 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)10 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)10 Material (com.thoughtworks.go.domain.materials.Material)9