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

jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new edc61144 [SEDONA-249] Add jvm flags for running tests on Java 17 (#772)
edc61144 is described below

commit edc61144ad9c1f4afaaee0616e3937d4b54521b3
Author: Martin Andersson <[email protected]>
AuthorDate: Sat Feb 18 19:54:09 2023 +0100

    [SEDONA-249] Add jvm flags for running tests on Java 17 (#772)
---
 .../sedona/core/utils/CRSTransformationTest.java   | 33 ----------------------
 pom.xml                                            | 23 +++++++++++++++
 2 files changed, 23 insertions(+), 33 deletions(-)

diff --git 
a/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java 
b/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java
index 11025a4f..6044e35e 100644
--- a/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java
+++ b/core/src/test/java/org/apache/sedona/core/utils/CRSTransformationTest.java
@@ -23,12 +23,10 @@ import org.apache.log4j.Logger;
 import org.apache.sedona.core.enums.FileDataSplitter;
 import org.apache.sedona.core.enums.GridType;
 import org.apache.sedona.core.enums.IndexType;
-import org.apache.sedona.common.geometryObjects.Circle;
 import org.apache.sedona.core.knnJudgement.GeometryDistanceComparator;
 import org.apache.sedona.core.spatialOperator.JoinQuery;
 import org.apache.sedona.core.spatialOperator.KNNQuery;
 import org.apache.sedona.core.spatialOperator.RangeQuery;
-import org.apache.sedona.core.spatialRDD.CircleRDD;
 import org.apache.sedona.core.spatialRDD.PointRDD;
 import org.apache.sedona.core.spatialRDD.PolygonRDD;
 import org.apache.spark.SparkConf;
@@ -39,7 +37,6 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.locationtech.jts.geom.Coordinate;
 import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.Geometry;
 import org.locationtech.jts.geom.GeometryFactory;
 import org.locationtech.jts.geom.Point;
 import org.locationtech.jts.geom.Polygon;
@@ -52,9 +49,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 // TODO: Auto-generated Javadoc
 
 /**
@@ -352,31 +346,4 @@ public class CRSTransformationTest
             assert result.get(i)._2().size() == 0 || 
result.get(i)._2().iterator().next().getUserData() != null;
         }
     }
-
-    /**
-     * Test polygon distance join with CRS transformation.
-     *
-     * @throws Exception the exception
-     */
-    @Test
-    public void testPolygonDistanceJoinWithCRSTransformation()
-            throws Exception
-    {
-        PolygonRDD queryRDD = new PolygonRDD(sc, InputLocationQueryPolygon, 
splitter, true, numPartitions, StorageLevel.MEMORY_ONLY(), "epsg:4326", 
"epsg:3857");
-        CircleRDD windowRDD = new CircleRDD(queryRDD, 0.1);
-        PolygonRDD objectRDD = new PolygonRDD(sc, InputLocationQueryPolygon, 
splitter, true, numPartitions, StorageLevel.MEMORY_ONLY(), "epsg:4326", 
"epsg:3857");
-        objectRDD.rawSpatialRDD.repartition(4);
-        objectRDD.spatialPartitioning(GridType.KDBTREE);
-        objectRDD.buildIndex(IndexType.RTREE, true);
-        windowRDD.spatialPartitioning(objectRDD.getPartitioner());
-
-        List<Tuple2<Geometry, List<Polygon>>> results = 
JoinQuery.DistanceJoinQuery(objectRDD, windowRDD, true, false).collect();
-        assertEquals(5467, results.size());
-
-        for (Tuple2<Geometry, List<Polygon>> tuple : results) {
-            for (Polygon polygon : tuple._2()) {
-                assertTrue(new Circle(tuple._1(), 0.1).covers(polygon));
-            }
-        }
-    }
 }
diff --git a/pom.xml b/pom.xml
index f8a5227e..8c85ef11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,6 +84,25 @@
         <geotools.scope>provided</geotools.scope>
         <!-- Because it's not in Maven central, make it provided by default -->
         <cdm.scope>provided</cdm.scope>
+
+        <!-- For JDK-17 test -->
+        <extraJavaTestArgs>
+            -XX:+IgnoreUnrecognizedVMOptions
+            --add-opens=java.base/java.lang=ALL-UNNAMED
+            --add-opens=java.base/java.lang.invoke=ALL-UNNAMED
+            --add-opens=java.base/java.lang.reflect=ALL-UNNAMED
+            --add-opens=java.base/java.io=ALL-UNNAMED
+            --add-opens=java.base/java.net=ALL-UNNAMED
+            --add-opens=java.base/java.nio=ALL-UNNAMED
+            --add-opens=java.base/java.util=ALL-UNNAMED
+            --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
+            --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
+            --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
+            --add-opens=java.base/sun.nio.cs=ALL-UNNAMED
+            --add-opens=java.base/sun.security.action=ALL-UNNAMED
+            --add-opens=java.base/sun.util.calendar=ALL-UNNAMED
+            -Djdk.reflect.useDirectMethodHandle=false
+        </extraJavaTestArgs>
     </properties>
 
     <dependencies>
@@ -404,6 +423,7 @@
                         
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                         <junitxml>.</junitxml>
                         <filereports>TestSuiteReport.txt</filereports>
+                        <argLine>${extraJavaTestArgs}</argLine>
                     </configuration>
                     <executions>
                         <execution>
@@ -500,6 +520,9 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <version>2.18.1</version>
+                <configuration>
+                    <argLine>${extraJavaTestArgs}</argLine>
+                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

Reply via email to