use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnCommand method getAllExternalURLs.
public List<SvnExternal> getAllExternalURLs() {
CommandLine svnExternalCommand = svn(true).withArgs("propget", "--non-interactive", "svn:externals", "-R").withArg(repositoryUrl);
ConsoleResult result = executeCommand(svnExternalCommand);
String svnExternalConsoleOut = result.outputAsString();
SvnInfo remoteInfo = remoteInfo(new SAXBuilder());
String repoUrl = remoteInfo.getUrl();
String repoRoot = remoteInfo.getRoot();
List<SvnExternal> svnExternalList = null;
try {
svnExternalList = new SvnExternalParser().parse(svnExternalConsoleOut, repoUrl, repoRoot);
} catch (RuntimeException e) {
throw (RuntimeException) result.smudgedException(e);
}
return svnExternalList;
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnCommand method getBuilder.
private SAXBuilder getBuilder() {
SAXBuilder saxBuilder = saxBuilderThreadLocal.get();
if (saxBuilder == null) {
saxBuilder = new SAXBuilder();
saxBuilderThreadLocal.set(saxBuilder);
}
return saxBuilder;
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnLogXmlParserTest method shouldGetAllModifiedFilesUnderRootPath.
@Test
public void shouldGetAllModifiedFilesUnderRootPath() {
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> materialRevisions = parser.parse(MULTIPLE_FILES, "", new SAXBuilder());
Modification mod = materialRevisions.get(0);
List<ModifiedFile> files = mod.getModifiedFiles();
assertThat(files.size(), is(2));
ModifiedFile file = files.get(0);
assertThat(file.getFileName(), is("/trunk/revision3.txt"));
assertThat(file.getAction(), is(ModifiedAction.added));
file = files.get(1);
assertThat(file.getFileName(), is("/branch/1.1/readme.txt"));
assertThat(file.getAction(), is(ModifiedAction.deleted));
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnLogXmlParserTest method shouldParse.
@Test
public void shouldParse() throws ParseException {
SvnLogXmlParser parser = new SvnLogXmlParser();
List<Modification> materialRevisions = parser.parse(XML, "", new SAXBuilder());
assertThat(materialRevisions.size(), is(1));
Modification mod = materialRevisions.get(0);
assertThat(mod.getRevision(), is("3"));
assertThat(mod.getUserName(), is("cceuser"));
assertThat(mod.getModifiedTime(), is(convertDate("2008-03-11T07:52:41.162075Z")));
assertThat(mod.getComment(), is("[Liyanhui & Gabbar] Checked in new file for test"));
List<ModifiedFile> files = mod.getModifiedFiles();
assertThat(files.size(), is(1));
ModifiedFile file = files.get(0);
assertThat(file.getFileName(), is("/trunk/revision3.txt"));
assertThat(file.getAction(), is(ModifiedAction.added));
}
use of org.jdom2.input.SAXBuilder in project gocd by gocd.
the class SvnLogXmlParserTest method shouldParseSvnInfoOutputToConstructUrlToRemoteUUIDMapping.
@Test
public void shouldParseSvnInfoOutputToConstructUrlToRemoteUUIDMapping() {
final SvnLogXmlParser svnLogXmlParser = new SvnLogXmlParser();
final String svnInfoOutput = "<?xml version=\"1.0\"?>\n" + "<info>\n" + "<entry\n" + " kind=\"dir\"\n" + " path=\"trunk\"\n" + " revision=\"3432\">\n" + "<url>http://gears.googlecode.com/svn/trunk</url>\n" + "<repository>\n" + "<root>http://gears.googlecode.com/svn</root>\n" + "<uuid>fe895e04-df30-0410-9975-d76d301b4276</uuid>\n" + "</repository>\n" + "<commit\n" + " revision=\"3430\">\n" + "<author>gears.daemon</author>\n" + "<date>2010-10-06T02:00:50.517477Z</date>\n" + "</commit>\n" + "</entry>\n" + "</info>";
final HashMap<String, String> map = svnLogXmlParser.parseInfoToGetUUID(svnInfoOutput, "http://gears.googlecode.com/svn/trunk", new SAXBuilder());
assertThat(map.size(), is(1));
assertThat(map.get("http://gears.googlecode.com/svn/trunk"), is("fe895e04-df30-0410-9975-d76d301b4276"));
}
Aggregations