Return-Path: X-Original-To: apmail-incubator-rat-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-rat-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 50A8D7117 for ; Mon, 18 Jul 2011 09:30:45 +0000 (UTC) Received: (qmail 8447 invoked by uid 500); 18 Jul 2011 09:30:43 -0000 Delivered-To: apmail-incubator-rat-commits-archive@incubator.apache.org Received: (qmail 8365 invoked by uid 500); 18 Jul 2011 09:30:35 -0000 Mailing-List: contact rat-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: rat-dev@incubator.apache.org Delivered-To: mailing list rat-commits@incubator.apache.org Received: (qmail 8246 invoked by uid 99); 18 Jul 2011 09:30:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 09:30:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2011 09:30:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id EC1C3238890D; Mon, 18 Jul 2011 09:30:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1147800 - in /incubator/rat/main/trunk: ./ apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/ apache-rat-core/src/main/resources/org/apache/rat/ apache-rat-core/src/test/java/org/apache/rat/ apache-rat-core/src/test/java/o... Date: Mon, 18 Jul 2011 09:30:03 -0000 To: rat-commits@incubator.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110718093003.EC1C3238890D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Mon Jul 18 09:30:00 2011 New Revision: 1147800 URL: http://svn.apache.org/viewvc?rev=1147800&view=rev Log: add a timestamp. RAT-67 Modified: incubator/rat/main/trunk/RELEASE_NOTES.txt incubator/rat/main/trunk/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java incubator/rat/main/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java Modified: incubator/rat/main/trunk/RELEASE_NOTES.txt URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/RELEASE_NOTES.txt?rev=1147800&r1=1147799&r2=1147800&view=diff ============================================================================== --- incubator/rat/main/trunk/RELEASE_NOTES.txt (original) +++ incubator/rat/main/trunk/RELEASE_NOTES.txt Mon Jul 18 09:30:00 2011 @@ -22,6 +22,8 @@ RAT 0.8 * RAT-34 --addLicense will add the license to the top of Java files without a package line or XML files without an XML declaration now - it used to not add anything. + * RAT-67 The XML and standard plain text reports now contain a + timestamp with the time the report has been generated. RAT 0.7 ======= Modified: incubator/rat/main/trunk/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java?rev=1147800&r1=1147799&r2=1147800&view=diff ============================================================================== --- incubator/rat/main/trunk/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java (original) +++ incubator/rat/main/trunk/apache-rat-core/src/main/java/org/apache/rat/report/claim/impl/xml/SimpleXmlClaimReporter.java Mon Jul 18 09:30:00 2011 @@ -19,6 +19,9 @@ package org.apache.rat.report.claim.impl.xml; import java.io.IOException; +import java.util.Calendar; + +import org.apache.commons.lang.time.DateFormatUtils; import org.apache.rat.api.Document; import org.apache.rat.api.MetaData; @@ -132,7 +135,10 @@ public class SimpleXmlClaimReporter exte public void startReport() throws RatException { try { - writer.openElement("rat-report"); + writer.openElement("rat-report") + .attribute("timestamp", + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT + .format(Calendar.getInstance())); } catch (IOException e) { throw new RatException("Cannot open start element", e); } Modified: incubator/rat/main/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl?rev=1147800&r1=1147799&r2=1147800&view=diff ============================================================================== --- incubator/rat/main/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl (original) +++ incubator/rat/main/trunk/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl Mon Jul 18 09:30:00 2011 @@ -24,6 +24,7 @@ ***************************************************** Summary ------- +Generated at: Notes: Binaries: Archives: Modified: incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java?rev=1147800&r1=1147799&r2=1147800&view=diff ============================================================================== --- incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java (original) +++ incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/ReportTest.java Mon Jul 18 09:30:00 2011 @@ -28,12 +28,15 @@ import org.apache.rat.analysis.util.Head import org.apache.rat.test.utils.Resources; public class ReportTest extends TestCase { - private static String getElementsReports(String pElementsPath) { - return + private static final String HEADER = "\n" + "*****************************************************\n" + "Summary\n" + "-------\n" + + "Generated at: "; + + private static String getElementsReports(String pElementsPath) { + return "Notes: 2\n" + "Binaries: 1\n" + "Archives: 1\n" + @@ -115,10 +118,13 @@ public class ReportTest extends TestCase Report.report(out, new DirectoryWalker(new File(elementsPath)), 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()); final String elementsReports = getElementsReports(elementsPath); assertEquals("Report created", - elementsReports.replaceAll("\n", - System.getProperty("line.separator")), - result); + elementsReports.replaceAll("\n", nl), + result.substring(generatedAtLineEnd + nl.length())); } } Modified: incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java?rev=1147800&r1=1147799&r2=1147800&view=diff ============================================================================== --- incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java (original) +++ incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportFactoryTest.java Mon Jul 18 09:30:00 2011 @@ -70,9 +70,11 @@ public class XmlReportFactoryTest extend report.endReport(); writer.closeDocument(); final String output = out.toString(); - assertEquals( - "" + - "" + + assertTrue("Preamble and document element are OK", + output.startsWith("" + + "" + "" + "" + "" + @@ -85,7 +87,7 @@ public class XmlReportFactoryTest extend "" + "" + "" + - "", output); + "")); assertTrue("Is well formed", XmlUtils.isWellFormedXml(output)); assertEquals("Binary files", new Integer(1), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_BINARY)); assertEquals("Notice files", new Integer(2), statistic.getDocumentCategoryMap().get(MetaData.RAT_DOCUMENT_CATEGORY_VALUE_NOTICE)); Modified: incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java URL: http://svn.apache.org/viewvc/incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java?rev=1147800&r1=1147799&r2=1147800&view=diff ============================================================================== --- incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java (original) +++ incubator/rat/main/trunk/apache-rat-core/src/test/java/org/apache/rat/report/xml/XmlReportTest.java Mon Jul 18 09:30:00 2011 @@ -83,9 +83,11 @@ public class XmlReportTest extends TestC report.endReport(); writer.closeDocument(); final String output = out.toString();; - assertEquals( - "" + - "" + + assertTrue("Preamble and document element are OK", + output.startsWith("" + + "" + "" + "" + "" + @@ -187,7 +189,7 @@ public class XmlReportTest extends TestC "" + "" + "\n" + - "", output); + "")); assertTrue("Is well formed", XmlUtils.isWellFormedXml(output)); }