Top Description Fields Constructors Methods
org.glassfish.pfl.test

public Class XMLJUnitReportWriter

extends Object
implements JUnitReportWriter, XMLConstants
Class Inheritance
All Implemented Interfaces
org.glassfish.pfl.test.XMLConstants, org.glassfish.pfl.test.JUnitReportWriter
Imports
java.io.BufferedReader, .BufferedWriter, .IOException, .OutputStream, .OutputStreamWriter, .PrintWriter, .StringReader, .StringWriter, .Writer, java.net.InetAddress, .UnknownHostException, java.text.SimpleDateFormat, java.util.Date, .Enumeration, .HashMap, .HashSet, .Map, .Properties, .Set, .TimeZone, javax.xml.parsers.DocumentBuilder, .DocumentBuilderFactory, org.w3c.dom.Document, .Element, .Text

Prints XML output of the test to a specified Writer.
See Also
FormatterElement

Field Summary

Modifier and TypeField and Description
private static final String[]
private Document
doc

The XML document.

private int
private Set<JUnitReportWriter.TestDescription>
failedTests

tests that failed.

private int
private boolean
private OutputStream
out

Where to write the log to.

private Element
rootElement

The wrapper for the whole testsuite.

private int
private long
private Map<JUnitReportWriter.TestDescription, Element>
testElements

Element for the current test.

private Map<JUnitReportWriter.TestDescription, Long>
testStarts

Timing helper.

private static final String
UNKNOWN

constant for unnnamed testsuites/cases

Constructor Summary

AccessConstructor and Description
public
XMLJUnitReportWriter()

No arg constructor.

public
XMLJUnitReportWriter(boolean filter)

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public void
public Element
public JUnitReportWriter.TestCounts
private boolean
private String
private void
private void
formatOutput(String type, String output)

private static DocumentBuilder
private String
private String
private String
public void
setOutput(OutputStream out)

Implements org.glassfish.pfl.test.JUnitReportWriter.setOutput.

Sets the stream the formatter is supposed to write its results to.

public void
setSystemError(String out)

Implements org.glassfish.pfl.test.JUnitReportWriter.setSystemError.

This is what the test has written to System.err

public void
setSystemOutput(String out)

Implements org.glassfish.pfl.test.JUnitReportWriter.setSystemOutput.

This is what the test has written to System.out

public void
public void
startTestSuite(String name, Properties props)

Implements org.glassfish.pfl.test.JUnitReportWriter.startTestSuite.

The whole testsuite started.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_TRACE_FILTERSback to summary
private static final String[] DEFAULT_TRACE_FILTERS
docback to summary
private Document doc

The XML document.

errorCountback to summary
private int errorCount
failedTestsback to summary
private Set<JUnitReportWriter.TestDescription> failedTests

tests that failed.

failureCountback to summary
private int failureCount
filterTraceback to summary
private boolean filterTrace
outback to summary
private OutputStream out

Where to write the log to.

rootElementback to summary
private Element rootElement

The wrapper for the whole testsuite.

runCountback to summary
private int runCount
startTimeback to summary
private long startTime
testElementsback to summary
private Map<JUnitReportWriter.TestDescription, Element> testElements

Element for the current test.

testStartsback to summary
private Map<JUnitReportWriter.TestDescription, Long> testStarts

Timing helper.

UNKNOWNback to summary
private static final String UNKNOWN

constant for unnnamed testsuites/cases

Constructor Detail

XMLJUnitReportWriterback to summary
public XMLJUnitReportWriter()

No arg constructor.

XMLJUnitReportWriterback to summary
public XMLJUnitReportWriter(boolean filter)

Method Detail

addErrorback to summary
public void addError(JUnitReportWriter.TestDescription test, Throwable t)

Implements org.glassfish.pfl.test.JUnitReportWriter.addError.

Doc from org.glassfish.pfl.test.JUnitReportWriter.addError.

An error occurred.

Annotations
@Override
addFailureback to summary
public void addFailure(JUnitReportWriter.TestDescription test, Throwable t)

Implements org.glassfish.pfl.test.JUnitReportWriter.addFailure.

Doc from org.glassfish.pfl.test.JUnitReportWriter.addFailure.

A failure occurred.

Annotations
@Override
endTestback to summary
public void endTest(JUnitReportWriter.TestDescription test, long duration)

Implements org.glassfish.pfl.test.JUnitReportWriter.endTest.

Doc from org.glassfish.pfl.test.JUnitReportWriter.endTest.

A test ended. Here we supply the duration, in case the duration is not determined by the [ startTest, endTest ] interval.

Annotations
@Override
endTestback to summary
public void endTest(JUnitReportWriter.TestDescription test)

Implements org.glassfish.pfl.test.JUnitReportWriter.endTest.

Doc from org.glassfish.pfl.test.JUnitReportWriter.endTest.

A test ended.

Annotations
@Override
endTestHelperback to summary
public Element endTestHelper(JUnitReportWriter.TestDescription test)
endTestSuiteback to summary
public JUnitReportWriter.TestCounts endTestSuite()

Implements org.glassfish.pfl.test.JUnitReportWriter.endTestSuite.

Doc from org.glassfish.pfl.test.JUnitReportWriter.endTestSuite.

The whole testsuite ended.

Annotations
@Override
filterLineback to summary
private boolean filterLine(String line)
filterStackback to summary
private String filterStack(String stack)
formatErrorback to summary
private void formatError(String type, JUnitReportWriter.TestDescription test, Throwable t)
formatOutputback to summary
private void formatOutput(String type, String output)
getDocumentBuilderback to summary
private static DocumentBuilder getDocumentBuilder()
getFilteredTraceback to summary
private String getFilteredTrace(Throwable t)
getHostnameback to summary
private String getHostname()
getStackTraceback to summary
private String getStackTrace(Throwable t)
setOutputback to summary
public void setOutput(OutputStream out)

Implements org.glassfish.pfl.test.JUnitReportWriter.setOutput.

Doc from org.glassfish.pfl.test.JUnitReportWriter.setOutput.

Sets the stream the formatter is supposed to write its results to.

Annotations
@Override
setSystemErrorback to summary
public void setSystemError(String out)

Implements org.glassfish.pfl.test.JUnitReportWriter.setSystemError.

Doc from org.glassfish.pfl.test.JUnitReportWriter.setSystemError.

This is what the test has written to System.err

Annotations
@Override
setSystemOutputback to summary
public void setSystemOutput(String out)

Implements org.glassfish.pfl.test.JUnitReportWriter.setSystemOutput.

Doc from org.glassfish.pfl.test.JUnitReportWriter.setSystemOutput.

This is what the test has written to System.out

Annotations
@Override
startTestback to summary
public void startTest(JUnitReportWriter.TestDescription t)

Implements org.glassfish.pfl.test.JUnitReportWriter.startTest.

Doc from org.glassfish.pfl.test.JUnitReportWriter.startTest.

A test started.

Annotations
@Override
startTestSuiteback to summary
public void startTestSuite(String name, Properties props)

Implements org.glassfish.pfl.test.JUnitReportWriter.startTestSuite.

Doc from org.glassfish.pfl.test.JUnitReportWriter.startTestSuite.

The whole testsuite started.

Annotations
@Override