Author: desruisseaux
Date: Sun Oct 15 15:04:35 2017
New Revision: 1812220
URL: http://svn.apache.org/viewvc?rev=1812220&view=rev
Log:
Tests consolidation and addition of javadoc about combined URIs.
Added:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java
- copied, changed from r1812190,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
Modified:
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/sql/TestDatabase.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateReferenceSystemTest.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/StorageConnectorTest.java
Modified:
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/sql/TestDatabase.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/sql/TestDatabase.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/sql/TestDatabase.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/metadata/sql/TestDatabase.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -16,12 +16,9 @@
*/
package org.apache.sis.internal.metadata.sql;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.apache.sis.util.Debug;
-import org.apache.sis.internal.system.DataDirectory;
import static org.junit.Assume.*;
@@ -77,21 +74,6 @@ public final strictfp class TestDatabase
}
/**
- * Returns the path to the directory of the given name in {@code
$SIS_DATA/Databases}.
- * If the directory is not found, then the test will be interrupted by an
{@code org.junit.Assume} statement.
- *
- * @param name the name of the sub-directory.
- * @return the path to the given sub-directory.
- */
- public static Path directory(final String name) {
- Path dir = DataDirectory.DATABASES.getDirectory();
- assumeNotNull("$SIS_DATA/Databases directory not found.", dir);
- dir = dir.resolve(name);
- assumeTrue("Specified directory not found.", Files.isDirectory(dir));
- return dir;
- }
-
- /**
* Creates a Derby database in memory. If no Derby or JavaDB driver is not
found,
* then the test will be interrupted by an {@code org.junit.Assume}
statement.
*
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -184,7 +184,7 @@ public final class CRS extends Static {
* <tr><td>EPSG:5714</td> <td>{@link CommonCRS.Vertical#MEAN_SEA_LEVEL
MEAN_SEA_LEVEL}</td> <td>Vertical</td> <td>Mean Sea Level height</td></tr>
* </table></blockquote>
*
- * This method accepts also the URN and URL syntax.
+ * This method accepts also the URN and URL syntaxes.
* For example the following codes are considered equivalent to {@code
"EPSG:4326"}:
* <ul>
* <li>{@code "EPSG::4326"}</li>
@@ -193,6 +193,26 @@ public final class CRS extends Static {
* <li>{@code "http://www.opengis.net/gml/srs/epsg.xml#4326"}</li>
* </ul>
*
+ * URIs can be combined for creating larger objects. For example the
following URIs combine a
+ * two-dimensional WGS84 reference system (EPSG:4326) with a Mean Sea
Level height (EPSG:5714).
+ * The result is a three-dimensional {@linkplain
org.apache.sis.referencing.crs.DefaultCompoundCRS
+ * compound coordinate reference system}:
+ *
+ * <ul>
+ * <li>{@code "urn:ogc:def:crs,crs:EPSG::4326,crs:EPSG::5714"}</li>
+ * <li><code>"http://www.opengis.net/def/crs-compound?<br>
+ * 1=http://www.opengis.net/def/crs/epsg/0/4326&<br>
+ * 2=http://www.opengis.net/def/crs/epsg/0/5714"</code></li>
+ * </ul>
+ *
+ * <p>URNs (but not URLs) can also combine a
+ * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum
geodetic datum} with an
+ * {@linkplain org.apache.sis.referencing.cs.DefaultEllipsoidalCS
ellipsoidal coordinate system} for creating a new
+ * {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS
geographic CRS}, or a base geographic CRS with a
+ * {@linkplain org.apache.sis.referencing.operation.DefaultConversion
conversion} and a
+ * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian
coordinate system} for creating a new
+ * {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS
projected coordinate reference system}.</p>
+ *
* Note that the {@link IdentifiedObjects#lookupURN(IdentifiedObject,
Citation)}
* method can be seen as a converse of this method.
* More codes may also be supported depending on which extension modules
are available.
@@ -205,6 +225,7 @@ public final class CRS extends Static {
*
* @see #getAuthorityFactory(String)
* @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory
+ * @see <a href="http://epsg-registry.org/">EPSG Geodetic Registry</a>
*
* @category factory
*/
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -386,8 +386,14 @@ public final class IdentifiedObjects ext
* Looks up a URN, such as {@code "urn:ogc:def:crs:EPSG:9.1:4326"}, of the
specified object.
* This method searches in all {@linkplain
org.apache.sis.referencing.factory.GeodeticAuthorityFactory geodetic
* authority factories} known to SIS for an object {@linkplain
org.apache.sis.util.ComparisonMode#APPROXIMATIVE
- * approximatively equals} to the specified object. If such an object is
found, then the URN for the given
- * authority is returned. Otherwise or if there is ambiguity, this method
returns {@code null}.
+ * approximatively equals} to the specified object. Then there is a choice:
+ *
+ * <ul>
+ * <li>If a single matching object is found in the specified authority
factory, then its URN is returned.</li>
+ * <li>Otherwise if the given object is a {@link CompoundCRS} or {@link
ConcatenatedOperation}
+ * and all components have an URN, then this method returns a
combined URN.</li>
+ * <li>Otherwise this method returns {@code null}.</li>
+ * </ul>
*
* <p><strong>Note that this method checks the identifier
validity.</strong>
* If the given object declares explicitly an identifier, then this method
will instantiate an object from the
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -79,7 +79,7 @@ import org.apache.sis.util.collection.Ba
* then the work is delegated to that factory. Otherwise a {@link
NoSuchAuthorityFactoryException} is thrown.</p>
*
* <div class="section">URI syntax</div>
- * This factory can also parse URNs of the following forms:
+ * This factory can also parse URNs or URLs of the following forms:
*
* <ul>
* <li>{@code "urn:ogc:def:}<var>type</var>{@code
:}<var>authority</var>{@code :}<var>version</var>{@code :}<var>code</var>{@code
"}</li>
@@ -99,6 +99,30 @@ import org.apache.sis.util.collection.Ba
* instead of {@link
org.apache.sis.referencing.factory.sql.EPSGDataAccess#createObject(String)}
because of the
* {@code "crs"} part in the URN. The more specific method gives better
performances and avoid ambiguities.</div>
*
+ * This class accepts also combined URIs of the following forms
+ * (only two components shown, but arbitrary number of components is allowed):
+ *
+ * <ul>
+ * <li>{@code "urn:ogc:def:}<var>type</var>{@code ,}
+ * <var>type₁</var>{@code :}<var>authority₁</var>{@code
:}<var>version₁</var>{@code :}<var>code₁</var>{@code ,}
+ * <var>type₂</var>{@code :}<var>authority₂</var>{@code
:}<var>version₂</var>{@code :}<var>code₂</var>{@code "}</li>
+ * <li>{@code "http://www.opengis.net/def/crs-compound?}<br>
+ * {@code 1=http://www.opengis.net/def/crs/}<var>authority₁</var>{@code
/}<var>version₁</var>{@code /}<var>code₁</var>{@code &}<br>
+ * {@code 2=http://www.opengis.net/def/crs/}<var>authority₂</var>{@code
/}<var>version₂</var>{@code /}<var>code₂</var>{@code "}</li>
+ * </ul>
+ *
+ * Given such URIs, {@code MultiAuthoritiesFactory} invokes {@link
#createObject(String)} for each component
+ * and combines the result as described by the {@link
CRS#compound(CoordinateReferenceSystem...)} method.
+ * URNs (but not URLs) can also combine a
+ * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum geodetic
datum} with an
+ * {@linkplain org.apache.sis.referencing.cs.DefaultEllipsoidalCS ellipsoidal
coordinate system} for creating a new
+ * {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic
CRS}, or a base geographic CRS with a
+ * {@linkplain org.apache.sis.referencing.operation.DefaultConversion
conversion} and a
+ * {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian
coordinate system} for creating a new
+ * {@linkplain org.apache.sis.referencing.crs.DefaultProjectedCRS projected
coordinate reference system}, or
+ * {@linkplain
org.apache.sis.referencing.operation.AbstractCoordinateOperation coordinate
operations}
+ * for creating a concatenated operation.
+ *
* <div class="section">Multiple versions for the same authority</div>
* {@code MultiAuthoritiesFactory} accepts an arbitrary amount of factories
for the same authority, provided that
* those factories have different version numbers. If a {@code
createFoo(String)} method is invoked with a URN
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/DatumShiftTestCase.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/CodesTest.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2003.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2007.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2008.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2009.java
[UTF-8] Sun Oct 15 15:04:35 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();
}
}
Copied:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java
(from r1812190,
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java?p2=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java&p1=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java&r1=1812190&r2=1812220&rev=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2001.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -19,41 +19,52 @@ package org.apache.sis.referencing.facto
import java.util.Map;
import java.util.HashMap;
import org.opengis.util.FactoryException;
+import org.opengis.referencing.crs.CRSAuthorityFactory;
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.CRS;
import org.apache.sis.referencing.factory.sql.EPSGFactory;
-// Test imports
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.FixMethodOrder;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.junit.runners.MethodSorters;
-
+import static org.junit.Assume.*;
import static org.opengis.test.Assert.*;
/**
- * Tests {@link
org.apache.sis.referencing.factory.sql.EPSGDataAccess#createUnit(String)}.
- * This is part of <cite>Geospatial Integrity of Geoscience Software</cite>
(GIGS) tests implemented in GeoAPI.
+ * Provides an EPSG factory to use for testing purpose, or notifies if no
factory is available.
+ * This is the common class used by all tests that need a full EPSG geodetic
dataset to be installed.
+ * Use this class as below:
+ *
+ * {@preformat java
+ * @BeforeClass
+ * public static void createFactory() throws FactoryException {
+ * TestFactorySource.createFactory();
+ * }
+ *
+ * @AfterClass
+ * public static void close() throws FactoryException {
+ * TestFactorySource.close();
+ * }
*
- * <div class="note"><b>Note:</b>
- * this test is defined in this package instead than in the {@code sql}
sub-package because of the need to access
- * package-private methods in {@link ConcurrentAuthorityFactory}, and for
keeping all GIGS tests together.</div>
+ * @Test
+ * public void testFoo() {
+ * assumeNotNull(TestFactorySource.factory);
+ * // Test can happen now.
+ * }
+ * }
*
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
- * @since 0.7
+ * @since 0.8
* @module
*/
-@RunWith(JUnit4.class)
-@FixMethodOrder(MethodSorters.JVM) // Intentionally want some randomness
-public final strictfp class GIGS2001 extends
org.opengis.test.referencing.gigs.GIGS2001 {
+public final strictfp class TestFactorySource {
/**
* 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()}.
+ * Test classes using this field shall declare their own {@code
createFactory()}
+ * and {@code close()} methods delegating their work to the corresponding
methods
+ * in this {@code TestFactorySource} class.
*/
public static EPSGFactory factory;
@@ -63,21 +74,41 @@ public final strictfp class GIGS2001 ext
private static boolean isUnavailable;
/**
- * Creates a new test using the default authority factory.
+ * Do not allow instantiation of this class.
*/
- public GIGS2001() {
- super(factory);
+ private TestFactorySource() {
+ }
+
+ /**
+ * Returns the system-wide EPSG factory, or interrupts the tests with
{@link org.junit.Assume}
+ * if the EPSG factory is not available. Note that this method breaks
isolation between tests.
+ * For more isolated tests, use {@link #createFactory()} and {@link
#close()} instead.
+ *
+ * @return the system-wide EPSG factory.
+ * @throws FactoryException if an error occurred while fetching the
factory.
+ */
+ public static synchronized EPSGFactory getSharedFactory() throws
FactoryException {
+ assumeFalse("No connection to EPSG dataset.", isUnavailable);
+ final CRSAuthorityFactory factory =
CRS.getAuthorityFactory(Constants.EPSG);
+ assumeTrue("No connection to EPSG dataset.", factory instanceof
EPSGFactory);
+ try {
+ assertNotNull(factory.createGeographicCRS("4326"));
+ } catch (UnavailableFactoryException e) {
+ isUnavailable = true;
+ Logging.getLogger(Loggers.CRS_FACTORY).warning(e.toString());
+ assumeNoException("No connection to EPSG dataset.", e);
+ }
+ return (EPSGFactory) factory;
}
/**
- * Creates the factory to use for all tests in this class.
+ * Creates the factory to use for all tests in a 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 {
+ public static synchronized void createFactory() throws FactoryException {
if (!isUnavailable) {
EPSGFactory af = factory;
if (af == null) {
@@ -110,12 +141,11 @@ public final strictfp class GIGS2001 ext
}
/**
- * Force releases of JDBC connections after the tests in this class.
+ * Forces release of JDBC connections after the tests in a class.
*
* @throws FactoryException if an error occurred while closing the
connections.
*/
- @AfterClass
- public static void close() throws FactoryException {
+ public static synchronized void close() throws FactoryException {
final EPSGFactory af = factory;
if (af != null) {
factory = null;
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
[UTF-8] Sun Oct 15 15:04:35 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/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java
[UTF-8] Sun Oct 15 15:04:35 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;
/**
Modified:
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateReferenceSystemTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateReferenceSystemTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateReferenceSystemTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateReferenceSystemTest.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -19,11 +19,13 @@ package org.apache.sis.test.integration;
import org.opengis.util.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.sis.referencing.CRS;
+import org.apache.sis.referencing.factory.TestFactorySource;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;
+import static org.junit.Assume.assumeNotNull;
/**
@@ -48,8 +50,8 @@ public final strictfp class CoordinateRe
* @throws FactoryException if an authority or a code is not recognized.
*/
@Test
- @org.junit.Ignore("Pending a mechanism for detecting if EPSG dataset is
present.")
public void testCreateFromCombinedURN() throws FactoryException {
+ assumeNotNull(TestFactorySource.getSharedFactory());
CoordinateReferenceSystem crs = CRS.forCode("urn:ogc:def:crs,
crs:EPSG::27700, crs:EPSG::5701");
assertSame("OSGB 1936 / British National Grid + ODN height",
CRS.forCode("EPSG:7405"), crs);
}
Modified:
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -30,7 +30,7 @@ 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.Assume.assumeTrue;
import static org.apache.sis.test.Assert.*;
@@ -49,7 +49,7 @@ public final strictfp class PathConverte
* Windows platform has driver letters instead, like "C:\\",
* which are not correctly tested by this class.
*/
- static void assumeUnixRoot() {
+ private static void assumeUnixRoot() {
assumeTrue(ArraysExt.contains(File.listRoots(), new File("/")));
}
Modified:
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -20,7 +20,7 @@ import java.util.Locale;
import org.apache.sis.test.TestCase;
import org.junit.Test;
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
import static org.apache.sis.test.Assert.*;
Modified:
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -50,11 +50,12 @@ public final strictfp class Assume exten
* @return the path to the given file.
*/
public static Path assumeDataExists(final DataDirectory type, final String
file) {
- assumeNotNull(System.getenv(DataDirectory.ENV));
+ assumeNotNull("$SIS_DATA environment variable not set.",
System.getenv(DataDirectory.ENV));
Path path = type.getDirectory();
- assumeNotNull(path);
+ assumeNotNull("$SIS_DATA/" + type + " directory not found.", path);
path = path.resolve(file);
- assumeTrue(Files.isReadable(path));
+ assumeTrue("Specified directory not found.", Files.isDirectory(path));
+ assumeTrue("Specified directory not readable.",
Files.isReadable(path));
return path;
}
}
Modified:
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -22,8 +22,8 @@ import org.apache.sis.util.Numbers;
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;
/**
Modified:
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -23,7 +23,7 @@ import org.apache.sis.test.TestCase;
import org.junit.BeforeClass;
import org.junit.Test;
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
import static org.apache.sis.test.Assert.*;
Modified:
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/folder/StoreTest.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -34,7 +34,7 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
/**
Modified:
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/StorageConnectorTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/StorageConnectorTest.java?rev=1812220&r1=1812219&r2=1812220&view=diff
==============================================================================
---
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/StorageConnectorTest.java
[UTF-8] (original)
+++
sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/storage/StorageConnectorTest.java
[UTF-8] Sun Oct 15 15:04:35 2017
@@ -37,7 +37,7 @@ 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.Assume.assumeTrue;
import static org.opengis.test.Assert.*;