Search in sources :

Example 1 with SimpleXmlWriter

use of org.gradle.internal.xml.SimpleXmlWriter in project gradle by gradle.

the class IvyXmlModuleDescriptorWriter method write.

@Override
public void write(IvyModulePublishMetadata module, File output) {
    try {
        output.getParentFile().mkdirs();
        OutputStream outputStream = new FileOutputStream(output);
        try {
            SimpleXmlWriter xmlWriter = new SimpleXmlWriter(outputStream, "  ");
            writeTo(module, xmlWriter);
            xmlWriter.flush();
        } finally {
            outputStream.close();
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) UncheckedIOException(org.gradle.api.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(org.gradle.api.UncheckedIOException) SimpleXmlWriter(org.gradle.internal.xml.SimpleXmlWriter)

Example 2 with SimpleXmlWriter

use of org.gradle.internal.xml.SimpleXmlWriter in project gradle by gradle.

the class DefaultIvyModuleDescriptorWriter method write.

@Override
public void write(IvyModulePublishMetadata module, File output) {
    try {
        output.getParentFile().mkdirs();
        OutputStream outputStream = new FileOutputStream(output);
        try {
            SimpleXmlWriter xmlWriter = new SimpleXmlWriter(outputStream, "  ");
            writeTo(module, xmlWriter);
            xmlWriter.flush();
        } finally {
            outputStream.close();
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) UncheckedIOException(org.gradle.api.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(org.gradle.api.UncheckedIOException) SimpleXmlWriter(org.gradle.internal.xml.SimpleXmlWriter)

Example 3 with SimpleXmlWriter

use of org.gradle.internal.xml.SimpleXmlWriter in project gradle by gradle.

the class JUnitXmlResultWriter method write.

/**
 * @param output The destination, unbuffered
 */
public void write(TestClassResult result, OutputStream output) {
    String className = result.getClassName();
    long classId = result.getId();
    try {
        SimpleXmlWriter writer = new SimpleXmlWriter(output, "  ");
        writer.startElement("testsuite").attribute("name", className).attribute("tests", String.valueOf(result.getTestsCount())).attribute("skipped", String.valueOf(result.getSkippedCount())).attribute("failures", String.valueOf(result.getFailuresCount())).attribute("errors", "0").attribute("timestamp", DateUtils.format(result.getStartTime(), DateUtils.ISO8601_DATETIME_PATTERN)).attribute("hostname", hostName).attribute("time", String.valueOf(result.getDuration() / 1000.0));
        writer.startElement("properties");
        writer.endElement();
        writeTests(writer, result.getResults(), className, classId);
        writer.startElement("system-out");
        writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdOut);
        writer.endElement();
        writer.startElement("system-err");
        writeOutputs(writer, classId, outputAssociation.equals(TestOutputAssociation.WITH_SUITE), TestOutputEvent.Destination.StdErr);
        writer.endElement();
        writer.endElement();
    } catch (IOException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
Also used : IOException(java.io.IOException) SimpleXmlWriter(org.gradle.internal.xml.SimpleXmlWriter)

Aggregations

IOException (java.io.IOException)3 SimpleXmlWriter (org.gradle.internal.xml.SimpleXmlWriter)3 FileOutputStream (java.io.FileOutputStream)2 OutputStream (java.io.OutputStream)2 UncheckedIOException (org.gradle.api.UncheckedIOException)2