creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1548810 - 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 Sat, 07 Dec 2013 08:20:23 GMT
Author: rdonkin
Date: Sat Dec  7 08:20:22 2013
New Revision: 1548810

URL: http://svn.apache.org/r1548810
Log:
Convert CDDL1License to use LicenseFamily constructor

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/CDDL1License.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/CDDL1LicenseFamily.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/analysis/license/CDDL1LicenseTest.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=1548810&r1=1548809&r2=1548810&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
Sat Dec  7 08:20:22 2013
@@ -45,6 +45,10 @@ public enum RatLicenseFamily {
 			"The MIT License",
 			"MIT  ",
 			"Note that MIT requires a NOTICE. All modifications require notes. See http://opensource.org/licenses/MIT."),
+	CDDL1(
+			"COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0",
+			"CDDL1",
+			"Note that CDDL1 requires a NOTICE. All modifications require notes. See https://oss.oracle.com/licenses/CDDL."),
     W3C(
             "W3C Software Copyright",
             "W3C  ",

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=1548810&r1=1548809&r2=1548810&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
Sat Dec  7 08:20:22 2013
@@ -19,6 +19,7 @@
 package org.apache.rat.api.domain;
 
 import static org.apache.rat.api.domain.RatLicenseFamily.APACHE;
+import static org.apache.rat.api.domain.RatLicenseFamily.CDDL1;
 import static org.apache.rat.api.domain.RatLicenseFamily.GPL1;
 import static org.apache.rat.api.domain.RatLicenseFamily.GPL2;
 import static org.apache.rat.api.domain.RatLicenseFamily.GPL3;
@@ -150,4 +151,22 @@ public class RatLicenseFamilyTest {
 				MIT.getNotes(),
 				is("Note that MIT requires a NOTICE. All modifications require notes. See http://opensource.org/licenses/MIT."));
 	}
+
+	@Test
+	public void testCDDL1LicenseFamilyCategory() {
+		assertThat(CDDL1.getCategory(), is("CDDL1"));
+	}
+
+	@Test
+	public void testCDDL1LicenseFamilyName() {
+		assertThat(CDDL1.getName(),
+				is("COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0"));
+	}
+
+	@Test
+	public void testCDDL1LicenseFamilyNotes() {
+		assertThat(
+				CDDL1.getNotes(),
+				is("Note that CDDL1 requires a NOTICE. All modifications require notes. See https://oss.oracle.com/licenses/CDDL."));
+	}
 }

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java?rev=1548810&r1=1548809&r2=1548810&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/CDDL1License.java
Sat Dec  7 08:20:22 2013
@@ -18,10 +18,11 @@
  */
 package org.apache.rat.analysis.license;
 
+import static org.apache.rat.api.domain.RatLicenseFamily.CDDL1;
+
 import java.util.regex.Pattern;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.rat.api.MetaData;
 
 /**
  * Base CDDL 1.0 license.
@@ -42,9 +43,7 @@ public class CDDL1License extends Simple
 	 * Instantiates a new cDD l1 license.
 	 */
     public CDDL1License() {
-        super(MetaData.RAT_LICENSE_FAMILY_CATEGORY_DATUM_CDLL1,
-                MetaData.RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1,
-                "", new String[]{LICENSE_LINE, LICENSE_URL});
+		super(CDDL1.licenseFamily(), new String[] { LICENSE_LINE, LICENSE_URL });
     }
 
 	/**
@@ -53,7 +52,7 @@ public class CDDL1License extends Simple
 	 * @return the reg ex patterns
 	 */
     private Pattern[] getRegExPatterns() {
-        Pattern[] result;
+		Pattern[] result;
         final String[] pttrns = getPatterns();
         if (ArrayUtils.isEmpty(pttrns)) {
             result = new Pattern[0];

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=1548810&r1=1548809&r2=1548810&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
Sat Dec  7 08:20:22 2013
@@ -67,7 +67,6 @@ public class MetaData {
     public static final String RAT_LICENSE_FAMILY_CATEGORY_VALUE_OASIS = "OASIS";
     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_CDDL1 = "CDDL1";
 
     public static final Datum RAT_LICENSE_FAMILY_CATEGORY_DATUM_GEN = new Datum(
             RAT_URL_LICENSE_FAMILY_CATEGORY,
@@ -84,9 +83,6 @@ public class MetaData {
     public static final Datum RAT_LICENSE_FAMILY_CATEGORY_DATUM_TMF = new Datum(
             RAT_URL_LICENSE_FAMILY_CATEGORY,
             RAT_LICENSE_FAMILY_CATEGORY_VALUE_TMF);
-    public static final Datum RAT_LICENSE_FAMILY_CATEGORY_DATUM_CDLL1 = new Datum(
-            RAT_URL_LICENSE_FAMILY_CATEGORY,
-            RAT_LICENSE_FAMILY_CATEGORY_VALUE_CDDL1);
 
     // License Family Standard Names
     public static final String RAT_URL_LICENSE_FAMILY_NAME = RAT_BASE_URL
@@ -94,7 +90,6 @@ public class MetaData {
     public static final String RAT_LICENSE_FAMILY_NAME_VALUE_W3C_DOCUMENT_COPYRIGHT = "W3C
Document Copyright";
     public static final String RAT_LICENSE_FAMILY_NAME_VALUE_OASIS_OPEN_LICENSE = "OASIS
Open License";
     public static final String RAT_LICENSE_FAMILY_NAME_VALUE_MODIFIED_BSD_LICENSE = "Modified
BSD License";
-    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_OASIS_OPEN_LICENSE = new Datum(
@@ -103,8 +98,6 @@ public class MetaData {
     public static final Datum RAT_LICENSE_FAMILY_NAME_DATUM_MODIFIED_BSD_LICENSE = new Datum(
             RAT_URL_LICENSE_FAMILY_NAME,
             RAT_LICENSE_FAMILY_NAME_VALUE_MODIFIED_BSD_LICENSE);
-    public static final Datum RAT_LICENSE_FAMILY_NAME_DATUM_CDDL1 = new Datum(
-            RAT_URL_LICENSE_FAMILY_NAME, RAT_LICENSE_FAMILY_NAME_VALUE_CDDL1);
 
     public static final Datum RAT_LICENSE_FAMILY_NAME_DATUM_ACADEMIC_FREE_LICENSE_VERSION_2_1
= new Datum(
             RAT_URL_LICENSE_FAMILY_NAME,

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/CDDL1LicenseFamily.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/CDDL1LicenseFamily.java?rev=1548810&r1=1548809&r2=1548810&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/CDDL1LicenseFamily.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/license/CDDL1LicenseFamily.java
Sat Dec  7 08:20:22 2013
@@ -18,7 +18,7 @@
  */
 package org.apache.rat.license;
 
-import org.apache.rat.api.MetaData;
+import static org.apache.rat.api.domain.RatLicenseFamily.CDDL1;
 
 /**
  * Base implementation for CDDL 1.0 licenses.
@@ -26,6 +26,6 @@ import org.apache.rat.api.MetaData;
 public class CDDL1LicenseFamily extends SimpleLicenseFamily {
 
     public CDDL1LicenseFamily() {
-        super(MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_CDDL1);
+		super(CDDL1.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=1548810&r1=1548809&r2=1548810&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
Sat Dec  7 08:20:22 2013
@@ -20,6 +20,7 @@ package org.apache.rat.policy;
 
 
 import static org.apache.rat.api.domain.RatLicenseFamily.APACHE;
+import static org.apache.rat.api.domain.RatLicenseFamily.CDDL1;
 import static org.apache.rat.api.domain.RatLicenseFamily.MIT;
 import static org.apache.rat.api.domain.RatLicenseFamily.W3C;
 import static org.apache.rat.api.domain.RatLicenseFamily.W3C_DOCUMENTATION;
@@ -37,7 +38,7 @@ public class DefaultPolicy implements ID
                    MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_OASIS_OPEN_LICENSE,
                    W3C.getName(), W3C_DOCUMENTATION.getName(),
                    MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_MODIFIED_BSD_LICENSE,
-                   MIT.getName(), MetaData.RAT_LICENSE_FAMILY_NAME_VALUE_CDDL1, };
+                   MIT.getName(), CDDL1.getName(), };
 
     private static final String[] toNames(final ILicenseFamily[] approvedLicenses) {
         String[] results = null;

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java?rev=1548810&r1=1548809&r2=1548810&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/CDDL1LicenseTest.java
Sat Dec  7 08:20:22 2013
@@ -18,8 +18,10 @@
  */
 package org.apache.rat.analysis.license;
 
+import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 import java.util.HashMap;
@@ -96,4 +98,22 @@ public class CDDL1LicenseTest {
 					.match(subject, "\t" + licenceUnderTest.getValue()));
         }
     }
+    
+	@Test
+	public void testNotes() {
+		assertThat(
+				new CDDL1License().getNotes(),
+				is("Note that CDDL1 requires a NOTICE. All modifications require notes. See https://oss.oracle.com/licenses/CDDL."));
+	}
+
+	@Test
+	public void testCategory() {
+		assertThat(new CDDL1License().getLicenseFamilyCategory(), is("CDDL1"));
+	}
+
+	@Test
+	public void testName() {
+		assertThat(new CDDL1License().getLicenseFamilyName(),
+				is("COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0"));
+	}
 }



Mime
View raw message