public abstract class AbstractReporter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static ReportMetadata |
META |
protected static String |
TEMPLATE_EXTENSION |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractReporter(String classpathPrefix) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
copyClasspathResource(File outputDirectory,
String resourceName,
String targetFileName)
Copy a single named resource from the classpath to the output directory.
|
protected void |
copyFile(File outputDirectory,
File sourceFile,
String targetFileName)
Copy a single named file to the output directory.
|
protected void |
copyStream(File outputDirectory,
InputStream stream,
String targetFileName)
Helper method to copy the contents of a stream to a file.
|
protected org.apache.velocity.VelocityContext |
createContext()
Helper method that creates a Velocity context and initialises it
with a reference to the ReportNG utils, report metadata and localised messages.
|
protected void |
generateFile(File file,
String templateName,
org.apache.velocity.VelocityContext context)
Generate the specified output file by merging the specified
Velocity template with the supplied context.
|
protected void |
removeEmptyDirectories(File outputDirectory)
Deletes any empty directories under the output directory.
|
protected static final String TEMPLATE_EXTENSION
protected static final ReportMetadata META
protected AbstractReporter(String classpathPrefix)
classpathPrefix - Where in the classpath to load templates from.protected org.apache.velocity.VelocityContext createContext()
protected void generateFile(File file, String templateName, org.apache.velocity.VelocityContext context) throws Exception
Exceptionprotected void copyClasspathResource(File outputDirectory, String resourceName, String targetFileName) throws IOException
outputDirectory - The destination directory for the copied resource.resourceName - The filename of the resource.targetFileName - The name of the file created in outputDirectory.IOException - If the resource cannot be copied.protected void copyFile(File outputDirectory, File sourceFile, String targetFileName) throws IOException
outputDirectory - The destination directory for the copied resource.sourceFile - The path of the file to copy.targetFileName - The name of the file created in outputDirectory.IOException - If the file cannot be copied.protected void copyStream(File outputDirectory, InputStream stream, String targetFileName) throws IOException
outputDirectory - The directory in which the new file is created.stream - The stream to copy.targetFileName - The file to write the stream contents to.IOException - If the stream cannot be copied.protected void removeEmptyDirectories(File outputDirectory)
outputDirectory - The directory to search for empty directories.