You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by rd...@apache.org on 2012/10/30 21:14:10 UTC

svn commit: r1403853 - in /creadur/whisker/trunk: apache-whisker-plugin4maven/src/it/primary-license-with-copyright-notice/ apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/ apache-whisker-velocity/src/test/java/o...

Author: rdonkin
Date: Tue Oct 30 20:14:09 2012
New Revision: 1403853

URL: http://svn.apache.org/viewvc?rev=1403853&view=rev
Log:
WHISKER-6 Output resource name when license has a copyright notice

Modified:
    creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/primary-license-with-copyright-notice/verify.groovy
    creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
    creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java

Modified: creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/primary-license-with-copyright-notice/verify.groovy
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/primary-license-with-copyright-notice/verify.groovy?rev=1403853&r1=1403852&r2=1403853&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/primary-license-with-copyright-notice/verify.groovy (original)
+++ creadur/whisker/trunk/apache-whisker-plugin4maven/src/it/primary-license-with-copyright-notice/verify.groovy Tue Oct 30 20:14:09 2012
@@ -26,6 +26,7 @@ def reader = new BufferedReader(new Inpu
 
 def primary = false
 def dependent = false
+def resource = false
 
 def line = reader.readLine()
 while (line != null) {
@@ -35,12 +36,16 @@ while (line != null) {
     if (line.contains("Copyright (c) DEPENDENT")) {
         dependent = true
     }
+    if (dependent && line.contains("other.text")) {
+        resource = true
+    }
 
     line = reader.readLine()
 }
 
 assert primary
 assert dependent
+assert resource
 
 
 return true;
\ No newline at end of file

Modified: creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm?rev=1403853&r1=1403852&r2=1403853&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm (original)
+++ creadur/whisker/trunk/apache-whisker-velocity/src/main/resources/org/apache/creadur/whisker/template/velocity/license.vm Tue Oct 30 20:14:09 2012
@@ -52,7 +52,7 @@ Within the $directory.Name directory
 $indent.indent(12,$license.CopyrightNotice) $indent.indent(12, $license.Text)
 #end
 #foreach( $organisation in $license.Organisations)
-#if ( !$work.isPrimary( $organisation ))
+#if ( !$work.isPrimary( $organisation ) || $license.hasCopyrightNotice() )
         from $organisation.Name #if ($organisation.URL) $organisation.URL #end
 
 #foreach( $resource in $organisation.Resources)

Modified: creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java
URL: http://svn.apache.org/viewvc/creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java?rev=1403853&r1=1403852&r2=1403853&view=diff
==============================================================================
--- creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java (original)
+++ creadur/whisker/trunk/apache-whisker-velocity/src/test/java/org/apache/creadur/whisker/out/velocity/TestLicenseGeneration.java Tue Oct 30 20:14:09 2012
@@ -50,10 +50,12 @@ public class TestLicenseGeneration exten
     Map<String, String> notices = new HashMap<String, String>();
     Map<String, Organisation> organisations = new HashMap<String, Organisation>();
     String secondaryCopyright;
+    String resourceName;
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        resourceName = "resource";
         secondaryCopyright = "Copyright (c) this is secondary";
         writerFactory = new StringResultWriterFactory();
         subject = new VelocityEngine(new EmptyLog());
@@ -77,8 +79,7 @@ public class TestLicenseGeneration exten
         notices.put(noticeId, "Some notice text");
         Collection<Resource> resources = new ArrayList<Resource>();
         String source = "";
-        String name = "resource";
-        resources.add(new Resource(name, noticeId, source));
+        resources.add(new Resource(resourceName, noticeId, source));
         return resources;
     }
 
@@ -142,6 +143,9 @@ public class TestLicenseGeneration exten
         assertTrue("Expect secondary copyright to be presented: " + writerFactory.firstOutputFor(Result.LICENSE),
                 StringUtils.contains(writerFactory.firstOutputFor(Result.LICENSE),
                         secondaryCopyright));
+        assertTrue("Expect resource to be indicated: " + writerFactory.firstOutputFor(Result.LICENSE),
+                StringUtils.contains(writerFactory.firstOutputFor(Result.LICENSE),
+                        resourceName));
 
     }
 }