use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ConfigConverterTest method shouldConvertConfigMaterialWhenConfigRepoIsHg.
@Test
public void shouldConvertConfigMaterialWhenConfigRepoIsHg() {
// these parameters would be configured inside xml config-repo section
HgMaterialConfig configRepoMaterial = new HgMaterialConfig(new HgUrlArgument("url"), true, new Filter(new IgnoredFiles("ignore")), false, "folder", new CaseInsensitiveString("name"));
when(context.configMaterial()).thenReturn(configRepoMaterial);
CRConfigMaterial crConfigMaterial = new CRConfigMaterial("example", null, null);
MaterialConfig materialConfig = configConverter.toMaterialConfig(crConfigMaterial, context);
assertThat("shouldSetMaterialNameAsInConfigRepoSourceCode", materialConfig.getName().toLower(), is("example"));
assertThat("shouldUseFolderFromXMLWhenConfigRepoHasNone", materialConfig.getFolder(), is("folder"));
HgMaterialConfig hgMaterialConfig = (HgMaterialConfig) materialConfig;
assertThat(hgMaterialConfig.getAutoUpdate(), is(true));
assertThat(hgMaterialConfig.getFilterAsString(), is("ignore"));
assertThat(hgMaterialConfig.getUrl(), is("url"));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class GoConfigDaoTestBase method shouldFeedCloneOfConfigBackToCommand.
@Test
public void shouldFeedCloneOfConfigBackToCommand() throws Exception {
CheckedTestUpdateCommand command = new CheckedTestUpdateCommand(cachedGoConfig.loadForEditing().getMd5(), true) {
@Override
public CruiseConfig update(CruiseConfig cruiseConfig) throws Exception {
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("foo"), "#{bar}-${COUNT}", null, false, new MaterialConfigs(new HgMaterialConfig("url", null)), a(StageConfigMother.custom("stage", "job")));
pipelineConfig.addParam(new ParamConfig("bar", "baz"));
cruiseConfig.addPipeline("my-group", pipelineConfig);
return cruiseConfig;
}
};
goConfigDao.updateConfig(command);
assertThat(command.after.pipelineConfigByName(new CaseInsensitiveString("foo")).getLabelTemplate(), is("baz-${COUNT}"));
assertThat(command.after.getEnvironments().size(), is(0));
command.after.addEnvironment("bar");
assertThat(cachedGoConfig.currentConfig().getEnvironments().size(), is(0));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ModificationsTest method shouldIgnoreModificationsIfInvertFilterAndSpecificFileNotChanged2.
@Test
public void shouldIgnoreModificationsIfInvertFilterAndSpecificFileNotChanged2() {
HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig();
Filter filter = new Filter(Arrays.asList(new IgnoredFiles("foo/bar.baz")));
materialConfig.setFilter(filter);
materialConfig.setInvertFilter(true);
Modifications modifications = new Modifications(multipleCheckin(aCheckIn("100", "a.java", "foo", "bar.baz", "foo/bar.qux")));
assertThat(modifications.shouldBeIgnoredByFilterIn(materialConfig), is(true));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ModificationsTest method shouldIgnoreModificationsIfAllTheIgnoresMatch.
@Test
public void shouldIgnoreModificationsIfAllTheIgnoresMatch() {
HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig();
Filter filter = new Filter(Arrays.asList(new IgnoredFiles("*.doc"), new IgnoredFiles("*.pdf")));
materialConfig.setFilter(filter);
assertThat(new Modifications(multipleCheckin(aCheckIn("100", "a.doc", "a.pdf"))).shouldBeIgnoredByFilterIn(materialConfig), is(true));
assertThat(new Modifications(multipleCheckin(aCheckIn("100", "a.doc", "a.doc"))).shouldBeIgnoredByFilterIn(materialConfig), is(true));
assertThat(new Modifications(multipleCheckin(aCheckIn("100", "a.pdf", "b.pdf"), aCheckIn("100", "a.doc", "b.doc"))).shouldBeIgnoredByFilterIn(materialConfig), is(true));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ModificationsTest method shouldIncludeModificationsIfInvertFilterAndSpecificIsChanged.
@Test
public void shouldIncludeModificationsIfInvertFilterAndSpecificIsChanged() {
HgMaterialConfig materialConfig = MaterialConfigsMother.hgMaterialConfig();
Filter filter = new Filter(Arrays.asList(new IgnoredFiles("foo/bar.baz")));
materialConfig.setFilter(filter);
materialConfig.setInvertFilter(true);
Modifications modifications = new Modifications(multipleCheckin(aCheckIn("101", "foo/bar.baz")));
assertThat(modifications.shouldBeIgnoredByFilterIn(materialConfig), is(false));
}
Aggregations