use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnLogXmlParserTest method shouldParseLogEntryWithoutComment.
@Test
public void shouldParseLogEntryWithoutComment() throws ParseException {
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> materialRevisions = parser.parse("<?xml version=\"1.0\"?>\n" + "<log>\n" + "<logentry\n" + " revision=\"3\">\n" + "<author>cceuser</author>\n" + "<date>2008-03-11T07:52:41.162075Z</date>\n" + "<paths>\n" + "<path\n" + " action=\"A\">/trunk/revision3.txt</path>\n" + "</paths>\n" + "</logentry>\n" + "</log>", "", new SAXBuilder());
assertThat(materialRevisions.size(), is(1));
Modification mod = materialRevisions.get(0);
assertThat(mod.getRevision(), is("3"));
assertThat(mod.getComment(), is(nullValue()));
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnLogXmlParserTest method shouldParseLogWithEmptyRevision.
@Test
public void shouldParseLogWithEmptyRevision() throws ParseException {
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> materialRevisions = parser.parse("<?xml version=\"1.0\"?>\n" + "<log>\n" + "<logentry\n" + " revision=\"2\">\n" + "</logentry>\n" + "<logentry\n" + " revision=\"3\">\n" + "<author>cceuser</author>\n" + "<date>2008-03-11T07:52:41.162075Z</date>\n" + "<paths>\n" + "<path\n" + " action=\"A\">/trunk/revision3.txt</path>\n" + "</paths>\n" + "</logentry>\n" + "</log>", "", new SAXBuilder());
assertThat(materialRevisions.size(), is(1));
Modification mod = materialRevisions.get(0);
assertThat(mod.getRevision(), is("3"));
assertThat(mod.getComment(), is(nullValue()));
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnCommandRemoteTest method shouldMaskPassword_remoteInfo.
@Test
public void shouldMaskPassword_remoteInfo() {
try {
badUserNameCommand().remoteInfo(new SAXBuilder());
fail("should have failed");
} catch (Exception e) {
assertThat("Plain text password detected!", e.getMessage().contains(HARRYS_PASSWORD), Is.is(false));
}
try {
badPasswordCommand().remoteInfo(new SAXBuilder());
fail("should have failed");
} catch (Exception e) {
assertThat("Plain text password detected!", e.getMessage().contains("some_bad_password"), Is.is(false));
}
try {
badUrlCommand().remoteInfo(new SAXBuilder());
fail("should have failed");
} catch (Exception e) {
assertThat("Plain text password detected!", e.getMessage().contains(HARRYS_PASSWORD), Is.is(false));
}
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnCommandRemoteTest method shouldSupportSvnInfo.
@Test
public void shouldSupportSvnInfo() throws Exception {
SvnCommand.SvnInfo info = command.remoteInfo(new SAXBuilder());
assertThat(info.getUrl(), is(repository.getUrl()));
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnCommandTest method shouldParseSvnInfoWithUTF8ChineseNameInUrl.
@Test
public void shouldParseSvnInfoWithUTF8ChineseNameInUrl() throws Exception {
String output = "<?xml version=\"1.0\"?>\n" + "<info>\n" + "<entry\n" + " kind=\"dir\"\n" + " path=\"司徒空在此\"\n" + " revision=\"4\">\n" + "<url>file:///home/cceuser/bigfs/projects/cruise/common/test-resources/unit/data/svnrepo/end2end/%E5%8F%B8%E5%BE%92%E7%A9%BA%E5%9C%A8%E6%AD%A4</url>\n" + "<repository>\n" + "<root>file:///home/cceuser/bigfs/projects/cruise/common/test-resources/unit/data/svnrepo/end2end</root>\n" + "<uuid>f953918e-915c-4459-8d4c-83860cce9d9a</uuid>\n" + "</repository>\n" + "<commit\n" + " revision=\"4\">\n" + "<author></author>\n" + "<date>2009-05-31T04:14:44.223393Z</date>\n" + "</commit>\n" + "</entry>\n" + "</info>";
SvnCommand.SvnInfo svnInfo = new SvnCommand.SvnInfo();
svnInfo.parse(output, new SAXBuilder());
assertThat(svnInfo.getPath(), is("/司徒空在此"));
assertThat(svnInfo.getUrl(), is("file:///home/cceuser/bigfs/projects/cruise/common/test-resources/unit/data/svnrepo/end2end/%E5%8F%B8%E5%BE%92%E7%A9%BA%E5%9C%A8%E6%AD%A4"));
}
Aggregations