use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnCommandTest method buildMockSvnMaterial.
private SvnMaterial buildMockSvnMaterial(String url, String username, String password) {
final SvnMaterial svnMaterial = mock(SvnMaterial.class);
when(svnMaterial.getUrl()).thenReturn(url);
when(svnMaterial.getUserName()).thenReturn(username);
when(svnMaterial.getPassword()).thenReturn(password);
return svnMaterial;
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldBeAbleToConvertToJson.
@Test
public void shouldBeAbleToConvertToJson() {
SvnMaterial material = MaterialsMother.svnMaterial("url");
Map<String, Object> json = new LinkedHashMap<>();
material.toJson(json, revision);
JsonValue jsonValue = from(json);
assertThat(jsonValue.getString("scmType"), is("Subversion"));
assertThat(new File(jsonValue.getString("location")), is(new File(material.getUrl())));
assertThat(jsonValue.getString("action"), is("Modified"));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldReturnNotEqualsWhenCheckExternalsIsChanged.
@Test
public void shouldReturnNotEqualsWhenCheckExternalsIsChanged() throws Exception {
SvnMaterial material = MaterialsMother.svnMaterial("url", "svnDir", null, null, true, "*.txt");
SvnMaterial other = MaterialsMother.svnMaterial("url", "svnDir", null, null, false, "*.txt");
assertThat(material, is(not(other)));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldApplyThePatternDirectly.
@Test
public void shouldApplyThePatternDirectly() throws Exception {
SvnMaterial material = MaterialsMother.svnMaterial();
assertThat(material.matches("/a.doc", "/a.doc"), is(true));
}
use of com.thoughtworks.go.config.materials.svn.SvnMaterial in project gocd by gocd.
the class SvnMaterialTest method shouldNotDecryptSvnPasswordIfPasswordIsNotNull.
@Test
public void shouldNotDecryptSvnPasswordIfPasswordIsNotNull() throws Exception {
GoCipher mockGoCipher = mock(GoCipher.class);
when(mockGoCipher.encrypt("password")).thenReturn("encrypted");
when(mockGoCipher.decrypt("encrypted")).thenReturn("password");
SvnMaterial material = new SvnMaterial("/foo", "username", "password", false, mockGoCipher);
material.ensureEncrypted();
when(mockGoCipher.encrypt("new_password")).thenReturn("new_encrypted");
material.setPassword("new_password");
when(mockGoCipher.decrypt("new_encrypted")).thenReturn("new_password");
assertThat(material.getPassword(), is("new_password"));
}
Aggregations