use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class CruiseConfigTestBase method getAllUniquePostCommitSchedulableMaterials_shouldReturnMaterialsWithAutoUpdateFalse.
@Test
public void getAllUniquePostCommitSchedulableMaterials_shouldReturnMaterialsWithAutoUpdateFalse() {
GitMaterialConfig gitAutoMaterial = MaterialConfigsMother.gitMaterialConfig("url");
PipelineConfig pipelineAuto = pipelineConfig("pipelineAuto", new MaterialConfigs(gitAutoMaterial));
GitMaterialConfig gitNonAutoMaterial = new GitMaterialConfig(new UrlArgument("other-url"), "master", "dest", false, null, false, null, new CaseInsensitiveString("git"), false);
PipelineConfig pipelineTriggerable = pipelineConfig("pipelineTriggerable", new MaterialConfigs(gitNonAutoMaterial));
PipelineConfigs defaultGroup = createGroup("defaultGroup", pipelineAuto, pipelineTriggerable);
cruiseConfig.getGroups().add(defaultGroup);
Set<MaterialConfig> materials = cruiseConfig.getAllUniquePostCommitSchedulableMaterials();
assertThat(materials.size(), is(1));
assertThat(materials, hasItem(gitNonAutoMaterial));
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class GitMaterialConfig method setConfigAttributes.
@Override
public void setConfigAttributes(Object attributes) {
if (attributes == null) {
return;
}
super.setConfigAttributes(attributes);
Map map = (Map) attributes;
if (map.containsKey(BRANCH)) {
String branchName = (String) map.get(BRANCH);
this.branch = StringUtils.isBlank(branchName) ? DEFAULT_BRANCH : branchName;
}
if (map.containsKey(URL)) {
this.url = new UrlArgument((String) map.get(URL));
}
this.shallowClone = "true".equals(map.get(SHALLOW_CLONE));
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class SvnMaterialConfig 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 UrlArgument((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);
}
this.checkExternals = "true".equals(map.get(CHECK_EXTERNALS));
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class TfsMaterialConfig 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 UrlArgument((String) map.get(URL));
}
if (map.containsKey(USERNAME)) {
this.userName = (String) map.get(USERNAME);
}
if (map.containsKey(DOMAIN)) {
this.domain = (String) map.get(DOMAIN);
}
if (map.containsKey(PASSWORD_CHANGED) && "1".equals(map.get(PASSWORD_CHANGED))) {
String passwordToSet = (String) map.get(PASSWORD);
resetPassword(passwordToSet);
}
if (map.containsKey(PROJECT_PATH)) {
this.projectPath = (String) map.get(PROJECT_PATH);
}
}
use of com.thoughtworks.go.util.command.UrlArgument in project gocd by gocd.
the class GitPostCommitHookImplementerTest method shouldReturnEmptyListIfParamHasNoValueForRepoURL.
@Test
public void shouldReturnEmptyListIfParamHasNoValueForRepoURL() throws Exception {
GitMaterial material1 = mock(GitMaterial.class);
when(material1.getUrlArgument()).thenReturn(new UrlArgument("https://machine.local.git"));
Set<Material> materials = new HashSet<>(Arrays.asList(material1));
HashMap params = new HashMap();
params.put(GitPostCommitHookImplementer.REPO_URL_PARAM_KEY, "");
Set<Material> actual = implementer.prune(materials, params);
assertThat(actual.size(), is(0));
verifyNoMoreInteractions(material1);
}
Aggregations