You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by po...@apache.org on 2015/05/17 23:11:13 UTC

svn commit: r1679901 - in /creadur/rat/trunk: ./ apache-rat-core/src/main/resources/org/apache/rat/ apache-rat-core/src/test/java/org/apache/rat/ apache-rat-core/src/test/java/org/apache/rat/analysis/ apache-rat-core/src/test/java/org/apache/rat/docume...

Author: pottlinger
Date: Sun May 17 21:11:13 2015
New Revision: 1679901

URL: http://svn.apache.org/r1679901
Log:
RAT-180: Generify RAT report

* Changed format of plain-rat.xsl (wording and spacing).
* Enhanced Resources helper class to be able to load from src/test/resources
  and src/main/resources. Unfortunately resource loading in tests does not
  work from within IntelliJ since it has a different current working directory -
  adapted Resources helper to work from the command line.
* Refactored tests to use Resources-helper to load any test/main resources,
  adapted test expectations.


Modified:
    creadur/rat/trunk/RELEASE_NOTES.txt
    creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
    creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
    creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java
    creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java
    creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java
    creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java

Modified: creadur/rat/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/RELEASE_NOTES.txt?rev=1679901&r1=1679900&r2=1679901&view=diff
==============================================================================
--- creadur/rat/trunk/RELEASE_NOTES.txt (original)
+++ creadur/rat/trunk/RELEASE_NOTES.txt Sun May 17 21:11:13 2015
@@ -21,6 +21,7 @@ Rat 0.12 (SNAPSHOT)
                   configurability of that file. 
                   (thanks to Christopher Tubbs)
     * [RAT-179] - Maven plugin and Ant task do not support adding extra approved licenses.
+    * [RAT-180] - Generify and beautify texts in RAT report. 
 
    New features
     * [RAT-171] - Maven plugin allows scanning of source code management ignore files. Their contents is added as exclusion to be ignored during RAT runs.

Modified: creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl?rev=1679901&r1=1679900&r2=1679901&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl Sun May 17 21:11:13 2015
@@ -25,6 +25,7 @@
 Summary
 -------
 Generated at: <xsl:value-of select='rat-report/@timestamp'/>
+
 Notes: <xsl:value-of select='count(descendant::type[attribute::name="notice"])'/>
 Binaries: <xsl:value-of select='count(descendant::type[attribute::name="binary"])'/>
 Archives: <xsl:value-of select='count(descendant::type[attribute::name="archive"])'/>
@@ -33,14 +34,14 @@ Standards: <xsl:value-of select='count(d
 Apache Licensed: <xsl:value-of select='count(descendant::header-type[attribute::name="AL   "])'/>
 Generated Documents: <xsl:value-of select='count(descendant::header-type[attribute::name="GEN  "])'/>
 
-JavaDocs are generated and so license header is optional
-Generated files do not required license headers
+JavaDocs are generated, thus a license header is optional.
+Generated files do not require license headers.
 
 <xsl:value-of select='count(descendant::header-type[attribute::name="?????"])'/> Unknown Licenses
 
 *******************************
 
-Unapproved licenses:
+Files with unapproved licenses:
 
 <xsl:for-each select='descendant::resource[license-approval/@name="false"]'>
   <xsl:text>  </xsl:text>
@@ -58,9 +59,9 @@ Archives:
  </xsl:for-each>
 *****************************************************
   Files with Apache License headers will be marked AL
-  Binary files (which do not require AL headers) will be marked B
+  Binary files (which do not require any license headers) will be marked B
   Compressed archives will be marked A
-  Notices, licenses etc will be marked N
+  Notices, licenses etc. will be marked N
  <xsl:for-each select='descendant::resource'>
   <xsl:choose>
      <xsl:when test='license-approval/@name="false"'>!</xsl:when>
@@ -79,11 +80,10 @@ Archives:
  </xsl:text>
  </xsl:for-each>
 *****************************************************
- Printing headers for files without AL header...
- 
+ Printing headers for text files without a valid license header...
  <xsl:for-each select='descendant::resource[header-type/@name="?????"]'>
 =======================================================================
-==<xsl:value-of select='@name'/>
+== File: <xsl:value-of select='@name'/>
 =======================================================================
 <xsl:value-of select='header-sample'/>
 </xsl:for-each>

Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java?rev=1679901&r1=1679900&r2=1679901&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java Sun May 17 21:11:13 2015
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
+ */
 package org.apache.rat;
 
 import org.apache.rat.analysis.util.HeaderMatcherMultiplexer;
@@ -30,80 +30,81 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 
 public class ReportTest {
+    private static final String NL = System.getProperty("line.separator");
+
     private static final String HEADER =
-            "\n" + 
-            "*****************************************************\n" + 
-            "Summary\n" + 
-            "-------\n" + 
-            "Generated at: ";
+            NL +
+                    "*****************************************************" + NL +//
+                    "Summary" + NL +//
+                    "-------" + NL +//
+                    "Generated at: ";
 
     private static String getElementsReports(String pElementsPath) {
         return
-            "Notes: 2\n" + 
-            "Binaries: 1\n" + 
-            "Archives: 1\n" + 
-            "Standards: 6\n" + 
-            "\n" + 
-            "Apache Licensed: 3\n" + 
-            "Generated Documents: 0\n" + 
-            "\n" + 
-            "JavaDocs are generated and so license header is optional\n" + 
-            "Generated files do not required license headers\n" + 
-            "\n" + 
-            "2 Unknown Licenses\n" + 
-            "\n" + 
-            "*******************************\n" + 
-            "\n" + 
-            "Unapproved licenses:\n" + 
-            "\n" +
-            "  " + pElementsPath + "/Source.java\n" +
-            "  " + pElementsPath + "/sub/Empty.txt\n" +
-            "\n" +
-            "*******************************\n" + 
-            "\n" + 
-            "Archives:\n" + 
-            "\n" + 
-            " + " + pElementsPath + "/dummy.jar\n" + 
-            " \n" + 
-            "*****************************************************\n" + 
-            "  Files with Apache License headers will be marked AL\n" + 
-            "  Binary files (which do not require AL headers) will be marked B\n" + 
-            "  Compressed archives will be marked A\n" + 
-            "  Notices, licenses etc will be marked N\n" + 
-            "  MIT   " + pElementsPath + "/ILoggerFactory.java\n" + 
-            "  B     " + pElementsPath + "/Image.png\n" + 
-            "  N     " + pElementsPath + "/LICENSE\n" + 
-            "  N     " + pElementsPath + "/NOTICE\n" + 
-            " !????? " + pElementsPath + "/Source.java\n" + 
-            "  AL    " + pElementsPath + "/Text.txt\n" + 
-            "  AL    " + pElementsPath + "/Xml.xml\n" + 
-            "  AL    " + pElementsPath + "/buildr.rb\n" + 
-            "  A     " + pElementsPath + "/dummy.jar\n" + 
-            " !????? " + pElementsPath + "/sub/Empty.txt\n" + 
-            " \n" + 
-            "*****************************************************\n" + 
-            " Printing headers for files without AL header...\n" + 
-            " \n" + 
-            " \n" + 
-            "=======================================================================\n" + 
-            "==" + pElementsPath + "/Source.java\n" + 
-            "=======================================================================\n" + 
-            "package elements;\n" + 
-            "\n" +
-            "/*\n" +
-            " * This file does intentionally *NOT* contain an AL license header,\n" +
-            " * because it is used in the test suite.\n" +
-            " */\n" +
-            "public class Source {\n" + 
-            "\n" + 
-            "}\n" + 
-            "\n" + 
-            "=======================================================================\n" + 
-            "==" + pElementsPath + "/sub/Empty.txt\n" + 
-            "=======================================================================\n" + 
-            "\n";
+                NL + "Notes: 2" + NL +//
+                        "Binaries: 1" + NL +//
+                        "Archives: 1" + NL +//
+                        "Standards: 6" + NL +//
+                        "" + NL +//
+                        "Apache Licensed: 3" + NL +//
+                        "Generated Documents: 0" + NL +//
+                        "" + NL +//
+                        "JavaDocs are generated, thus a license header is optional." + NL +//
+                        "Generated files do not require license headers." + NL +//
+                        "" + NL +//
+                        "2 Unknown Licenses" + NL +//
+                        "" + NL +//
+                        "*******************************" + NL +//
+                        "" + NL +//
+                        "Files with unapproved licenses:" + NL +//
+                        "" + NL +//
+                        "  " + pElementsPath + "/Source.java" + NL +//
+                        "  " + pElementsPath + "/sub/Empty.txt" + NL +//
+                        "" + NL +//
+                        "*******************************" + NL +//
+                        "" + NL +//
+                        "Archives:" + NL +//
+                        "" + NL +//
+                        " + " + pElementsPath + "/dummy.jar" + NL +//
+                        " " + NL +//
+                        "*****************************************************" + NL +//
+                        "  Files with Apache License headers will be marked AL" + NL +//
+                        "  Binary files (which do not require any license headers) will be marked B" + NL +//
+                        "  Compressed archives will be marked A" + NL +//
+                        "  Notices, licenses etc. will be marked N" + NL +//
+                        "  MIT   " + pElementsPath + "/ILoggerFactory.java" + NL +//
+                        "  B     " + pElementsPath + "/Image.png" + NL +//
+                        "  N     " + pElementsPath + "/LICENSE" + NL +//
+                        "  N     " + pElementsPath + "/NOTICE" + NL +//
+                        " !????? " + pElementsPath + "/Source.java" + NL +//
+                        "  AL    " + pElementsPath + "/Text.txt" + NL +//
+                        "  AL    " + pElementsPath + "/Xml.xml" + NL +//
+                        "  AL    " + pElementsPath + "/buildr.rb" + NL +//
+                        "  A     " + pElementsPath + "/dummy.jar" + NL +//
+                        " !????? " + pElementsPath + "/sub/Empty.txt" + NL +//
+                        " " + NL +//
+                        "*****************************************************" + NL +//
+                        " Printing headers for text files without a valid license header..." + NL +//
+                        " " + NL +//
+                        "=======================================================================" + NL +//
+                        "== File: " + pElementsPath + "/Source.java" + NL +//
+                        "=======================================================================" + NL + //
+                        "package elements;" + NL +//
+                        "" + NL +//
+                        "/*" + NL +//
+                        " * This file does intentionally *NOT* contain an AL license header," + NL +//
+                        " * because it is used in the test suite." + NL +//
+                        " */" + NL +//
+                        "public class Source {" + NL +//
+                        "" + NL +//
+                        "}" + NL +//
+                        "" + NL +//
+                        "=======================================================================" + NL +//
+                        "== File: " + pElementsPath + "/sub/Empty.txt" + NL +//
+                        "=======================================================================" + NL +//
+                        NL;
     }
-    
+
     @Test
     public void plainReport() throws Exception {
         StringWriter out = new StringWriter();
@@ -116,13 +117,14 @@ public class ReportTest {
                 Defaults.getPlainStyleSheet(), configuration);
 
         String result = out.getBuffer().toString();
-        final String nl = System.getProperty("line.separator");
         assertTrue("'Generated at' is present in " + result,
-                   result.startsWith(HEADER.replaceAll("\n", nl)));
-        final int generatedAtLineEnd = result.indexOf(nl, HEADER.length());
+                result.startsWith(HEADER));
+
+        final int generatedAtLineEnd = result.indexOf(NL, HEADER.length());
+
         final String elementsReports = getElementsReports(elementsPath);
-        assertEquals("Report created",
-                     elementsReports.replaceAll("\n", nl),
-                     result.substring(generatedAtLineEnd + nl.length()));
+        assertEquals("Report created was: " + result,
+                elementsReports,
+                result.substring(generatedAtLineEnd + NL.length()));
     }
 }

Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java?rev=1679901&r1=1679900&r2=1679901&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTransformerTest.java Sun May 17 21:11:13 2015
@@ -18,10 +18,10 @@
  */ 
 package org.apache.rat;
 
+import org.apache.rat.test.utils.Resources;
 import org.junit.Test;
 
 import java.io.BufferedReader;
-import java.io.File;
 import java.io.FileReader;
 import java.io.StringReader;
 import java.io.StringWriter;
@@ -45,7 +45,7 @@ public class ReportTransformerTest {
         assertNotNull(writer);
         StringReader in = new StringReader(SIMPLE_CONTENT);
         ReportTransformer transformer = new ReportTransformer(writer, 
-                new BufferedReader(new FileReader(new File("src/main/resources/org/apache/rat/plain-rat.xsl"))), 
+                new BufferedReader(new FileReader(Resources.getMainResourceFile("/org/apache/rat/plain-rat.xsl"))),
                 in);
         transformer.transform();
     }

Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java?rev=1679901&r1=1679900&r2=1679901&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/analysis/AnalyserFactoryTest.java Sun May 17 21:11:13 2015
@@ -15,7 +15,7 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
+ */
 package org.apache.rat.analysis;
 
 import org.apache.rat.api.Document;
@@ -23,40 +23,40 @@ import org.apache.rat.document.IDocument
 import org.apache.rat.document.impl.MonolithicFileDocument;
 import org.apache.rat.report.claim.impl.xml.SimpleXmlClaimReporter;
 import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
+import org.apache.rat.test.utils.Resources;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.io.File;
 import java.io.StringWriter;
 
 import static org.junit.Assert.assertEquals;
 
 public class AnalyserFactoryTest {
 
-    StringWriter out;
-    SimpleXmlClaimReporter reporter;
-    IHeaderMatcher matcherStub;
+    private static final IHeaderMatcher MATCHES_NOTHING_MATCHER = new IHeaderMatcher() {
+        public boolean match(Document subject, String line) throws RatHeaderAnalysisException {
+            return false;
+        }
+
+        public void reset() {
+        }
+    };
+
+    private StringWriter out;
+    private SimpleXmlClaimReporter reporter;
+    private IDocumentAnalyser analyser;
 
     @Before
     public void setUp() throws Exception {
         out = new StringWriter();
         XmlWriter writer = new XmlWriter(out);
         reporter = new SimpleXmlClaimReporter(writer);
-        matcherStub = new IHeaderMatcher() {
-
-            public boolean match(Document subject, String line) throws RatHeaderAnalysisException {
-                return false;
-            }
-
-            public void reset() {
-            }            
-        };
-     }
+        analyser = DefaultAnalyserFactory.createDefaultAnalyser(MATCHES_NOTHING_MATCHER);
+    }
 
     @Test
     public void standardTypeAnalyser() throws Exception {
-        MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/resources/elements/Text.txt"));
-        IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
+        MonolithicFileDocument document = new MonolithicFileDocument(Resources.getResourceFile("/elements/Text.txt"));
         analyser.analyse(document);
         reporter.report(document);
         assertEquals("Open standard element", "<resource name='src/test/resources/elements/Text.txt'><header-sample>/*\n" +
@@ -80,32 +80,30 @@ public class AnalyserFactoryTest {
                 "\n" +
                 "            \n" +
                 "</header-sample><header-type name='?????'/><license-family name='?????'/><type name='standard'/>", out.toString());
+
     }
 
     @Test
     public void noteTypeAnalyser() throws Exception {
-        MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/elements/LICENSE"));
-        IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
+        MonolithicFileDocument document = new MonolithicFileDocument(Resources.getResourceFile("/elements/LICENSE"));
         analyser.analyse(document);
         reporter.report(document);
-        assertEquals("Open note element", "<resource name='src/test/elements/LICENSE'><type name='notice'/>", out.toString());
+        assertEquals("Open note element", "<resource name='src/test/resources/elements/LICENSE'><type name='notice'/>", out.toString());
     }
 
     @Test
     public void binaryTypeAnalyser() throws Exception {
-        MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/elements/Image.png"));
-        IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
+        MonolithicFileDocument document = new MonolithicFileDocument(Resources.getResourceFile("/elements/Image.png"));
         analyser.analyse(document);
         reporter.report(document);
-        assertEquals("Open binary element", "<resource name='src/test/elements/Image.png'><type name='binary'/>", out.toString());
+        assertEquals("Open binary element", "<resource name='src/test/resources/elements/Image.png'><type name='binary'/>", out.toString());
     }
 
     @Test
     public void archiveTypeAnalyser() throws Exception {
-        MonolithicFileDocument document = new MonolithicFileDocument(new File("src/test/elements/Dummy.jar"));
-        IDocumentAnalyser analyser = DefaultAnalyserFactory.createDefaultAnalyser(matcherStub);
+        MonolithicFileDocument document = new MonolithicFileDocument(Resources.getResourceFile("/elements/dummy.jar"));
         analyser.analyse(document);
         reporter.report(document);
-        assertEquals("Open archive element", "<resource name='src/test/elements/Dummy.jar'><type name='archive'/>", out.toString());
+        assertEquals("Open archive element", "<resource name='src/test/resources/elements/dummy.jar'><type name='archive'/>", out.toString());
     }
 }

Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java?rev=1679901&r1=1679900&r2=1679901&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/document/impl/guesser/BinaryGuesserTest.java Sun May 17 21:11:13 2015
@@ -20,9 +20,9 @@ package org.apache.rat.document.impl.gue
 
 import org.apache.rat.document.MockDocument;
 import org.apache.rat.document.impl.FileDocument;
+import org.apache.rat.test.utils.Resources;
 import org.junit.Test;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
 
@@ -76,7 +76,7 @@ public class BinaryGuesserTest {
      */
     @Test
     public void binaryWithMalformedInputRAT81() throws Exception {
-        FileDocument doc = new FileDocument(new File("src/test/resources/binaries/UTF16_with_signature.xml"));
+        FileDocument doc = new FileDocument(Resources.getResourceFile("/binaries/UTF16_with_signature.xml"));
         Reader r = doc.reader(); // this will fail test if file is not readable
         try {
             char[] dummy = new char[100];
@@ -85,7 +85,7 @@ public class BinaryGuesserTest {
             // any exception, try the UTF-8 encoded one
             r.close();
             r = null; // ensure we detect failure to read second file
-            doc = new FileDocument(new File("src/test/resources/binaries/UTF8_with_signature.xml"));
+            doc = new FileDocument(Resources.getResourceFile("/binaries/UTF8_with_signature.xml"));
             r = doc.reader();
             r.read(dummy);
             // still here?  can't test on this platform
@@ -106,10 +106,10 @@ public class BinaryGuesserTest {
     }
 
     @Test
-    public void realBinaryContent() {
+    public void realBinaryContent() throws IOException {
         // This test is not accurate on all platforms
         final String encoding = System.getProperty("file.encoding");
-        final boolean isBinary = BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/binaries/Image-png.not")));
+        final boolean isBinary = BinaryGuesser.isBinary(new FileDocument(Resources.getResourceFile("/binaries/Image-png.not")));
         if (encoding.startsWith("ANSI")) {
             assertTrue(isBinary);
         } else {
@@ -122,12 +122,12 @@ public class BinaryGuesserTest {
     }
 
     @Test
-    public void textualContent() {
-        assertFalse(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/elements/Text.txt"))));
+    public void textualContent() throws IOException {
+        assertFalse(BinaryGuesser.isBinary(new FileDocument(Resources.getResourceFile("/elements/Text.txt"))));
     }
 
     @Test
-    public void emptyFile() {
-        assertFalse(BinaryGuesser.isBinary(new FileDocument(new File("src/test/resources/elements/sub/Empty.txt"))));
+    public void emptyFile() throws IOException {
+        assertFalse(BinaryGuesser.isBinary(new FileDocument(Resources.getResourceFile("/elements/sub/Empty.txt"))));
     }
 }

Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java?rev=1679901&r1=1679900&r2=1679901&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/test/utils/Resources.java Sun May 17 21:11:13 2015
@@ -43,14 +43,28 @@ public class Resources {
         // Does nothing
     }
 
-    // Does not work from within IntelliJ since root path is not module, but apache-rat-trunk
-    private static File RESOURCE_BASE_PATH = new File("src/test/resources");
+    // DevHint: needs to be prefix with apache-rat-core to work properly from within IntelliJ
+    public static final String SRC_TEST_RESOURCES = "src/test/resources";
+    public static final String SRC_MAIN_RESOURCES = "src/main/resources";
+    private static File TEST_RESOURCE_BASE_PATH = new File(SRC_TEST_RESOURCES);
+    private static File RESOURCE_BASE_PATH =  new File(SRC_MAIN_RESOURCES);
 
     /**
-     * Locates a resource file in the class path.
+     * Locates a test resource file in the class path.
      */
     public static File getResourceFile(String pResource) throws IOException {
-        final File f = new File(RESOURCE_BASE_PATH, pResource);
+        return getResourceFromBase(TEST_RESOURCE_BASE_PATH, pResource);
+    }
+
+    /**
+     * Locates a main resource file in the class path.
+     */
+    public static File getMainResourceFile(String pResource) throws IOException {
+        return getResourceFromBase(RESOURCE_BASE_PATH, pResource);
+    }
+
+    private static File getResourceFromBase(File baseDir, String pResource) throws IOException {
+        final File f = new File(baseDir, pResource);
         if (!f.isFile()) {
             throw new FileNotFoundException("Unable to locate resource file: " + pResource);
         }
@@ -61,7 +75,7 @@ public class Resources {
      * Locates a set of resource files in the class path.
      */
     public static File[] getResourceFiles(String pResource) throws IOException {
-        final File f = new File(RESOURCE_BASE_PATH, pResource);
+        final File f = new File(TEST_RESOURCE_BASE_PATH, pResource);
         if (!f.isDirectory()) {
             throw new FileNotFoundException("Unable to locate resource directory: " + f);
         }