creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1407998 - in /creadur/whisker/trunk/apache-whisker-plugin4maven/src: it/example-copyright-notices/descriptor.xml it/example-copyright-notices/verify.groovy test/java/org/apache/creadur/whisker/it/Helpers.java
Date Sun, 11 Nov 2012 14:15:37 GMT
Author: rdonkin
Date: Sun Nov 11 14:15:36 2012
New Revision: 1407998

URL: http://svn.apache.org/viewvc?rev=1407998&view=rev
Log:
Improved test framework and added some checks for notice

Modified:
    creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml
    creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy
    creadur/whisker/trunk/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java

Modified: creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml?rev=1407998&r1=1407997&r2=1407998&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml
(original)
+++ creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/descriptor.xml
Sun Nov 11 14:15:36 2012
@@ -792,8 +792,10 @@
     <!-- Consulting the release of the Apache licensed work, we discover
       (and add) the NOTICE -->
     <notice id='example.org'>
-      Copyright (c) 2525 The Example Project
-      http://example.org
+      Copyright (c) 9595 The Example Project
+
+      This product includes software developed at
+      The Example Foundation (http://example.org/).
     </notice>
   </notices>
   <!-- To keep this example simple, assume all works are licensed by the

Modified: creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy?rev=1407998&r1=1407997&r2=1407998&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy
(original)
+++ creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/example-copyright-notices/verify.groovy
Sun Nov 11 14:15:36 2012
@@ -38,5 +38,9 @@ if (results.hasFailed()) {
      license.expectThat(aLineContainsResource("mit.txt"))
      license.expectThat(aLineContainsAL2())
      //license.expectThat(aLineContainsResource("apache.txt"))
-     return license.failures()
+     notice = noticeIn(basedir)
+     notice.expectThat(aLineContains("Copyright (c) 9595 The Example Project"))
+     notice.expectThat(aLineContains("This product includes software developed at"))
+     notice.expectThat(aLineContains("The Example Foundation (http://example.org/)."))
+     return aggregate(license.failures(), notice.failures())
 }
\ No newline at end of file

Modified: creadur/whisker/trunk/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java?rev=1407998&r1=1407997&r2=1407998&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java
(original)
+++ creadur/whisker/trunk/apache-whisker-plugin4maven/src/test/java/org/apache/creadur/whisker/it/Helpers.java
Sun Nov 11 14:15:36 2012
@@ -25,6 +25,29 @@ import java.io.File;
 
 public class Helpers {
 
+    private static final String PATH_TO_LICENSE_FILE = "target/LICENSE";
+
+    private static final String PATH_TO_NOTICE_FILE = "target/NOTICE";
+
+    public static String aggregate(final String firstFailureReport,
+            final String secondFailureReport) {
+        final String result;
+        if (firstFailureReport == null) {
+            if (secondFailureReport == null) {
+                result = null;
+            } else {
+                result = secondFailureReport;
+            }
+        } else {
+            if (secondFailureReport == null) {
+                result = firstFailureReport;
+            } else {
+                result = firstFailureReport + "\n\n" + secondFailureReport;
+            }
+        }
+        return result;
+    }
+
     public static Check aLineContainsResource(String name) {
         return new AnyLineContainsCheck(name);
     }
@@ -53,10 +76,8 @@ public class Helpers {
         return new AnyLineContainsCheck(value);
     }
 
-    private static final String PATH_TO_LICENSE_FILE = "target/LICENSE";
-
     public static boolean noticeIsMissing(File basedir) {
-        return fileIsMissing(basedir, "target/NOTICE");
+        return fileIsMissing(basedir, PATH_TO_NOTICE_FILE);
     }
 
     private static boolean fileIsMissing(File basedir, final String string) {
@@ -71,6 +92,10 @@ public class Helpers {
         return new FileVerifier(new File(basedir, PATH_TO_LICENSE_FILE), "LICENSE");
     }
 
+    public static FileVerifier noticeIn(File basedir) {
+        return new FileVerifier(new File(basedir, PATH_TO_NOTICE_FILE), "NOTICE");
+    }
+
     public static Results results() {
         return new Results();
     }



Mime
View raw message