use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class MaterialRevisionTest method shouldUseLatestMaterial.
@Test
public void shouldUseLatestMaterial() throws Exception {
MaterialRevision original = new MaterialRevision(hgMaterial, hgMaterial.modificationsSince(workingFolder, REVISION_0, new TestSubprocessExecutionContext()));
HgMaterial newMaterial = MaterialsMother.hgMaterial(hgMaterial.getUrl());
newMaterial.setFilter(new Filter(new IgnoredFiles("**/*.txt")));
final MaterialRevision after = findNewRevision(original, newMaterial, workingFolder, new TestSubprocessExecutionContext());
assertThat(after.getMaterial(), is(newMaterial));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class MaterialRevisionTest method shouldIncludeJavaFileWithSemanticallyEqualsIgnoreFilter.
@Test
public void shouldIncludeJavaFileWithSemanticallyEqualsIgnoreFilter() throws Exception {
MaterialRevision original = new MaterialRevision(hgMaterial, hgMaterial.modificationsSince(workingFolder, REVISION_0, new TestSubprocessExecutionContext()));
Filter filter = new Filter(new IgnoredFiles("**/*.doc"), new IgnoredFiles("*.doc"));
GoConfigMother.createPipelineConfig(filter, (ScmMaterialConfig) hgMaterial.config());
checkInFiles(hgMaterial, "A.java");
checkInFiles(hgMaterial, "B.doc");
checkInFiles(hgMaterial, "C.pdf");
MaterialRevision newRev = findNewRevision(original, hgMaterial, workingFolder, new TestSubprocessExecutionContext());
assertThat(newRev.filter(original), is(newRev));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class SCMConfigXmlLoaderTest method shouldReadFolderAndFilterForPluggableSCMMaterialConfig.
@Test
public void shouldReadFolderAndFilterForPluggableSCMMaterialConfig() throws Exception {
String xml = "<cruise schemaVersion='" + GoConstants.CONFIG_SCHEMA_VERSION + "'>\n" + "<scms>\n" + " <scm id='scm-id' name='scm-name'>\n" + " <pluginConfiguration id='plugin-id' version='1.0'/>\n" + " <configuration>\n" + " <property>\n" + " <key>url</key>\n" + " <value>http://go</value>\n" + " </property>\n" + " </configuration>\n" + " </scm>\n" + " </scms>" + "<pipelines group=\"group_name\">\n" + " <pipeline name=\"new_name\">\n" + " <materials>\n" + " <scm ref='scm-id' dest='dest'>\n" + " <filter>\n" + " <ignore pattern=\"x\"/>\n" + " <ignore pattern=\"y\"/>\n" + " </filter>\n" + " </scm>\n" + " </materials>\n" + " <stage name=\"stage_name\">\n" + " <jobs>\n" + " <job name=\"job_name\" />\n" + " </jobs>\n" + " </stage>\n" + " </pipeline>\n" + "</pipelines></cruise>";
GoConfigHolder goConfigHolder = xmlLoader.loadConfigHolder(xml);
PipelineConfig pipelineConfig = goConfigHolder.config.pipelineConfigByName(new CaseInsensitiveString("new_name"));
PluggableSCMMaterialConfig pluggableSCMMaterialConfig = (PluggableSCMMaterialConfig) pipelineConfig.materialConfigs().get(0);
assertThat(pluggableSCMMaterialConfig.getSCMConfig(), is(goConfigHolder.config.getSCMs().get(0)));
assertThat(pluggableSCMMaterialConfig.getFolder(), is("dest"));
assertThat(pluggableSCMMaterialConfig.filter(), is(new Filter(new IgnoredFiles("x"), new IgnoredFiles("y"))));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldNotTriggerPipelineWhenOnlyValidChangesAreIgnoredFiles.
@Test
public void shouldNotTriggerPipelineWhenOnlyValidChangesAreIgnoredFiles() throws Exception {
// p1 <- SVN
// | /
// v v
// p2 <- git (BL)
SvnMaterial svn = u.wf(new SvnMaterial("url", "username", "password", false), "folder1");
u.checkinInOrder(svn, "s1", "s2");
GitMaterial git = u.wf(new GitMaterial("git"), "folder2");
git.setFilter(new Filter(new IgnoredFiles("ignored.txt")));
u.checkinInOrder(git, "g1");
u.checkinFile(git, "g2", new File("ignored.txt"), ModifiedAction.modified);
ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(svn));
ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(p1), u.m(svn), u.m(git));
String p1_1 = u.runAndPass(p1, "s1");
String p2_1 = u.runAndPass(p2, p1_1, "s1", "g1");
MaterialRevisions given = u.mrs(new MaterialRevision[] { u.mr(p1, false, p1_1), u.mr(svn, true, "s2"), u.mr(git, true, "g2") });
MaterialRevisions previousRevisions = u.mrs(new MaterialRevision[] { u.mr(p1, false, p1_1), u.mr(svn, true, "s1"), u.mr(git, true, "g1") });
AutoBuild autoBuild = new AutoBuild(goConfigService, pipelineService, p2.config.name().toString(), systemEnvironment, materialChecker);
pipelineTimeline.update();
BuildCause buildCause = autoBuild.onModifications(given, false, previousRevisions);
assertThat(buildCause, is(nullValue()));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class AutoTriggerDependencyResolutionTest method shouldTriggerPipelineWhenThereAreOnlyIgnoredChanges_WithFanInOff.
@Test
public void shouldTriggerPipelineWhenThereAreOnlyIgnoredChanges_WithFanInOff() throws Exception {
// p1 <- git (BL)
// | /
// v v
// p2
SystemEnvironment env = mock(SystemEnvironment.class);
when(env.enforceRevisionCompatibilityWithUpstream()).thenReturn(false);
GitMaterial git = u.wf(new GitMaterial("git"), "folder2");
git.setFilter(new Filter(new IgnoredFiles("ignored.txt")));
u.checkinInOrder(git, "g1");
u.checkinFile(git, "g2", new File("ignored.txt"), ModifiedAction.modified);
ScheduleTestUtil.AddedPipeline p1 = u.saveConfigWith("p1", u.m(git));
ScheduleTestUtil.AddedPipeline p2 = u.saveConfigWith("p2", u.m(p1), u.m(git));
String p1_1 = u.runAndPass(p1, "g1");
String p2_1 = u.runAndPass(p2, p1_1, "g1");
MaterialRevisions given = u.mrs(new MaterialRevision[] { u.mr(p1, false, p1_1), u.mr(git, true, "g2") });
MaterialRevisions previousRevisions = u.mrs(new MaterialRevision[] { u.mr(p1, true, p1_1), u.mr(git, true, "g1") });
AutoBuild autoBuild = new AutoBuild(goConfigService, pipelineService, p2.config.name().toString(), env, materialChecker);
pipelineTimeline.update();
BuildCause buildCause = autoBuild.onModifications(given, true, previousRevisions);
assertThat(buildCause, is(notNullValue()));
assertThat(buildCause.getMaterialRevisions(), is(given));
}
Aggregations