use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldPassEqualsCheckIfFingerprintIsSame.
@Test
public void shouldPassEqualsCheckIfFingerprintIsSame() {
PluggableSCMMaterial material1 = MaterialsMother.pluggableSCMMaterial();
material1.setName(new CaseInsensitiveString("name1"));
PluggableSCMMaterial material2 = MaterialsMother.pluggableSCMMaterial();
material2.setName(new CaseInsensitiveString("name2"));
assertThat(material1.equals(material2), is(true));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldReturnWorkingDirectoryCorrectly.
@Test
public void shouldReturnWorkingDirectoryCorrectly() {
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setFolder("dest");
String baseFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();
String workingFolder = new File(baseFolder, "dest").getAbsolutePath();
assertThat(material.workingDirectory(new File(baseFolder)).getAbsolutePath(), is(workingFolder));
material.setFolder(null);
assertThat(material.workingDirectory(new File(baseFolder)).getAbsolutePath(), is(baseFolder));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldGetAttributesForXml.
@Test
public void shouldGetAttributesForXml() {
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);
Map<String, Object> attributesForXml = material.getAttributesForXml();
assertThat(attributesForXml.get("type").toString(), is(PluggableSCMMaterial.class.getSimpleName()));
assertThat(attributesForXml.get("scmName").toString(), is("scm-name"));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldFailEqualsCheckIfFingerprintDiffers.
@Test
public void shouldFailEqualsCheckIfFingerprintDiffers() {
PluggableSCMMaterial material1 = MaterialsMother.pluggableSCMMaterial();
material1.getScmConfig().getConfiguration().first().setConfigurationValue(new ConfigurationValue("new-url"));
PluggableSCMMaterial material2 = MaterialsMother.pluggableSCMMaterial();
assertThat(material1.equals(material2), is(false));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class MaterialAgentFactoryTest method shouldGetPluggableSCMMaterialAgent.
@Test
public void shouldGetPluggableSCMMaterialAgent() {
File workingDirectory = new File("/tmp/workingDirectory");
MaterialRevision revision = new MaterialRevision(new PluggableSCMMaterial(), new Modifications());
MaterialAgentFactory factory = new MaterialAgentFactory(null, workingDirectory, null, packageRepositoryExtension, scmExtension);
MaterialAgent agent = factory.createAgent(revision);
assertThat(agent instanceof PluggableSCMMaterialAgent, is(true));
assertThat(ReflectionUtil.getField(agent, "scmExtension"), is(scmExtension));
assertThat(ReflectionUtil.getField(agent, "revision"), is(revision));
assertThat(ReflectionUtil.getField(agent, "workingDirectory"), is(workingDirectory));
}
Aggregations