Search in sources :

Example 31 with UrlArgument

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));
}
Also used : UrlArgument(com.thoughtworks.go.util.command.UrlArgument) MaterialConfigs(com.thoughtworks.go.config.materials.MaterialConfigs) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) PluggableSCMMaterialConfig(com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig) GitMaterialConfig(com.thoughtworks.go.config.materials.git.GitMaterialConfig) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) HgMaterialConfig(com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) DependencyMaterialConfig(com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) ScmMaterialConfig(com.thoughtworks.go.config.materials.ScmMaterialConfig) MergePipelineConfigs(com.thoughtworks.go.config.merge.MergePipelineConfigs) Test(org.junit.Test)

Example 32 with UrlArgument

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));
}
Also used : UrlArgument(com.thoughtworks.go.util.command.UrlArgument) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString) Map(java.util.Map)

Example 33 with UrlArgument

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));
}
Also used : UrlArgument(com.thoughtworks.go.util.command.UrlArgument) Map(java.util.Map)

Example 34 with UrlArgument

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);
    }
}
Also used : UrlArgument(com.thoughtworks.go.util.command.UrlArgument) Map(java.util.Map)

Example 35 with UrlArgument

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);
}
Also used : UrlArgument(com.thoughtworks.go.util.command.UrlArgument) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Material(com.thoughtworks.go.domain.materials.Material) Test(org.junit.Test)

Aggregations

UrlArgument (com.thoughtworks.go.util.command.UrlArgument)63 Test (org.junit.Test)47 GoCipher (com.thoughtworks.go.security.GoCipher)37 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)9 ConfigSaveValidationContext (com.thoughtworks.go.config.ConfigSaveValidationContext)7 TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)7 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)5 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)5 Material (com.thoughtworks.go.domain.materials.Material)5 HgUrlArgument (com.thoughtworks.go.util.command.HgUrlArgument)5 File (java.io.File)5 Map (java.util.Map)5 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)4 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)4 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)4 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)4 TfsMaterial (com.thoughtworks.go.config.materials.tfs.TfsMaterial)4 InvalidCipherTextException (org.bouncycastle.crypto.InvalidCipherTextException)4 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)3 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)3