Search in sources :

Example 11 with TfsMaterialConfig

use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.

the class IgnoreTest method shouldEscapeAllValidSpecialCharactersInPattern.

@Test
public void shouldEscapeAllValidSpecialCharactersInPattern() {
    // see mingle #5700
    hgMaterialConfig = new TfsMaterialConfig(new GoCipher());
    IgnoredFiles ignore = new IgnoredFiles("$/tfs_repo/Properties/*.*");
    assertThat(ignore.shouldIgnore(hgMaterialConfig, "$/tfs_repo" + separator + "Properties" + separator + "AssemblyInfo.cs"), is(true));
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) Test(org.junit.Test)

Example 12 with TfsMaterialConfig

use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.

the class MagicalGoConfigXmlLoaderTest method shouldMigrateEncryptedMaterialPasswordWithNewlineAndSpaces_XslMigrationFrom88To90.

@Test
public void shouldMigrateEncryptedMaterialPasswordWithNewlineAndSpaces_XslMigrationFrom88To90() throws Exception {
    String plainText = "something";
    String encryptedValue = new GoCipher().encrypt(plainText);
    String encryptedValueWithWhitespaceAndNewline = new StringBuilder(encryptedValue).insert(2, "\r\n" + "                        ").toString();
    String content = configWithPipeline("<pipeline name='some_pipeline'>" + "    <materials>" + "      <svn url='asdsa' username='user' encryptedPassword='" + encryptedValueWithWhitespaceAndNewline + "' dest='svn'>" + "<filter>\n" + "            <ignore pattern='**/*' />\n" + "          </filter>" + "</svn>" + "<tfs url='tfsurl' username='user' domain='domain' encryptedPassword='" + encryptedValueWithWhitespaceAndNewline + "' projectPath='path' dest='tfs' />" + "<p4 port='host:9999' username='user' encryptedPassword='" + encryptedValueWithWhitespaceAndNewline + "' dest='perforce'>\n" + "          <view><![CDATA[view]]></view>\n" + "        </p4>" + "    </materials>" + "  <stage name='some_stage'>" + "    <jobs>" + "      <job name='some_job'>" + "      </job>" + "    </jobs>" + "  </stage>" + "</pipeline>", 88);
    CruiseConfig config = ConfigMigrator.loadWithMigration(content).config;
    MaterialConfigs materialConfigs = config.allPipelines().get(0).materialConfigs();
    SvnMaterialConfig svnMaterialConfig = (SvnMaterialConfig) materialConfigs.get(0);
    assertThat(svnMaterialConfig.getPassword(), is(plainText));
    assertThat(svnMaterialConfig.getEncryptedPassword(), is(encryptedValue));
    assertThat(svnMaterialConfig.getFilterAsString(), is("**/*"));
    TfsMaterialConfig tfs = (TfsMaterialConfig) materialConfigs.get(1);
    assertThat(tfs.getPassword(), is(plainText));
    assertThat(tfs.getEncryptedPassword(), is(encryptedValue));
    assertThat(tfs.getUrl(), is("tfsurl"));
    P4MaterialConfig p4 = (P4MaterialConfig) materialConfigs.get(2);
    assertThat(p4.getPassword(), is(plainText));
    assertThat(p4.getEncryptedPassword(), is(encryptedValue));
    assertThat(p4.getServerAndPort(), is("host:9999"));
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) P4MaterialConfig(com.thoughtworks.go.config.materials.perforce.P4MaterialConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Test(org.junit.Test)

Example 13 with TfsMaterialConfig

use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.

the class MagicalGoConfigXmlLoaderTest method shouldMigrateConfigToSplitUsernameAndDomainAsAttributeOnTfsMaterial.

@Test
public void shouldMigrateConfigToSplitUsernameAndDomainAsAttributeOnTfsMaterial() {
    String content = configWithPipeline("<pipeline name='some_pipeline'>" + "    <materials>" + "      <tfs url='tfsurl' username='domain\\username' password='bar' projectPath='project-path' />" + "    </materials>" + "  <stage name='some_stage'>" + "    <jobs>" + "      <job name='some_job'>" + "      </job>" + "    </jobs>" + "  </stage>" + "</pipeline>", 52);
    try {
        CruiseConfig config = ConfigMigrator.loadWithMigration(content).config;
        PipelineConfig pipeline = config.pipelineConfigByName(new CaseInsensitiveString("some_pipeline"));
        TfsMaterialConfig material = (TfsMaterialConfig) pipeline.materialConfigs().get(0);
        assertThat(material.getUsername(), is("username"));
        assertThat(material.getDomain(), is("domain"));
    } catch (Exception e) {
        fail("Valid TFS tag for migration 51 and above");
    }
}
Also used : PipelineConfig(com.thoughtworks.go.config.PipelineConfig) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) GoConfigInvalidException(com.thoughtworks.go.config.exceptions.GoConfigInvalidException) Test(org.junit.Test)

Example 14 with TfsMaterialConfig

use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.

the class MagicalGoConfigXmlLoaderTest method shouldAllowTFSMaterial.

@Test
public void shouldAllowTFSMaterial() {
    String content = configWithPipeline("<pipeline name='some_pipeline'>" + "    <materials>" + "      <tfs url='tfsurl' username='foo' password='bar' projectPath='project-path' />" + "    </materials>" + "  <stage name='some_stage'>" + "    <jobs>" + "      <job name='some_job'>" + "      </job>" + "    </jobs>" + "  </stage>" + "</pipeline>", CONFIG_SCHEMA_VERSION);
    GoConfigHolder goConfigHolder = ConfigMigrator.loadWithMigration(content);
    MaterialConfigs materialConfigs = goConfigHolder.config.pipelineConfigByName(new CaseInsensitiveString("some_pipeline")).materialConfigs();
    assertThat(materialConfigs.size(), is(1));
    TfsMaterialConfig materialConfig = (TfsMaterialConfig) materialConfigs.get(0);
    assertThat(materialConfig, is(new TfsMaterialConfig(new GoCipher(), UrlArgument.create("tfsurl"), "foo", "", "bar", "project-path")));
}
Also used : GoCipher(com.thoughtworks.go.security.GoCipher) TfsMaterialConfig(com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig) Test(org.junit.Test)

Aggregations

TfsMaterialConfig (com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig)14 Test (org.junit.Test)12 GoCipher (com.thoughtworks.go.security.GoCipher)8 P4MaterialConfig (com.thoughtworks.go.config.materials.perforce.P4MaterialConfig)5 SvnMaterialConfig (com.thoughtworks.go.config.materials.svn.SvnMaterialConfig)5 UrlArgument (com.thoughtworks.go.util.command.UrlArgument)5 GitMaterialConfig (com.thoughtworks.go.config.materials.git.GitMaterialConfig)3 HgMaterialConfig (com.thoughtworks.go.config.materials.mercurial.HgMaterialConfig)3 GoConfigInvalidException (com.thoughtworks.go.config.exceptions.GoConfigInvalidException)2 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)2 HgUrlArgument (com.thoughtworks.go.util.command.HgUrlArgument)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 PackageMaterialConfig (com.thoughtworks.go.config.materials.PackageMaterialConfig)1 PluggableSCMMaterialConfig (com.thoughtworks.go.config.materials.PluggableSCMMaterialConfig)1 ScmMaterialConfig (com.thoughtworks.go.config.materials.ScmMaterialConfig)1 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)1 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)1 File (java.io.File)1 HashMap (java.util.HashMap)1