Package org.uncommons.reportng
Class AbstractReporter
- java.lang.Object
-
- org.uncommons.reportng.AbstractReporter
-
- All Implemented Interfaces:
org.testng.IReporter,org.testng.ITestNGListener
- Direct Known Subclasses:
HTMLReporter,JUnitXMLReporter
public abstract class AbstractReporter extends java.lang.Object implements org.testng.IReporter
-
-
Field Summary
Fields Modifier and Type Field Description protected static ReportMetadataMETA
-
Constructor Summary
Constructors Constructor Description AbstractReporter(java.lang.String classpathPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopyClasspathResource(java.io.File outputDirectory, java.lang.String resourceName, java.lang.String targetFileName)Copy a single named resource from the classpath to the output directory.protected voidcopyFile(java.io.File outputDirectory, java.io.File sourceFile, java.lang.String targetFileName)Copy a single named file to the output directory.protected voidcopyStream(java.io.File outputDirectory, java.io.InputStream stream, java.lang.String targetFileName)Helper method to copy the contents of a stream to a file.java.util.Map<java.lang.String,java.lang.Object>createContext()protected voidremoveEmptyDirectories(java.io.File outputDirectory)Deletes any empty directories under the output directory.
-
-
-
Field Detail
-
META
protected static final ReportMetadata META
-
-
Method Detail
-
createContext
public java.util.Map<java.lang.String,java.lang.Object> createContext()
-
copyClasspathResource
protected void copyClasspathResource(java.io.File outputDirectory, java.lang.String resourceName, java.lang.String targetFileName) throws java.io.IOExceptionCopy a single named resource from the classpath to the output directory.- Parameters:
outputDirectory- The destination directory for the copied resource.resourceName- The filename of the resource.targetFileName- The name of the file created in outputDirectory.- Throws:
java.io.IOException- If the resource cannot be copied.
-
copyFile
protected void copyFile(java.io.File outputDirectory, java.io.File sourceFile, java.lang.String targetFileName) throws java.io.IOExceptionCopy a single named file to the output directory.- Parameters:
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.- Throws:
java.io.IOException- If the file cannot be copied.
-
copyStream
protected void copyStream(java.io.File outputDirectory, java.io.InputStream stream, java.lang.String targetFileName) throws java.io.IOExceptionHelper method to copy the contents of a stream to a file.- Parameters:
outputDirectory- The directory in which the new file is created.stream- The stream to copy.targetFileName- The file to write the stream contents to.- Throws:
java.io.IOException- If the stream cannot be copied.
-
removeEmptyDirectories
protected void removeEmptyDirectories(java.io.File outputDirectory)
Deletes any empty directories under the output directory. These directories are created by TestNG for its own reports regardless of whether those reports are generated. If you are using the default TestNG reports as well as ReportNG, these directories will not be empty and will be retained. Otherwise they will be removed.- Parameters:
outputDirectory- The directory to search for empty directories.
-
-