use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldGetUriForDisplayNameIfNameIsNull.
@Test
public void shouldGetUriForDisplayNameIfNameIsNull() {
ConfigurationProperty k1 = ConfigurationPropertyMother.create("k1", false, "scm-v1");
ConfigurationProperty k2 = ConfigurationPropertyMother.create("k2", false, "scm-v2");
SCM scmConfig = SCMMother.create("scm-id", null, "pluginid", "version", new Configuration(k1, k2));
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setSCMConfig(scmConfig);
assertThat(material.getDisplayName(), is(material.getUriForDisplay()));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldGetJsonRepresentationForPluggableSCMMaterial.
@Test
public void shouldGetJsonRepresentationForPluggableSCMMaterial() {
ConfigurationProperty k1 = create("k1", false, "v1");
SCM scmConfig = SCMMother.create("scm-id", "scm-name", "pluginid", "version", new Configuration(k1));
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setSCMConfig(scmConfig);
material.setFolder("folder");
Map<String, String> jsonMap = new LinkedHashMap<>();
material.toJson(jsonMap, new PluggableSCMMaterialRevision("rev123", new Date()));
assertThat(jsonMap.get("scmType"), is("SCM"));
assertThat(jsonMap.get("materialName"), is("scm-name"));
assertThat(jsonMap.get("location"), is(material.getUriForDisplay()));
assertThat(jsonMap.get("folder"), is("folder"));
assertThat(jsonMap.get("action"), is("Modified"));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldGetEmailContentForPluggableSCMMaterial.
@Test
public void shouldGetEmailContentForPluggableSCMMaterial() {
ConfigurationProperty k1 = ConfigurationPropertyMother.create("k1", false, "v1");
SCM scmConfig = SCMMother.create("scm-id", "scm-name", "pluginid", "version", new Configuration(k1));
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setSCMConfig(scmConfig);
StringBuilder content = new StringBuilder();
Date date = new Date(1367472329111L);
material.emailContent(content, new Modification(null, "comment", null, date, "rev123"));
assertThat(content.toString(), is(String.format("SCM : scm-name\nrevision: rev123, completed on %s\ncomment", date.toString())));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method createPluggableSCMMaterialWithSecureConfiguration.
private PluggableSCMMaterial createPluggableSCMMaterialWithSecureConfiguration() {
PluggableSCMMaterial material = MaterialsMother.pluggableSCMMaterial();
material.getScmConfig().getConfiguration().get(1).handleSecureValueConfiguration(true);
return material;
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldReturnSomethingMoreSaneForToString.
@Test
public void shouldReturnSomethingMoreSaneForToString() throws Exception {
PluggableSCMMaterial material = MaterialsMother.pluggableSCMMaterial();
SCMMetadataStore.getInstance().addMetadataFor(material.getPluginId(), new SCMConfigurations(), null);
assertThat(material.toString(), is("'PluggableSCMMaterial{[k1=v1, k2=v2]}'"));
}
Aggregations