sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1813747 [7/13] - in /sis/branches/JDK9: ./ application/ application/sis-console/ application/sis-console/src/main/artifact/ application/sis-console/src/main/artifact/lib/ application/sis-console/src/main/artifact/lib/darwin/ application/si...
Date Mon, 30 Oct 2017 10:25:10 GMT
Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -21,6 +21,7 @@ import org.opengis.referencing.cs.*;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.datum.PrimeMeridian;
+import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.IdentifiedObject;
 import org.apache.sis.referencing.datum.HardCodedDatum;
 import org.apache.sis.referencing.crs.HardCodedCRS;
@@ -56,6 +57,14 @@ public final strictfp class ReferencingU
     }
 
     /**
+     * Tests {@link ReferencingUtilities#isEllipsoidalHeight(VerticalDatum)}.
+     */
+    @Test
+    public void testEllipsoidalHeight() {
+        assertTrue(isEllipsoidalHeight(HardCodedDatum.ELLIPSOID));
+    }
+
+    /**
      * Asserts that normalization of the given CRS produces {@link HardCodedCRS#WGS84} (ignoring metadata).
      *
      * @param  message         the message to show in case of failure.
@@ -84,7 +93,7 @@ public final strictfp class ReferencingU
     }
 
     /**
-     * Tests {@link ReferencingUtilities#getPropertiesForModifiedCRS(IdentifiedObject, String...)}.
+     * Tests {@link ReferencingUtilities#getPropertiesForModifiedCRS(IdentifiedObject)}.
      *
      * @since 0.7
      */
@@ -110,7 +119,7 @@ public final strictfp class ReferencingU
         assertEquals("cylindricalCS",    toPropertyName(CoordinateSystem.class, CylindricalCS   .class).toString());
         assertEquals("ellipsoidalCS",    toPropertyName(CoordinateSystem.class, EllipsoidalCS   .class).toString());
         assertEquals("linearCS",         toPropertyName(CoordinateSystem.class, LinearCS        .class).toString());
-//      assertEquals("parametricCS",     toPropertyName(CoordinateSystem.class, ParametricCS    .class).toString());
+        assertEquals("parametricCS",     toPropertyName(CoordinateSystem.class, ParametricCS    .class).toString());
         assertEquals("polarCS",          toPropertyName(CoordinateSystem.class, PolarCS         .class).toString());
         assertEquals("sphericalCS",      toPropertyName(CoordinateSystem.class, SphericalCS     .class).toString());
         assertEquals("timeCS",           toPropertyName(CoordinateSystem.class, TimeCS          .class).toString());

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -16,29 +16,24 @@
  */
 package org.apache.sis.internal.referencing;
 
-import java.util.Map;
-import java.util.Collections;
+import java.util.Date;
 import org.opengis.geometry.Envelope;
 import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.metadata.extent.VerticalExtent;
-import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.referencing.crs.GeographicCRS;
-import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.operation.TransformException;
-import org.opengis.util.FactoryException;
-import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
 import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
+import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultSpatialTemporalExtent;
 import org.apache.sis.geometry.GeneralEnvelope;
-import org.apache.sis.referencing.CRS;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.crs.HardCodedCRS;
-import org.apache.sis.referencing.factory.GeodeticObjectFactory;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
+import org.apache.sis.test.TestUtilities;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -54,11 +49,20 @@ import static org.apache.sis.test.TestUt
  * @module
  */
 @DependsOn({
-    org.apache.sis.referencing.CRSTest.class,
     org.apache.sis.referencing.CommonCRSTest.class
 })
 public final strictfp class ServicesForMetadataTest extends TestCase {
     /**
+     * Tests {@link org.apache.sis.metadata.iso.extent.Extents#centroid(GeographicBoundingBox)}.
+     *
+     * @since 0.8
+     */
+    @Test
+    public void testGeographicBoundingBoxCentroid() {
+        org.apache.sis.metadata.iso.extent.ExtentsTest.testCentroid();
+    }
+
+    /**
      * Creates a test envelope with the given CRS and initialized with
      * [-10 … 70]° of longitude, [-20 … 30]° of latitude, [-40 … 60] metres of elevation
      * and [51000 … 52000] modified Julian days.
@@ -97,7 +101,6 @@ public final strictfp class ServicesForM
         assertEqualsIgnoreMetadata(expectedCRS.crs(), extent.getVerticalCRS());
     }
 
-
     /**
      * Tests (indirectly) {@link ServicesForMetadata#setBounds(Envelope, DefaultGeographicBoundingBox)}
      * from a three-dimensional envelope.
@@ -165,62 +168,40 @@ public final strictfp class ServicesForM
     }
 
     /**
-     * Tests {@link ServicesForMetadata#createCompoundCRS ReferencingUtilities.createCompoundCRS(…)}.
+     * Tests {@link DefaultVerticalExtent#intersect(VerticalExtent)}.
      *
-     * @throws FactoryException if a CRS can not be created.
+     * @throws TransformException if the transformation failed.
      *
-     * @see <a href="https://issues.apache.org/jira/browse/SIS-303">SIS-303</a>
-     *
-     * @since 0.7
+     * @since 0.8
      */
     @Test
-    public void testCreateCompoundCRS() throws FactoryException {
-        final ReferencingServices services = ServicesForMetadata.getInstance();
-        final GeodeticObjectFactory factory = new GeodeticObjectFactory();
-        final Map<String,String> properties = Collections.singletonMap(CoordinateReferenceSystem.NAME_KEY, "WGS 84 (4D)");
-        /*
-         * createCompoundCRS(…) should not combine GeographicCRS with non-ellipsoidal height.
-         */
-        CoordinateReferenceSystem compound = services.createCompoundCRS(factory, factory, properties,
-                HardCodedCRS.WGS84, HardCodedCRS.GRAVITY_RELATED_HEIGHT, HardCodedCRS.TIME);
-        assertArrayEqualsIgnoreMetadata(new SingleCRS[] {HardCodedCRS.WGS84, HardCodedCRS.GRAVITY_RELATED_HEIGHT, HardCodedCRS.TIME},
-                CRS.getSingleComponents(compound).toArray());
-        /*
-         * createCompoundCRS(…) should combine GeographicCRS with ellipsoidal height.
-         */
-        compound = services.createCompoundCRS(factory, factory, properties,
-                HardCodedCRS.WGS84, HardCodedCRS.ELLIPSOIDAL_HEIGHT);
-        assertArrayEqualsIgnoreMetadata(new SingleCRS[] {HardCodedCRS.WGS84_3D},
-                CRS.getSingleComponents(compound).toArray());
-        /*
-         * createCompoundCRS(…) should combine GeographicCRS with ellipsoidal height and keep time.
-         */
-        compound = services.createCompoundCRS(factory, factory, properties,
-                HardCodedCRS.WGS84, HardCodedCRS.ELLIPSOIDAL_HEIGHT, HardCodedCRS.TIME);
-        assertArrayEqualsIgnoreMetadata(new SingleCRS[] {HardCodedCRS.WGS84_3D, HardCodedCRS.TIME},
-                CRS.getSingleComponents(compound).toArray());
-        /*
-         * Non-standard feature: accept (VerticalCRS + GeodeticCRS) order.
-         * The test below use the reverse order for all axes compared to the previous test.
-         */
-        compound = services.createCompoundCRS(factory, factory, properties,
-                HardCodedCRS.TIME, HardCodedCRS.ELLIPSOIDAL_HEIGHT, HardCodedCRS.WGS84_φλ);
-        final Object[] components = CRS.getSingleComponents(compound).toArray();
-        assertEquals(2, components.length);
-        assertEqualsIgnoreMetadata(HardCodedCRS.TIME, components[0]);
-        assertInstanceOf("Shall be a three-dimensional geographic CRS.", GeographicCRS.class, components[1]);
-        assertAxisDirectionsEqual("Shall be a three-dimensional geographic CRS.",
-                ((CoordinateReferenceSystem) components[1]).getCoordinateSystem(),
-                AxisDirection.UP, AxisDirection.NORTH, AxisDirection.EAST);
+    public void testVerticalIntersection() throws TransformException {
+        final DefaultVerticalExtent e1 = new DefaultVerticalExtent(1000, 2000, HardCodedCRS.ELLIPSOIDAL_HEIGHT_cm);
+        final DefaultVerticalExtent e2 = new DefaultVerticalExtent(15,   25,   HardCodedCRS.ELLIPSOIDAL_HEIGHT);
+        e1.intersect(e2);
+        assertEquals(new DefaultVerticalExtent(1500, 2000, HardCodedCRS.ELLIPSOIDAL_HEIGHT_cm), e1);
     }
 
     /**
-     * Tests {@link org.apache.sis.metadata.iso.extent.Extents#centroid(GeographicBoundingBox)}.
+     * Tests {@link DefaultTemporalExtent#intersect(TemporalExtent)}.
+     *
+     * @throws TransformException if the transformation failed.
      *
      * @since 0.8
      */
     @Test
-    public void testGeographicBoundingBoxCentroid() {
-        org.apache.sis.metadata.iso.extent.ExtentsTest.testCentroid();
+    @Ignore("This operation requires the sis-temporal module.")
+    public void testTemporalIntersection() throws TransformException {
+        final DefaultTemporalExtent e1 = new DefaultTemporalExtent();
+        final DefaultTemporalExtent e2 = new DefaultTemporalExtent();
+        final Date t1 = TestUtilities.date("2016-12-05 19:45:20");
+        final Date t2 = TestUtilities.date("2017-02-18 02:12:50");
+        final Date t3 = TestUtilities.date("2017-11-30 23:50:00");
+        final Date t4 = TestUtilities.date("2018-05-20 12:30:45");
+        e1.setBounds(t1, t3);
+        e2.setBounds(t2, t4);
+        e1.intersect(e2);
+        assertEquals("startTime", t2, e1.getStartTime());
+        assertEquals("endTime",   t3, e1.getEndTime());
     }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -24,7 +24,7 @@ import java.nio.file.FileSystemNotFoundE
 import org.apache.sis.test.TestCase;
 
 import static org.junit.Assert.*;
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeFalse;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -109,7 +109,7 @@ public final strictfp class ProvidersTes
 
     /**
      * Returns the subset of {@link #methods()} which are expected to support
-     * {@link AbstractProvider#redimension(int, int)}.
+     * {@link AbstractProvider#redimension(int, int)}, not including map projections.
      */
     private static Class<?>[] redimensionables() {
         return new Class<?>[] {
@@ -224,6 +224,13 @@ public final strictfp class ProvidersTes
                         }
                     }
                 }
+            } else if (method instanceof MapProjection) {
+                final OperationMethod proj3D = ((MapProjection) method).redimension(sourceDimensions ^ 1, targetDimensions ^ 1);
+                assertNotSame("redimension(3,3) should return a new method.", method, proj3D);
+                assertSame("redimension(2,2) should give back the original method.", method,
+                        ((DefaultOperationMethod) proj3D).redimension(sourceDimensions, targetDimensions));
+                assertSame("Value of redimension(3,3) should have been cached.", proj3D,
+                        ((MapProjection) method).redimension(sourceDimensions ^ 1, targetDimensions ^ 1));
             } else try {
                 ((DefaultOperationMethod) method).redimension(sourceDimensions ^ 1, targetDimensions ^ 1);
                 fail("Type " + method.getClass().getName() + " is not in our list of redimensionable methods.");

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -17,6 +17,7 @@
 package org.apache.sis.referencing;
 
 import java.util.Collection;
+import java.util.ServiceLoader;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.NoSuchAuthorityCodeException;
 import org.opengis.referencing.IdentifiedObject;
@@ -26,7 +27,9 @@ import org.opengis.referencing.crs.Geogr
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.internal.referencing.EPSGFactoryProxy;
 import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.referencing.factory.CommonAuthorityFactory;
 import org.apache.sis.referencing.factory.IdentifiedObjectFinder;
 import org.apache.sis.referencing.factory.NoSuchAuthorityFactoryException;
 
@@ -66,6 +69,28 @@ public final strictfp class AuthorityFac
     }
 
     /**
+     * Ensures that {@link EPSGFactoryProxy} is declared before {@link CommonAuthorityFactory}.
+     * This is preferable (but not mandatory) because of the way we implemented {@link AuthorityFactories}.
+     */
+    @Test
+    public void testFactoryOrder() {
+        boolean foundProxy  = false;
+        boolean foundCommon = false;
+        for (CRSAuthorityFactory factory : ServiceLoader.load(CRSAuthorityFactory.class, AuthorityFactories.class.getClassLoader())) {
+            if (factory instanceof CommonAuthorityFactory) {
+                foundCommon = true;
+                assertTrue("Should not have found EPSGFactoryProxy after CommonAuthorityFactory.", foundProxy);
+            }
+            if (factory instanceof EPSGFactoryProxy) {
+                foundProxy = true;
+                assertFalse("Should not have found EPSGFactoryProxy after CommonAuthorityFactory.", foundCommon);
+            }
+        }
+        assertTrue("Factory not found.", foundCommon);
+        assertTrue("Factory not found.", foundProxy);
+    }
+
+    /**
      * Tests {@link CRSAuthorityFactory#getDescriptionText(String)}.
      *
      * @throws FactoryException if the EPSG:4326 name can not be obtained.

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -280,6 +280,24 @@ public final strictfp class CRSTest exte
     }
 
     /**
+     * Tests getting the horizontal and vertical components of a three-dimensional projected CRS.
+     *
+     * @since 0.8
+     */
+    @Test
+    public void testComponentsOfProjectedCRS() {
+        final ProjectedCRS volumetric = HardCodedConversions.mercator3D();
+        assertFalse("isHorizontalCRS", CRS.isHorizontalCRS(volumetric));
+        assertNull("getTemporalComponent", CRS.getTemporalComponent(volumetric));
+        assertNull("getVerticalComponent", CRS.getVerticalComponent(volumetric, false));
+        assertEqualsIgnoreMetadata(HardCodedCRS.ELLIPSOIDAL_HEIGHT, CRS.getVerticalComponent(volumetric, true));
+        final SingleCRS horizontal = CRS.getHorizontalComponent(volumetric);
+        assertInstanceOf("getHorizontalComponent", ProjectedCRS.class, horizontal);
+        assertEquals("dimension", 2, horizontal.getCoordinateSystem().getDimension());
+        assertTrue("isHorizontalCRS", CRS.isHorizontalCRS(horizontal));
+    }
+
+    /**
      * Tests {@link CRS#getComponentAt(CoordinateReferenceSystem, int, int)}.
      *
      * @since 0.5
@@ -310,6 +328,26 @@ public final strictfp class CRSTest exte
     }
 
     /**
+     * Tests {@link CRS#compound(CoordinateReferenceSystem...)}.
+     *
+     * @throws FactoryException if an error occurred while creating a compound CRS.
+     *
+     * @since 0.8
+     */
+    @Test
+    public void testCompound() throws FactoryException {
+        try {
+            CRS.compound();
+            fail("Should not accept empty array.");
+        } catch (IllegalArgumentException e) {
+            final String message = e.getMessage();
+            assertTrue(message, message.contains("components"));
+        }
+        assertSame(HardCodedCRS.WGS84, CRS.compound(HardCodedCRS.WGS84));
+        assertEqualsIgnoreMetadata(HardCodedCRS.WGS84_3D, CRS.compound(HardCodedCRS.WGS84, HardCodedCRS.ELLIPSOIDAL_HEIGHT));
+    }
+
+    /**
      * Tests {@link CRS#getComponentAt(CoordinateReferenceSystem, int, int)} on a (x,y,z,t)
      * coordinate reference system having 4 dimensions. All arguments given to this method
      * except the last one are the expected components, which may be {@code null}.

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -17,6 +17,9 @@
 package org.apache.sis.referencing.crs;
 
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Locale;
 import javax.xml.bind.JAXBException;
 import org.opengis.test.Validators;
 import org.opengis.referencing.cs.AxisDirection;
@@ -33,7 +36,7 @@ import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
 import static java.util.Collections.singletonMap;
-import static org.opengis.referencing.cs.CoordinateSystem.NAME_KEY;
+import static org.opengis.referencing.crs.CompoundCRS.NAME_KEY;
 import static org.apache.sis.test.ReferencingAssert.*;
 
 
@@ -41,7 +44,7 @@ import static org.apache.sis.test.Refere
  * Tests the {@link DefaultCompoundCRS} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
  * @since   0.4
  * @module
  */
@@ -67,6 +70,64 @@ public final strictfp class DefaultCompo
     private static final String XML_FILE = "CompoundCRS.xml";
 
     /**
+     * Verifies that we do not allow construction with a duplicated horizontal or vertical component.
+     *
+     * @since 0.8
+     */
+    @Test
+    @SuppressWarnings("ResultOfObjectAllocationIgnored")
+    public void testDuplicatedComponent() {
+        final Map<String,Object> properties = new HashMap<>(4);
+        assertNull(properties.put(DefaultCompoundCRS.LOCALE_KEY, Locale.ENGLISH));
+        assertNull(properties.put(DefaultCompoundCRS.NAME_KEY,   "3D + illegal"));
+        try {
+            new DefaultCompoundCRS(properties, HardCodedCRS.WGS84, HEIGHT, HardCodedCRS.SPHERE);
+            fail("Should not allow construction with two horizontal components.");
+        } catch (IllegalArgumentException e) {
+            assertEquals("Compound coordinate reference systems can not contain two horizontal components.", e.getMessage());
+        }
+        /*
+         * Try again with duplicated vertical components, opportunistically
+         * testing localization in a different language.
+         */
+        properties.put(DefaultCompoundCRS.LOCALE_KEY, Locale.FRENCH);
+        try {
+            new DefaultCompoundCRS(properties, HardCodedCRS.WGS84, HEIGHT, HardCodedCRS.ELLIPSOIDAL_HEIGHT);
+            fail("Should not allow construction with two vertical components.");
+        } catch (IllegalArgumentException e) {
+            assertEquals("Un système de référence des coordonnées ne peut pas contenir deux composantes verticales.", e.getMessage());
+        }
+    }
+
+    /**
+     * Verifies that horizontal CRS + ellipsoidal height is disallowed.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-303">SIS-303</a>
+     *
+     * @since 0.8
+     */
+    @Test
+    @SuppressWarnings("ResultOfObjectAllocationIgnored")
+    public void testEllipsoidalHeight() {
+        final Map<String,Object> properties = new HashMap<>(4);
+        assertNull(properties.put(DefaultCompoundCRS.LOCALE_KEY, Locale.ENGLISH));
+        assertNull(properties.put(DefaultCompoundCRS.NAME_KEY,   "3D"));
+        try {
+            new DefaultCompoundCRS(properties, HardCodedCRS.WGS84, HardCodedCRS.ELLIPSOIDAL_HEIGHT);
+            fail("Should not allow construction with ellipsoidal height.");
+        } catch (IllegalArgumentException e) {
+            assertEquals("Compound coordinate reference systems should not contain ellipsoidal height. "
+                    + "Use a three-dimensional geographic system instead.", e.getMessage());
+        }
+        /*
+         * We allow an ellipsoidal height if there is no horizontal CRS.
+         * This is a departure from ISO 19111.
+         */
+        final DefaultCompoundCRS crs = new DefaultCompoundCRS(properties, HardCodedCRS.ELLIPSOIDAL_HEIGHT, TIME);
+        assertAxisDirectionsEqual("CompoundCRS", crs.getCoordinateSystem(), AxisDirection.UP, AxisDirection.FUTURE);
+    }
+
+    /**
      * Tests construction and serialization of a {@link DefaultCompoundCRS}.
      */
     @Test

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -19,19 +19,14 @@ package org.apache.sis.referencing.cs;
 import java.util.Map;
 import javax.measure.Unit;
 import java.lang.reflect.Field;
-import org.opengis.util.FactoryException;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CSAuthorityFactory;
-import org.opengis.referencing.crs.CRSAuthorityFactory;
-import org.apache.sis.referencing.factory.UnavailableFactoryException;
-import org.apache.sis.referencing.factory.sql.EPSGFactory;
-import org.apache.sis.referencing.CRS;
+import org.apache.sis.referencing.factory.TestFactorySource;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static org.junit.Assume.*;
 
 
 /**
@@ -44,20 +39,6 @@ import static org.junit.Assume.*;
  */
 public final strictfp class CodesTest extends TestCase {
     /**
-     * Returns the EPSG factory, or skips the test if the factory is not available.
-     */
-    private static CSAuthorityFactory factory() throws FactoryException {
-        final CRSAuthorityFactory factory = CRS.getAuthorityFactory("EPSG");
-        assumeTrue("No connection to EPSG dataset.", factory instanceof EPSGFactory);
-        try {
-            assertNotNull(factory.createGeographicCRS("4326"));
-        } catch (UnavailableFactoryException e) {
-            assumeTrue("No connection to EPSG dataset.", false);
-        }
-        return (EPSGFactory) factory;
-    }
-
-    /**
      * Compares the axis directions and units with EPSG definitions.
      *
      * @throws Exception if an error occurred while fetching the codes or querying the database.
@@ -65,7 +46,7 @@ public final strictfp class CodesTest ex
     @Test
     @SuppressWarnings("unchecked")
     public void verify() throws Exception {
-        final CSAuthorityFactory factory = factory();
+        final CSAuthorityFactory factory = TestFactorySource.getSharedFactory();
         final Field field = Codes.class.getDeclaredField("EPSG");
         field.setAccessible(true);
         for (final Codes c : ((Map<Codes,?>) field.get(null)).keySet()) {

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -163,6 +163,19 @@ public final strictfp class HardCodedCS
             HardCodedAxes.NORTHING);
 
     /**
+     * A three-dimensional Cartesian CS with
+     * <var>{@linkplain HardCodedAxes#EASTING Easting}</var>,
+     * <var>{@linkplain HardCodedAxes#NORTHING Northing}</var>
+     * <var>{@linkplain HardCodedAxes#ELLIPSOIDAL_HEIGHT Height}</var>
+     * axes in metres.
+     */
+    public static final DefaultCartesianCS PROJECTED_3D = new DefaultCartesianCS(
+            singletonMap(NAME_KEY, "Projected"),
+            HardCodedAxes.EASTING,
+            HardCodedAxes.NORTHING,
+            HardCodedAxes.ELLIPSOIDAL_HEIGHT);
+
+    /**
      * A two-dimensional Cartesian CS with
      * <var>{@linkplain HardCodedAxes#X x}</var>,
      * <var>{@linkplain HardCodedAxes#Y y}</var>

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -27,6 +27,7 @@ import org.opengis.referencing.crs.CRSAu
 import org.opengis.referencing.crs.GeocentricCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.VerticalCRS;
+import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.CSAuthorityFactory;
 import org.opengis.referencing.datum.DatumAuthorityFactory;
 import org.opengis.referencing.datum.GeodeticDatum;
@@ -40,6 +41,7 @@ import org.apache.sis.measure.Units;
 import org.apache.sis.metadata.iso.extent.Extents;
 import org.apache.sis.referencing.datum.HardCodedDatum;
 import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.referencing.cs.HardCodedCS;
 
 import static org.junit.Assert.*;
 
@@ -48,7 +50,7 @@ import static org.junit.Assert.*;
  * A pseudo-authority factory with hard-coded objects.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
  * @since   0.7
  * @module
  */
@@ -114,6 +116,7 @@ public final strictfp class AuthorityFac
         if (type.isAssignableFrom(GeodeticDatum.class)) add(codes, 6326, 6322, 6807, 6301, 6612, 6047);
         if (type.isAssignableFrom(VerticalDatum.class)) add(codes, 5100);
         if (type.isAssignableFrom(VerticalCRS.class))   add(codes, 5714, 9905);
+        if (type.isAssignableFrom(EllipsoidalCS.class)) add(codes, 6422, 6424);
         return codes;
     }
 
@@ -147,6 +150,8 @@ public final strictfp class AuthorityFac
             case 6612: return HardCodedDatum.JGD2000;
             case 6047: return HardCodedDatum.SPHERE;
             case 5100: return HardCodedDatum.MEAN_SEA_LEVEL;
+            case 6422: return HardCodedCS.GEODETIC_φλ;
+            case 6424: return HardCodedCS.GEODETIC_2D;
             default: throw new NoSuchAuthorityCodeException(code, authority.getTitle().toString(), code);
         }
     }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -125,7 +125,7 @@ public final strictfp class CommonAuthor
         assertTrue (Citations.identifierMatches(authority, "WMS"));
         assertFalse(Citations.identifierMatches(authority, "OGP"));
         assertFalse(Citations.identifierMatches(authority, "EPSG"));
-        assertEquals(Constants.OGC, org.apache.sis.internal.util.Citations.getCodeSpace(authority));
+        assertEquals(Constants.OGC, Citations.getCodeSpace(authority));
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -16,13 +16,7 @@
  */
 package org.apache.sis.referencing.factory;
 
-import java.util.Map;
-import java.util.HashMap;
 import org.opengis.util.FactoryException;
-import org.apache.sis.util.logging.Logging;
-import org.apache.sis.internal.system.Loggers;
-import org.apache.sis.internal.util.Constants;
-import org.apache.sis.referencing.factory.sql.EPSGFactory;
 
 // Test imports
 import org.junit.AfterClass;
@@ -32,7 +26,6 @@ import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 import org.junit.runners.MethodSorters;
 
-import static org.opengis.test.Assert.*;
 
 
 /**
@@ -52,76 +45,29 @@ import static org.opengis.test.Assert.*;
 @FixMethodOrder(MethodSorters.JVM)      // Intentionally want some randomness
 public final strictfp class GIGS2001 extends org.opengis.test.referencing.gigs.GIGS2001 {
     /**
-     * The factory instance to use for the tests, or {@code null} if not available.
-     * This field is set by {@link #createFactory()} and cleared by {@link #close()}.
-     */
-    public static EPSGFactory factory;
-
-    /**
-     * {@code true} if we failed to create the {@link #factory}.
-     */
-    private static boolean isUnavailable;
-
-    /**
      * Creates a new test using the default authority factory.
      */
     public GIGS2001() {
-        super(factory);
+        super(TestFactorySource.factory);
     }
 
     /**
      * Creates the factory to use for all tests in this class.
-     * If this method fails to create the factory, then {@link #factory} is left to {@code null} value.
      *
      * @throws FactoryException if an error occurred while creating the factory.
      */
     @BeforeClass
-    @SuppressWarnings("null")
     public static void createFactory() throws FactoryException {
-        if (!isUnavailable) {
-            EPSGFactory af = factory;
-            if (af == null) {
-                final GeodeticObjectFactory f = new GeodeticObjectFactory();
-                final Map<String,Object> properties = new HashMap<>(6);
-                assertNull(properties.put("datumFactory", f));
-                assertNull(properties.put("csFactory", f));
-                assertNull(properties.put("crsFactory", f));
-                try {
-                    af = new EPSGFactory(properties);
-                    assertEquals("Expected no Data Access Object (DAO) before the first test is run.",
-                                 0, ((ConcurrentAuthorityFactory) af).countAvailableDataAccess());
-                    /*
-                     * Above method call may fail if no data source has been specified.
-                     * Following method call may fail if a data source has been specified,
-                     * but the database does not contain the required tables.
-                     */
-                    assertNotNull(af.createUnit(String.valueOf(Constants.EPSG_METRE)));
-                    factory = af;                                                           // Must be last.
-                } catch (UnavailableFactoryException e) {
-                    isUnavailable = true;
-                    Logging.getLogger(Loggers.CRS_FACTORY).warning(e.toString());
-                } finally {
-                    if (factory != af) {
-                        af.close();
-                    }
-                }
-            }
-        }
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        final EPSGFactory af = factory;
-        if (af != null) {
-            factory = null;
-            final int n = ((ConcurrentAuthorityFactory) af).countAvailableDataAccess();
-            af.close();
-            assertBetween("Since we ran all tests sequantially, should have no more than 1 Data Access Object (DAO).", 0, 1, n);
-        }
+        TestFactorySource.close();
     }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -64,7 +64,7 @@ public final strictfp class GIGS2002 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2002() {
-        super(GIGS2001.factory);
+        super(TestFactorySource.factory);
     }
 
     /**
@@ -74,17 +74,17 @@ public final strictfp class GIGS2002 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -52,7 +52,7 @@ public final strictfp class GIGS2003 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2003() {
-        super(GIGS2001.factory);
+        super(TestFactorySource.factory);
     }
 
     /**
@@ -62,16 +62,16 @@ public final strictfp class GIGS2003 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -68,7 +68,7 @@ public final strictfp class GIGS2004 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2004() {
-        super(GIGS2001.factory, GIGS2001.factory);
+        super(TestFactorySource.factory, TestFactorySource.factory);
     }
 
     /**
@@ -78,17 +78,17 @@ public final strictfp class GIGS2004 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -65,7 +65,7 @@ public final strictfp class GIGS2005 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2005() {
-        super(GIGS2001.factory);
+        super(TestFactorySource.factory);
     }
 
     /**
@@ -75,17 +75,17 @@ public final strictfp class GIGS2005 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -65,7 +65,7 @@ public final strictfp class GIGS2006 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2006() {
-        super(GIGS2001.factory);
+        super(TestFactorySource.factory);
     }
 
     /**
@@ -75,17 +75,17 @@ public final strictfp class GIGS2006 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -52,7 +52,7 @@ public final strictfp class GIGS2007 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2007() {
-        super(GIGS2001.factory);
+        super(TestFactorySource.factory);
     }
 
     /**
@@ -62,16 +62,16 @@ public final strictfp class GIGS2007 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -52,7 +52,7 @@ public final strictfp class GIGS2008 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2008() {
-        super(GIGS2001.factory, GIGS2001.factory);
+        super(TestFactorySource.factory, TestFactorySource.factory);
     }
 
     /**
@@ -62,16 +62,16 @@ public final strictfp class GIGS2008 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -52,7 +52,7 @@ public final strictfp class GIGS2009 ext
      * Creates a new test using the default authority factory.
      */
     public GIGS2009() {
-        super(GIGS2001.factory);
+        super(TestFactorySource.factory);
     }
 
     /**
@@ -62,16 +62,16 @@ public final strictfp class GIGS2009 ext
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -28,6 +28,8 @@ import org.opengis.referencing.crs.Geoce
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.GeographicCRS;
 import org.opengis.referencing.crs.VerticalCRS;
+import org.opengis.referencing.crs.CompoundCRS;
+import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.datum.Datum;
 import org.opengis.referencing.datum.DatumAuthorityFactory;
 import org.opengis.referencing.datum.GeodeticDatum;
@@ -36,6 +38,7 @@ import org.opengis.referencing.datum.Ver
 import org.opengis.util.FactoryException;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.referencing.cs.HardCodedCS;
 import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.referencing.datum.HardCodedDatum;
 import org.apache.sis.measure.Units;
@@ -274,6 +277,89 @@ public final strictfp class MultiAuthori
     }
 
     /**
+     * Tests {@code MultiAuthoritiesFactory.createFoo(String)} from codes in the
+     * {@code "urn:ogc:def:type, type₁:authority₁:version₁:code₁, type₂:authority₂:version₂:code₂"} form.
+     *
+     * @throws FactoryException if an authority or a code is not recognized.
+     *
+     * @since 0.8
+     */
+    @Test
+    @DependsOnMethod("testCreateFromURNs")
+    public void testCreateFromCombinedURNs() throws FactoryException {
+        final Set<AuthorityFactoryMock> mock = Collections.singleton(new AuthorityFactoryMock("MOCK", "2.3"));
+        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, mock, mock, null);
+        testCreateFromCombinedURIs(factory, "urn:ogc:def:crs, crs:MOCK::4326, crs:MOCK::5714");
+        /*
+         * Following are more unusual combinations described in OGC 07-092r1 (2007)
+         * "Definition identifier URNs in OGC namespace".
+         */
+        SingleCRS crs = factory.createGeographicCRS("urn:ogc:def:crs, datum:MOCK::6326, cs:MOCK::6424");
+        assertSame("datum", HardCodedDatum.WGS84, crs.getDatum());
+        assertSame("cs", HardCodedCS.GEODETIC_2D, crs.getCoordinateSystem());
+        /*
+         * Verify that invalid combined URIs are rejected.
+         */
+        try {
+            factory.createObject("urn:ogc:def:cs, crs:MOCK::4326, crs:MOCK::5714");
+            fail("Shall not accept to create CoordinateSystem from combined URI.");
+        } catch (FactoryException e) {
+            String message = e.getMessage();
+            assertTrue(message, message.contains("CoordinateSystem"));
+        }
+        try {
+            factory.createObject("urn:ogc:def:crs, datum:MOCK::6326, cs:MOCK::6424, cs:MOCK::6422");
+            fail("Shall not accept to create combined URI with unexpected objects.");
+        } catch (FactoryException e) {
+            assertNotNull(e.getMessage());
+        }
+    }
+
+    /**
+     * Tests {@code MultiAuthoritiesFactory.createFoo(String)} from codes in the
+     * {@code "http://www.opengis.net/def/crs-compound?1=(…)/code₁&2=(…)/code₂"} form.
+     *
+     * @throws FactoryException if an authority or a code is not recognized.
+     *
+     * @since 0.8
+     */
+    @Test
+    @DependsOnMethod("testCreateFromHTTPs")
+    public void testCreateFromCombinedHTTPs() throws FactoryException {
+        final Set<AuthorityFactoryMock> mock = Collections.singleton(new AuthorityFactoryMock("MOCK", "2.3"));
+        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, mock, mock, null);
+        testCreateFromCombinedURIs(factory, "http://www.opengis.net/def/crs-compound?"
+                                        + "1=http://www.opengis.net/def/crs/MOCK/0/4326&"
+                                        + "2=http://www.opengis.net/def/crs/MOCK/0/5714");
+        testCreateFromCombinedURIs(factory, "http://www.opengis.net/def/crs-compound?"
+                                        + "2=http://www.opengis.net/def/crs/MOCK/0/5714&"
+                                        + "1=http://www.opengis.net/def/crs/MOCK/0/4326");
+        /*
+         * Contrarily to URN, the HTTP form shall not accept Datum + CoordinateSystem combination.
+         */
+        try {
+            factory.createObject("http://www.opengis.net/def/crs-compound?"
+                             + "1=http://www.opengis.net/def/datum/MOCK/0/6326&"
+                             + "2=http://www.opengis.net/def/cs/MOCK/0/6424");
+            fail("Shall not accept Datum + CoordinateSystem combination.");
+        } catch (FactoryException e) {
+            assertNotNull(e.getMessage());
+        }
+    }
+
+    /**
+     * Implementation of {@link #testCreateFromCombinedURNs()} and {@link #testCreateFromCombinedHTTPs()}.
+     */
+    private static void testCreateFromCombinedURIs(final MultiAuthoritiesFactory factory, final String heightOnWGS84)
+            throws FactoryException
+    {
+        CompoundCRS crs = factory.createCompoundCRS(heightOnWGS84);
+        assertArrayEquals("WGS 84 + MSL height", new SingleCRS[] {
+            HardCodedCRS.WGS84_φλ, HardCodedCRS.GRAVITY_RELATED_HEIGHT
+        }, crs.getComponents().toArray());
+    }
+
+    /**
      * Tests {@link MultiAuthoritiesFactory#getAuthorityCodes(Class)}.
      *
      * @throws FactoryException if an error occurred while fetching the set of codes.

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -66,7 +66,7 @@ import org.apache.sis.test.TestCase;
 import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.referencing.factory.GIGS2001;
+import org.apache.sis.referencing.factory.TestFactorySource;
 
 import static org.junit.Assume.assumeNotNull;
 import static org.apache.sis.test.ReferencingAssert.*;
@@ -96,7 +96,7 @@ public final strictfp class EPSGFactoryT
      */
     @BeforeClass
     public static void createFactory() throws FactoryException {
-        GIGS2001.createFactory();
+        TestFactorySource.createFactory();
     }
 
     /**
@@ -106,7 +106,7 @@ public final strictfp class EPSGFactoryT
      */
     @AfterClass
     public static void close() throws FactoryException {
-        GIGS2001.close();
+        TestFactorySource.close();
     }
 
     /**
@@ -140,7 +140,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testWGS84() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final GeographicCRS crs = factory.createGeographicCRS("EPSG:4326");
         assertEpsgNameAndIdentifierEqual("WGS 84", 4326, crs);
@@ -162,7 +162,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testWGS84")
     public void testGeographic2D() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final GeographicCRS crs = factory.createGeographicCRS("4274");
         assertEpsgNameAndIdentifierEqual("Datum 73", 4274, crs);
@@ -183,7 +183,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testGeographic2D")
     public void testGeographic3D() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final GeographicCRS crs = factory.createGeographicCRS("EPSG::4993");
         assertEpsgNameAndIdentifierEqual("Lao 1997", 4993, crs);
@@ -201,7 +201,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testGeocentric() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final GeocentricCRS crs = factory.createGeocentricCRS("epsg:4915");
         assertEpsgNameAndIdentifierEqual("ITRF93", 4915, crs);
@@ -220,7 +220,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testGeographic2D")
     public void testProjected() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final ProjectedCRS crs = factory.createProjectedCRS("2027");
         assertEpsgNameAndIdentifierEqual("NAD27(76) / UTM zone 15N", 2027, crs);
@@ -258,7 +258,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testProjected")
     public void testProjectedNorthEast() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final ProjectedCRS crs = factory.createProjectedCRS(" EPSG : 2442 ");
         assertEpsgNameAndIdentifierEqual("Beijing 1954 / 3-degree Gauss-Kruger CM 135E", 2442, crs);
@@ -291,7 +291,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testProjected")
     public void testProjectedWithSharedConversion() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final ProjectedCRS crs = factory.createProjectedCRS("32210");
         assertEpsgNameAndIdentifierEqual("WGS 72 / UTM zone 10N", 32210, crs);
@@ -330,7 +330,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testCreateByName")
     public void testProjectedByName() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final ProjectedCRS crs = factory.createProjectedCRS("NTF (Paris) / Lambert zone I");
         assertEpsgNameAndIdentifierEqual("NTF (Paris) / Lambert zone I", 27571, crs);
@@ -358,7 +358,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @Ignore("“Lambert Azimuthal Equal Area (Spherical)” projection is not yet implemented.")
     public void testProjectedOnPole() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final ProjectedCRS crs = factory.createProjectedCRS("3408");
         assertEpsgNameAndIdentifierEqual("NSIDC EASE-Grid North", 3408, crs);
@@ -378,7 +378,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testGoogleProjection() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final ProjectedCRS crs = factory.createProjectedCRS("3857");
         assertEpsgNameAndIdentifierEqual("WGS 84 / Pseudo-Mercator", 3857, crs);
@@ -397,7 +397,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testEngineering() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final EngineeringCRS crs = factory.createEngineeringCRS("EPSG:5801");
         assertEpsgNameAndIdentifierEqual("Barcelona Grid B1", 5801, crs);
@@ -413,7 +413,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testVertical() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final VerticalCRS crs = factory.createVerticalCRS("EPSG:5735");
         assertEpsgNameAndIdentifierEqual("Black Sea height", 5735, crs);
@@ -431,7 +431,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod({"testGeographic2D", "testVertical"})
     public void testCompound() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final CompoundCRS crs = factory.createCompoundCRS("EPSG:7400");
         assertEpsgNameAndIdentifierEqual("NTF (Paris) + NGF IGN69 height", 7400, crs);
@@ -461,7 +461,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testDeprecatedCoordinateSystems() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         for (final Map.Entry<Integer,Integer> entry : EPSGDataAccess.deprecatedCS().entrySet()) {
             final CoordinateSystem expected = factory.createEllipsoidalCS(entry.getValue().toString());
@@ -504,7 +504,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod({"testGeographic2D", "testDeprecatedCoordinateSystems"})
     public void testDeprecatedGeographic() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
 
         final GeographicCRS crs = factory.createGeographicCRS("63266405");
@@ -526,7 +526,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod({"testDeprecatedGeographic", "testDeprecatedCoordinateSystems"})
     public void testDeprecatedProjected() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
 
         final ProjectedCRS crs = factory.createProjectedCRS("3786");
@@ -559,7 +559,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testCreateByName() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         assertSame   (factory.createUnit("9002"), factory.createUnit("foot"));
         assertNotSame(factory.createUnit("9001"), factory.createUnit("foot"));
@@ -591,7 +591,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testAuthorityCodes() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         /*
          * Most basic objects.
@@ -758,7 +758,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testDescriptionText() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
 
         assertEquals("World Geodetic System 1984", factory.getDescriptionText( "6326").toString(Locale.US));
@@ -776,7 +776,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testProjectedWithSharedConversion")
     public void testConversion() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         /*
          * Fetch directly the "UTM zone 10N" operation. Because this operation was not obtained in
@@ -833,7 +833,7 @@ public final strictfp class EPSGFactoryT
      */
     @Test
     public void testSimpleTransformation() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final CoordinateOperation operation = factory.createCoordinateOperation("1764");
         assertEpsgNameAndIdentifierEqual("NTF (Paris) to NTF (2)", 1764, operation);
@@ -851,7 +851,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testSimpleTransformation")
     public void testTransformation() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final CoordinateOperation operation = factory.createCoordinateOperation("1609");
         assertEpsgNameAndIdentifierEqual("BD72 to WGS 84 (1)", 1609, operation);
@@ -868,7 +868,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testTransformation")
     public void testCreateFromCoordinateReferenceSystemCodes() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         /*
          * ED50 (4230)  to  WGS 84 (4326)  using
@@ -942,7 +942,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testWGS84")
     public void testFindGeographic() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final IdentifiedObjectFinder finder = factory.newIdentifiedObjectFinder();
         final DefaultGeographicCRS crs = (DefaultGeographicCRS) CRS.fromWKT(
@@ -990,7 +990,7 @@ public final strictfp class EPSGFactoryT
     @Test
     @DependsOnMethod("testFindGeographic")
     public void testFindProjected() throws FactoryException {
-        final EPSGFactory factory = GIGS2001.factory;
+        final EPSGFactory factory = TestFactorySource.factory;
         assumeNotNull(factory);
         final IdentifiedObjectFinder finder = factory.newIdentifiedObjectFinder();
         /*

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -49,7 +49,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html [UTF-8] Mon Oct 30 10:25:08 2017
@@ -17,7 +17,7 @@
 -->
 <html>
   <head>
-    <title>EPSG dateset update procedure</title>
+    <title>EPSG dataset update procedure</title>
     <meta charset="UTF-8">
   </head>
   <body>

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -814,7 +814,7 @@ public final strictfp class CoordinateOp
                 "  Id[“EPSG”, “3395”]]");
 
         CoordinateReferenceSystem sourceCRS = targetCRS;
-        sourceCRS = compound("Mercator 3D", sourceCRS, CommonCRS.Vertical.ELLIPSOIDAL.crs());
+        sourceCRS = compound("Mercator 3D", sourceCRS, CommonCRS.Vertical.MEAN_SEA_LEVEL.crs());
         sourceCRS = compound("Mercator 4D", sourceCRS, CommonCRS.Temporal.MODIFIED_JULIAN.crs());
 
         final CoordinateOperation operation = finder.createOperation(sourceCRS, targetCRS);
@@ -864,7 +864,7 @@ public final strictfp class CoordinateOp
         assertSame      ("sourceCRS", sourceCRS, operation.getSourceCRS());
         assertSame      ("targetCRS", targetCRS, operation.getTargetCRS());
         assertInstanceOf("operation", ConcatenatedOperation.class, operation);
-        assertEquals    ("name", "CompoundCRS[“Test3D”] → CompoundCRS[“Test4D”]", operation.getName().getCode());
+        assertEquals    ("name", "CompoundCRS[“Test3D”] ⟶ CompoundCRS[“Test4D”]", operation.getName().getCode());
 
         transform = operation.getMathTransform();
         assertInstanceOf("transform", LinearTransform.class, transform);

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -45,7 +45,7 @@ import org.junit.AfterClass;
 import org.junit.Test;
 
 import static org.apache.sis.test.ReferencingAssert.*;
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -212,10 +212,10 @@ public final strictfp class DefaultCoord
         final CoordinateReferenceSystem sourceCRS = parse(
                 "CompoundCRS[“NTF 4D”," +
                 "  $NTF,\n" +
-                "  VerticalCRS[“Ellipsoidal height”,\n" +
-                "    VerticalDatum[“Ellipsoid”],\n" +
+                "  VerticalCRS[“Geoidal height”,\n" +
+                "    VerticalDatum[“Geoid”],\n" +
                 "    CS[vertical, 1],\n" +
-                "      Axis[“Ellipsoidal height (h)”, up],\n" +
+                "      Axis[“Geoidal height (H)”, up],\n" +
                 "      Unit[“metre”, 1]],\n" +
                 "  TimeCRS[“Modified Julian”,\n" +
                 "    TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
@@ -229,7 +229,7 @@ public final strictfp class DefaultCoord
         assertSame      ("targetCRS", targetCRS, operation.getTargetCRS());
         assertInstanceOf("operation", ConcatenatedOperation.class, operation);
         /*
-         * The accuracy of the coordinate operation depends on whether a path as been found with the help
+         * The accuracy of the coordinate operation depends on whether a path has been found with the help
          * of the EPSG database. See testProjectionAndLongitudeRotation() for more information.
          */
         final boolean isUsingEpsgFactory = verifyParametersNTF(((ConcatenatedOperation) operation).getOperations(), 2);

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -16,9 +16,15 @@
  */
 package org.apache.sis.referencing.operation;
 
+import java.util.Map;
 import java.util.Collections;
+import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.crs.ProjectedCRS;
 import org.opengis.referencing.operation.OperationMethod;
 import org.apache.sis.internal.referencing.provider.Mercator1SP;
+import org.apache.sis.referencing.crs.DefaultProjectedCRS;
+import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.referencing.cs.HardCodedCS;
 
 
 /**
@@ -46,4 +52,52 @@ public final strictfp class HardCodedCon
      */
     private HardCodedConversions() {
     }
+
+    /**
+     * A two-dimensional Mercator projection using the WGS84 datum.
+     * This CRS uses (<var>easting</var>, <var>northing</var>) ordinates in metres.
+     * The base CRS uses (<var>longitude</var>, <var>latitude</var>) axes
+     * and the prime meridian is Greenwich.
+     *
+     * <p>This CRS is equivalent to {@code EPSG:3395} except for base CRS axis order,
+     * since EPSG puts latitude before longitude.</p>
+     *
+     * @return two-dimensional Mercator projection.
+     */
+    public static DefaultProjectedCRS mercator() {
+        return new DefaultProjectedCRS(name("Mercator"),
+                HardCodedCRS.WGS84, HardCodedConversions.MERCATOR, HardCodedCS.PROJECTED);
+    }
+
+    /**
+     * A three-dimensional Mercator projection using the WGS84 datum.
+     * This CRS uses (<var>easting</var>, <var>northing</var>, <var>height</var>) ordinates in metres.
+     * The base CRS uses (<var>longitude</var>, <var>latitude</var>, <var>height</var>) axes
+     * and the prime meridian is Greenwich.
+     *
+     * @return three-dimensional Mercator projection.
+     */
+    public static DefaultProjectedCRS mercator3D() {
+        return new DefaultProjectedCRS(name("Mercator 3D"),
+                HardCodedCRS.WGS84_3D, HardCodedConversions.MERCATOR, HardCodedCS.PROJECTED_3D);
+    }
+
+    /**
+     * A two- or three-dimensional Mercator projection using the given base CRS.
+     * This CRS uses (<var>easting</var>, <var>northing</var>) ordinates in metres.
+     *
+     * @param  baseCRS  the two- or three-dimensional base CRS.
+     * @return two- or three-dimensional Mercator projection.
+     */
+    public static DefaultProjectedCRS mercator(final GeographicCRS baseCRS) {
+        return new DefaultProjectedCRS(name("Mercator (other)"), baseCRS, HardCodedConversions.MERCATOR,
+                baseCRS.getCoordinateSystem().getDimension() == 3 ? HardCodedCS.PROJECTED_3D : HardCodedCS.PROJECTED);
+    }
+
+    /**
+     * Puts the given name in a property map CRS constructors.
+     */
+    private static Map<String,?> name(final String name) {
+        return Collections.singletonMap(ProjectedCRS.NAME_KEY, name);
+    }
 }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -62,12 +62,12 @@ public final strictfp class AlbersEqualA
     @Test
     public void testSphere() throws FactoryException, TransformException {
         createCompleteProjection(new org.apache.sis.internal.referencing.provider.AlbersEqualArea(),
-                6370997,    // Semi-major axis from Synder table 15
+                6370997,    // Semi-major axis from Snyder table 15
                 6370997,    // Semi-minor axis
                 0,          // Central meridian
                 0,          // Latitude of origin
-                29.5,       // Standard parallel 1 (from Synder table 15)
-                45.5,       // Standard parallel 2 (from Synder table 15)
+                29.5,       // Standard parallel 1 (from Snyder table 15)
+                45.5,       // Standard parallel 2 (from Snyder table 15)
                 NaN,        // Scale factor (none)
                 0,          // False easting
                 0);         // False northing
@@ -78,10 +78,10 @@ public final strictfp class AlbersEqualA
         tolerance = Formulas.LINEAR_TOLERANCE;
         final AlbersEqualArea kernel = (AlbersEqualArea) getKernel();
         assertTrue("isSpherical", isSpherical(kernel));
-        assertEquals("n", 0.6028370, kernel.nm, 0.5E-7);                    // Expected 'n' value from Synder table 15.
+        assertEquals("n", 0.6028370, kernel.nm, 0.5E-7);                    // Expected 'n' value from Snyder table 15.
         /*
          * When stepping into the AlbersEqualArea.Sphere.transform(…) method with a debugger, the
-         * expected value of 6370997*ρ/n is 6910941 (value taken from ρ column in Synder table 15).
+         * expected value of 6370997*ρ/n is 6910941 (value taken from ρ column in Snyder table 15).
          */
         verifyTransform(new double[] {0, 50}, new double[] {0, 5373933.180});
         /*
@@ -111,12 +111,12 @@ public final strictfp class AlbersEqualA
     @DependsOnMethod("testSphere")
     public void testEllipse() throws FactoryException, TransformException {
         createCompleteProjection(new org.apache.sis.internal.referencing.provider.AlbersEqualArea(),
-                6378206.4,  // Semi-major axis from Synder table 15
+                6378206.4,  // Semi-major axis from Snyder table 15
                 6356583.8,  // Semi-minor axis
                 0,          // Central meridian
                 0,          // Latitude of origin
-                29.5,       // Standard parallel 1 (from Synder table 15)
-                45.5,       // Standard parallel 2 (from Synder table 15)
+                29.5,       // Standard parallel 1 (from Snyder table 15)
+                45.5,       // Standard parallel 2 (from Snyder table 15)
                 NaN,        // Scale factor (none)
                 0,          // False easting
                 0);         // False northing
@@ -128,13 +128,13 @@ public final strictfp class AlbersEqualA
         final AlbersEqualArea kernel = (AlbersEqualArea) getKernel();
         assertFalse("isSpherical", isSpherical(kernel));
         /*
-         * Expected 'n' value from Synder table 15. The division by (1-ℯ²) is because Apache SIS omits this factor
+         * Expected 'n' value from Snyder table 15. The division by (1-ℯ²) is because Apache SIS omits this factor
          * in its calculation of n (we rather take it in account in (de)normalization matrices and elsewhere).
          */
         assertEquals("n", 0.6029035, kernel.nm / (1 - kernel.eccentricitySquared), 0.5E-7);
         /*
          * When stepping into the AlbersEqualArea.Sphere.transform(…) method with a debugger, the expected
-         * value of 6378206.4*ρ/(nm/(1-ℯ²)) is 6931335 (value taken from ρ column in Synder table 15).
+         * value of 6378206.4*ρ/(nm/(1-ℯ²)) is 6931335 (value taken from ρ column in Snyder table 15).
          */
         verifyTransform(new double[] {0, 50}, new double[] {0, 5356698.435});
         /*

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MathTransformTestCase.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -310,6 +310,7 @@ public abstract strictfp class MathTrans
 
     /**
      * Generates random numbers that can be used for the current transform.
+     * The number of dimensions is given by {@code transform.getSourceDimensions()}.
      *
      * @param  domain   the domain of the numbers to be generated.
      * @param  propNaN  approximative percentage of NaN values as a fraction between 0 and 1, or 0 if none.

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/ReferencingAssert.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -22,6 +22,7 @@ import java.awt.geom.RectangularShape;
 import java.awt.geom.AffineTransform;
 import javax.measure.Unit;
 import org.opengis.geometry.Envelope;
+import org.opengis.geometry.DirectPosition;
 import org.opengis.metadata.Identifier;
 import org.opengis.parameter.GeneralParameterValue;
 import org.opengis.parameter.ParameterDescriptor;
@@ -51,7 +52,7 @@ import static java.lang.StrictMath.*;
  * from other modules and libraries.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
  * @since   0.3
  * @module
  */
@@ -281,15 +282,19 @@ public strictfp class ReferencingAssert
     public static void assertEnvelopeEquals(final Envelope expected, final Envelope actual, final double... tolerances) {
         final int dimension = expected.getDimension();
         assertEquals("dimension", dimension, actual.getDimension());
+        final DirectPosition expectedLower = expected.getLowerCorner();
+        final DirectPosition expectedUpper = expected.getUpperCorner();
+        final DirectPosition actualLower   = actual  .getLowerCorner();
+        final DirectPosition actualUpper   = actual  .getUpperCorner();
         double tolerance = 0;
         for (int i=0; i<dimension; i++) {
             if (i < tolerances.length) {
                 tolerance = tolerances[i];
             }
-            if (abs(expected.getMinimum(i) - actual.getMinimum(i)) > tolerance ||
-                abs(expected.getMaximum(i) - actual.getMaximum(i)) > tolerance)
+            if (abs(expectedLower.getOrdinate(i) - actualLower.getOrdinate(i)) > tolerance ||
+                abs(expectedUpper.getOrdinate(i) - actualUpper.getOrdinate(i)) > tolerance)
             {
-                fail("Envelopes are not equal:\n"
+                fail("Envelopes are not equal in dimension " + i + ":\n"
                         + "expected " + Envelopes.toString(expected) + "\n"
                         + " but got " + Envelopes.toString(actual));
             }

Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -39,8 +39,8 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assume.*;
 import static org.junit.Assert.*;
+import static org.junit.Assume.assumeTrue;
 
 
 /**



Mime
View raw message