use of org.apache.type_test.types1.Document in project gocd by gocd.
the class XmlView method renderMergedOutputModel.
protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
Document document = (Document) model.get("document");
ServletOutputStream outputStream = response.getOutputStream();
try {
XmlUtils.writeXml(document, outputStream);
} finally {
IOUtils.closeQuietly(outputStream);
}
}
use of org.apache.type_test.types1.Document in project gocd by gocd.
the class GoControlLog method writeLogFile.
protected void writeLogFile(File file, Element element) throws IOException {
// Write the log file out, let jdom care about the encoding by using
// an OutputStream instead of a Writer.
OutputStream logStream = null;
try {
Format format = Format.getPrettyFormat();
XMLOutputter outputter = new XMLOutputter(format);
IO.mkdirFor(file);
file.setWritable(true);
logStream = new BufferedOutputStream(new FileOutputStream(file));
outputter.output(new Document(element), logStream);
} finally {
IO.close(logStream);
}
}
use of org.apache.type_test.types1.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_setsFormatTo1.
@Test
public void exportPreferences_setsFormatTo1() throws Exception {
Document document = exportPreferences(false, Collections.<String>emptySet());
assertEquals("1", document.getRootElement().getAttributeValue("format"));
}
use of org.apache.type_test.types1.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_setsVersionToLatest.
@Test
public void exportPreferences_setsVersionToLatest() throws Exception {
Document document = exportPreferences(false, Collections.<String>emptySet());
assertEquals(Integer.toString(Settings.VERSION), document.getRootElement().getAttributeValue("version"));
}
use of org.apache.type_test.types1.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_ignoresGlobalSettingsWhenRequested.
@Test
public void exportPreferences_ignoresGlobalSettingsWhenRequested() throws Exception {
Document document = exportPreferences(false, Collections.<String>emptySet());
assertNull(document.getRootElement().getChild("global"));
}
Aggregations