use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class AutoBuildCauseTest method shouldReturnCorrectRevisionsIfUpstreamIgnoresAllTheModificationsAndFirstOrderMaterialNotChanged.
@Test
public void shouldReturnCorrectRevisionsIfUpstreamIgnoresAllTheModificationsAndFirstOrderMaterialNotChanged() throws Exception {
PipelineConfigDependencyGraph dependencyGraph = dependencyGraphOfDepthOne(MaterialConfigsMother.hgMaterialConfig(), MaterialConfigsMother.svnMaterialConfig());
String targetPipeline = dependencyGraph.getCurrent().name().toLower();
firstHgMaterial(dependencyGraph).setFilter(new Filter(new IgnoredFiles("**/*.xml")));
MaterialRevisions revisions = createHgMaterialWithMultipleRevisions(1, oneModifiedFile("2"));
MaterialRevisions firstOrderRevision = createSvnMaterialWithMultipleRevisions(1, oneModifiedFile("2"));
MaterialRevision dependencyRevision = dependencyMaterialRevision("up1", 1, "label", "first", 1, new Date());
revisions.addAll(firstOrderRevision);
revisions.addRevision(dependencyRevision);
dependencyRevision.markAsNotChanged();
firstOrderRevision.getMaterialRevision(0).markAsNotChanged();
revisions.getMaterialRevision(0).markAsChanged();
MaterialRevisions expectedRevisions = createHgMaterialWithMultipleRevisions(1, oneModifiedFile("2"));
expectedRevisions.addRevision(dependencyRevision);
when(goConfigService.upstreamDependencyGraphOf(targetPipeline, cruiseConfig)).thenReturn(dependencyGraph);
when(pipelineService.getRevisionsBasedOnDependencies(eq(revisions), eq(cruiseConfig), eq(dependencyGraph.getCurrent().name()))).thenReturn(expectedRevisions);
assertThat(new AutoBuild(goConfigService, pipelineService, targetPipeline, new SystemEnvironment(), materialChecker, serverHealthService).onModifications(revisions, false, null).getMaterialRevisions(), is(expectedRevisions));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class FilterTest method shouldInitializeFromDisplayString.
@Test
public void shouldInitializeFromDisplayString() {
assertThat(Filter.fromDisplayString("/foo/**.*,/another/**.*,bar"), is(new Filter(new IgnoredFiles("/foo/**.*"), new IgnoredFiles("/another/**.*"), new IgnoredFiles("bar"))));
assertThat(Filter.fromDisplayString("/foo/**.* , /another/**.*, bar "), is(new Filter(new IgnoredFiles("/foo/**.*"), new IgnoredFiles("/another/**.*"), new IgnoredFiles("bar"))));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class FilterTest method shouldConcatenateIgnoredFilesWithCommaWhenDisplaying.
@Test
public void shouldConcatenateIgnoredFilesWithCommaWhenDisplaying() {
Filter filter = new Filter(new IgnoredFiles("/foo/**.*"), new IgnoredFiles("/another/**.*"), new IgnoredFiles("bar"));
assertThat(filter.getStringForDisplay(), is("/foo/**.*,/another/**.*,bar"));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class FilterTest method shouldAddErrorToItsErrorCollection.
@Test
public void shouldAddErrorToItsErrorCollection() {
IgnoredFiles ignore = new IgnoredFiles("helper/*.*");
Filter filter = new Filter(ignore);
filter.addError("key", "some error");
assertThat(filter.errors().on("key"), is("some error"));
}
use of com.thoughtworks.go.config.materials.IgnoredFiles in project gocd by gocd.
the class ConfigConverterTest method shouldConvertConfigMaterialWhenConfigRepoIsGitWithBlacklist.
@Test
public void shouldConvertConfigMaterialWhenConfigRepoIsGitWithBlacklist() {
// this url would be configured inside xml config-repo section
GitMaterialConfig configRepoMaterial = new GitMaterialConfig("url");
when(context.configMaterial()).thenReturn(configRepoMaterial);
CRConfigMaterial crConfigMaterial = new CRConfigMaterial();
crConfigMaterial.setFilter(new CRFilter(filter, false));
MaterialConfig materialConfig = configConverter.toMaterialConfig(crConfigMaterial, context);
assertNull("shouldSetEmptyMaterialNameAsInConfigRepoSourceCode", materialConfig.getName());
GitMaterialConfig gitMaterialConfig = (GitMaterialConfig) materialConfig;
assertThat(gitMaterialConfig.getAutoUpdate(), is(true));
assertThat(gitMaterialConfig.getUrl(), is("url"));
assertNull(gitMaterialConfig.getFolder());
assertThat(gitMaterialConfig.getAutoUpdate(), is(true));
assertThat(gitMaterialConfig.isShallowClone(), is(false));
Filter blacklistFilter = new Filter(new IgnoredFiles("filter"));
assertThat(gitMaterialConfig.filter(), is(blacklistFilter));
assertThat(gitMaterialConfig.getUrl(), is("url"));
assertThat(gitMaterialConfig.getBranch(), is("master"));
}
Aggregations