You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2021/07/13 16:53:23 UTC

[sis] branch geoapi-4.0 updated (2f900ed -> b26a5d7)

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git.


    from 2f900ed  Downgrade from JUnit 5 to JUnit 4. The mix of JUnit 4 and 5 seems to cause some tests to be ignored. Full migration to JUnit 5 will be done later: https://issues.apache.org/jira/browse/SIS-457
     new fb628eb  Re-enable test execution as a test suite.
     new dda5ef6  Document `QuerySpliteratorsBench`, use some services provide by testing framework and adjust build configuration.
     new 1c5d597  Document other tests.
     new b26a5d7  Fix a NullPointerException when converting an array of `float` containing unmapped values.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/sis/coverage/CategoryList.java |  11 +-
 ide-project/NetBeans/nbproject/project.properties  |   3 +-
 pom.xml                                            |   8 ++
 storage/sis-sqlstore/pom.xml                       |   9 --
 .../apache/sis/internal/sql/feature/EWKBTest.java  |  67 +++++++++---
 .../sql/feature/FilterInterpreterTest.java         |  57 ++++++++--
 .../internal/sql/feature/PostGISMappingTest.java   |  43 ++++++--
 .../sql/feature/QuerySpliteratorsBench.java        | 117 ++++++++++++++-------
 .../org/apache/sis/test/suite/SQLTestSuite.java    |  17 ++-
 .../org/apache/sis/test/suite/package-info.txt     |   0
 .../sis/internal/sql/feature/hexa_ewkb_4326.csv    |  17 ++-
 .../sis/internal/sql/feature/hexa_ewkb_4326.sql    |   9 ++
 .../org/apache/sis/storage/sql/Features.sql        |   4 +-
 13 files changed, 274 insertions(+), 88 deletions(-)
 copy profiles/sis-japan-profile/src/test/java/org/apache/sis/test/suite/JapanProfileTestSuite.java => storage/sis-sqlstore/src/test/java/org/apache/sis/test/suite/SQLTestSuite.java (73%)
 copy storage/{sis-xmlstore => sis-sqlstore}/src/test/java/org/apache/sis/test/suite/package-info.txt (100%)

[sis] 02/04: Document `QuerySpliteratorsBench`, use some services provide by testing framework and adjust build configuration.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit dda5ef6b7570eefd68c357d53fe489a8ed5f9ae7
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Jul 13 15:24:54 2021 +0200

    Document `QuerySpliteratorsBench`, use some services provide by testing framework and adjust build configuration.
---
 ide-project/NetBeans/nbproject/project.properties  |   3 +-
 pom.xml                                            |   8 ++
 storage/sis-sqlstore/pom.xml                       |   9 --
 .../sql/feature/QuerySpliteratorsBench.java        | 117 ++++++++++++++-------
 4 files changed, 91 insertions(+), 46 deletions(-)

diff --git a/ide-project/NetBeans/nbproject/project.properties b/ide-project/NetBeans/nbproject/project.properties
index c1d4e2c..8b2fc41 100644
--- a/ide-project/NetBeans/nbproject/project.properties
+++ b/ide-project/NetBeans/nbproject/project.properties
@@ -130,7 +130,7 @@ hamcrest.version     = 1.3
 derby.version        = 10.14.2.0
 hsqldb.version       = 2.5.1
 postgresql.version   = 42.2.18
-icons.version        = 3.0.1
+jmh.version          = 1.32
 
 #
 # Classpaths for compilation, execution and tests.
@@ -161,6 +161,7 @@ javac.test.classpath=\
     ${maven.repository}/net/sf/geographiclib/GeographicLib-Java/${geographlib.version}/GeographicLib-Java-${geographlib.version}.jar:\
     ${maven.repository}/junit/junit/${junit.version}/junit-${junit.version}.jar:\
     ${maven.repository}/org/hamcrest/hamcrest-core/${hamcrest.version}/hamcrest-core-${hamcrest.version}.jar:\
+    ${maven.repository}/org/openjdk/jmh/jmh-core/${jmh.version}/jmh-core-${jmh.version}.jar:\
     ${project.GeoAPI}/dist/geoapi-tests.jar:\
     ${build.classes.dir}
 javac.test.processorpath=\
diff --git a/pom.xml b/pom.xml
index cbe0974..eaa7c0c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -520,6 +520,14 @@
         <artifactId>slf4j-jdk14</artifactId>
         <version>1.7.22</version>               <!-- Must matches the version used by netCDF. -->
       </dependency>
+
+      <!-- Tests and benchmarks -->
+      <dependency>
+        <groupId>org.openjdk.jmh</groupId>
+        <artifactId>jmh-generator-annprocess</artifactId>
+        <version>1.32</version>
+        <scope>test</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 
diff --git a/storage/sis-sqlstore/pom.xml b/storage/sis-sqlstore/pom.xml
index 17ccd49..6b63cdd 100644
--- a/storage/sis-sqlstore/pom.xml
+++ b/storage/sis-sqlstore/pom.xml
@@ -137,20 +137,11 @@
       <artifactId>jts-core</artifactId>
       <scope>test</scope>
     </dependency>
-
-    <dependency>
-      <groupId>org.openjdk.jmh</groupId>
-      <artifactId>jmh-core</artifactId>
-      <version>1.21</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.openjdk.jmh</groupId>
       <artifactId>jmh-generator-annprocess</artifactId>
-      <version>1.21</version>
       <scope>test</scope>
     </dependency>
-
   </dependencies>
 
 </project>
diff --git a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/QuerySpliteratorsBench.java b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/QuerySpliteratorsBench.java
index 8abc26f..a135602 100644
--- a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/QuerySpliteratorsBench.java
+++ b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/QuerySpliteratorsBench.java
@@ -16,15 +16,16 @@
  */
 package org.apache.sis.internal.sql.feature;
 
+import java.util.Random;
+import java.util.concurrent.TimeUnit;
+import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
-import java.util.Random;
-import java.util.concurrent.TimeUnit;
 
-import org.apache.derby.jdbc.EmbeddedDataSource;
-import org.apache.sis.internal.metadata.sql.LocalDataSource;
+import org.apache.sis.test.sql.TestDatabase;
+import org.apache.sis.util.ArgumentChecks;
 
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.Fork;
@@ -37,53 +38,88 @@ import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.annotations.Warmup;
 
-import static org.apache.sis.util.ArgumentChecks.ensureStrictlyPositive;
+import static org.junit.Assert.assertEquals;
+
 
 /**
+ * Measure the performance of the stream returned by {@link QueryFeatureSet#features(boolean)}.
  *
- * @author Alexis Manin (Geomatys)
- * @version 2.0
- * @since   2.0
+ * @author  Alexis Manin (Geomatys)
+ * @version 1.1
+ * @since   1.1
  * @module
  */
-@Fork(value = 2, jvmArgs = {"-server", "-Xmx2g"} )
+@Fork(value = 2, jvmArgs = {"-server", "-Xmx2G"} )
 @Warmup(iterations = 2, time = 4, timeUnit = TimeUnit.SECONDS)
 @Measurement(iterations = 2, time = 4, timeUnit = TimeUnit.SECONDS)
 public class QuerySpliteratorsBench {
-
+    /**
+     * Provide {@link QueryFeatureSet} instances to be tested.
+     * Various configurations are used (number of rows, parallelism, <i>etc.</i>).
+     *
+     * @see QuerySpliteratorsBench#test(DatabaseInput)
+     */
     @State(Scope.Benchmark)
     public static class DatabaseInput {
-
+        /**
+         * Number of rows to insert in the test database.
+         */
         @Param({"1000", "100000"})
         int numRows;
 
+        /**
+         * Argument to be given in the call to {@link QueryFeatureSet#features(boolean)}.
+         */
         @Param({"true", "false"})
         boolean parallel;
 
+        /**
+         * Value to assign to {@link QueryFeatureSet#allowBatchLoading}.
+         */
         @Param({"true", "false"})
-        boolean prefetch;
+        private boolean prefetch;
 
+        /**
+         * Value to assign to {@link QueryFeatureSet#fetchSize}.
+         */
         @Param({"10", "100", "1000"})
-        int fetchSize;
+        private int fetchSize;
 
+        /**
+         * Value to assign to {@link QueryFeatureSet#fetchRatio}.
+         */
         @Param({"0.5", "1", "2"})
-        float fetchRatio;
+        private float fetchRatio;
+
+        /**
+         * Encapsulate a data source for an in-memory database.
+         */
+        private TestDatabase db;
 
-        EmbeddedDataSource db;
+        /**
+         * The feature set to benchmark.
+         */
         QueryFeatureSet fs;
 
-        public DatabaseInput() {}
+        /**
+         * Creates a new set of {@link QueryFeatureSet} provider.
+         */
+        public DatabaseInput() {
+        }
 
+        /**
+         * Prepares a database populated with arbitrary rows, then creates a {@link QueryFeatureSet}
+         * for querying that database. The {@code QueryFeatureSet} configuration will vary between
+         * different calls to this method, depending on values injected by JMH in the annotated fields.
+         *
+         * @throws SQLException if an error occurred while preparing the database.
+         */
         @Setup(Level.Trial)
         public void setup() throws SQLException {
-            ensureStrictlyPositive("Number of rows", numRows);
+            ArgumentChecks.ensureStrictlyPositive("Number of rows", numRows);
 
-            db = new EmbeddedDataSource();
-            db.setDatabaseName("memory:spliterators");
-            db.setDataSourceName("Apache SIS test database");
-            db.setCreateDatabase("create");
-
-            try (Connection c = db.getConnection()) {
+            db = TestDatabase.create("spliterators");
+            try (Connection c = db.source.getConnection()) {
                 c.createStatement().execute(
                         "CREATE TABLE TEST (str CHARACTER VARYING(20), myInt INTEGER, myDouble DOUBLE)"
                 );
@@ -104,34 +140,43 @@ public class QuerySpliteratorsBench {
                     st.clearBatch();
                 } while (rows < numRows);
 
-                fs = new QueryFeatureSet("SELECT * FROM TEST", db, c);
+                fs = new QueryFeatureSet("SELECT * FROM TEST", db.source, c);
                 fs.allowBatchLoading = prefetch;
-                fs.fetchSize = fetchSize;
+                fs.fetchSize  = fetchSize;
                 fs.fetchRatio = fetchRatio;
             }
         }
 
+        /**
+         * Destroy the in-memory database.
+         *
+         * @throws SQLException in an error occurred.
+         */
         @TearDown
         public void dropDatabase() throws SQLException {
-            db.setCreateDatabase("no");
-            db.setConnectionAttributes("drop=true");
-            try {
-                db.getConnection().close();
-            } catch (SQLException e) {                          // This is the expected exception.
-                if (!LocalDataSource.isSuccessfulShutdown(e)) {
-                    throw e;
-                }
-            }
+            db.close();
         }
     }
 
+    /**
+     * Invoked by JMH for executing the operation that we want to benchmark.
+     *
+     * @param  input  encapsulate the {@link QueryFeatureSet} instance to benchmark.
+     * @throws SQLException if an error occurred during the database query.
+     */
     @Benchmark
     public void test(DatabaseInput input) throws SQLException {
         final int sum = input.fs.features(input.parallel).mapToInt(f -> 1).sum();
-        if (sum != input.numRows) throw new AssertionError("..." + sum + "..." + "WTF ?!");
+        assertEquals(input.numRows, sum);
     }
 
-    public static void main(String... args) throws Exception {
+    /**
+     * Launch the benchmark.
+     *
+     * @param  args  JMH command line argument.
+     * @throws IOException if JMH can not proceed.
+     */
+    public static void main(final String[] args) throws IOException {
         org.openjdk.jmh.Main.main(args);
     }
 }

[sis] 04/04: Fix a NullPointerException when converting an array of `float` containing unmapped values.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit b26a5d7669055ea165d3396b43ce573792f54d27
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Jul 13 16:00:24 2021 +0200

    Fix a NullPointerException when converting an array of `float` containing unmapped values.
---
 .../src/main/java/org/apache/sis/coverage/CategoryList.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/CategoryList.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/CategoryList.java
index 430d214..60586ad 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/CategoryList.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/CategoryList.java
@@ -628,12 +628,19 @@ final class CategoryList extends AbstractList<Category> implements MathTransform
              */
             if (numPts < 0) break;
             while ((index = binarySearch(minimums, value)) < 0) {
-                dstPts[peekOff + srcToDst] = unmappedValue(value);
+                final double fill = unmappedValue(value);
+                final int i = peekOff + srcToDst;
+                if (dstFloat != null) {
+                    dstFloat[i] = (float) fill;
+                } else {
+                    dstPts[i] = fill;
+                }
                 if (--numPts < 0) {
                     // Skip also the assignment to `lastUsed` because `index` is invalid.
                     return;
                 }
-                value = srcPts[peekOff += direction];
+                peekOff += direction;
+                value = (srcFloat != null) ? srcFloat[peekOff] : srcPts[peekOff];
             }
             srcOff = peekOff;
         }

[sis] 03/04: Document other tests.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 1c5d5975be2ffbf46a1a9780e913b254fccf69f3
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Jul 13 17:15:55 2021 +0200

    Document other tests.
---
 .../apache/sis/internal/sql/feature/EWKBTest.java  | 67 ++++++++++++++++++----
 .../sql/feature/FilterInterpreterTest.java         | 57 ++++++++++++++++--
 .../internal/sql/feature/PostGISMappingTest.java   | 43 +++++++++++---
 .../sis/internal/sql/feature/hexa_ewkb_4326.csv    | 17 +++++-
 .../sis/internal/sql/feature/hexa_ewkb_4326.sql    |  9 +++
 .../org/apache/sis/storage/sql/Features.sql        |  4 +-
 6 files changed, 167 insertions(+), 30 deletions(-)

diff --git a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/EWKBTest.java b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/EWKBTest.java
index d4ff045..b060f3e 100644
--- a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/EWKBTest.java
+++ b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/EWKBTest.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.sis.internal.sql.feature;
 
 import java.io.BufferedReader;
@@ -16,11 +32,38 @@ import org.junit.Test;
 import static org.junit.Assert.*;
 
 
-public class EWKBTest extends TestCase {
+/**
+ * Tests the parsing of geometries encoded in Extended Well Known Binary (EWKB) format.
+ *
+ * @author  Alexis Manin (Geomatys)
+ * @version 1.1
+ * @since   1.1
+ * @module
+ *
+ * @todo Run the same test for all supported geometry implementations (ESRI and JTS).
+ */
+public strictfp class EWKBTest extends TestCase {
+    /**
+     * The factory to use for creating geometric objects.
+     * It requires a geometry implementation to be available on the classpath.
+     */
+    private final Geometries<?> GF;
 
-    public static final Geometries<?> GF = Geometries.implementation(GeometryLibrary.JTS);
+    /**
+     * Creates a new test using JTS geometry implementation.
+     */
+    public EWKBTest() {
+        GF = Geometries.implementation(GeometryLibrary.JTS);
+    }
 
-    public void decodeHexadecimal(String wkt, String hexEWKB) throws Exception {
+    /**
+     * Decodes a geometry encoded in EWKB format and compares with the geometry specified in WKT format.
+     *
+     * @param  wkt        WKT representation of the geometry. This is used as the reference value.
+     * @param  hexEWKB    EWKB representation of the same geometry. This is the value to test.
+     * @throws Exception  if an error occurred while decoding one of the given string.
+     */
+    public void decodeHexadecimal(final String wkt, final String hexEWKB) throws Exception {
         final GeographicCRS expectedCrs = CommonCRS.defaultGeographic();
         final EWKBReader reader = new EWKBReader(GF).forCrs(expectedCrs);
         assertEquals("WKT and hexadecimal EWKB representation don't match",
@@ -28,22 +71,22 @@ public class EWKBTest extends TestCase {
     }
 
     /**
-     * The purpose of this test is not to check complex geometries, which is validated by above one. We just want to
-     * ensure that decoding directly a byte stream behaves in the same way than through hexadecimal.
+     * Tests the decoding of a geometry from a byte stream. The purpose of this test is not to check complex geometries,
+     * which are validated by {@link #decodeHexadecimal(String, String)}. This test only ensures that decoding directly
+     * a byte stream behaves in the same way than through hexadecimal.
      */
     @Test
     public void testBinary() {
-        final ByteBuffer point = ByteBuffer.allocate(163);
-        // Skip first byte: XDR mode
-        point.position(1);
-        // Create a 2D point
+        final ByteBuffer point = ByteBuffer.allocate(21);
+        point.put((byte) 0);    // XDR mode.
+
+        // Create a 2D point.
         point.putInt(1);
         point.putDouble(42.2);
         point.putDouble(43.3);
 
-        // Prepare for reading
-        point.position(0);
-
+        // Read the point.
+        point.rewind();
         final Object read = new EWKBReader(GeometryLibrary.JTS).read(point);
         assertEquals(GF.createPoint(42.2, 43.3), read);
     }
diff --git a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/FilterInterpreterTest.java b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/FilterInterpreterTest.java
index aad198f..07e3046 100644
--- a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/FilterInterpreterTest.java
+++ b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/FilterInterpreterTest.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.sis.internal.sql.feature;
 
 import org.apache.sis.filter.DefaultFilterFactory;
@@ -15,14 +31,36 @@ import org.opengis.filter.FilterFactory;
 import org.opengis.filter.SpatialOperator;
 
 
-public class FilterInterpreterTest extends TestCase {
-    private static final FilterFactory<Feature,Object,Object> FF = DefaultFilterFactory.forFeatures();
+/**
+ * Tests the formatting of {@link Filter} as a SQL {@code WHERE} statement body.
+ *
+ * @author  Alexis Manin (Geomatys)
+ * @version 1.1
+ * @since   1.1
+ * @module
+ */
+public final strictfp class FilterInterpreterTest extends TestCase {
+    /**
+     * The factory to use for creating the filter objects.
+     */
+    private final FilterFactory<Feature,Object,Object> FF;
 
+    /**
+     * Creates a new test.
+     */
+    public FilterInterpreterTest() {
+        FF = DefaultFilterFactory.forFeatures();
+    }
+
+    /**
+     * Creates a filter with a geometric objects and verifies that it is translated to the expected SQL fragment.
+     */
     @Test
     public void testGeometricFilter() {
         final SpatialOperator<Feature> filter = FF.bbox(FF.property("Toto"),
                 new GeneralEnvelope(new DefaultGeographicBoundingBox(-12.3, 2.1, 43.3, 51.7)));
-        assertConversion(filter,
+
+        verifySQL(filter,
                 "ST_Intersects(" +
                             "\"Toto\", " +
                             "ST_GeomFromText(" +
@@ -32,19 +70,26 @@ public class FilterInterpreterTest extends TestCase {
         );
     }
 
+    /**
+     * Creates a filter without geometry and verifies that it is translated to the expected SQL fragment.
+     */
     @Test
     public void testSimpleFilter() {
-        Filter<Feature> filter = FF.and(
+        final Filter<Feature> filter = FF.and(
                 FF.greater(FF.property("mySchema/myTable"), FF.property("otter")),
                 FF.or(
                         FF.isNull(FF.property("whatever")),
                         FF.equal(FF.literal(3.14), FF.property("π"))
                 )
         );
-        assertConversion(filter, "((\"mySchema\".\"myTable\" > \"otter\") AND (\"whatever\" IS NULL OR (3.14 = \"π\")))");
+        verifySQL(filter, "((\"mySchema\".\"myTable\" > \"otter\") AND (\"whatever\" IS NULL OR (3.14 = \"π\")))");
     }
 
-    private static void assertConversion(final Filter<Feature> source, final String expected) {
+    /**
+     * Formats the given filter as a SQL {@code WHERE} statement body
+     * and verifies that the result is equal to the expected string.
+     */
+    private static void verifySQL(final Filter<Feature> source, final String expected) {
         final StringBuilder sb = new StringBuilder();
         new ANSIInterpreter().visit(source, sb);
         assertEquals(expected, sb.toString());
diff --git a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/PostGISMappingTest.java b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/PostGISMappingTest.java
index 15a412c..c5bf9e9 100644
--- a/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/PostGISMappingTest.java
+++ b/storage/sis-sqlstore/src/test/java/org/apache/sis/internal/sql/feature/PostGISMappingTest.java
@@ -1,22 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.sis.internal.sql.feature;
 
+import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.apache.sis.internal.sql.feature.PostGISMapping.verifyVersion;
 import static org.junit.Assert.*;
 
-public class PostGISMappingTest {
 
+/**
+ * Tests {@link PostGISMapping}.
+ *
+ * @author  Alexis Manin (Geomatys)
+ * @version 1.1
+ * @since   1.1
+ * @module
+ */
+public final strictfp class PostGISMappingTest extends TestCase {
+    /**
+     * Tests {@link PostGISMapping#verifyVersion(String, int)}.
+     */
     @Test
     public void parse_postgis_version() {
-        assertTrue(verifyVersion("3.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1", 2));
-        assertFalse(verifyVersion("2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1", 3));
+        assertTrue (PostGISMapping.verifyVersion("3.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1", 2));
+        assertFalse(PostGISMapping.verifyVersion("2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1", 3));
 
         // Verify minimal requirements: we need a text that starts with a number.
-        assertTrue(verifyVersion("2", 2));
-        assertTrue(verifyVersion("10.123.23", 2));
+        assertTrue(PostGISMapping.verifyVersion("2", 2));
+        assertTrue(PostGISMapping.verifyVersion("10.123.23", 2));
 
-        assertFalse(verifyVersion("3d", 2));
-        assertFalse(verifyVersion("d3", 2));
+        assertFalse(PostGISMapping.verifyVersion("3d", 2));
+        assertFalse(PostGISMapping.verifyVersion("d3", 2));
     }
 }
diff --git a/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.csv b/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.csv
index 8593250..f8fc6a5 100644
--- a/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.csv
+++ b/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.csv
@@ -1,5 +1,18 @@
-# This dataset has been generated using SQL script given in 'hexa_ewkb_4326.sql' in this folder, against a PostGIS 2.5.2
-wkt	hexadecimal_ewkb
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+
+#
+# This dataset has been generated using SQL script given in 'hexa_ewkb_4326.sql'
+# in this folder, against a PostGIS 2.5.2. It contains two columns separated by
+# a tabulation:
+#
+#  - The geometry in WKT format.
+#  - The same geometry in EWKB format, with bytes encoded as hexadecimal numbers.
+#
+
+WKT	hexadecimal EWKB
 POINT(0 0)	0101000020E610000000000000000000000000000000000000
 LINESTRING(-71.160281 42.258729,-71.160837 42.259113,-71.161144 42.25932)	0102000020E610000003000000E44A3D0B42CA51C06EC328081E21454027BF45274BCA51C0F67B629D2A214540957CEC2E50CA51C07099D36531214540
 POLYGON((0 0,0 1,1 1,1 0,0 0))	0103000020E61000000100000005000000000000000000000000000000000000000000000000000000000000000000F03F000000000000F03F000000000000F03F000000000000F03F000000000000000000000000000000000000000000000000
diff --git a/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.sql b/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.sql
index 515d76a..ce508c7 100644
--- a/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.sql
+++ b/storage/sis-sqlstore/src/test/resources/org/apache/sis/internal/sql/feature/hexa_ewkb_4326.sql
@@ -1,3 +1,12 @@
+
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+
+
+-- This SQL script generates the content of `hexa_ewkb_4326.csv` file.
+-- This file is not used directly by the tests.
+
 SELECT wkt, ST_GeomFromText(wkt, 4326) AS hexadecimal_ewkb
 FROM (
          VALUES ('POINT(0 0)'),
diff --git a/storage/sis-sqlstore/src/test/resources/org/apache/sis/storage/sql/Features.sql b/storage/sis-sqlstore/src/test/resources/org/apache/sis/storage/sql/Features.sql
index 27e4d65..148c076 100644
--- a/storage/sis-sqlstore/src/test/resources/org/apache/sis/storage/sql/Features.sql
+++ b/storage/sis-sqlstore/src/test/resources/org/apache/sis/storage/sql/Features.sql
@@ -65,5 +65,5 @@ INSERT INTO features."Parks" ("country", "city", "native_name", "english_name")
     ('CAN', 'Montréal', 'Mont Royal',           'Mount Royal'),
     ('FRA', 'Paris',    'Jardin des Tuileries', 'Tuileries Garden'),
     ('FRA', 'Paris',    'Jardin du Luxembourg', 'Luxembourg Garden'),
-    ('JPN', '東京',      '代々木公園',            'Yoyogi-kōen'),
-    ('JPN', '東京',      '新宿御苑',              'Shinjuku Gyoen');
+    ('JPN', '東京',     '代々木公園',           'Yoyogi-kōen'),
+    ('JPN', '東京',     '新宿御苑',             'Shinjuku Gyoen');

[sis] 01/04: Re-enable test execution as a test suite.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit fb628eb3ce0fe16f2a4438f7491d49aa9cf9a509
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Jul 13 17:15:19 2021 +0200

    Re-enable test execution as a test suite.
---
 .../org/apache/sis/test/suite/SQLTestSuite.java    | 42 ++++++++++++++++++++++
 .../org/apache/sis/test/suite/package-info.txt     |  3 ++
 2 files changed, 45 insertions(+)

diff --git a/storage/sis-sqlstore/src/test/java/org/apache/sis/test/suite/SQLTestSuite.java b/storage/sis-sqlstore/src/test/java/org/apache/sis/test/suite/SQLTestSuite.java
new file mode 100644
index 0000000..3288ada
--- /dev/null
+++ b/storage/sis-sqlstore/src/test/java/org/apache/sis/test/suite/SQLTestSuite.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.test.suite;
+
+import org.apache.sis.test.TestSuite;
+import org.junit.runners.Suite;
+import org.junit.BeforeClass;
+
+
+/**
+ * All tests from the {@code sis-sqlstore} module, in rough dependency order.
+ */
+@Suite.SuiteClasses({
+    org.apache.sis.internal.sql.feature.EWKBTest.class,
+    org.apache.sis.internal.sql.feature.FilterInterpreterTest.class,
+    org.apache.sis.internal.sql.feature.PostGISMappingTest.class,
+    org.apache.sis.storage.sql.SQLStoreTest.class
+})
+public final strictfp class SQLTestSuite extends TestSuite {
+    /**
+     * Verifies the list of tests before to run the suite.
+     * See {@link #verifyTestList(Class, Class[])} for more information.
+     */
+    @BeforeClass
+    public static void verifyTestList() {
+        verifyTestList(SQLTestSuite.class);
+    }
+}
diff --git a/storage/sis-sqlstore/src/test/java/org/apache/sis/test/suite/package-info.txt b/storage/sis-sqlstore/src/test/java/org/apache/sis/test/suite/package-info.txt
new file mode 100644
index 0000000..ac895b5
--- /dev/null
+++ b/storage/sis-sqlstore/src/test/java/org/apache/sis/test/suite/package-info.txt
@@ -0,0 +1,3 @@
+Different modules provide classes in this package - be careful about collisions.
+This package is initially defined by the sis-utility module, which also provides
+the package-info.java file.