org.apache.tools.ant.taskdefs.optional.junit

Class AggregateTransformer


public class AggregateTransformer
extends java.lang.Object

Transform a JUnit xml report. The default transformation generates an html report in either framed or non-framed style. The non-framed style is convenient to have a concise report via mail, the framed report is much more convenient if you want to browse into different packages or testcases since it is a Javadoc like report.

Nested Class Summary

static class
AggregateTransformer.Format

Field Summary

static String
FRAMES
static String
NOFRAMES
protected static DocumentBuilderFactory
dbfactory
XML Parser factory accessible to subclasses
protected Document
document
the xml document to process
protected String
format
the format to use for the report.
protected File
styleDir
the style directory.
protected Task
task
Task
protected File
toDir
the destination directory, this is the root from where html should be generated

Constructor Summary

AggregateTransformer(Task task)

Method Summary

protected void
checkOptions()
check for invalid options
protected static DocumentBuilderFactory
getDocumentBuilderFactory()
Get the Document Builder Factory
protected String
getStylesheetSystemId()
Get the systemid of the appropriate stylesheet based on its name and styledir.
void
setExtension(String ext)
set the extension of the output files
void
setFormat(AggregateTransformer.Format format)
void
setStyledir(File styledir)
set the style directory.
void
setTodir(File todir)
set the destination directory
void
setXmlDocument(Document doc)
protected void
setXmlfile(File xmlfile)
Set the xml file to be processed.
void
transform()

Field Details

FRAMES

public static final String FRAMES

NOFRAMES

public static final String NOFRAMES

dbfactory

protected static DocumentBuilderFactory dbfactory
XML Parser factory accessible to subclasses

document

protected Document document
the xml document to process

format

protected String format
the format to use for the report. Must be FRAMES or NOFRAMES

styleDir

protected File styleDir
the style directory. XSLs should be read from here if necessary

task

protected Task task
Task

toDir

protected File toDir
the destination directory, this is the root from where html should be generated

Constructor Details

AggregateTransformer

public AggregateTransformer(Task task)

Method Details

checkOptions

protected void checkOptions()
            throws BuildException
check for invalid options

getDocumentBuilderFactory

protected static DocumentBuilderFactory getDocumentBuilderFactory()
Get the Document Builder Factory
Returns:
the DocumentBuilderFactory instance in use

getStylesheetSystemId

protected String getStylesheetSystemId()
            throws IOException
Get the systemid of the appropriate stylesheet based on its name and styledir. If no styledir is defined it will load it as a java resource in the xsl child package, otherwise it will get it from the given directory.

setExtension

public void setExtension(String ext)
set the extension of the output files

setFormat

public void setFormat(AggregateTransformer.Format format)

setStyledir

public void setStyledir(File styledir)
set the style directory. It is optional and will override the default xsl used.
Parameters:
styledir - the directory containing the xsl files if the user would like to override with its own style.

setTodir

public void setTodir(File todir)
set the destination directory

setXmlDocument

public void setXmlDocument(Document doc)

setXmlfile

protected void setXmlfile(File xmlfile)
            throws BuildException
Set the xml file to be processed. This is a helper if you want to set the file directly. Much more for testing purposes.
Parameters:
xmlfile - xml file to be processed

transform

public void transform()
            throws BuildException

Copyright B) 2000-2006 Apache Software Foundation. All Rights Reserved.