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));
}
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"));
}
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");
}
}
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")));
}
Aggregations