use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldReturnFalseForIsUsedInFetchArtifact.
@Test
public void shouldReturnFalseForIsUsedInFetchArtifact() {
PluggableSCMMaterial material = new PluggableSCMMaterial();
assertThat(material.isUsedInFetchArtifact(new PipelineConfig()), is(false));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldReturnMatchedRevisionForPluggableSCMMaterial.
@Test
public void shouldReturnMatchedRevisionForPluggableSCMMaterial() {
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);
Date timestamp = new Date();
MatchedRevision matchedRevision = material.createMatchedRevision(new Modification("go", "comment", null, timestamp, "rev123"), "rev");
assertThat(matchedRevision.getShortRevision(), is("rev123"));
assertThat(matchedRevision.getLongRevision(), is("rev123"));
assertThat(matchedRevision.getCheckinTime(), is(timestamp));
assertThat(matchedRevision.getUser(), is("go"));
assertThat(matchedRevision.getComment(), is("comment"));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldNotThrowUpWhenAdditionalDataIsRandomJunkAndNotJSON.
@Test
public void shouldNotThrowUpWhenAdditionalDataIsRandomJunkAndNotJSON() {
ConfigurationProperty k1 = ConfigurationPropertyMother.create("k1", false, "v1");
SCM scmConfig = SCMMother.create("scm-id", "tw-dev", "pluginid", "version", new Configuration(k1));
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setSCMConfig(scmConfig);
material.setName(new CaseInsensitiveString("tw-dev:go-agent"));
Modifications modifications = new Modifications(new Modification("loser", "comment", "email", new Date(), "revision-123", "salkdfjdsa-jjgkj!!!vcxknbvkjk"));
EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
material.populateEnvironmentContext(environmentVariableContext, new MaterialRevision(material, modifications), null);
assertThat(environmentVariableContext.getProperty("GO_SCM_TW_DEV_GO_AGENT_LABEL"), is("revision-123"));
assertThat(environmentVariableContext.getProperty("GO_SCM_TW_DEV_GO_AGENT_K1"), is("v1"));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldGetDifferentFingerprintWhenPluginIdChanges.
@Test
public void shouldGetDifferentFingerprintWhenPluginIdChanges() {
SCM scmConfig = SCMMother.create("scm-id", "scm-name", "plugin-1", "version", new Configuration(ConfigurationPropertyMother.create("k1", false, "v1")));
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setSCMConfig(scmConfig);
SCM anotherSCMConfig = SCMMother.create("scm-id", "scm-name", "plugin-2", "version", new Configuration(ConfigurationPropertyMother.create("k1", false, "v1")));
PluggableSCMMaterial anotherMaterial = new PluggableSCMMaterial();
anotherMaterial.setSCMConfig(anotherSCMConfig);
assertThat(material.getFingerprint().equals(anotherMaterial.getFingerprint()), is(false));
}
use of com.thoughtworks.go.config.materials.PluggableSCMMaterial in project gocd by gocd.
the class PluggableSCMMaterialTest method shouldNotThrowUpWhenAdditionalDataIsNull.
@Test
public void shouldNotThrowUpWhenAdditionalDataIsNull() {
ConfigurationProperty k1 = ConfigurationPropertyMother.create("k1", false, "v1");
SCM scmConfig = SCMMother.create("scm-id", "tw-dev", "pluginid", "version", new Configuration(k1));
PluggableSCMMaterial material = new PluggableSCMMaterial();
material.setSCMConfig(scmConfig);
material.setName(new CaseInsensitiveString("tw-dev:go-agent"));
Modifications modifications = new Modifications(new Modification("loser", "comment", "email", new Date(), "revision-123", null));
EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext();
material.populateEnvironmentContext(environmentVariableContext, new MaterialRevision(material, modifications), null);
assertThat(environmentVariableContext.getProperty("GO_SCM_TW_DEV_GO_AGENT_LABEL"), is("revision-123"));
assertThat(environmentVariableContext.getProperty("GO_SCM_TW_DEV_GO_AGENT_K1"), is("v1"));
}
Aggregations