creadur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r1548846 - in /creadur/rat/branches/gsoc/apache-rat-core/src: main/java/org/apache/rat/analysis/license/ test/java/org/apache/rat/analysis/license/
Date Sat, 07 Dec 2013 10:57:36 GMT
Author: rdonkin
Date: Sat Dec  7 10:57:36 2013
New Revision: 1548846

URL: http://svn.apache.org/r1548846
Log:
Remove complex contracts of BaseLicense.

Modified:
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
    creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java
    creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java
    creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java?rev=1548846&r1=1548845&r2=1548846&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java
Sat Dec  7 10:57:36 2013
@@ -47,35 +47,6 @@ public class BaseLicense {
     }
 
     /**
-     * Instantiates a new base license.
-     * 
-     * @param licenseFamilyCategory
-     *            the license family category
-     * @param licenseFamilyName
-     *            the license family name
-     * @param notes
-     *            the notes
-     */
-    public BaseLicense(final MetaData.Datum licenseFamilyCategory,
-            final MetaData.Datum licenseFamilyName, final String notes) {
-        if (!MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY
-                .equals(licenseFamilyCategory.getName())) {
-            throw new IllegalStateException("Expected "
-                    + MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY + ", got "
-                    + licenseFamilyCategory.getName());
-        }
-        setLicenseFamilyCategory(licenseFamilyCategory.getValue());
-        if (!MetaData.RAT_URL_LICENSE_FAMILY_NAME.equals(licenseFamilyName
-                .getName())) {
-            throw new IllegalStateException("Expected "
-                    + MetaData.RAT_URL_LICENSE_FAMILY_NAME + ", got "
-                    + licenseFamilyName.getName());
-        }
-        setLicenseFamilyName(licenseFamilyName.getValue());
-        setNotes(notes);
-    }
-
-    /**
      * Constructs a license based on the given family.
      * 
      * @param licenseFamily

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java?rev=1548846&r1=1548845&r2=1548846&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java
Sat Dec  7 10:57:36 2013
@@ -22,7 +22,6 @@ import java.util.Locale;
 
 import org.apache.rat.analysis.IHeaderMatcher;
 import org.apache.rat.api.Document;
-import org.apache.rat.api.MetaData.Datum;
 import org.apache.rat.api.domain.LicenseFamily;
 
 /**
@@ -65,25 +64,6 @@ public class FullTextMatchingLicense ext
         super();
         this.fullText = null;
     }
-
-    /**
-     * Instantiates a new full text matching license.
-     * 
-     * @param licenseFamilyCategory
-     *            the license family category
-     * @param licenseFamilyName
-     *            the license family name
-     * @param notes
-     *            the notes
-     * @param fullText
-     *            the full text
-     */
-    public FullTextMatchingLicense(final Datum licenseFamilyCategory,
-            final Datum licenseFamilyName, final String notes,
-            final String fullText) {
-        super(licenseFamilyCategory, licenseFamilyName, notes);
-        setFullText(fullText);
-    }
     
 	/**
 	 * Constructs a license indicated by the given patterns.

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java?rev=1548846&r1=1548845&r2=1548846&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/ApacheSoftwareLicense20Test.java
Sat Dec  7 10:57:36 2013
@@ -24,8 +24,6 @@ import static org.junit.Assert.assertTha
 import static org.junit.Assert.assertTrue;
 
 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.junit.Before;
 import org.junit.Test;
@@ -68,25 +66,6 @@ public class ApacheSoftwareLicense20Test
 					subject, "'Behold, Telemachus! (nor fear the sight,)"));
 		}
 	}
-	
-	@Test(expected = IllegalStateException.class)
-	public void testApacheLicenseIllegalStateFamilyCategory() {
-		Datum licenseFamilyCategory = new Datum("", "");
-		Datum licenseFamilyName = new Datum("", "");
-		String notes = null;
-		new BaseLicense(licenseFamilyCategory,
-				licenseFamilyName, notes);
-	}
-
-	@Test(expected = IllegalStateException.class)
-	public void testApacheLicenseIllegalStateFamilyName() {
-		Datum licenseFamilyCategory = new Datum(
-				MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY,
-				MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY);
-		Datum licenseFamilyName = new Datum("", "");
-		String notes = null;
-		new BaseLicense(licenseFamilyCategory, licenseFamilyName, notes);
-	}
 
 	@Test
 	public void testNotes() {

Modified: creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
URL: http://svn.apache.org/viewvc/creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java?rev=1548846&r1=1548845&r2=1548846&view=diff
==============================================================================
--- creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
(original)
+++ creadur/rat/branches/gsoc/apache-rat-core/src/test/java/org/apache/rat/analysis/license/AppliedApacheSoftwareLicense20Test.java
Sat Dec  7 10:57:36 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.rat.analysis.license;
 
+import static org.apache.rat.api.domain.RatLicenseFamily.GPL1;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -26,8 +27,6 @@ import java.io.IOException;
 import java.io.StringReader;
 
 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.test.utils.Resources;
 import org.junit.Assert;
@@ -104,15 +103,9 @@ public class AppliedApacheSoftwareLicens
 
 	@Test
 	public void testHasFullText() {
-		Datum licenseFamilyCategory = new Datum(
-				MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY,
-				MetaData.RAT_URL_LICENSE_FAMILY_CATEGORY);
-		Datum licenseFamilyName = new Datum(
-				MetaData.RAT_URL_LICENSE_FAMILY_NAME,
-				MetaData.RAT_URL_LICENSE_FAMILY_NAME);
 		String fullText = "";
 		FullTextMatchingLicense fullTextMatchingLicense = new FullTextMatchingLicense(
-				licenseFamilyCategory, licenseFamilyName, null, fullText);
+				GPL1.licenseFamily(), fullText);
 		assertTrue("fullText not null", fullTextMatchingLicense.hasFullText());
 	}
 }



Mime
View raw message