From 1ea4cee8f08b61524c18bdfa71631c800e95b974 Mon Sep 17 00:00:00 2001 From: Martin Desruisseaux Date: Tue, 27 Feb 2024 19:38:46 +0100 Subject: [PATCH] Upgrade to `geomatics-geotk` version 1.17-SNAPSHOT. Two tests had to be modified: * Surface-PolygonPatch-AxisOrder.xml: wrong CRS identifier. * LineString-invalidCoords.xml: coordinates were geographic instead of projected, and were not really outside the CRS domain. --- pom.xml | 58 +++------- .../cite/iso19136/TestRunListener.java | 100 ------------------ .../iso19136/data/spatial/CurveTests.java | 21 ++-- .../iso19136/data/spatial/EnvelopeTests.java | 33 +++--- .../iso19136/data/spatial/GeometryAssert.java | 68 ++++++------ .../data/spatial/LineStringTests.java | 21 ++-- .../iso19136/data/spatial/PointTests.java | 28 ++--- .../org/opengis/cite/iso19136/testng.xml | 1 - .../data/spatial/VerifyEnvelopeTests.java | 2 +- .../data/spatial/VerifyGeometryAssert.java | 12 ++- .../geom/LineString-invalidCoords.xml | 2 +- .../geom/Surface-PolygonPatch-AxisOrder.xml | 4 +- 12 files changed, 113 insertions(+), 237 deletions(-) delete mode 100644 src/main/java/org/opengis/cite/iso19136/TestRunListener.java diff --git a/pom.xml b/pom.xml index 1d66362..b4a8d87 100644 --- a/pom.xml +++ b/pom.xml @@ -81,7 +81,7 @@ org.opengis.cite geomatics-geotk - 1.15 + 1.17-SNAPSHOT junit @@ -91,41 +91,15 @@ org.mockito mockito-core - - com.vividsolutions - jts - 1.13 - + javax.ws.rs jsr311-api 1.1.1 - - org.geotoolkit - geotk-referencing - 3.21 - - - org.geotoolkit - geotk-utility - 3.21 - - - org.geotoolkit - geotk-xml-base - 3.21 - - - org.geotoolkit.pending - geotk-xml-gml - 3.21 - - - org.opengis - geoapi-pending - 3.1-M04 - org.opengis.cite.saxon saxon9 @@ -134,7 +108,7 @@ org.testng testng - 6.9.10 + 7.9.0 xerces @@ -144,7 +118,7 @@ xml-apis xml-apis - 1.4.01 + 2.0.2 @@ -153,7 +127,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.10.4 + 3.6.3 true package @@ -206,7 +180,7 @@ org.apache.maven.plugins maven-release-plugin - 2.5.3 + 3.0.1 true @{project.version} @@ -223,7 +197,7 @@ org.apache.maven.plugins maven-scm-publish-plugin - 1.1 + 3.2.1 gh-pages @@ -236,7 +210,7 @@ com.jgoodies forms - 1.0.7 + 1.2.1 @@ -261,7 +235,7 @@ io.fabric8 docker-maven-plugin - 0.28.0 + 0.43.4 @@ -304,7 +278,7 @@ maven-dependency-plugin - 3.0.0 + 3.6.1 @@ -399,7 +373,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.1.0 sign-artifacts @@ -468,11 +442,11 @@ - + geotoolkit Geotk Modules - http://maven.geotoolkit.org/ + https://nexus.geomatys.com/repository/maven-public default diff --git a/src/main/java/org/opengis/cite/iso19136/TestRunListener.java b/src/main/java/org/opengis/cite/iso19136/TestRunListener.java deleted file mode 100644 index d6b6396..0000000 --- a/src/main/java/org/opengis/cite/iso19136/TestRunListener.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.opengis.cite.iso19136; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.logging.Level; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import org.geotoolkit.factory.Hints; -import org.geotoolkit.referencing.factory.epsg.EpsgInstaller; -import org.opengis.cite.iso19136.util.TestSuiteLogger; -import org.opengis.util.FactoryException; -import org.testng.IExecutionListener; - -/** - * A listener that is invoked before and after a test run. It is often used to - * configure a shared fixture that exists for the duration of the entire test - * run. - * - *

- * A shared fixture should be used with caution in order to avoid undesirable - * test interactions. In general, it should be populated with "read-only" - * objects that are not modified during the test run. - *

- * - * @see com.occamlab.te.spi.executors.FixtureManager FixtureManager - * - */ -public class TestRunListener implements IExecutionListener { - - /** - * Notifies the listener that a test run is about to start; it looks for a - * JNDI DataSource named "jdbc/EPSG" that provides access to a database - * containing the official EPSG geodetic parameters. If one is found, it is - * set as a {@link org.geotoolkit.factory.Hints#EPSG_DATA_SOURCE hint} when - * initializing the EPSG factory. An embedded database will be created if - * necessary. - */ - @Override - public void onExecutionStart() { - DataSource dataSource = null; - try { - Context initContext = new InitialContext(); - Context envContext = (Context) initContext.lookup("java:/comp/env"); - dataSource = (DataSource) envContext.lookup("jdbc/EPSG"); - } catch (NamingException nx) { - TestSuiteLogger - .log(Level.INFO, - "JNDI DataSource 'jdbc/EPSG' not found. An embedded database will be created if necessary."); - } - if (null != dataSource) { - checkEpsgDataSource(dataSource); - Hints.putSystemDefault(Hints.EPSG_DATA_SOURCE, dataSource); - } - } - - @Override - public void onExecutionFinish() { - } - - /** - * Checks that the database represented by the given DataSource is - * accessible and contains the EPSG geodetic parameter data. If the EPSG - * schema is not found, it will be created and the data loaded. - * - * @param dataSource - * A JDBC DataSource. - */ - void checkEpsgDataSource(DataSource dataSource) { - if (null == dataSource) { - throw new IllegalArgumentException("DataSource is null."); - } - try (Connection dbConn = dataSource.getConnection()) { - boolean epsgSchemaExists = false; - ResultSet schemas = dbConn.getMetaData().getSchemas(); - while (schemas.next()) { - // first column is schema name - if (schemas.getString(1).equalsIgnoreCase("EPSG")) { - epsgSchemaExists = true; - break; - } - } - if (!epsgSchemaExists) { - TestSuiteLogger - .log(Level.WARNING, - "EPSG schema not found in DataSource--it will be created."); - EpsgInstaller installer = new EpsgInstaller(); - installer.setDatabase(dbConn); - EpsgInstaller.Result result = installer.call(); - TestSuiteLogger.log(Level.INFO, result.toString()); - } - } catch (SQLException | FactoryException e) { - throw new RuntimeException(e.getMessage()); - } - } -} diff --git a/src/main/java/org/opengis/cite/iso19136/data/spatial/CurveTests.java b/src/main/java/org/opengis/cite/iso19136/data/spatial/CurveTests.java index b60891b..94bde8a 100644 --- a/src/main/java/org/opengis/cite/iso19136/data/spatial/CurveTests.java +++ b/src/main/java/org/opengis/cite/iso19136/data/spatial/CurveTests.java @@ -5,19 +5,21 @@ import java.util.List; import java.util.Map; import java.util.logging.Level; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; + import org.apache.xerces.xs.XSElementDeclaration; +import org.apache.sis.xml.MarshallerPool; import org.geotoolkit.gml.xml.v321.CurveType; -import org.geotoolkit.xml.MarshallerPool; +import org.geotoolkit.gml.xml.GMLMarshallerPool; + import org.opengis.cite.geomatics.gml.GmlUtils; import org.opengis.cite.iso19136.GML32; import org.opengis.cite.iso19136.data.DataFixture; @@ -40,7 +42,7 @@ * connected to one another, with the end point of each segment (except the * last) being the start point of the next segment. *

- * + * *

* Sources *

@@ -90,7 +92,7 @@ public void findCurves() { /** * [{@code Test}] Verifies that a gml:Curve element has a valid CRS * reference. - * + * *

* Sources *

@@ -115,7 +117,7 @@ public void curveHasValidCRS() { *
  • the segments are connected;
  • *
  • the segments are all located within the valid area of the CRS.
  • * - * + * *

    * Sources *

    @@ -127,8 +129,7 @@ public void curveHasValidCRS() { public void validCurveSegments() { Unmarshaller gmlUnmarshaller; try { - MarshallerPool pool = new MarshallerPool( - "org.geotoolkit.gml.xml.v321"); + MarshallerPool pool = GMLMarshallerPool.getInstance(); gmlUnmarshaller = pool.acquireUnmarshaller(); } catch (JAXBException jxe) { throw new RuntimeException(jxe); diff --git a/src/main/java/org/opengis/cite/iso19136/data/spatial/EnvelopeTests.java b/src/main/java/org/opengis/cite/iso19136/data/spatial/EnvelopeTests.java index eb92587..86f4828 100644 --- a/src/main/java/org/opengis/cite/iso19136/data/spatial/EnvelopeTests.java +++ b/src/main/java/org/opengis/cite/iso19136/data/spatial/EnvelopeTests.java @@ -3,19 +3,21 @@ import java.io.FileInputStream; import java.util.ArrayList; import java.util.List; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamReader; -import org.geotoolkit.geometry.GeneralEnvelope; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; + +import org.apache.sis.geometry.GeneralEnvelope; +import org.apache.sis.referencing.CRS; +import org.apache.sis.xml.MarshallerPool; import org.geotoolkit.gml.xml.v321.EnvelopeType; -import org.geotoolkit.referencing.CRS; -import org.geotoolkit.xml.MarshallerPool; +import org.geotoolkit.gml.xml.GMLMarshallerPool; + import org.opengis.cite.geomatics.GeodesyUtils; import org.opengis.cite.iso19136.GML32; import org.opengis.cite.iso19136.data.DataFixture; @@ -30,14 +32,14 @@ /** * Validates the content of a gml:Envelope element, which implements the * GM_Envelope class from ISO 19107. - * + * *

    * The "lowerCorner" represents a coordinate position consisting of all the * minimal ordinates for each dimension for all points within the envelope. The * "upperCorner" is a coordinate position consisting of all the maximal * ordinates for each dimension for all points within the envelope. *

    - * + * *

    * Sources *

    @@ -63,8 +65,7 @@ public void findEnvelopes() { this.envelopes = new ArrayList(); Unmarshaller unmarshaller; try { - MarshallerPool pool = new MarshallerPool( - "org.geotoolkit.gml.xml.v321"); + MarshallerPool pool = GMLMarshallerPool.getInstance(); unmarshaller = pool.acquireUnmarshaller(); } catch (JAXBException jxb) { throw new RuntimeException(jxb); @@ -88,7 +89,7 @@ public void findEnvelopes() { String crsRef = GeodesyUtils .getAbbreviatedCRSIdentifier(env.getSrsName()); GeneralEnvelope genEnv = new GeneralEnvelope( - CRS.decode(crsRef)); + CRS.forCode(crsRef)); double[] lowerPos = env.getLowerCorner() .getCoordinate(); double[] upperPos = env.getUpperCorner() @@ -120,7 +121,7 @@ public void findEnvelopes() { * [{@code Test}] An envelope must refer to a coordinate reference system * using the {@code srsName} attribute. The alternative is to specify the * CRS separately for each corner position but this is very uncommon. - * + * *

    * The value of the srsName attribute must be an absolute URI, but it need * not be dereferenceable for well-known CRS identifiers. The 'urn' or @@ -134,13 +135,13 @@ public void findEnvelopes() { *

  • urn:ogc:def:crs:EPSG::4326
  • *
  • http://www.opengis.net/def/crs/EPSG/0/4326
  • * - * + * *

    * Note: Since gml:Envelope is not a geometry object, the * CRS reference cannot be inherited from some larger spatial context * according to ISO 19136, cl. 9.10. *

    - * + * * @see OGC 09-048r3 */ @@ -165,7 +166,7 @@ public void envelopeHasValidCRS() { * coordinates of the upper corner, where the coordinate tuples are compared * item by item. Furthermore, the dimension of the corner positions must be * identical and equal to that of the CRS. - * + * * @see "ISO 19107: cl. 6.4.3.2, 6.4.3.3" */ @Test(description = "See ISO 19107: 6.4.3.2, 6.4.3.3") diff --git a/src/main/java/org/opengis/cite/iso19136/data/spatial/GeometryAssert.java b/src/main/java/org/opengis/cite/iso19136/data/spatial/GeometryAssert.java index 9aa8fc5..7859e84 100644 --- a/src/main/java/org/opengis/cite/iso19136/data/spatial/GeometryAssert.java +++ b/src/main/java/org/opengis/cite/iso19136/data/spatial/GeometryAssert.java @@ -5,23 +5,31 @@ import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; -import org.geotoolkit.geometry.Envelopes; -import org.geotoolkit.geometry.jts.JTS; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; + +import org.apache.sis.referencing.CRS; +import org.apache.sis.xml.MarshallerPool; import org.geotoolkit.gml.xml.AbstractRing; import org.geotoolkit.gml.xml.v321.AbstractCurveSegmentType; import org.geotoolkit.gml.xml.v321.AbstractCurveType; import org.geotoolkit.gml.xml.v321.AbstractGeometryType; import org.geotoolkit.gml.xml.v321.AbstractSurfaceType; import org.geotoolkit.gml.xml.v321.CurveType; -import org.geotoolkit.referencing.CRS; -import org.geotoolkit.xml.MarshallerPool; +import org.geotoolkit.gml.xml.GMLMarshallerPool; + +import org.locationtech.jts.algorithm.CGAlgorithms; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.Geometry; +import org.locationtech.jts.geom.GeometryCollection; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.LineString; +import org.locationtech.jts.geom.Polygon; + import org.opengis.cite.geomatics.Extents; import org.opengis.cite.geomatics.GeodesyUtils; import org.opengis.cite.geomatics.gml.CurveCoordinateListFactory; @@ -35,21 +43,11 @@ import org.opengis.cite.iso19136.util.XMLUtils; import org.opengis.geometry.Envelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; -import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.TransformException; import org.opengis.util.FactoryException; import org.testng.Assert; import org.w3c.dom.Element; import org.w3c.dom.NodeList; -import com.vividsolutions.jts.algorithm.CGAlgorithms; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.GeometryCollection; -import com.vividsolutions.jts.geom.GeometryFactory; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.Polygon; - /** * Provides specialized assertion methods that apply to representations of * geometry objects. @@ -62,7 +60,7 @@ public class GeometryAssert { private static Unmarshaller initGmlUnmarshaller() { Unmarshaller unmarshaller = null; try { - MarshallerPool pool = new MarshallerPool("org.geotoolkit.gml.xml.v321"); + MarshallerPool pool = GMLMarshallerPool.getInstance(); unmarshaller = pool.acquireUnmarshaller(); } catch (JAXBException je) { throw new RuntimeException(je); @@ -79,11 +77,11 @@ private GeometryAssert() { * a "well-known" CRS definition or refers to a CRS definition. The * reference may be inherited from a containing geometry (aggregate) or * feature envelope. - * + * * @param geom * A DOM Element node representing a GML geometry element (or an * element that can be substituted for one). - * + * * @see "ISO 19136: cl. 9.10, 10.1.3.2" */ public static void assertValidCRS(Element geom) { @@ -103,11 +101,11 @@ public static void assertValidCRS(Element geom) { /** * Asserts that the given geometry element is covered by the valid area of * its associated CRS. - * + * *

    * WARNING: May be problematic for 3D coordinates. *

    - * + * * @param gmlGeom * A GML geometry element. */ @@ -117,7 +115,7 @@ public static void assertGeometryCoveredByValidArea(AbstractGeometryType gmlGeom gmlGeom.getClass().getSimpleName(), gmlGeom.getId())); // Geotk v3 does not recognize 'http' CRS identifiers gmlGeom.setSrsName(GeodesyUtils.convertSRSNameToURN(srsName)); - Envelope crsDomain = Envelopes.getDomainOfValidity(gmlGeom.getCoordinateReferenceSystem()); + Envelope crsDomain = CRS.getDomainOfValidity(gmlGeom.getCoordinateReferenceSystem(false)); Polygon validArea = Extents.envelopeAsPolygon(crsDomain); Geometry geom = GmlUtils.computeConvexHull(gmlGeom); if (geom.getClass().equals(GeometryCollection.class)) { @@ -132,13 +130,13 @@ public static void assertGeometryCoveredByValidArea(AbstractGeometryType gmlGeom * Asserts that the number of direct positions in the posList element * appearing within each segment of the given curve geometry satisfies the * minimum length requirements. - * + * * The number of entries in a posList element is equal to the product of the * dimensionality of the CRS and the number of direct positions. An * additional check ensures that the number of entries is consistent with * the CRS even if the minimum length constraint is satisfied; that is, * size(posList) % dimCRS = 0. - * + * * @param gmlCurve * An Element node representing a GML curve geometry (gml:Curve * or gml:LineString) @@ -158,7 +156,7 @@ public static void assertAllCurveSegmentsHaveRequiredLength(Element gmlCurve) { // Geotk v3 does not recognize 'http' CRS identifiers srsName = GeodesyUtils.convertSRSNameToURN(srsName); try { - CoordinateReferenceSystem crs = CRS.decode(srsName); + CoordinateReferenceSystem crs = CRS.forCode(srsName); crsDim = crs.getCoordinateSystem().getDimension(); } catch (FactoryException fe) { TestSuiteLogger.log(Level.WARNING, srsName, fe); @@ -182,7 +180,7 @@ public static void assertAllCurveSegmentsHaveRequiredLength(Element gmlCurve) { * Asserts that all segments of a curve are connected; that is, the end * point of each segment (except the last) is identical to the start point * of the next segment. - * + * * @param gmlCurve * An Element node representing a gml:Curve element. */ @@ -210,7 +208,7 @@ public static void assertCurveSegmentsAreConnected(Element gmlCurve) { for (int i = 0; i < segmentList.size(); i++) { AbstractCurveSegmentType segment = segmentList.get(i); CurveSegmentType segmentType = CurveCoordinateListFactory.segmentTypeMap.get(segment.getClass().getName()); - List coordList = segmentType.getCoordinateList(segment, curve.getCoordinateReferenceSystem()); + List coordList = segmentType.getCoordinateList(segment, curve.getCoordinateReferenceSystem(false)); firstPoint = coordList.get(0); if (i > 0) { assertCoordinateEquals(firstPoint, lastPoint, 2, @@ -225,7 +223,7 @@ public static void assertCurveSegmentsAreConnected(Element gmlCurve) { * Asserts that the components of a composite curve are connected; that is, * the orientation of the curve members is such that each component (except * the first) begins where the preceding one ends. - * + * * @param gmlCurve * An Element node representing a gml:CompositeCurve element. */ @@ -274,7 +272,7 @@ public static void assertCurveComponentsAreConnected(Element gmlCurve) { /** * Asserts that the given Coordinate tuples are equal within the specified * tolerance. - * + * * @param actualPos * The actual position. * @param expectedPos @@ -302,12 +300,12 @@ public static void assertCoordinateEquals(Coordinate actualPos, Coordinate expec * boundary points), and *
  • closed (forms a cycle).
  • * - * + * * Furthermore, each interior ring must be covered by the surface delimited * by the exterior boundary (the rings may touch at a tangent point). - * + * * Note: Surface patches based on parametric curves are not supported. - * + * * @param surfaceElem * A DOM Element node representing a surface geometry * (substitutes for gml:AbstractSurface). @@ -387,7 +385,7 @@ public static void assertValidSurfaceBoundary(Element surfaceElem) { * and *
  • all interior rings are oriented in a clockwise (CW) direction.
  • * - * + * * @param surfaceElem * A DOM Element node representing a surface geometry * (substitutes for gml:AbstractSurface). diff --git a/src/main/java/org/opengis/cite/iso19136/data/spatial/LineStringTests.java b/src/main/java/org/opengis/cite/iso19136/data/spatial/LineStringTests.java index 67b01ca..f1e83ba 100644 --- a/src/main/java/org/opengis/cite/iso19136/data/spatial/LineStringTests.java +++ b/src/main/java/org/opengis/cite/iso19136/data/spatial/LineStringTests.java @@ -5,19 +5,21 @@ import java.util.List; import java.util.Map; import java.util.logging.Level; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; + import org.apache.xerces.xs.XSElementDeclaration; +import org.apache.sis.xml.MarshallerPool; import org.geotoolkit.gml.xml.v321.LineStringType; -import org.geotoolkit.xml.MarshallerPool; +import org.geotoolkit.gml.xml.GMLMarshallerPool; + import org.opengis.cite.geomatics.gml.GmlUtils; import org.opengis.cite.iso19136.GML32; import org.opengis.cite.iso19136.data.DataFixture; @@ -36,7 +38,7 @@ * that consists of a single (implicit) segment with linear interpolation; it * must have two or more coordinate tuples. Note that in ISO 19107 a * GM_LineString is treated as a curve segment, not as a geometry type. - * + * *

    * Sources *

    @@ -86,7 +88,7 @@ public void findLineStrings() { /** * [{@code Test}] Verifies that a gml:LineString element has a valid CRS * reference. - * + * *

    * Sources *

    @@ -106,7 +108,7 @@ public void lineHasValidCRS() { /** * [{@code Test}] Verifies that a gml:LineString element contains at least * two coordinate tuples and that it lies within the valid area of the CRS. - * + * *

    * Sources *

    @@ -118,8 +120,7 @@ public void lineHasValidCRS() { public void validLineString() { Unmarshaller gmlUnmarshaller; try { - MarshallerPool pool = new MarshallerPool( - "org.geotoolkit.gml.xml.v321"); + MarshallerPool pool = GMLMarshallerPool.getInstance(); gmlUnmarshaller = pool.acquireUnmarshaller(); } catch (JAXBException jxe) { throw new RuntimeException(jxe); diff --git a/src/main/java/org/opengis/cite/iso19136/data/spatial/PointTests.java b/src/main/java/org/opengis/cite/iso19136/data/spatial/PointTests.java index ccdda82..71986c3 100644 --- a/src/main/java/org/opengis/cite/iso19136/data/spatial/PointTests.java +++ b/src/main/java/org/opengis/cite/iso19136/data/spatial/PointTests.java @@ -13,10 +13,10 @@ import javax.xml.xpath.XPathExpressionException; import org.apache.xerces.xs.XSElementDeclaration; -import org.geotoolkit.geometry.Envelopes; -import org.geotoolkit.geometry.GeneralDirectPosition; -import org.geotoolkit.geometry.ImmutableEnvelope; -import org.geotoolkit.referencing.CRS; +import org.apache.sis.geometry.GeneralDirectPosition; +import org.apache.sis.geometry.ImmutableEnvelope; +import org.apache.sis.referencing.CRS; + import org.opengis.cite.geomatics.GeodesyUtils; import org.opengis.cite.geomatics.gml.GmlUtils; import org.opengis.cite.iso19136.ErrorMessage; @@ -39,7 +39,7 @@ * Validates the content of a gml:Point element (or any element in its * substitution group), which implements the GM_Point class from ISO 19107. A * point is defined by a single coordinate tuple. - * + * *

    * Sources *

    @@ -88,7 +88,7 @@ public void findPoints() { /** * [{@code Test}] Verifies that a gml:Point element has a valid CRS * reference. - * + * *

    * Sources *

    @@ -112,13 +112,13 @@ public void pointHasValidCRS() { *
  • length of coordinate tuple = CRS dimension;
  • *
  • the point is located within the valid area of the CRS.
  • * - * + * *

    * Note that the last constraint will detect obvious cases where the axis * order is incorrect (e.g. a position expressed in EPSG 4326 as -122.22, * 50.55). *

    - * + * *

    * Sources *

    @@ -150,7 +150,7 @@ public void pointHasValidPosition() { point.getAttributeNS(GML32.NS_NAME, "id"), GmlUtils.findCRSReference(point))); ImmutableEnvelope validArea = new ImmutableEnvelope( - Envelopes.getDomainOfValidity(dpos + CRS.getDomainOfValidity(dpos .getCoordinateReferenceSystem())); Assert.assertTrue(validArea.contains(dpos), String.format( "%s[@gml:id='%s'] is not within CRS area of use: %s.", @@ -164,12 +164,12 @@ public void pointHasValidPosition() { * Creates a DirectPosition object from a gml:Point element. It will have * the same CRS as the given point; the reference system may be inherited * from a containing geometry (aggregate) or feature. - * + * * @param point * A gml:Point element (or an element in its substitution group). * @param ignoreThirdDimension - * If this flag is true then it will ignore third dimension - * else it will include all dimension. + * If this flag is true then it will ignore third dimension + * else it will include all dimension. * @throws IndexOutOfBoundsException * If the length of the coordinate tuple exceeds the dimension * of the associated CRS. @@ -185,10 +185,10 @@ DirectPosition createDirectPosition(Element point, boolean ignoreThirdDimension) String srsName = GmlUtils.findCRSReference(point); CoordinateReferenceSystem crs = null; try { - crs = CRS.decode(GeodesyUtils.getAbbreviatedCRSIdentifier(srsName)); + crs = CRS.forCode(GeodesyUtils.getAbbreviatedCRSIdentifier(srsName)); // The only Projected CRS is returned if third dimension is ignored. if (ignoreThirdDimension) { - crs = CRS.getHorizontalCRS(crs); + crs = CRS.getHorizontalComponent(crs); } } catch (FactoryException fex) { TestSuiteLogger.log(Level.WARNING, String.format( diff --git a/src/main/resources/org/opengis/cite/iso19136/testng.xml b/src/main/resources/org/opengis/cite/iso19136/testng.xml index 5c70f6f..f08e485 100644 --- a/src/main/resources/org/opengis/cite/iso19136/testng.xml +++ b/src/main/resources/org/opengis/cite/iso19136/testng.xml @@ -4,7 +4,6 @@ - diff --git a/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyEnvelopeTests.java b/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyEnvelopeTests.java index 6a30859..111c8d2 100644 --- a/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyEnvelopeTests.java +++ b/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyEnvelopeTests.java @@ -5,7 +5,7 @@ import java.net.URISyntaxException; import java.net.URL; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import javax.xml.stream.XMLStreamException; import org.junit.Rule; diff --git a/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyGeometryAssert.java b/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyGeometryAssert.java index 250e4b8..40ba2bc 100644 --- a/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyGeometryAssert.java +++ b/src/test/java/org/opengis/cite/iso19136/data/spatial/VerifyGeometryAssert.java @@ -4,12 +4,14 @@ import java.io.InputStream; import java.net.URL; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; +import org.apache.sis.xml.MarshallerPool; import org.geotoolkit.gml.xml.v321.CurveType; -import org.geotoolkit.xml.MarshallerPool; +import org.geotoolkit.gml.xml.GMLMarshallerPool; + import org.junit.BeforeClass; import org.junit.Test; import org.opengis.cite.iso19136.BasicFixture; @@ -25,7 +27,7 @@ public class VerifyGeometryAssert extends BasicFixture { @BeforeClass public static void initFixture() throws JAXBException { - MarshallerPool pool = new MarshallerPool("org.geotoolkit.gml.xml.v321"); + MarshallerPool pool = GMLMarshallerPool.getInstance(); gmlUnmarshaller = pool.acquireUnmarshaller(); } diff --git a/src/test/resources/geom/LineString-invalidCoords.xml b/src/test/resources/geom/LineString-invalidCoords.xml index 75a766b..f9e826d 100644 --- a/src/test/resources/geom/LineString-invalidCoords.xml +++ b/src/test/resources/geom/LineString-invalidCoords.xml @@ -2,5 +2,5 @@ - 51.507 -0.128 53.467, -2.233 + 550000 180000 680000 -20000 diff --git a/src/test/resources/geom/Surface-PolygonPatch-AxisOrder.xml b/src/test/resources/geom/Surface-PolygonPatch-AxisOrder.xml index 0f25aed..a65f521 100644 --- a/src/test/resources/geom/Surface-PolygonPatch-AxisOrder.xml +++ b/src/test/resources/geom/Surface-PolygonPatch-AxisOrder.xml @@ -1,8 +1,8 @@ + gml:id="_77073d46-7578-4d9b-b031-ab587b75d30a" + srsName="http://www.opengis.net/def/crs/EPSG/0/3044">