use of com.thoughtworks.go.util.command.HgUrlArgument in project gocd by gocd.
the class HgMaterialConfig method setConfigAttributes.
@Override
public void setConfigAttributes(Object attributes) {
if (attributes == null) {
return;
}
super.setConfigAttributes(attributes);
Map map = (Map) attributes;
if (map.containsKey(URL)) {
this.url = new HgUrlArgument((String) map.get(URL));
}
if (map.containsKey("userName")) {
this.userName = (String) map.get("userName");
}
if (map.containsKey(PASSWORD_CHANGED) && "1".equals(map.get(PASSWORD_CHANGED))) {
String passwordToSet = (String) map.get(PASSWORD);
resetPassword(passwordToSet);
}
if (map.containsKey(BRANCH)) {
setBranchAttribute((String) map.get(BRANCH));
}
}
use of com.thoughtworks.go.util.command.HgUrlArgument in project gocd by gocd.
the class ConfigConverterTest method shouldConvertConfigMaterialWhenConfigRepoIsHgWithDestination.
@Test
void shouldConvertConfigMaterialWhenConfigRepoIsHgWithDestination() {
// these parameters would be configured inside xml config-repo section
HgMaterialConfig configRepoMaterial = hg(new HgUrlArgument("url"), null, null, null, 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, new SCMs());
assertThat(materialConfig.getName().toLower()).as("shouldSetMaterialNameAsInConfigRepoSourceCode").isEqualTo("example");
assertThat(materialConfig.getFolder()).as("shouldUseFolderFromConfigRepoWhenSpecified").isEqualTo("dest1");
HgMaterialConfig hgMaterialConfig = (HgMaterialConfig) materialConfig;
assertThat(hgMaterialConfig.getAutoUpdate()).isTrue();
assertThat(hgMaterialConfig.getFilterAsString()).isEqualTo("ignore");
assertThat(hgMaterialConfig.getUrl()).isEqualTo("url");
}
use of com.thoughtworks.go.util.command.HgUrlArgument in project gocd by gocd.
the class ConfigConverterTest method shouldConvertConfigMaterialWhenConfigRepoIsHg.
@Test
void shouldConvertConfigMaterialWhenConfigRepoIsHg() {
// these parameters would be configured inside xml config-repo section
HgMaterialConfig configRepoMaterial = hg(new HgUrlArgument("url"), null, null, null, 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, new SCMs());
assertThat(materialConfig.getName().toLower()).as("shouldSetMaterialNameAsInConfigRepoSourceCode").isEqualTo("example");
assertThat(materialConfig.getFolder()).as("shouldUseFolderFromXMLWhenConfigRepoHasNone").isEqualTo("folder");
HgMaterialConfig hgMaterialConfig = (HgMaterialConfig) materialConfig;
assertThat(hgMaterialConfig.getAutoUpdate()).isTrue();
assertThat(hgMaterialConfig.getFilterAsString()).isEqualTo("ignore");
assertThat(hgMaterialConfig.getUrl()).isEqualTo("url");
}
Aggregations