sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1817597 [9/19] - in /sis/branches/ISO-19115-3: ./ 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/ applica...
Date Sat, 09 Dec 2017 10:57:47 GMT
Modified: sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ServicesForMetadataTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/AuthorityFactoryMock.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/package.html [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java [UTF-8] Sat Dec  9 10:57:44 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;
 
 
 /**
@@ -57,12 +57,16 @@ import static org.junit.Assume.*;
  * <ul>
  *   <li><cite>"NTF (Paris) to WGS 84 (1)"</cite> operation (EPSG:8094), which implies a longitude rotation
  *       followed by a geocentric translation in the geographic domain.</li>
+ *   <li><cite>"Martinique 1938 to RGAF09 (1)"</cite> operation (EPSG:5491), which implies a datum shift
+ *       that does not go through WGS84. Furthermore since the EPSG database defines (λ,φ) axis order in
+ *       addition to the usual (φ,λ) order for the target CRS, this tests allows us to verify we can find
+ *       this operation despite different axis order.</li>
  * </ul>
  *
  * The operations are tested with various axis order and dimension in source and target CRS.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
  * @since   0.7
  * @module
  */
@@ -94,6 +98,11 @@ public final strictfp class CoordinateOp
     private static WKTFormat parser;
 
     /**
+     * The EPSG authority factory for CRS objects. Can be used as an alternative to {@link #parser}.
+     */
+    private final CRSAuthorityFactory crsFactory;
+
+    /**
      * The instance on which to execute the tests.
      */
     private final CoordinateOperationRegistry registry;
@@ -104,7 +113,7 @@ public final strictfp class CoordinateOp
      * @throws FactoryException if an error occurred while creating the factory to be tested.
      */
     public CoordinateOperationRegistryTest() throws FactoryException {
-        final CRSAuthorityFactory crsFactory = CRS.getAuthorityFactory("EPSG");
+        crsFactory = CRS.getAuthorityFactory("EPSG");
         assumeTrue("EPSG factory required.", crsFactory instanceof CoordinateOperationAuthorityFactory);
         registry = new CoordinateOperationRegistry((CoordinateOperationAuthorityFactory) crsFactory, factory, null);
     }
@@ -363,4 +372,39 @@ public final strictfp class CoordinateOp
             assertFalse("EPSG identifier not allowed for modified objects.", "EPSG".equalsIgnoreCase(id.getCodeSpace()));
         }
     }
+
+    /**
+     * Tests <cite>"Martinique 1938 to RGAF09 (1)"</cite> operation with a target CRS fixed to EPSG:7086
+     * instead of EPSG:5489. Both are <cite>"RGAF09"</cite>, but the former use (longitude, latitude) axis
+     * order instead than the usual (latitude, longitude) order. The source CRS stay fixed to EPSG:4625.
+     *
+     * @throws FactoryException if an error occurred while creating a CRS or operation.
+     */
+    @Test
+    public void testFindDespiteDifferentAxisOrder() throws FactoryException {
+        CoordinateReferenceSystem sourceCRS = crsFactory.createGeographicCRS("EPSG:4625");
+        CoordinateReferenceSystem targetCRS = crsFactory.createGeographicCRS("EPSG:5489");
+        CoordinateOperation operation = registry.createOperation(sourceCRS, targetCRS);
+        assertEpsgNameAndIdentifierEqual("Martinique 1938 to RGAF09 (1)", 5491, operation);
+        /*
+         * Above was only a verification using the source and target CRS expected by EPSG dataset.
+         * Now the interesting test: use a target CRS with different axis order.
+         */
+        targetCRS = crsFactory.createGeographicCRS("EPSG:7086");
+        operation = registry.createOperation(sourceCRS, targetCRS);
+        assertEpsgNameWithoutIdentifierEqual("Martinique 1938 to RGAF09 (1)", operation);
+        final ParameterValueGroup p = ((SingleOperation) operation).getParameterValues();
+        /*
+         * Values below are copied from EPSG geodetic dataset 9.1. They may need
+         * to be adjusted if a future version of EPSG dataset modify those values.
+         */
+        assertEquals("X-axis translation", 127.744,  p.parameter("X-axis translation").doubleValue(), STRICT);
+        assertEquals("Y-axis translation", 547.069,  p.parameter("Y-axis translation").doubleValue(), STRICT);
+        assertEquals("Z-axis translation", 118.359,  p.parameter("Z-axis translation").doubleValue(), STRICT);
+        assertEquals("X-axis rotation",     -3.1116, p.parameter("X-axis rotation")   .doubleValue(), STRICT);
+        assertEquals("Y-axis rotation",      4.9509, p.parameter("Y-axis rotation")   .doubleValue(), STRICT);
+        assertEquals("Z-axis rotation",     -0.8837, p.parameter("Z-axis rotation")   .doubleValue(), STRICT);
+        assertEquals("Scale difference",    14.1012, p.parameter("Scale difference")  .doubleValue(), STRICT);
+        assertEquals("linearAccuracy",       0.1,    CRS.getLinearAccuracy(operation),                STRICT);
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -43,7 +43,7 @@ import static org.apache.sis.test.TestUt
  * Tests the {@link DefaultConcatenatedOperation} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
  * @since   0.7
  * @module
  */
@@ -114,9 +114,7 @@ public final strictfp class DefaultConca
                 "      Axis[“Latitude (B)”, north, Unit[“degree”, 0.017453292519943295]],\n" +
                 "      Axis[“Ellipsoidal height (h)”, up, Unit[“metre”, 1]]]],\n" +
                 "  CoordinateOperationStep[“Geographic to geocentric”,\n" +
-                "    Method[“Geographic/geocentric conversions”],\n" +
-                "      Parameter[“semi_major”, 6377397.155, Unit[“metre”, 1]],\n" +
-                "      Parameter[“semi_minor”, 6356078.962818189, Unit[“metre”, 1]]],\n" +
+                "    Method[“Geographic/geocentric conversions”]],\n" +         // Omit non-EPSG parameters for EPSG method.
                 "  CoordinateOperationStep[“Tokyo to JGD2000 (GSI)”,\n" +
                 "    Method[“Geocentric translations”],\n" +
                 "      Parameter[“X-axis translation”, -146.414],\n" +

Modified: sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -169,16 +169,18 @@ 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 (in which case the reported accuracy is 2 metres) or if we had to find an
-         * operation by ourselves (in which case we conservatively report an accuracy of 3000 metres, bu
-         * in practice observe an error of about 80 metres for this test).
+         * operation by ourselves (in which case we conservatively report an accuracy of 3000 metres, but
+         * in practice observe an error between 80 and 515 metres for this test depending on the operation
+         * method used). By comparison, the translation declared in EPSG database is about 370 metres in
+         * geocentric coordinates.
          */
         final boolean isUsingEpsgFactory = verifyParametersNTF(((ConcatenatedOperation) operation).getOperations(), 1);
         assertEquals("linearAccuracy", isUsingEpsgFactory ? 2 : PositionalAccuracyConstant.UNKNOWN_ACCURACY,
                                        CRS.getLinearAccuracy(operation), STRICT);
 
-        tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 100;
+        tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 600;
         transform = operation.getMathTransform();
         /*
          * Test using the location of Paris (48.856578°N, 2.351828°E) first,
@@ -212,10 +214,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,14 +231,14 @@ 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);
         assertEquals("linearAccuracy", isUsingEpsgFactory ? 2 : PositionalAccuracyConstant.UNKNOWN_ACCURACY,
                                        CRS.getLinearAccuracy(operation), STRICT);
 
-        tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 100;
+        tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 600;
         transform = operation.getMathTransform();
         isInverseTransformSupported = false;
         /*

Modified: sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/HardCodedConversions.java [UTF-8] Sat Dec  9 10:57:44 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/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java?rev=1817597&r1=1817596&r2=1817597&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java [UTF-8] Sat Dec  9 10:57:44 2017
@@ -74,15 +74,12 @@ public final strictfp class LinearTransf
      */
     @Test
     public void testMinimalist2D() throws FactoryException {
+        final Map<DirectPosition2D,DirectPosition2D> pos = new HashMap<>(8);
+        assertNull(pos.put(new DirectPosition2D(1, 1), new DirectPosition2D(3, 2)));
+        assertNull(pos.put(new DirectPosition2D(1, 2), new DirectPosition2D(3, 5)));
+        assertNull(pos.put(new DirectPosition2D(2, 2), new DirectPosition2D(5, 5)));
         final LinearTransformBuilder builder = new LinearTransformBuilder();
-        builder.setSourcePoints(
-                new DirectPosition2D(1, 1),
-                new DirectPosition2D(1, 2),
-                new DirectPosition2D(2, 2));
-        builder.setTargetPoints(
-                new DirectPosition2D(3, 2),
-                new DirectPosition2D(3, 5),
-                new DirectPosition2D(5, 5));
+        builder.setControlPoints(pos);
 
         assertArrayEquals(new double[] {3, 2}, builder.getControlPoint(new int[] {1, 1}), STRICT);
         assertArrayEquals(new double[] {3, 5}, builder.getControlPoint(new int[] {1, 2}), STRICT);



Mime
View raw message