creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1548690 - in /creadur/rat/branches/gsoc: apache-rat-api/src/main/java/org/apache/rat/api/domain/ apache-rat-api/src/test/java/org/apache/rat/api/domain/ apache-rat-core/src/main/java/org/apache/rat/analysis/license/ apache-rat-core/src/mai...
Date Fri, 06 Dec 2013 19:33:05 GMT
Author: rdonkin
Date: Fri Dec  6 19:33:05 2013
New Revision: 1548690

URL: http://svn.apache.org/r1548690
Log:
Convert W3CDocumentLicense to use LicenseFamily constructor

Added:
    creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CDocLicenseTest.java
      - copied, changed from r1548688, creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java
Modified:
    creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
    creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/W3CDocLicense.java
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
    creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java

Modified: creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java?rev=1548690&r1=1548689&r2=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-api/src/main/java/org/apache/rat/api/domain/RatLicenseFamily.java
Fri Dec  6 19:33:05 2013
@@ -28,7 +28,12 @@ public enum RatLicenseFamily {
     W3C(
             "W3C Software Copyright",
             "W3C  ",
-            "Note that W3C requires a NOTICE. All modifications require notes. See http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.");
+            "Note that W3C requires a NOTICE. All modifications require notes. See http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231."),
+
+    W3C_DOCUMENTATION(
+            "W3C Document Copyright",
+            "W3CD ",
+            "Note that W3CD does not allow modifications. See http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231.");
 
     /** @see LicenseFamily#getName() */
     private final String name;

Modified: creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java?rev=1548690&r1=1548689&r2=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-api/src/test/java/org/apache/rat/api/domain/RatLicenseFamilyTest.java
Fri Dec  6 19:33:05 2013
@@ -19,6 +19,7 @@
 package org.apache.rat.api.domain;
 
 import static org.apache.rat.api.domain.RatLicenseFamily.W3C;
+import static org.apache.rat.api.domain.RatLicenseFamily.W3C_DOCUMENTATION;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 
@@ -42,4 +43,21 @@ public class RatLicenseFamilyTest {
                 W3C.getNotes(),
                 is("Note that W3C requires a NOTICE. All modifications require notes. See
http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231."));
     }
+
+    @Test
+    public void testW3CDocLicenseFamilyCategory() {
+        assertThat(W3C_DOCUMENTATION.getCategory(), is("W3CD "));
+    }
+
+    @Test
+    public void testW3CDocLicenseFamilyName() {
+        assertThat(W3C_DOCUMENTATION.getName(), is("W3C Document Copyright"));
+    }
+
+    @Test
+    public void testW3CDocLicenseFamilyNotes() {
+        assertThat(
+                W3C_DOCUMENTATION.getNotes(),
+                is("Note that W3CD does not allow modifications. See http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231."));
+    }
 }

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/W3CDocLicense.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/W3CDocLicense.java?rev=1548690&r1=1548689&r2=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/W3CDocLicense.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/W3CDocLicense.java
Fri Dec  6 19:33:05 2013
@@ -18,18 +18,15 @@
  */
 package org.apache.rat.analysis.license;
 
-import org.apache.rat.api.MetaData;
+import org.apache.rat.api.domain.RatLicenseFamily;
 
 public class W3CDocLicense extends SimplePatternBasedLicense {
 
-    private static final String NOTES 
-        = "Note that W3CD does not allow modifications. See http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231.";
-    private static final String COPYRIGHT_URL 
-    = "http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231";
-    
+    private static final String COPYRIGHT_URL =
+            "http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231";
+
     public W3CDocLicense() {
-        super(MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_W3CD, 
-                MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_W3C_DOCUMENT_COPYRIGHT,  NOTES,
-                new String[]{COPYRIGHT_URL});
+        super(RatLicenseFamily.W3C_DOCUMENTATION.licenseFamily(),
+                new String[] { COPYRIGHT_URL });
     }
 }

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java?rev=1548690&r1=1548689&r2=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/api/MetaData.java
Fri Dec  6 19:33:05 2013
@@ -18,7 +18,6 @@
  */
 package org.apache.rat.api;
 
-import static org.apache.rat.api.domain.RatLicenseFamily.W3C;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -67,7 +66,6 @@ public class MetaData {
     public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_UNKNOWN = "?????";
     public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_ASL = "AL   ";
     public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_OASIS = "OASIS";
-    public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_W3CD = "W3CD ";
     public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_DOJO = "DOJO ";
     public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_TMF = "TMF  ";
     public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_GPL1 = "GPL1 ";
@@ -88,11 +86,6 @@ public class MetaData {
     public static final Datum RAT_LICENSE_FAMILY_CATEGORY_DATUM_OASIS = new Datum(
             RAT_URL_LICENSE_FAMILY_CATEGORY,
             RAT_LICENSE_FAMILY_CATEGORY_VALUE_OASIS);
-    public static final Datum RAT_LICENSE_FAMILY_CATEGORY_DATUM_W3CD = new Datum(
-            RAT_URL_LICENSE_FAMILY_CATEGORY,
-            RAT_LICENSE_FAMILY_CATEGORY_VALUE_W3CD);
-    public static final Datum RAT_LICENSE_FAMILY_CATEGORY_DATUM_W3C =
-            new Datum(RAT_URL_LICENSE_FAMILY_CATEGORY, W3C.getCategory());
     public static final Datum RAT_LICENSE_FAMILY_CATEGORY_DATUM_DOJO = new Datum(
             RAT_URL_LICENSE_FAMILY_CATEGORY,
             RAT_LICENSE_FAMILY_CATEGORY_VALUE_DOJO);
@@ -129,11 +122,6 @@ public class MetaData {
     public static final String RAT_LICENSE_FAMILY_NAME_VALUE_CDDL1 = "COMMON DEVELOPMENT
AND DISTRIBUTION LICENSE Version 1.0";
     public static final String RAT_LICENSE_FAMILY_NAME_VALUE_ACADEMIC_FREE_LICENSE_VERSION_2_1
= "Academic Free License, Version 2.1";
     public static final String RAT_LICENSE_FAMILY_NAME_VALUE_UNKNOWN = "?????";
-    public static final Datum RAT_LICENSE_FAMILY_NAME_DATUM_W3C_SOFTWARE_COPYRIGHT =
-            new Datum(RAT_URL_LICENSE_FAMILY_NAME, W3C.getName());
-    public static final Datum RAT_LICENSE_FAMILY_NAME_DATUM_W3C_DOCUMENT_COPYRIGHT = new
Datum(
-            RAT_URL_LICENSE_FAMILY_NAME,
-            RAT_LICENSE_FAMILY_NAME_VALUE_W3C_DOCUMENT_COPYRIGHT);
     public static final Datum RAT_LICENSE_FAMILY_NAME_DATUM_OASIS_OPEN_LICENSE = new Datum(
             RAT_URL_LICENSE_FAMILY_NAME,
             RAT_LICENSE_FAMILY_NAME_VALUE_OASIS_OPEN_LICENSE);

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java?rev=1548690&r1=1548689&r2=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java
Fri Dec  6 19:33:05 2013
@@ -18,10 +18,10 @@
  */ 
 package org.apache.rat.license;
 
-import org.apache.rat.api.MetaData;
+import org.apache.rat.api.domain.RatLicenseFamily;
 
 public class W3CDocumentLicenseFamily extends SimpleLicenseFamily {
     public W3CDocumentLicenseFamily() {
-        super(MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_W3C_DOCUMENT_COPYRIGHT);
+        super(RatLicenseFamily.W3C_DOCUMENTATION.getName());
     }
 }

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java?rev=1548690&r1=1548689&r2=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/policy/DefaultPolicy.java
Fri Dec  6 19:33:05 2013
@@ -23,6 +23,7 @@ import static org.apache.rat.api.domain.
 import org.apache.rat.api.Document;
 import org.apache.rat.api.MetaData;
 import org.apache.rat.api.MetaData.Datum;
+import org.apache.rat.api.domain.RatLicenseFamily;
 import org.apache.rat.document.IDocumentAnalyser;
 import org.apache.rat.license.ILicenseFamily;
 
@@ -33,7 +34,7 @@ public class DefaultPolicy implements ID
         MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_APACHE_LICENSE_VERSION_2_0,
         MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_OASIS_OPEN_LICENSE,
         W3C.getName(),
-        MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_W3C_DOCUMENT_COPYRIGHT,
+        RatLicenseFamily.W3C_DOCUMENTATION.getName(),
         MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_MODIFIED_BSD_LICENSE,
         MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_MIT,
         MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_CDDL1,

Copied: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CDocLicenseTest.java
(from r1548688, creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java)
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CDocLicenseTest.java?p2=creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CDocLicenseTest.java&p1=creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java&r1=1548688&r2=1548690&rev=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/W3CDocumentLicenseFamily.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/W3CDocLicenseTest.java
Fri Dec  6 19:33:05 2013
@@ -15,13 +15,39 @@
  * KIND, either express or implied.  See the License for the    *
  * specific language governing permissions and limitations      *
  * under the License.                                           *
- */ 
-package org.apache.rat.license;
+ */
+package org.apache.rat.analysis.license;
 
-import org.apache.rat.api.MetaData;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
 
-public class W3CDocumentLicenseFamily extends SimpleLicenseFamily {
-    public W3CDocumentLicenseFamily() {
-        super(MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_W3C_DOCUMENT_COPYRIGHT);
+import org.junit.Before;
+import org.junit.Test;
+
+public class W3CDocLicenseTest {
+
+    W3CDocLicense license;
+
+    @Before
+    public void setUp() throws Exception {
+        this.license = new W3CDocLicense();
+    }
+
+    @Test
+    public void testNotes() {
+        assertThat(
+                this.license.getNotes(),
+                is("Note that W3CD does not allow modifications. See http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231."));
+    }
+
+    @Test
+    public void testCategory() {
+        assertThat(this.license.getLicenseFamilyCategory(), is("W3CD "));
+    }
+
+    @Test
+    public void testName() {
+        assertThat(this.license.getLicenseFamilyName(),
+                is("W3C Document Copyright"));
     }
 }

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java?rev=1548690&r1=1548689&r2=1548690&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/policy/DefaultPolicyTest.java
Fri Dec  6 19:33:05 2013
@@ -20,11 +20,14 @@ package org.apache.rat.policy;
 
 import org.apache.rat.api.Document;
 import org.apache.rat.api.MetaData;
+import org.apache.rat.api.MetaData.Datum;
 import org.apache.rat.document.MockLocation;
 import org.apache.rat.report.claim.impl.xml.MockClaimReporter;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.rat.api.domain.RatLicenseFamily.W3C;
+import static org.apache.rat.api.domain.RatLicenseFamily.W3C_DOCUMENTATION;
 import static org.junit.Assert.assertEquals;
 
 
@@ -62,14 +65,14 @@ public class DefaultPolicyTest {
     
     @Test
     public void testW3CFamily() throws Exception {
-        subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_W3C_SOFTWARE_COPYRIGHT);
+        subject.getMetaData().set(new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME,
W3C.getName()));
         policy.analyse(subject);
         assertApproval(true);
     }
     
     @Test
     public void testW3CDocFamily() throws Exception {
-        subject.getMetaData().set(MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_W3C_DOCUMENT_COPYRIGHT);
+        subject.getMetaData().set(new MetaData.Datum(MetaData.RAT_URL_LICENSE_FAMILY_NAME,
W3C_DOCUMENTATION.getName()));
         policy.analyse(subject);
         assertApproval(true);
     }



Mime
View raw message