use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class HealthStateScopeTest method shouldRemoveScopeWhenMaterialIsRemovedFromConfig.
@Test
public void shouldRemoveScopeWhenMaterialIsRemovedFromConfig() throws Exception {
HgMaterialConfig hgMaterialConfig = MaterialConfigsMother.hgMaterialConfig();
CruiseConfig config = GoConfigMother.pipelineHavingJob("blahPipeline", "blahStage", "blahJob", "fii", "baz");
config.pipelineConfigByName(new CaseInsensitiveString("blahPipeline")).addMaterialConfig(hgMaterialConfig);
assertThat(HealthStateScope.forMaterialConfig(hgMaterialConfig).isRemovedFromConfig(config), is(false));
assertThat(HealthStateScope.forMaterial(MaterialsMother.svnMaterial("file:///bar")).isRemovedFromConfig(config), is(true));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ConfigConverterTest method shouldConvertHgMaterialWhenWhitelist.
@Test
public void shouldConvertHgMaterialWhenWhitelist() {
CRHgMaterial crHgMaterial = new CRHgMaterial("name", "folder", true, true, filter, "url");
HgMaterialConfig hgMaterialConfig = (HgMaterialConfig) configConverter.toMaterialConfig(crHgMaterial, context);
assertThat(hgMaterialConfig.getName().toLower(), is("name"));
assertThat(hgMaterialConfig.getFolder(), is("folder"));
assertThat(hgMaterialConfig.getAutoUpdate(), is(true));
assertThat(hgMaterialConfig.isInvertFilter(), is(true));
assertThat(hgMaterialConfig.getFilterAsString(), is("filter"));
assertThat(hgMaterialConfig.getUrl(), is("url"));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ConfigConverterTest method shouldConvertHgMaterialWhenEmptyName.
@Test
public void shouldConvertHgMaterialWhenEmptyName() {
CRHgMaterial crHgMaterial = new CRHgMaterial("", "folder", true, false, filter, "url");
HgMaterialConfig hgMaterialConfig = (HgMaterialConfig) configConverter.toMaterialConfig(crHgMaterial, context);
assertNull(hgMaterialConfig.getName());
assertThat(hgMaterialConfig.getFolder(), is("folder"));
assertThat(hgMaterialConfig.getAutoUpdate(), is(true));
assertThat(hgMaterialConfig.getFilterAsString(), is("filter"));
assertThat(hgMaterialConfig.getUrl(), is("url"));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ConfigConverterTest method shouldConvertHgMaterial.
@Test
public void shouldConvertHgMaterial() {
CRHgMaterial crHgMaterial = new CRHgMaterial("name", "folder", true, false, filter, "url");
HgMaterialConfig hgMaterialConfig = (HgMaterialConfig) configConverter.toMaterialConfig(crHgMaterial, context);
assertThat(hgMaterialConfig.getName().toLower(), is("name"));
assertThat(hgMaterialConfig.getFolder(), is("folder"));
assertThat(hgMaterialConfig.getAutoUpdate(), is(true));
assertThat(hgMaterialConfig.getFilterAsString(), is("filter"));
assertThat(hgMaterialConfig.getUrl(), is("url"));
}
use of com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig in project gocd by gocd.
the class ConfigConverterTest method shouldConvertConfigMaterialWhenConfigRepoIsHgWithDestination.
@Test
public void shouldConvertConfigMaterialWhenConfigRepoIsHgWithDestination() {
// 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", "dest1", null);
MaterialConfig materialConfig = configConverter.toMaterialConfig(crConfigMaterial, context);
assertThat("shouldSetMaterialNameAsInConfigRepoSourceCode", materialConfig.getName().toLower(), is("example"));
assertThat("shouldUseFolderFromConfigRepoWhenSpecified", materialConfig.getFolder(), is("dest1"));
HgMaterialConfig hgMaterialConfig = (HgMaterialConfig) materialConfig;
assertThat(hgMaterialConfig.getAutoUpdate(), is(true));
assertThat(hgMaterialConfig.getFilterAsString(), is("ignore"));
assertThat(hgMaterialConfig.getUrl(), is("url"));
}
Aggregations