use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.
the class MagicalGoConfigXmlWriterTest method shouldNotThrowUpWhenTfsWorkspaceIsNotSpecified.
@Test
public void shouldNotThrowUpWhenTfsWorkspaceIsNotSpecified() {
CruiseConfig cruiseConfig = GoConfigMother.configWithPipelines("tfs_pipeline");
PipelineConfig tfs_pipeline = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString("tfs_pipeline"));
tfs_pipeline.materialConfigs().clear();
tfs_pipeline.addMaterialConfig(new TfsMaterialConfig(new GoCipher(), new UrlArgument("http://tfs.com"), "username", "CORPORATE", "password", "$/project_path"));
try {
xmlWriter.write(cruiseConfig, output, false);
} catch (Exception e) {
fail("should not fail as workspace name is not mandatory anymore " + e);
}
}
use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.
the class CruiseConfigTestBase method shouldReturnAllUniqueSchedulableScmMaterials.
@Test
public void shouldReturnAllUniqueSchedulableScmMaterials() {
final MaterialConfig svnMaterialConfig = new SvnMaterialConfig("http://svn_url_1", "username", "password", false);
svnMaterialConfig.setAutoUpdate(false);
final MaterialConfig svnMaterialConfigWithAutoUpdate = new SvnMaterialConfig("http://svn_url_2", "username", "password", false);
svnMaterialConfigWithAutoUpdate.setAutoUpdate(true);
final MaterialConfig hgMaterialConfig = new HgMaterialConfig("http://hg_url", null);
hgMaterialConfig.setAutoUpdate(false);
final MaterialConfig gitMaterialConfig = new GitMaterialConfig("http://git_url");
gitMaterialConfig.setAutoUpdate(false);
final MaterialConfig tfsMaterialConfig = new TfsMaterialConfig(mock(GoCipher.class), new UrlArgument("http://tfs_url"), "username", "domain", "password", "project_path");
tfsMaterialConfig.setAutoUpdate(false);
final MaterialConfig p4MaterialConfig = new P4MaterialConfig("http://p4_url", "view", "username");
p4MaterialConfig.setAutoUpdate(false);
final MaterialConfig dependencyMaterialConfig = MaterialConfigsMother.dependencyMaterialConfig();
final PluggableSCMMaterialConfig pluggableSCMMaterialConfig = MaterialConfigsMother.pluggableSCMMaterialConfig("scm-id-1", null, null);
pluggableSCMMaterialConfig.getSCMConfig().setAutoUpdate(false);
final PipelineConfig p1 = PipelineConfigMother.pipelineConfig("pipeline1", new MaterialConfigs(svnMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p2 = PipelineConfigMother.pipelineConfig("pipeline2", new MaterialConfigs(svnMaterialConfig, gitMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p3 = PipelineConfigMother.pipelineConfig("pipeline3", new MaterialConfigs(hgMaterialConfig, dependencyMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p4 = PipelineConfigMother.pipelineConfig("pipeline4", new MaterialConfigs(p4MaterialConfig, pluggableSCMMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
final PipelineConfig p5 = PipelineConfigMother.pipelineConfig("pipeline5", new MaterialConfigs(svnMaterialConfigWithAutoUpdate, tfsMaterialConfig), new JobConfigs(new JobConfig(new CaseInsensitiveString("jobName"))));
cruiseConfig.getGroups().add(new BasicPipelineConfigs(p1, p2, p3, p4, p5));
final Set<MaterialConfig> materials = cruiseConfig.getAllUniquePostCommitSchedulableMaterials();
assertThat(materials.size(), is(6));
assertThat(materials, hasItems(svnMaterialConfig, hgMaterialConfig, gitMaterialConfig, tfsMaterialConfig, p4MaterialConfig, pluggableSCMMaterialConfig));
assertThat(materials, not(hasItem(svnMaterialConfigWithAutoUpdate)));
}
use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldSetTfsConfigAttributesForMaterial.
@Test
public void shouldSetTfsConfigAttributesForMaterial() {
MaterialConfigs materialConfigs = new MaterialConfigs();
Map<String, String> tfsAttrMap = new HashMap<>();
tfsAttrMap.put(TfsMaterialConfig.URL, "foo");
tfsAttrMap.put(TfsMaterialConfig.USERNAME, "bar");
tfsAttrMap.put(TfsMaterialConfig.PASSWORD, "baz");
tfsAttrMap.put(TfsMaterialConfig.PROJECT_PATH, "to_hell");
tfsAttrMap.put(TfsMaterialConfig.MATERIAL_NAME, "crapy_material");
tfsAttrMap.put(TfsMaterialConfig.DOMAIN, "CORPORATE");
Map<String, Object> attributeMap = new HashMap<>();
attributeMap.put(AbstractMaterialConfig.MATERIAL_TYPE, TfsMaterialConfig.TYPE);
attributeMap.put(TfsMaterialConfig.TYPE, tfsAttrMap);
materialConfigs.setConfigAttributes(attributeMap);
TfsMaterialConfig tfsMaterialConfig = new TfsMaterialConfig(new GoCipher(), new UrlArgument("foo"), "bar", "CORPORATE", "baz", "to_hell");
tfsMaterialConfig.setName(new CaseInsensitiveString("crapy_material"));
assertThat(materialConfigs.first(), is(tfsMaterialConfig));
assertThat(tfsMaterialConfig.getPassword(), is("baz"));
}
use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.
the class MaterialConfigsTest method shouldValidateTree.
@Test
public void shouldValidateTree() {
GitMaterialConfig git = new GitMaterialConfig();
git.setName(new CaseInsensitiveString("mat-name"));
SvnMaterialConfig svn = new SvnMaterialConfig("url", true);
svn.setName(new CaseInsensitiveString("mat-name"));
P4MaterialConfig p4 = new P4MaterialConfig();
TfsMaterialConfig tfs = new TfsMaterialConfig();
HgMaterialConfig hg = new HgMaterialConfig();
MaterialConfigs materialConfigs = new MaterialConfigs(git, svn, p4, tfs, hg);
PipelineConfig pipelineConfig = new PipelineConfig(new CaseInsensitiveString("p1"), new MaterialConfigs(svn));
materialConfigs.validateTree(PipelineConfigSaveValidationContext.forChain(true, "group", new BasicCruiseConfig(new BasicPipelineConfigs(pipelineConfig)), pipelineConfig));
assertThat(git.errors().on(GitMaterialConfig.MATERIAL_NAME), contains("You have defined multiple materials called 'mat-name'"));
assertThat(git.errors().on(GitMaterialConfig.URL), is("URL cannot be blank"));
assertThat(svn.errors().on(SvnMaterialConfig.MATERIAL_NAME), contains("You have defined multiple materials called 'mat-name'"));
assertThat(p4.errors().on(P4MaterialConfig.VIEW), contains("P4 view cannot be empty."));
assertThat(tfs.errors().on(TfsMaterialConfig.URL), contains("URL cannot be blank"));
assertThat(hg.errors().on(HgMaterialConfig.URL), is("URL cannot be blank"));
}
use of com.thoughtworks.go.config.materials.tfs.TfsMaterialConfig in project gocd by gocd.
the class MaterialConfigsMother method tfsMaterialConfig.
public static TfsMaterialConfig tfsMaterialConfig() {
Filter filter = new Filter(new IgnoredFiles("**/*.html"), new IgnoredFiles("**/foobar/"));
TfsMaterialConfig tfsMaterialConfig = new TfsMaterialConfig(new GoCipher(), new UrlArgument("http://10.4.4.101:8080/tfs/Sample"), "loser", "some_domain", "passwd", "walk_this_path");
tfsMaterialConfig.setFilter(filter);
tfsMaterialConfig.setName(new CaseInsensitiveString("tfs-material"));
tfsMaterialConfig.setFolder("dest-folder");
return tfsMaterialConfig;
}
Aggregations