Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Merged remote branch 'weissjeffm/master'.
Browse files Browse the repository at this point in the history
Some other minor tidying.
  • Loading branch information
dwdyer committed Feb 10, 2011
2 parents a052cef + 4f79754 commit 9e77829
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 19 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.txt
@@ -1,8 +1,10 @@
Changes in version 1.1.3
------------------------

* Fix for TestNG version dependency in Maven POM (GitHub issue #12). Thanks to
Jeff Weiss.
* Merged in Jeff Weiss' patch to allow custom stylesheets to be loaded from the
classpath (GitHub issue #10).

* Fix for TestNG version dependency in Maven POM (GitHub issue #12).


Changes in version 1.1.2
Expand Down
2 changes: 1 addition & 1 deletion etc/intellij/reportng.ipr
Expand Up @@ -79,7 +79,7 @@
</component>
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
<component name="EntryPointsManager">
<entry_points />
<entry_points version="2.0" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
Expand Down
Expand Up @@ -159,9 +159,9 @@ protected void copyFile(File outputDirectory,
* @param targetFileName The file to write the stream contents to.
* @throws IOException If the stream cannot be copied.
*/
private void copyStream(File outputDirectory,
InputStream stream,
String targetFileName) throws IOException
protected void copyStream(File outputDirectory,
InputStream stream,
String targetFileName) throws IOException
{
File resourceFile = new File(outputDirectory, targetFileName);
BufferedReader reader = null;
Expand Down
31 changes: 23 additions & 8 deletions reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
Expand Up @@ -18,24 +18,25 @@

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.Collections;
import org.apache.velocity.VelocityContext;
import org.testng.IClass;
import org.testng.IResultMap;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.ITestNGMethod;
import org.testng.Reporter;
import org.testng.IClass;
import org.testng.ITestResult;
import org.testng.IResultMap;
import org.testng.Reporter;
import org.testng.xml.XmlSuite;

/**
Expand Down Expand Up @@ -309,9 +310,23 @@ private void copyResources(File outputDirectory) throws IOException
copyClasspathResource(outputDirectory, "sorttable.js", "sorttable.js");
// If there is a custom stylesheet, copy that.
File customStylesheet = META.getStylesheetPath();

if (customStylesheet != null)
{
copyFile(outputDirectory, customStylesheet, CUSTOM_STYLE_FILE);
if (customStylesheet.exists())
{
copyFile(outputDirectory, customStylesheet, CUSTOM_STYLE_FILE);
}
else
{
// If not found, try to read the file as a resource on the classpath
// useful when reportng is called by a jarred up library
InputStream stream = ClassLoader.getSystemClassLoader().getResourceAsStream(customStylesheet.getPath());
if (stream != null)
{
copyStream(outputDirectory, stream, CUSTOM_STYLE_FILE);
}
}
}
}
}
Expand Up @@ -16,16 +16,16 @@
package org.uncommons.reportng;

import java.io.File;
import java.util.List;
import java.util.Collection;
import java.util.Map;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.velocity.VelocityContext;
import org.testng.IClass;
import org.testng.ISuite;
import org.testng.ISuiteResult;
import org.testng.IClass;
import org.testng.ITestResult;
import org.testng.xml.XmlSuite;

Expand Down
Expand Up @@ -15,8 +15,8 @@
//=============================================================================
package org.uncommons.reportng;

import org.testng.IClass;
import java.util.Comparator;
import org.testng.IClass;

/**
* Comparator for sorting classes alphabetically by fully-qualified name.
Expand Down
Expand Up @@ -15,8 +15,8 @@
//=============================================================================
package org.uncommons.reportng;

import org.testng.ITestNGMethod;
import java.util.Comparator;
import org.testng.ITestNGMethod;

/**
* Comparator for sorting TestNG test methods. Sorts method alphabeticaly
Expand Down

0 comments on commit 9e77829

Please sign in to comment.