sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1724528 [9/15] - in /sis/branches/JDK6: ./ application/sis-console/src/main/artifact/bin/ application/sis-console/src/main/artifact/log/ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/src/main/java/org/...
Date Wed, 13 Jan 2016 23:25:42 GMT
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -17,13 +17,14 @@
 package org.apache.sis.referencing;
 
 import java.util.Date;
-import org.opengis.test.Validators;
+import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.TemporalCRS;
 import org.opengis.referencing.crs.VerticalCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.GeocentricCRS;
+import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.EllipsoidalCS;
@@ -33,6 +34,9 @@ import org.opengis.referencing.datum.Ver
 import org.apache.sis.internal.metadata.AxisNames;
 import org.apache.sis.internal.metadata.VerticalDatumTypes;
 import org.apache.sis.internal.util.Constants;
+
+// Test dependencies
+import org.opengis.test.Validators;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -47,7 +51,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.5
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -143,11 +147,12 @@ public final strictfp class CommonCRSTes
             final VerticalDatumType datumType;
             final String axisName, datumName;
             switch (e) {
-                case BAROMETRIC:     axisName = "Barometric altitude";            datumName = "Constant pressure surface"; datumType = VerticalDatumType. BAROMETRIC;    break;
-                case MEAN_SEA_LEVEL: axisName = AxisNames.GRAVITY_RELATED_HEIGHT; datumName = "Mean Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
-                case DEPTH:          axisName = AxisNames.DEPTH;                  datumName = "Mean Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
-                case ELLIPSOIDAL:    axisName = AxisNames.ELLIPSOIDAL_HEIGHT;     datumName = "Ellipsoid";                 datumType = VerticalDatumTypes.ELLIPSOIDAL;   break;
-                case OTHER_SURFACE:  axisName = "Height";                         datumName = "Other surface";             datumType = VerticalDatumType. OTHER_SURFACE; break;
+                case NAVD88:         axisName = AxisNames.GRAVITY_RELATED_HEIGHT; datumName = "North American Vertical Datum 1988"; datumType = VerticalDatumType. GEOIDAL;       break;
+                case BAROMETRIC:     axisName = "Barometric altitude";            datumName = "Constant pressure surface";          datumType = VerticalDatumType. BAROMETRIC;    break;
+                case MEAN_SEA_LEVEL: axisName = AxisNames.GRAVITY_RELATED_HEIGHT; datumName = "Mean Sea Level";                     datumType = VerticalDatumType. GEOIDAL;       break;
+                case DEPTH:          axisName = AxisNames.DEPTH;                  datumName = "Mean Sea Level";                     datumType = VerticalDatumType. GEOIDAL;       break;
+                case ELLIPSOIDAL:    axisName = AxisNames.ELLIPSOIDAL_HEIGHT;     datumName = "Ellipsoid";                          datumType = VerticalDatumTypes.ELLIPSOIDAL;   break;
+                case OTHER_SURFACE:  axisName = "Height";                         datumName = "Other surface";                      datumType = VerticalDatumType. OTHER_SURFACE; break;
                 default: throw new AssertionError(e);
             }
             final String        name  = e.name();
@@ -202,6 +207,23 @@ public final strictfp class CommonCRSTes
     }
 
     /**
+     * Tests {@link CommonCRS#UTM(double, double)}.
+     *
+     * @since 0.7
+     */
+    @Test
+    @DependsOnMethod("testGeographic")
+    public void testUTM() {
+        final ProjectedCRS crs = CommonCRS.WGS72.UTM(-45, -122);
+        assertEquals("name", "WGS 72 / UTM zone 10S", crs.getName().getCode());
+        final ParameterValueGroup pg = crs.getConversionFromBase().getParameterValues();
+        assertEquals(Constants.LATITUDE_OF_ORIGIN, -123, pg.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(), STRICT);
+        assertEquals(Constants.FALSE_NORTHING, 10000000, pg.parameter(Constants.FALSE_NORTHING).doubleValue(),   STRICT);
+        assertSame("Expected a cached instance.", crs, CommonCRS.WGS72.UTM(-45, -122));
+        assertNotSame("Expected a new instance.", crs, CommonCRS.WGS72.UTM(+45, -122));
+    }
+
+    /**
      * Tests {@link CommonCRS#forCode(String, String, FactoryException)}.
      *
      * @throws FactoryException If a CRS can not be constructed.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -16,12 +16,22 @@
  */
 package org.apache.sis.referencing;
 
+import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.crs.ProjectedCRS;
+import org.opengis.referencing.crs.VerticalCRS;
+import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
+import org.opengis.referencing.datum.VerticalDatum;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.internal.util.Constants;
+
+// Test dependencies
 import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -29,6 +39,7 @@ import org.apache.sis.test.TestCase;
 import org.opengis.test.Validators;
 import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.referencing.cs.HardCodedAxes;
+import org.apache.sis.referencing.cs.HardCodedCS;
 import org.apache.sis.referencing.datum.HardCodedDatum;
 import org.junit.Test;
 
@@ -40,14 +51,30 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 @DependsOn({
-    org.apache.sis.referencing.crs.DefaultGeographicCRSTest.class
+    org.apache.sis.referencing.crs.DefaultGeographicCRSTest.class,
+    org.apache.sis.internal.referencing.provider.TransverseMercatorTest.class
 })
 public final strictfp class StandardDefinitionsTest extends TestCase {
     /**
+     * Tests {@link StandardDefinitions#createUTM(int, GeographicCRS, double, boolean, CartesianCS)}.
+     *
+     * @since 0.7
+     */
+    @Test
+    @DependsOnMethod("testCreateGeographicCRS")
+    public void testCreateUTM() {
+        final ProjectedCRS crs = StandardDefinitions.createUTM(32610, HardCodedCRS.WGS84, 15, -122, HardCodedCS.PROJECTED);
+        assertEquals("name", "WGS 84 / UTM zone 10N", crs.getName().getCode());
+        final ParameterValueGroup pg = crs.getConversionFromBase().getParameterValues();
+        assertEquals(Constants.LATITUDE_OF_ORIGIN, -123, pg.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(), STRICT);
+        assertEquals(Constants.FALSE_NORTHING,        0, pg.parameter(Constants.FALSE_NORTHING).doubleValue(),   STRICT);
+    }
+
+    /**
      * Compares the values created by {@code StandardDefinitions} against hard-coded constants.
      * This method tests the following methods:
      *
@@ -64,7 +91,7 @@ public final strictfp class StandardDefi
      */
     @Test
     @DependsOnMethod("testCreateAxis")
-    public void testCreateGographicCRS() {
+    public void testCreateGeographicCRS() {
         final PrimeMeridian pm = StandardDefinitions.primeMeridian();
         final EllipsoidalCS cs = (EllipsoidalCS) StandardDefinitions.createCoordinateSystem((short) 6422);
         for (final CommonCRS e : CommonCRS.values()) {
@@ -123,10 +150,12 @@ public final strictfp class StandardDefi
      */
     @Test
     public void testCreateAxis() {
-        for (final short code : new short[] {106, 107, 110, 114, 113}) {
+        for (final short code : new short[] {1, 2, 106, 107, 110, 114, 113}) {
             final CoordinateSystemAxis actual = StandardDefinitions.createAxis(code);
             Validators.validate(actual);
             switch (code) {
+                case   1: compare(HardCodedAxes.EASTING,                actual); break;
+                case   2: compare(HardCodedAxes.NORTHING,               actual); break;
                 case 106: compare(HardCodedAxes.GEODETIC_LATITUDE,      actual); break;
                 case 107: compare(HardCodedAxes.GEODETIC_LONGITUDE,     actual); break;
                 case 110: compare(HardCodedAxes.ELLIPSOIDAL_HEIGHT,     actual); break;
@@ -149,4 +178,37 @@ public final strictfp class StandardDefi
         assertEquals("maximumValue", expected.getMaximumValue(),   actual.getMaximumValue(), STRICT);
         assertEquals("rangeMeaning", expected.getRangeMeaning(),   actual.getRangeMeaning());
     }
+
+    /**
+     * Tests the creation of vertical CRS.
+     *
+     * @since 0.7
+     */
+    @Test
+    @DependsOnMethod("testCreateAxis")
+    public void testCreateVerticalCRS() {
+        VerticalDatum datum;
+        VerticalCRS crs;
+
+        datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.NAVD88.datum);
+        crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.NAVD88.crs, datum);
+        assertEquals("name", "NAVD88 height", crs.getName().getCode());
+        assertEquals("identifier", "5703", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
+        assertEquals("identifier",   "88", IdentifiedObjects.getIdentifier(crs, Citations.OGC ).getCode());
+        assertEquals("direction", AxisDirection.UP, crs.getCoordinateSystem().getAxis(0).getDirection());
+
+        datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.MEAN_SEA_LEVEL.datum);
+        crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs, datum);
+        assertEquals("name", "MSL height", crs.getName().getCode());
+        assertEquals("identifier", "5714", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
+        assertNull  ("identifier", IdentifiedObjects.getIdentifier(crs, Citations.OGC));
+        assertEquals("direction", AxisDirection.UP, crs.getCoordinateSystem().getAxis(0).getDirection());
+
+        datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.DEPTH.datum);
+        crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.DEPTH.crs, datum);
+        assertEquals("name", "MSL depth", crs.getName().getCode());
+        assertEquals("identifier", "5715", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
+        assertNull  ("identifier", IdentifiedObjects.getIdentifier(crs, Citations.OGC));
+        assertEquals("direction", AxisDirection.DOWN, crs.getCoordinateSystem().getAxis(0).getDirection());
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -26,14 +26,19 @@ import org.opengis.referencing.crs.Geogr
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.operation.Projection;
 import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.test.Validators;
 import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.cs.HardCodedCS;
-import org.apache.sis.referencing.GeodeticObjectBuilder;
+import org.apache.sis.internal.referencing.GeodeticObjectBuilder;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.LenientComparable;
+
+// Test dependencies
+import org.opengis.test.Validators;
 import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -49,7 +54,7 @@ import static org.apache.sis.test.Refere
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -455,4 +460,23 @@ public final strictfp class DefaultProje
         assertMarshalEqualsFile(XML_FILE, crs, STRICT, new String[] {"gml:name"},
                 new String[] {"xmlns:*", "xsi:schemaLocation", "gml:id"});
     }
+
+    /**
+     * Tests {@link DefaultProjectedCRS#equals(Object, ComparisonMode)}.
+     * In particular, we want to test the ability to ignore axis order of the base CRS in "ignore metadata" mode.
+     *
+     * @throws FactoryException if the CRS creation failed.
+     *
+     * @since 0.7
+     */
+    @Test
+    public void testEquals() throws FactoryException {
+        final ProjectedCRS standard   = create(CommonCRS.WGS84.geographic());
+        final ProjectedCRS normalized = create(CommonCRS.WGS84.normalizedGeographic());
+        assertFalse("STRICT",          ((LenientComparable) standard).equals(normalized, ComparisonMode.STRICT));
+        assertFalse("BY_CONTRACT",     ((LenientComparable) standard).equals(normalized, ComparisonMode.BY_CONTRACT));
+        assertTrue ("IGNORE_METADATA", ((LenientComparable) standard).equals(normalized, ComparisonMode.IGNORE_METADATA));
+        assertTrue ("APPROXIMATIVE",   ((LenientComparable) standard).equals(normalized, ComparisonMode.APPROXIMATIVE));
+        assertTrue ("ALLOW_VARIANT",   ((LenientComparable) standard).equals(normalized, ComparisonMode.ALLOW_VARIANT));
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3002.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -19,8 +19,10 @@ package org.apache.sis.referencing.facto
 import org.opengis.referencing.datum.DatumFactory;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.test.DependsOn;
+import org.junit.FixMethodOrder;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.junit.runners.MethodSorters;
 
 
 /**
@@ -32,10 +34,11 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
     org.apache.sis.referencing.datum.DefaultEllipsoidTest.class
 })
+@RunWith(JUnit4.class)
+@FixMethodOrder(MethodSorters.JVM)      // Intentionally want some randomness
 public final strictfp class GIGS3002 extends org.opengis.test.referencing.gigs.GIGS3002 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3003.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -19,8 +19,10 @@ package org.apache.sis.referencing.facto
 import org.opengis.referencing.datum.DatumFactory;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.test.DependsOn;
+import org.junit.FixMethodOrder;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.junit.runners.MethodSorters;
 
 
 /**
@@ -32,10 +34,11 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
     org.apache.sis.referencing.datum.DefaultPrimeMeridianTest.class
 })
+@RunWith(JUnit4.class)
+@FixMethodOrder(MethodSorters.JVM)      // Intentionally want some randomness
 public final strictfp class GIGS3003 extends org.opengis.test.referencing.gigs.GIGS3003 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3004.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -21,8 +21,10 @@ import org.opengis.referencing.crs.CRSFa
 import org.opengis.referencing.datum.DatumFactory;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.test.DependsOn;
+import org.junit.FixMethodOrder;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.junit.runners.MethodSorters;
 
 
 /**
@@ -35,11 +37,13 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
-    GIGS3002.class, GIGS3003.class,
+    GIGS3002.class,     // Ellipsoids created from properties
+    GIGS3003.class,     // Prime meridians created from properties
     org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class
 })
+@RunWith(JUnit4.class)
+@FixMethodOrder(MethodSorters.JVM)      // Intentionally want some randomness
 public final strictfp class GIGS3004 extends org.opengis.test.referencing.gigs.GIGS3004 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS3005.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -19,8 +19,10 @@ package org.apache.sis.referencing.facto
 import org.opengis.referencing.operation.CoordinateOperationFactory;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.test.DependsOn;
+import org.junit.FixMethodOrder;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
+import org.junit.runners.MethodSorters;
 
 
 /**
@@ -32,10 +34,11 @@ import org.junit.runners.JUnit4;
  * @version 0.6
  * @module
  */
-@RunWith(JUnit4.class)
 @DependsOn({
     org.apache.sis.referencing.operation.DefaultConversionTest.class
 })
+@RunWith(JUnit4.class)
+@FixMethodOrder(MethodSorters.JVM)      // Intentionally want some randomness
 public final strictfp class GIGS3005 extends org.opengis.test.referencing.gigs.GIGS3005 {
     /**
      * Creates a new test suite using the singleton factory instance.

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -16,21 +16,46 @@
  */
 package org.apache.sis.referencing.factory;
 
+import java.util.Map;
+import java.util.Collections;
+import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
+import javax.measure.unit.NonSI;
+import javax.measure.quantity.Angle;
+import javax.measure.quantity.Length;
+import org.opengis.util.FactoryException;
+import org.opengis.referencing.IdentifiedObject;
 import org.opengis.referencing.cs.CSFactory;
+import org.opengis.referencing.cs.CartesianCS;
+import org.opengis.referencing.cs.EllipsoidalCS;
+import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.crs.CRSFactory;
 import org.opengis.referencing.crs.GeodeticCRS;
+import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.datum.DatumFactory;
+import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.operation.CoordinateOperationFactory;
-import org.opengis.test.referencing.ObjectFactoryTest;
-import org.opengis.util.FactoryException;
+import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.Conversion;
+import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.referencing.operation.DefaultConversion;
+import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.io.wkt.Convention;
+
+// Test dependencies
+import org.opengis.test.referencing.ObjectFactoryTest;
 import org.apache.sis.test.DependsOn;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**
@@ -39,7 +64,7 @@ import static org.junit.Assert.*;
  *
  * @author  Cédric Briançon (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @RunWith(JUnit4.class)
@@ -84,4 +109,116 @@ public final strictfp class GeodeticObje
         assertEquals("name",  "WGS 84", crs.getName().getCode());
         assertEquals("datum", "World Geodetic System 1984", crs.getDatum().getName().getCode());
     }
+
+    /**
+     * Convenience method creating a map with only the "{@code name"} property.
+     * This is the only mandatory property for object creation.
+     */
+    private static Map<String,?> name(final String name) {
+        return Collections.singletonMap(IdentifiedObject.NAME_KEY, name);
+    }
+
+    /**
+     * Tests step-by-step the creation of a new projected coordinate reference systems.
+     * This test creates every objects itself and compares with expected WKT 1 after each step.
+     *
+     * <p>Note that practical applications may use existing constants declared in the
+     * {@link CommonCRS} class instead than creating everything like this test does.</p>
+     *
+     * @throws FactoryException if the creation of a geodetic component failed.
+     *
+     * @since 0.7
+     */
+    @Test
+    public void testStepByStepCreation() throws FactoryException {
+        /*
+         * List of all objects to be created in this test.
+         */
+        final Unit<Length>         linearUnit;
+        final Unit<Angle>          angularUnit;
+        final Ellipsoid            ellipsoid;
+        final PrimeMeridian        meridian;
+        final GeodeticDatum        datum;
+        final CoordinateSystemAxis longitude, latitude, easting, northing;
+        final EllipsoidalCS        geographicCS;
+        final GeographicCRS        geographicCRS;
+        final OperationMethod      method;
+        final ParameterValueGroup  parameters;
+        final Conversion           projection;
+        final CartesianCS          projectedCS;
+        final ProjectedCRS         projectedCRS;
+        /*
+         * Prime meridian
+         */
+        angularUnit = NonSI.DEGREE_ANGLE;
+        meridian = datumFactory.createPrimeMeridian(name("Greenwich"), 0, angularUnit);
+        assertWktEquals(Convention.WKT1,
+                "PRIMEM[“Greenwich”, 0.0]", meridian);
+        /*
+         * Ellipsoid
+         */
+        linearUnit = SI.METRE;
+        ellipsoid = datumFactory.createEllipsoid(name("Airy1830"), 6377563.396, 6356256.910, linearUnit);
+        assertWktEquals(Convention.WKT1,
+                "SPHEROID[“Airy1830”, 6377563.396, 299.3249753150345]", ellipsoid);
+        /*
+         * Geodetic datum
+         */
+        datum = datumFactory.createGeodeticDatum(name("Airy1830"), ellipsoid, meridian);
+        assertWktEquals(Convention.WKT1,
+                "DATUM[“Airy1830”,\n" +
+                "  SPHEROID[“Airy1830”, 6377563.396, 299.3249753150345]]", datum);
+        /*
+         * Base coordinate reference system
+         */
+        longitude     =  csFactory.createCoordinateSystemAxis(name("Longitude"), "long", AxisDirection.EAST,  angularUnit);
+        latitude      =  csFactory.createCoordinateSystemAxis(name("Latitude"),  "lat",  AxisDirection.NORTH, angularUnit);
+        geographicCS  =  csFactory.createEllipsoidalCS(name("Ellipsoidal"), longitude, latitude);
+        geographicCRS = crsFactory.createGeographicCRS(name("Airy1830"), datum, geographicCS);
+        assertWktEquals(Convention.WKT1,
+                "GEOGCS[“Airy1830”,\n" +
+                "  DATUM[“Airy1830”,\n" +
+                "    SPHEROID[“Airy1830”, 6377563.396, 299.3249753150345]],\n" +
+                "    PRIMEM[“Greenwich”, 0.0],\n" +
+                "  UNIT[“degree”, 0.017453292519943295],\n" +
+                "  AXIS[“Longitude”, EAST],\n" +
+                "  AXIS[“Latitude”, NORTH]]", geographicCRS);
+        /*
+         * Defining conversion
+         */
+        method = copFactory.getOperationMethod("Transverse_Mercator");
+        parameters = method.getParameters().createValue();
+        parameters.parameter("semi_major")        .setValue(ellipsoid.getSemiMajorAxis());
+        parameters.parameter("semi_minor")        .setValue(ellipsoid.getSemiMinorAxis());
+        parameters.parameter("central_meridian")  .setValue(     49);
+        parameters.parameter("latitude_of_origin").setValue(     -2);
+        parameters.parameter("false_easting")     .setValue( 400000);
+        parameters.parameter("false_northing")    .setValue(-100000);
+        projection = new DefaultConversion(name("GBN grid"), method, null, parameters);
+        /*
+         * Projected coordinate reference system
+         */
+        easting      =  csFactory.createCoordinateSystemAxis(name("Easting"),  "x", AxisDirection.EAST,  linearUnit);
+        northing     =  csFactory.createCoordinateSystemAxis(name("Northing"), "y", AxisDirection.NORTH, linearUnit);
+        projectedCS  =  csFactory.createCartesianCS(name("Cartesian"), easting, northing);
+        projectedCRS = crsFactory.createProjectedCRS(name("Great_Britian_National_Grid"), geographicCRS, projection, projectedCS);
+        assertWktEquals(Convention.WKT1,
+                "PROJCS[“Great_Britian_National_Grid”,\n" +
+                "  GEOGCS[“Airy1830”,\n" +
+                "    DATUM[“Airy1830”,\n" +
+                "      SPHEROID[“Airy1830”, 6377563.396, 299.3249753150345]],\n" +
+                "      PRIMEM[“Greenwich”, 0.0],\n" +
+                "    UNIT[“degree”, 0.017453292519943295],\n" +
+                "    AXIS[“Longitude”, EAST],\n" +
+                "    AXIS[“Latitude”, NORTH]],\n" +
+                "  PROJECTION[“Transverse_Mercator”, AUTHORITY[“EPSG”, “9807”]],\n" +
+                "  PARAMETER[“latitude_of_origin”, -2.0],\n" +
+                "  PARAMETER[“central_meridian”, 49.0],\n" +
+                "  PARAMETER[“scale_factor”, 1.0],\n" +
+                "  PARAMETER[“false_easting”, 400000.0],\n" +
+                "  PARAMETER[“false_northing”, -100000.0],\n" +
+                "  UNIT[“metre”, 1],\n" +
+                "  AXIS[“Easting”, EAST],\n" +
+                "  AXIS[“Northing”, NORTH]]", projectedCRS);
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -100,7 +100,7 @@ public abstract strictfp class MatrixTes
      *
      * @see NonSquareMatrixTest#printStatistics()
      */
-    static final Statistics statistics = verbose ? new Statistics("|SIS - JAMA|") : null;
+    static final Statistics statistics = VERBOSE ? new Statistics("|SIS - JAMA|") : null;
 
     /**
      * Random number generator, created by {@link #initialize(long)} as the first operation of

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/LambertConicConformalTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -106,7 +106,7 @@ public final strictfp class LambertConic
         assertWktEqualsRegex("(?m)\\Q" +
                 "PARAM_MT[“Lambert conic conformal”,\n" +
                 "  PARAMETER[“eccentricity”, 0.0818191908426215],\n" +
-                "  PARAMETER[“n”, 0.64278760968653\\E\\d*\\]\\]");  // 0.6427876096865393 in the original test.
+                "  PARAMETER[“n”, 0.64278760968653\\E\\d*\\Q]]\\E");  // 0.6427876096865393 in the original test.
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MapProjectionTestCase.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -97,7 +97,7 @@ strictfp class MapProjectionTestCase ext
     {
         final Parameters parameters = parameters(provider, ellipse);
         if (centralMeridian  != 0) parameters.parameter(Constants.CENTRAL_MERIDIAN)   .setValue(centralMeridian, NonSI.DEGREE_ANGLE);
-        if (latitudeOfOrigin != 0) parameters.parameter("latitude_of_origin")         .setValue(latitudeOfOrigin);
+        if (latitudeOfOrigin != 0) parameters.parameter(Constants.LATITUDE_OF_ORIGIN) .setValue(latitudeOfOrigin);
         if (standardParallel != 0) parameters.parameter(Constants.STANDARD_PARALLEL_1).setValue(standardParallel);
         if (scaleFactor      != 1) parameters.parameter(Constants.SCALE_FACTOR)       .setValue(scaleFactor);
         if (falseEasting     != 0) parameters.parameter(Constants.FALSE_EASTING)      .setValue(falseEasting);

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -16,7 +16,10 @@
  */
 package org.apache.sis.referencing.operation.transform;
 
+import java.util.Map;
 import java.util.Set;
+import java.util.Collection;
+import java.util.Collections;
 import org.opengis.util.FactoryException;
 import org.opengis.util.NoSuchIdentifierException;
 import org.opengis.referencing.operation.Conversion;
@@ -25,11 +28,21 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
+import org.opengis.parameter.ParameterValueGroup;
+import org.apache.sis.parameter.Parameterized;
+import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.operation.DefaultConversion;
 import org.apache.sis.referencing.operation.matrix.Matrix2;
+import org.apache.sis.referencing.crs.DefaultProjectedCRS;
+import org.apache.sis.referencing.factory.InvalidGeodeticParameterException;
 import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.internal.referencing.provider.Mercator1SP;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.util.CharSequences;
+
+// Test dependencies
+import org.apache.sis.referencing.cs.HardCodedCS;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -45,7 +58,7 @@ import static org.opengis.test.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -162,4 +175,68 @@ public final strictfp class DefaultMathT
                 1, 7,
                 0, 1), MathTransforms.getMatrix(tr), STRICT);
     }
+
+    /**
+     * Tests the creation of all registered map projections.
+     * Only the semi-axis lengths are specified. For the rest, we rely on default values.
+     *
+     * @throws FactoryException if the construction of a map projection failed.
+     *
+     * @since 0.7
+     */
+    @Test
+    public void testAllMapProjections() throws FactoryException {
+        /*
+         * Gets all map projections and creates a projection using the WGS84 ellipsoid
+         * and default parameter values.
+         */
+        final Map<String,?> dummyName = Collections.singletonMap(DefaultProjectedCRS.NAME_KEY, "Test");
+        final MathTransformFactory mtFactory = DefaultFactories.forBuildin(MathTransformFactory.class);
+        final Collection<OperationMethod> methods = mtFactory.getAvailableMethods(Projection.class);
+        for (final OperationMethod method : methods) {
+            final String classification = method.getName().getCode();
+            ParameterValueGroup param = mtFactory.getDefaultParameters(classification);
+            param.parameter("semi_major").setValue(6377563.396);
+            param.parameter("semi_minor").setValue(6356256.909237285);
+            final MathTransform mt;
+            try {
+                mt = mtFactory.createParameterizedTransform(param);
+            } catch (InvalidGeodeticParameterException e) {
+                // Some map projections have mandatory parameters which we ignore for now
+                // except for a few well-known projection that we know should not fail.
+                if (classification.contains("Mercator")) {
+                    throw e;
+                }
+                out.print(classification);
+                out.print(CharSequences.spaces(42 - classification.length()));
+                out.print(": ");
+                out.println(e.getLocalizedMessage());
+                continue;
+            }
+            /*
+             * Verifies that the map projection properties are the ones that we specified.
+             * Note that the Equirectangular projection has been optimized as an affine transform, which we skip.
+             */
+            if (mt instanceof LinearTransform) {
+                continue;
+            }
+            assertInstanceOf(classification, Parameterized.class, mt);
+            param = ((Parameterized) mt).getParameterValues();
+            assertEquals(classification, param.getDescriptor().getName().getCode());
+            assertEquals(classification, 6377563.396,       param.parameter("semi_major").doubleValue(), 1E-4);
+            assertEquals(classification, 6356256.909237285, param.parameter("semi_minor").doubleValue(), 1E-4);
+            /*
+             * Creates a ProjectedCRS from the map projection. This part is more an integration test than
+             * a DefaultMathTransformFactory test. Again, the intend is to verify that the properties are
+             * the one that we specified.
+             */
+            final DefaultProjectedCRS crs = new DefaultProjectedCRS(dummyName,
+                    CommonCRS.WGS84.normalizedGeographic(),
+                    new DefaultConversion(dummyName, method, mt, null),
+                    HardCodedCS.PROJECTED);
+            final Conversion projection = crs.getConversionFromBase();
+            assertSame(classification, mt, projection.getMathTransform());
+            assertEquals(classification, projection.getMethod().getName().getCode());
+        }
+    }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransformTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -60,11 +60,7 @@ public final strictfp class EllipsoidToC
      */
     private void createGeodeticConversion(final Ellipsoid ellipsoid, boolean is3D) throws FactoryException {
         transform = EllipsoidToCentricTransform.createGeodeticConversion(
-                DefaultFactories.forBuildin(MathTransformFactory.class),
-                ellipsoid.getSemiMajorAxis(),
-                ellipsoid.getSemiMinorAxis(),
-                ellipsoid.getAxisUnit(), is3D,
-                EllipsoidToCentricTransform.TargetType.CARTESIAN);
+                DefaultFactories.forBuildin(MathTransformFactory.class), ellipsoid, is3D);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -396,6 +396,19 @@ public abstract strictfp class MathTrans
     }
 
     /**
+     * Asserts that the current {@linkplain #transform transform} produces an internal WKT
+     * matching the given regular expression.
+     *
+     * @param expected A regular expression for the expected internal WKT.
+     *
+     * @since 0.7
+     */
+    protected final void assertInternalWktEqualsRegex(final String expected) {
+        assertNotNull("The 'transform' field shall be assigned a value.", transform);
+        ReferencingAssert.assertWktEqualsRegex(Convention.INTERNAL, expected, transform);
+    }
+
+    /**
      * Prints the current {@linkplain #transform transform} as normal and internal WKT.
      * This method is for debugging purpose only.
      *

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -16,26 +16,36 @@
  */
 package org.apache.sis.referencing.operation.transform;
 
+import java.util.Arrays;
+import java.io.IOException;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.TransformException;
 import org.opengis.parameter.ParameterValueGroup;
+import org.apache.sis.internal.referencing.provider.FranceGeocentricInterpolation;
 import org.apache.sis.internal.referencing.provider.AbridgedMolodensky;
 import org.apache.sis.internal.referencing.provider.Molodensky;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.referencing.CommonCRS;
-import org.apache.sis.measure.Longitude;
+import org.apache.sis.math.StatisticsFormat;
+import org.apache.sis.math.Statistics;
 
-import static java.lang.StrictMath.toRadians;
+import static java.lang.StrictMath.*;
+import static org.apache.sis.internal.metadata.ReferencingServices.NAUTICAL_MILE;
 
 // Test dependencies
+import org.apache.sis.internal.referencing.provider.FranceGeocentricInterpolationTest;
 import org.apache.sis.internal.referencing.provider.GeocentricTranslationTest;
+import org.apache.sis.referencing.datum.HardCodedDatum;
 import org.apache.sis.test.mock.MathTransformFactoryMock;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestUtilities;
+import org.apache.sis.test.TestCase;
+import org.opengis.test.CalculationType;
 import org.opengis.test.ToleranceModifier;
 import org.opengis.test.ToleranceModifiers;
 import org.opengis.test.referencing.ParameterizedTransformTest;
@@ -45,7 +55,10 @@ import static org.apache.sis.test.Assert
 
 
 /**
- * Tests {@link MolodenskyTransform}.
+ * Tests {@link MolodenskyTransform}. The {@link #compareWithGeocentricTranslation()}
+ * method uses {@link EllipsoidToCentricTransform} as a reference implementation.
+ * The errors compared to geocentric translations should not be greater than
+ * approximatively 1 centimetre.
  *
  * @author  Tara Athan
  * @author  Martin Desruisseaux (Geomatys)
@@ -56,10 +69,82 @@ import static org.apache.sis.test.Assert
  */
 @DependsOn({
     CoordinateDomainTest.class,
-    ContextualParametersTest.class
+    ContextualParametersTest.class,
+    EllipsoidToCentricTransformTest.class   // Used as a reference implementation
 })
 public final strictfp class MolodenskyTransformTest extends MathTransformTestCase {
     /**
+     * Creates a new test case.
+     */
+    public MolodenskyTransformTest() {
+        final double delta = toRadians(100.0 / 60) / 1852;      // Approximatively 100 metres
+        derivativeDeltas   = new double[] {delta, delta, 100};  // (Δλ, Δφ, Δh)
+        λDimension         = new int[] {0};                     // Dimension for which to ignore ±360° differences.
+        zDimension         = new int[] {2};                     // Dimension of h where to apply zTolerance
+        zTolerance         = Formulas.LINEAR_TOLERANCE;         // Tolerance for ellipsoidal heights (h)
+        tolerance          = Formulas.ANGULAR_TOLERANCE;        // Tolerance for longitude and latitude in degrees
+    }
+
+    /**
+     * Compares the Molodensky (non-abridged) transform with a geocentric translation.
+     * Molodensky is an approximation of geocentric translation, so we test here how good this approximation is.
+     * If {@link TestCase#verbose} is {@code true}, then this method will print error statistics.
+     *
+     * @throws FactoryException if an error occurred while creating a transform step.
+     * @throws TransformException if a transformation failed.
+     * @throws IOException should never happen.
+     *
+     * @see #compareWithGeocentricTranslation()
+     */
+    @SuppressWarnings("fallthrough")
+    private void compareWithGeocentricTranslation(
+            final Ellipsoid source, final Ellipsoid target,
+            final double tX,   final double tY,   final double tZ,
+            final double xmin, final double ymin, final double zmin,
+            final double xmax, final double ymax, final double zmax)
+            throws FactoryException, TransformException, IOException
+    {
+        final MathTransform reference;
+        final MathTransformFactory factory = DefaultFactories.forBuildin(MathTransformFactory.class);
+        transform = MolodenskyTransform.createGeodeticTransformation(factory, source, true, target, true, tX, tY, tZ, false);
+        reference = GeocentricTranslationTest.createDatumShiftForGeographic3D(factory, source, target, tX, tY, tZ);
+        final float[] srcPts = verifyInDomain(
+                new double[] {xmin, ymin, zmin},
+                new double[] {xmax, ymax, zmax},
+                new int[]    {  10,   10,   10},
+                TestUtilities.createRandomNumberGenerator(103627524044558476L));
+        /*
+         * Transform the same input coordinates using Molodensky transform (actual) and using the reference
+         * implementation (expected). If we were asked to print statistics, compute them before to test the
+         * values since the statistics may be a useful information in case of problem.
+         */
+        final double[] actual   = new double[srcPts.length];
+        final double[] expected = new double[srcPts.length];
+        transform.transform(srcPts, 0, actual,   0, srcPts.length / 3);
+        reference.transform(srcPts, 0, expected, 0, srcPts.length / 3);
+        if (TestCase.VERBOSE) {
+            final Statistics[] stats = {
+                new Statistics("|Δλ| (~cm)"),
+                new Statistics("|Δφ| (~cm)"),
+                new Statistics("|Δh| (cm)")
+            };
+            for (int i=0; i<srcPts.length; i++) {
+                double Δ = actual[i] - expected[i];
+                final int j = i % stats.length;
+                switch (j) {
+                    case 0: Δ *= cos(toRadians(expected[i+1]));     // Fall through
+                    case 1: Δ *= 60 * NAUTICAL_MILE; break;         // Approximative conversion to metres
+                }
+                Δ *= 100;   // Conversion to centimetres.
+                stats[j].accept(abs(Δ));
+            }
+            StatisticsFormat.getInstance().format(stats, TestCase.out);
+        }
+        assertCoordinatesEqual("Comparison of Molodensky and geocentric translation", 3,
+                expected, 0, actual, 0, expected.length / 3, CalculationType.DIRECT_TRANSFORM);
+    }
+
+    /**
      * Creates a Molodensky transform for a datum shift from WGS84 to ED50.
      * Tolerance thresholds are also initialized.
      *
@@ -70,13 +155,14 @@ public final strictfp class MolodenskyTr
         final Ellipsoid target = CommonCRS.ED50.ellipsoid();
         transform = MolodenskyTransform.createGeodeticTransformation(
                 DefaultFactories.forBuildin(MathTransformFactory.class),
-                source, true, target, true, 84.87, 96.49, 116.95, abridged);
+                source, true, target, true,
+                GeocentricTranslationTest.TX,
+                GeocentricTranslationTest.TY,
+                GeocentricTranslationTest.TZ,
+                abridged);
 
-        final double delta = toRadians(100.0 / 60) / 1852;          // Approximatively 100 metres
-        derivativeDeltas = new double[] {delta, delta, 100};        // (Δλ, Δφ, Δh)
         tolerance  = GeocentricTranslationTest.precision(1);        // Half the precision of target sample point
         zTolerance = GeocentricTranslationTest.precision(3);        // Required precision for h
-        zDimension = new int[] {2};                                 // Dimension of h where to apply zTolerance
         assertFalse(transform.isIdentity());
         validate();
     }
@@ -169,9 +255,84 @@ public final strictfp class MolodenskyTr
     }
 
     /**
+     * Tests the point used in {@link FranceGeocentricInterpolationTest}. We use this test for measuring the
+     * errors induced by the use of the Molodensky approximation instead than a real geocentric translation.
+     * The error is approximatively 1 centimetre, which is about 6 times more than the accuracy of the point
+     * given in {@code FranceGeocentricInterpolationTest}.
+     *
+     * @throws FactoryException if an error occurred while creating the transform.
+     * @throws TransformException if transformation of a point failed.
+     *
+     * @see GeocentricTranslationTest#testFranceGeocentricInterpolationPoint()
+     */
+    @Test
+    @DependsOnMethod("testMolodensky")
+    public void testFranceGeocentricInterpolationPoint() throws FactoryException, TransformException {
+        transform = MolodenskyTransform.createGeodeticTransformation(
+                DefaultFactories.forBuildin(MathTransformFactory.class),
+                HardCodedDatum.NTF.getEllipsoid(), true,        // Clarke 1880 (IGN)
+                CommonCRS.ETRS89.ellipsoid(), true,             // GRS 1980 ellipsoid
+               -FranceGeocentricInterpolation.TX,
+               -FranceGeocentricInterpolation.TY,
+               -FranceGeocentricInterpolation.TZ,
+                false);
+        /*
+         * Code below is a copy-and-paste of GeocentricTranslationTest.testFranceGeocentricInterpolationPoint(),
+         * but with the tolerance threshold increased. We do not let the error goes beyond 1 cm however.
+         */
+        tolerance = min(Formulas.ANGULAR_TOLERANCE, FranceGeocentricInterpolationTest.ANGULAR_TOLERANCE * 6);
+        final double[] source   = Arrays.copyOf(FranceGeocentricInterpolationTest.samplePoint(1), 3);
+        final double[] expected = Arrays.copyOf(FranceGeocentricInterpolationTest.samplePoint(2), 3);
+        expected[2] = 43.15;  // Anti-regression (this value is not provided in NTG_88 guidance note).
+        verifyTransform(source, expected);
+        validate();
+    }
+
+    /**
+     * Compares the Molodensky (non-abridged) transforms with geocentric translations.
+     * Molodensky is an approximation of geocentric translation, so we test here how good this
+     * approximation is. This test performs the comparison for the following transformations:
+     *
+     * <ul>
+     *   <li>Transformation from NTF to RGF93. Those CRS are the source and target of <cite>"France geocentric
+     *       interpolation"</cite> (ESPG:9655). This test allows us to verify the accuracy documented in
+     *       {@link InterpolatedGeocentricTransform}.</li>
+     *   <li>(More areas may be added later).</li>
+     * </ul>
+     *
+     * If {@link TestCase#verbose} is {@code true}, then this method will print error statistics.
+     *
+     * @throws FactoryException if an error occurred while creating a transform step.
+     * @throws TransformException if a transformation failed.
+     * @throws IOException should never happen.
+     *
+     * @see #testFranceGeocentricInterpolationPoint()
+     */
+    @Test
+    @DependsOnMethod("testFranceGeocentricInterpolationPoint")
+    public void compareWithGeocentricTranslation() throws FactoryException, TransformException, IOException {
+        /*
+         * Disable the test for inverse transformations because they are not the purpose of this test.
+         * Errors of inverse transformations are added to the error of forward transformations, which
+         * would force us to double the tolerance threshold.
+         */
+        isInverseTransformSupported = false;
+        tolerance         = 3*Formulas.LINEAR_TOLERANCE; // To be converted in degrees by ToleranceModifier.GEOGRAPHIC
+        zTolerance        = 4*Formulas.LINEAR_TOLERANCE;
+        toleranceModifier = ToleranceModifiers.concatenate(ToleranceModifier.GEOGRAPHIC, toleranceModifier);
+        compareWithGeocentricTranslation(HardCodedDatum.NTF.getEllipsoid(),   // Clarke 1880 (IGN)
+                                         CommonCRS.ETRS89.ellipsoid(),        // GRS 1980 ellipsoid
+                                         FranceGeocentricInterpolation.TX,
+                                         FranceGeocentricInterpolation.TY,
+                                         FranceGeocentricInterpolation.TZ,
+                                         -5.5, 41.0, -200,   // Geographic area of GR2DF97A datum shift grid.
+                                         10.0, 52.0, +200);
+    }
+
+    /**
      * Tests conversion of random points. The test is performed with the Molodensky transform,
-     * not the abridged one, because the errors caused by the abridged Molondeky method is too
-     * high for this test.
+     * not the abridged one, because the errors caused by the abridged Molodensky method are
+     * too high for this test.
      *
      * @throws FactoryException if an error occurred while creating a transform step.
      * @throws TransformException if a transformation failed.
@@ -183,9 +344,9 @@ public final strictfp class MolodenskyTr
         tolerance  = Formulas.LINEAR_TOLERANCE * 3;     // To be converted in degrees by ToleranceModifier.GEOGRAPHIC
         zTolerance = Formulas.LINEAR_TOLERANCE * 2;
         toleranceModifier = ToleranceModifiers.concatenate(ToleranceModifier.GEOGRAPHIC, toleranceModifier);
-        verifyInDomain(new double[] {Longitude.MIN_VALUE, -85, -500},
-                       new double[] {Longitude.MIN_VALUE, +85, +500},
-                       new int[] {8, 8, 8},
+        verifyInDomain(new double[] {-179, -85, -500},
+                       new double[] {+179, +85, +500},
+                       new int[]    {   8,   8,    8},
                        TestUtilities.createRandomNumberGenerator(208129394));
     }
 
@@ -211,11 +372,8 @@ public final strictfp class MolodenskyTr
         transform = factory.createParameterizedTransform(parameters);
         assertEquals(3, transform.getSourceDimensions());
         assertEquals(3, transform.getTargetDimensions());
-        final double delta = toRadians(100.0 / 60) / 1852;          // Approximatively 100 metres
-        derivativeDeltas = new double[] {delta, delta, 100};        // (Δλ, Δφ, Δh)
-        tolerance = Formulas.ANGULAR_TOLERANCE * 5;
-        zTolerance = Formulas.LINEAR_TOLERANCE * 5;
-        zDimension = new int[] {2};
+        tolerance  = Formulas.ANGULAR_TOLERANCE * 5;
+        zTolerance = Formulas.LINEAR_TOLERANCE  * 5;
         verifyInDomain(CoordinateDomain.RANGE_10, ORDINATE_COUNT);
     }
 
@@ -259,28 +417,28 @@ public final strictfp class MolodenskyTr
         create(true);
         assertWktEquals("PARAM_MT[“Abridged_Molodenski”,\n" +
                         "  PARAMETER[“dim”, 3],\n" +
+                        "  PARAMETER[“src_semi_major”, 6378137.0],\n" +
+                        "  PARAMETER[“src_semi_minor”, 6356752.314245179],\n" +
+                        "  PARAMETER[“tgt_semi_major”, 6378388.0],\n" +
+                        "  PARAMETER[“tgt_semi_minor”, 6356911.9461279465],\n" +
                         "  PARAMETER[“dx”, 84.87],\n" +
                         "  PARAMETER[“dy”, 96.49],\n" +
                         "  PARAMETER[“dz”, 116.95],\n" +
                         "  PARAMETER[“Semi-major axis length difference”, 251.0],\n" +
-                        "  PARAMETER[“Flattening difference”, 1.4192702255886284E-5],\n" +
-                        "  PARAMETER[“src_semi_major”, 6378137.0],\n" +
-                        "  PARAMETER[“src_semi_minor”, 6356752.314245179],\n" +
-                        "  PARAMETER[“tgt_semi_major”, 6378388.0],\n" +
-                        "  PARAMETER[“tgt_semi_minor”, 6356911.9461279465]]");
+                        "  PARAMETER[“Flattening difference”, 1.4192702255886284E-5]]");
 
         transform = transform.inverse();
         assertWktEquals("PARAM_MT[“Abridged_Molodenski”,\n" +
                         "  PARAMETER[“dim”, 3],\n" +
+                        "  PARAMETER[“src_semi_major”, 6378388.0],\n" +
+                        "  PARAMETER[“src_semi_minor”, 6356911.9461279465],\n" +
+                        "  PARAMETER[“tgt_semi_major”, 6378137.0],\n" +
+                        "  PARAMETER[“tgt_semi_minor”, 6356752.314245179],\n" +
                         "  PARAMETER[“dx”, -84.87],\n" +
                         "  PARAMETER[“dy”, -96.49],\n" +
                         "  PARAMETER[“dz”, -116.95],\n" +
                         "  PARAMETER[“Semi-major axis length difference”, -251.0],\n" +
-                        "  PARAMETER[“Flattening difference”, -1.4192702255886284E-5],\n" +
-                        "  PARAMETER[“src_semi_major”, 6378388.0],\n" +
-                        "  PARAMETER[“src_semi_minor”, 6356911.9461279465],\n" +
-                        "  PARAMETER[“tgt_semi_major”, 6378137.0],\n" +
-                        "  PARAMETER[“tgt_semi_minor”, 6356752.314245179]]");
+                        "  PARAMETER[“Flattening difference”, -1.4192702255886284E-5]]");
     }
 
     /**
@@ -302,13 +460,13 @@ public final strictfp class MolodenskyTr
                 "    Parameter[“elt_0_0”, 0.017453292519943295],\n" +       // Degrees to radians conversion
                 "    Parameter[“elt_1_1”, 0.017453292519943295]],\n" +
                 "  Param_MT[“Molodensky”,\n" +
+                "    Parameter[“src_semi_major”, 6378137.0],\n" +
+                "    Parameter[“src_semi_minor”, 6356752.314245179],\n" +
+                "    Parameter[“Semi-major axis length difference”, 251.0],\n" +
+                "    Parameter[“Flattening difference”, 1.4192702255886284E-5],\n" +
                 "    Parameter[“X-axis translation”, 84.87],\n" +
                 "    Parameter[“Y-axis translation”, 96.49],\n" +
                 "    Parameter[“Z-axis translation”, 116.95],\n" +
-                "    Parameter[“Semi-major axis length difference”, 251.0],\n" +
-                "    Parameter[“Flattening difference”, 1.4192702255886284E-5],\n" +
-                "    Parameter[“src_semi_major”, 6378137.0],\n" +
-                "    Parameter[“eccentricity”, 0.0818191908426215],\n" +
                 "    Parameter[“abridged”, TRUE],\n" +
                 "    Parameter[“dim”, 3]],\n" +
                 "  Param_MT[“Affine”,\n" +

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ProjectiveTransformTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -77,7 +77,7 @@ public strictfp class ProjectiveTransfor
                      * Opportunistically tests ScaledTransform together with ProjectiveTransform.
                      * We takes ScaledTransform as a reference implementation since it is simpler.
                      */
-                    tr = new TransformResultComparator(tr, pt);
+                    tr = new TransformResultComparator(tr, pt, 0);
                 }
                 return tr;
             }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransformResultComparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransformResultComparator.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransformResultComparator.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/TransformResultComparator.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -48,16 +48,17 @@ final strictfp class TransformResultComp
     final MathTransform tested;
 
     /**
-     * The tolerance threshold, which is zero by default.
+     * The tolerance threshold.
      */
-    double tolerance;
+    private final double tolerance;
 
     /**
      * Creates a transform which will compare the results of the two given transforms.
      */
-    TransformResultComparator(final MathTransform reference, final MathTransform tested) {
+    TransformResultComparator(final MathTransform reference, final MathTransform tested, final double tolerance) {
         this.reference = reference;
         this.tested    = tested;
+        this.tolerance = tolerance;
     }
 
     /**
@@ -173,7 +174,7 @@ final strictfp class TransformResultComp
      */
     @Override
     public MathTransform inverse() throws NoninvertibleTransformException {
-        return new TransformResultComparator(reference.inverse(), tested.inverse());
+        return new TransformResultComparator(reference.inverse(), tested.inverse(), tolerance);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -44,6 +44,9 @@ import org.apache.sis.internal.util.Cons
 
 import static java.lang.StrictMath.*;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk8.JDK8;
+
 
 /**
  * Assertion methods used by the {@code sis-referencing} module in addition of the ones inherited
@@ -371,7 +374,7 @@ public strictfp class ReferencingAssert
             assertFalse("e2.contains(e1)",   ae.contains  (e1, true));
         }
         final int dimension = e1.getDimension();
-        final int numCases = (int) round(pow(3, dimension));
+        final int numCases = JDK8.toIntExact(round(pow(3, dimension)));
         final GeneralDirectPosition pos = new GeneralDirectPosition(dimension);
         for (int index=0; index<numCases; index++) {
             int n = index;

Copied: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DatumShiftTest.java (from r1724479, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DatumShiftTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DatumShiftTest.java?p2=sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DatumShiftTest.java&p1=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DatumShiftTest.java&r1=1724479&r2=1724528&rev=1724528&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DatumShiftTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DatumShiftTest.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -30,7 +30,7 @@ import org.junit.Test;
 import static org.apache.sis.test.Assume.*;
 
 // Branch-specific imports
-import java.nio.file.Path;
+import org.apache.sis.internal.jdk7.Path;
 
 
 /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/package-info.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/package-info.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -17,11 +17,14 @@
 
 
 /**
- * Tests the integration between two ore more SIS modules.
+ * Tests the integration between two ore more SIS modules or integration with larger data.
+ * The larger data (e.g. datum shift grids) are not distributed with SIS. If desired, they
+ * must be downloaded by the user and stored in the directory identified by the {@code SIS_DATA}
+ * environment variable.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 package org.apache.sis.test.integration;

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -52,7 +52,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.matrix.Matrix2Test.class,
     org.apache.sis.referencing.operation.matrix.Matrix3Test.class,
     org.apache.sis.referencing.operation.matrix.Matrix4Test.class,
-    org.apache.sis.referencing.operation.matrix.NonSquareMatrixTest.class, // Expected to be last MatrixTestCase - see javadoc.
+    org.apache.sis.referencing.operation.matrix.NonSquareMatrixTest.class,          // Expected to be last MatrixTestCase - see javadoc.
     org.apache.sis.referencing.operation.matrix.MatricesTest.class,
     org.apache.sis.referencing.operation.matrix.AffineTransforms2DTest.class,
 
@@ -62,6 +62,7 @@ import org.junit.BeforeClass;
     org.apache.sis.parameter.DefaultParameterValueTest.class,
     org.apache.sis.parameter.DefaultParameterValueGroupTest.class,
     org.apache.sis.parameter.UnmodifiableParameterValueTest.class,
+    org.apache.sis.parameter.UnmodifiableParameterValueGroupTest.class,
     org.apache.sis.parameter.ParametersTest.class,
     org.apache.sis.parameter.ParameterBuilderTest.class,
     org.apache.sis.parameter.ParameterFormatTest.class,
@@ -113,6 +114,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.operation.transform.CopyTransformTest.class,
     org.apache.sis.referencing.operation.transform.PassThroughTransformTest.class,
     org.apache.sis.referencing.operation.transform.ConcatenatedTransformTest.class,
+    org.apache.sis.referencing.operation.transform.TransformSeparatorTest.class,
     org.apache.sis.referencing.operation.transform.TransferFunctionTest.class,
     org.apache.sis.referencing.operation.transform.MathTransformsTest.class,
     org.apache.sis.referencing.operation.transform.ContextualParametersTest.class,
@@ -131,8 +133,16 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.referencing.provider.GeocentricTranslationTest.class,
     org.apache.sis.internal.referencing.provider.PositionVector7ParamTest.class,
     org.apache.sis.internal.referencing.provider.CoordinateFrameRotationTest.class,
+    org.apache.sis.internal.referencing.provider.MolodenskyTest.class,
+    org.apache.sis.internal.referencing.provider.FranceGeocentricInterpolationTest.class,
+    org.apache.sis.internal.referencing.provider.NTv2Test.class,
+    org.apache.sis.internal.referencing.provider.NADCONTest.class,
     org.apache.sis.internal.referencing.provider.MapProjectionTest.class,
+    org.apache.sis.internal.referencing.provider.TransverseMercatorTest.class,
     org.apache.sis.internal.referencing.provider.AllProvidersTest.class,
+    org.apache.sis.referencing.operation.transform.InterpolatedTransformTest.class,
+    org.apache.sis.referencing.operation.transform.InterpolatedGeocentricTransformTest.class,
+    org.apache.sis.referencing.operation.transform.InterpolatedMolodenskyTransformTest.class,
     org.apache.sis.referencing.operation.transform.DefaultMathTransformFactoryTest.class,
 
     // Test map projections. Those tests need the providers tested above.
@@ -158,14 +168,27 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.crs.DefaultCompoundCRSTest.class,
     org.apache.sis.referencing.crs.HardCodedCRSTest.class,
 
+    org.apache.sis.referencing.StandardDefinitionsTest.class,
+    org.apache.sis.referencing.CommonCRSTest.class,
+    org.apache.sis.referencing.CRSTest.class,
     org.apache.sis.referencing.factory.GIGS3002.class,
     org.apache.sis.referencing.factory.GIGS3003.class,
     org.apache.sis.referencing.factory.GIGS3004.class,
     org.apache.sis.referencing.factory.GIGS3005.class,
     org.apache.sis.referencing.factory.GeodeticObjectFactoryTest.class,
-    org.apache.sis.referencing.StandardDefinitionsTest.class,
-    org.apache.sis.referencing.CommonCRSTest.class,
-    org.apache.sis.referencing.CRSTest.class,
+    org.apache.sis.referencing.factory.CommonAuthorityFactoryTest.class,
+    org.apache.sis.referencing.factory.AuthorityFactoryProxyTest.class,
+    org.apache.sis.referencing.factory.IdentifiedObjectFinderTest.class,
+    org.apache.sis.referencing.factory.GIGS2001.class,
+    org.apache.sis.referencing.factory.GIGS2002.class,
+    org.apache.sis.referencing.factory.GIGS2003.class,
+    org.apache.sis.referencing.factory.GIGS2004.class,
+    org.apache.sis.referencing.factory.GIGS2005.class,
+    org.apache.sis.referencing.factory.GIGS2006.class,
+    org.apache.sis.referencing.factory.GIGS2007.class,
+    org.apache.sis.referencing.factory.GIGS2008.class,
+    org.apache.sis.referencing.factory.GIGS2009.class,
+    org.apache.sis.referencing.factory.sql.EPSGFactoryTest.class,
 
     org.apache.sis.io.wkt.MathTransformParserTest.class,
     org.apache.sis.io.wkt.GeodeticObjectParserTest.class,
@@ -188,6 +211,7 @@ import org.junit.BeforeClass;
 
     org.apache.sis.referencing.operation.builder.LinearTransformBuilderTest.class,
     org.apache.sis.internal.referencing.ServicesForMetadataTest.class,
+    org.apache.sis.test.integration.DatumShiftTest.class,
     org.apache.sis.test.integration.ReferencingInMetadataTest.class,
     org.apache.sis.test.integration.DefaultMetadataTest.class
 })

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/PathConverter.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -36,7 +36,7 @@ import org.apache.sis.util.Unconvertible
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
 abstract class PathConverter<S,T> extends SystemConverter<S,T> {
@@ -98,7 +98,7 @@ abstract class PathConverter<S,T> extend
     public static final class FileURI extends PathConverter<File,URI> {
         private static final long serialVersionUID = 1122784850124333991L;
         static final FileURI INSTANCE = new FileURI();
-        public FileURI() {super(File.class, URI.class);} // Instantiated by ServiceLoader.
+        public FileURI() {super(File.class, URI.class);}        // Instantiated by ServiceLoader.
 
         @Override public ObjectConverter<File,URI> unique()  {return INSTANCE;}
         @Override public ObjectConverter<URI,File> inverse() {return URIFile.INSTANCE;}
@@ -113,7 +113,7 @@ abstract class PathConverter<S,T> extend
     public static final class FileURL extends PathConverter<File,URL> {
         private static final long serialVersionUID = 2191394598748096966L;
         static final FileURL INSTANCE = new FileURL();
-        public FileURL() {super(File.class, URL.class);} // Instantiated by ServiceLoader.
+        public FileURL() {super(File.class, URL.class);}        // Instantiated by ServiceLoader.
 
         @Override public ObjectConverter<File,URL> unique()  {return INSTANCE;}
         @Override public ObjectConverter<URL,File> inverse() {return URLFile.INSTANCE;}
@@ -128,7 +128,7 @@ abstract class PathConverter<S,T> extend
     public static final class URLFile extends PathConverter<URL,File> {
         private static final long serialVersionUID = 3669726699184691997L;
         static final URLFile INSTANCE = new URLFile();
-        public URLFile() {super(URL.class, File.class);} // Instantiated by ServiceLoader.
+        public URLFile() {super(URL.class, File.class);}        // Instantiated by ServiceLoader.
 
         @Override public ObjectConverter<URL,File> unique()  {return INSTANCE;}
         @Override public ObjectConverter<File,URL> inverse() {return FileURL.INSTANCE;}
@@ -138,12 +138,12 @@ abstract class PathConverter<S,T> extend
     }
 
     /**
-     * Converter from {@link URL} to {@link File}.
+     * Converter from {@link URI} to {@link File}.
      */
     public static final class URIFile extends PathConverter<URI,File> {
         private static final long serialVersionUID = 5070991554943811760L;
         static final URIFile INSTANCE = new URIFile();
-        public URIFile() {super(URI.class, File.class);} // Instantiated by ServiceLoader.
+        public URIFile() {super(URI.class, File.class);}        // Instantiated by ServiceLoader.
 
         @Override public ObjectConverter<URI,File> unique()  {return INSTANCE;}
         @Override public ObjectConverter<File,URI> inverse() {return FileURI.INSTANCE;}
@@ -158,7 +158,7 @@ abstract class PathConverter<S,T> extend
     public static final class URL_URI extends PathConverter<URL,URI> {
         private static final long serialVersionUID = 6327568235014244008L;
         static final URL_URI INSTANCE = new URL_URI();
-        public URL_URI() {super(URL.class, URI.class);} // Instantiated by ServiceLoader.
+        public URL_URI() {super(URL.class, URI.class);}         // Instantiated by ServiceLoader.
 
         @Override public ObjectConverter<URL,URI> unique()  {return INSTANCE;}
         @Override public ObjectConverter<URI,URL> inverse() {return URI_URL.INSTANCE;}
@@ -173,7 +173,7 @@ abstract class PathConverter<S,T> extend
     public static final class URI_URL extends PathConverter<URI,URL> {
         private static final long serialVersionUID = 5478354821309176895L;
         static final URI_URL INSTANCE = new URI_URL();
-        public URI_URL() {super(URI.class, URL.class);} // Instantiated by ServiceLoader.
+        public URI_URL() {super(URI.class, URL.class);}         // Instantiated by ServiceLoader.
 
         @Override public ObjectConverter<URI,URL> unique()  {return INSTANCE;}
         @Override public ObjectConverter<URL,URI> inverse() {return URL_URI.INSTANCE;}

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/package-info.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/converter/package-info.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -43,7 +43,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
 package org.apache.sis.internal.converter;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AutoCloseable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AutoCloseable.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AutoCloseable.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/AutoCloseable.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -16,22 +16,24 @@
  */
 package org.apache.sis.internal.jdk7;
 
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
 
 /**
  * Placeholder for the {@link java.lang.AutoCloseable} interface.
+ * Class annotated by this annotation must have a public {@code close()} method.
  * {@code instanceof} checks and calls to {@code ((AutoCloseable) object).close()} need to be replaced
  * by calls to {@link JDK7#isAutoCloseable(Object)} and {@link JDK7#close(Object)} respectively.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
-public interface AutoCloseable {
-    /**
-     * See {@link java.lang.AutoCloseable#close()}.
-     *
-     * @throws Exception If an error occurred while closing the resource.
-     */
-    void close() throws Exception;
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AutoCloseable {
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Files.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Files.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Files.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Files.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -18,9 +18,17 @@ package org.apache.sis.internal.jdk7;
 
 import java.util.Set;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.channels.ByteChannel;
+import java.nio.charset.Charset;
+
 
 /**
  * Place holder for {@link java.nio.file.Files}.
@@ -28,7 +36,7 @@ import java.nio.channels.ByteChannel;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 public final class Files {
@@ -39,6 +47,111 @@ public final class Files {
     }
 
     /**
+     * Creates the directory at the given path.
+     * This method does not create parent directories.
+     *
+     * @param dir The directory to create.
+     * @return The given path.
+     * @throws IOException if the directory can not be created.
+     *
+     * @since 0.7
+     */
+    public static Path createDirectory(final Path dir) throws IOException {
+        if (!dir.mkdir()) {
+            throw new IOException("Can not create directory: " + dir);
+        }
+        return dir;
+    }
+
+    /**
+     * Returns {@code true} if the given path is a directory.
+     *
+     * @param path The path to test.
+     * @return {@code true} if the path is a directory.
+     *
+     * @since 0.7
+     */
+    public static boolean isDirectory(final Path path) {
+        return path.isDirectory();
+    }
+
+    /**
+     * Returns {@code true} if the given path is an ordinary file.
+     *
+     * @param path The path to test.
+     * @return {@code true} if the path is a file.
+     *
+     * @since 0.7
+     */
+    public static boolean isRegularFile(final Path path) {
+        return path.isFile();
+    }
+
+    /**
+     * Returns {@code true} if the file at the given path can be read.
+     *
+     * @param path The path to test.
+     * @return {@code true} if file at the given path can be read.
+     *
+     * @since 0.7
+     */
+    public static boolean isReadable(final Path path) {
+        return path.canRead();
+    }
+
+    /**
+     * Returns {@code true} if the file at the given path can be written.
+     *
+     * @param path The path to test.
+     * @return {@code true} if file at the given path can be written.
+     *
+     * @since 0.7
+     */
+    public static boolean isWritable(final Path path) {
+        return path.canWrite();
+    }
+
+    /**
+     * Returns {@code true} if the given file or directory exits.
+     *
+     * @param path The path to test.
+     * @return {@code true} if file or directory exists.
+     *
+     * @since 0.7
+     */
+    public static boolean exists(final Path path) {
+        return path.exists();
+    }
+
+    /**
+     * Creates a new buffered reader for the given character encoding.
+     *
+     * @param path The path of the file to read.
+     * @param cs The character encoding to use.
+     * @return The reader.
+     * @throws IOException if an error occurred while creating the reader.
+     *
+     * @since 0.7
+     */
+    public static BufferedReader newBufferedReader(final Path path, final Charset cs) throws IOException {
+        return new BufferedReader(new InputStreamReader(new FileInputStream(path), cs.newDecoder()));
+    }
+
+    /**
+     * Creates a new buffered writer for the given character encoding.
+     *
+     * @param path The path of the file to write.
+     * @param cs The character encoding to use.
+     * @return The writer.
+     * @throws IOException if an error occurred while creating the writer.
+     *
+     * @since 0.7
+     */
+    public static BufferedWriter newBufferedWriter(final Path path, final Charset cs) throws IOException {
+        return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path), cs.newEncoder()));
+    }
+
+    /**
      * Simulates {@link java.nio.file.Files#newByteChannel(java.nio.file.Path, java.nio.file.OpenOption[])}.
      *
      * @param  file    The file to open.
@@ -59,4 +172,15 @@ public final class Files {
         }
         return new RandomAccessFile(file, mode).getChannel();
     }
+
+    /**
+     * Creates a new byte channel.
+     *
+     * @param  path    The file to open.
+     * @return The channel.
+     * @throws IOException If an error occurred while opening the channel.
+     */
+    public static ByteChannel newByteChannel(final Path path) throws IOException {
+        return newByteChannel(path, null);
+    }
 }

Added: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/InvalidPathException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/InvalidPathException.java?rev=1724528&view=auto
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/InvalidPathException.java (added)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk7/InvalidPathException.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.jdk7;
+
+
+/**
+ * Place holder for {@link java.nio.file.Path}.
+ * This class exists only on the JDK6 branch of SIS.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+@SuppressWarnings("serial")
+public class InvalidPathException extends IllegalArgumentException {
+    /**
+     * Creates a new exception.
+     */
+    InvalidPathException(final RuntimeException cause) {
+        super(cause);
+    }
+}




Mime
View raw message