use of org.omegat.filters3.Element in project gocd by gocd.
the class HgModificationSplitter method parseFiles.
private List<File> parseFiles(Element filesElement, String fileType) {
List files = filesElement.getChild(fileType).getChildren("file");
List<File> modifiedFiles = new ArrayList<>();
for (Iterator iterator = files.iterator(); iterator.hasNext(); ) {
Element node = (Element) iterator.next();
modifiedFiles.add(new File(org.apache.commons.lang.StringEscapeUtils.unescapeXml(node.getText())));
}
return modifiedFiles;
}
use of org.omegat.filters3.Element in project gocd by gocd.
the class HgModificationSplitter method parseChangeset.
private Modification parseChangeset(Element changeset) throws ParseException {
Date modifiedTime = DateUtils.parseRFC822(changeset.getChildText("date"));
String author = org.apache.commons.lang.StringEscapeUtils.unescapeXml(changeset.getChildText("author"));
String comment = org.apache.commons.lang.StringEscapeUtils.unescapeXml(changeset.getChildText("desc"));
String revision = changeset.getChildText("node");
Modification modification = new Modification(author, comment, null, modifiedTime, revision);
Element files = changeset.getChild("files");
List<File> modifiedFiles = parseFiles(files, "modified");
List<File> addedFiles = parseFiles(files, "added");
List<File> deletedFiles = parseFiles(files, "deleted");
modifiedFiles.removeAll(addedFiles);
modifiedFiles.removeAll(deletedFiles);
addModificationFiles(modification, ModifiedAction.added, addedFiles);
addModificationFiles(modification, ModifiedAction.deleted, deletedFiles);
addModificationFiles(modification, ModifiedAction.modified, modifiedFiles);
return modification;
}
use of org.omegat.filters3.Element in project gocd by gocd.
the class SvnLogXmlParser method parseDOMTree.
private List<Modification> parseDOMTree(Document document, String path) throws ParseException {
List<Modification> modifications = new ArrayList<>();
Element rootElement = document.getRootElement();
List logEntries = rootElement.getChildren("logentry");
for (Iterator iterator = logEntries.iterator(); iterator.hasNext(); ) {
Element logEntry = (Element) iterator.next();
Modification modification = parseLogEntry(logEntry, path);
if (modification != null) {
modifications.add(modification);
}
}
return modifications;
}
use of org.omegat.filters3.Element in project gocd by gocd.
the class SvnLogXmlParser method parseLogEntry.
private Modification parseLogEntry(Element logEntry, String path) throws ParseException {
Element logEntryPaths = logEntry.getChild("paths");
if (logEntryPaths == null) {
/* Path-based access control forbids us from learning
* details of this log entry, so skip it. */
return null;
}
Date modifiedTime = convertDate(logEntry.getChildText("date"));
String author = logEntry.getChildText("author");
String comment = logEntry.getChildText("msg");
String revision = logEntry.getAttributeValue("revision");
Modification modification = new Modification(author, comment, null, modifiedTime, revision);
List paths = logEntryPaths.getChildren("path");
for (Iterator iterator = paths.iterator(); iterator.hasNext(); ) {
Element node = (Element) iterator.next();
if (underPath(path, node.getText())) {
ModifiedAction action = convertAction(node.getAttributeValue("action"));
modification.createModifiedFile(node.getText(), null, action);
}
}
return modification;
}
use of org.omegat.filters3.Element in project gocd by gocd.
the class StageCctrayPresentationModelTest method shouldContainBuilds.
private void shouldContainBuilds(Element root) {
Element buildProject = findChildByName(root, "cruise :: ft :: firefox");
assertThat(buildProject, hasAttribute("activity", "Sleeping"));
assertThat(buildProject, hasAttribute("lastBuildStatus", "Success"));
assertThat(buildProject, hasAttribute("lastBuildLabel", String.valueOf(LABEL)));
assertThat(buildProject, hasAttribute("lastBuildTime", DATE_STR));
assertThat(buildProject, hasAttribute("webUrl", buildDetailUrl()));
}
Aggregations