sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jso...@apache.org
Subject [sis] branch geoapi-4.0 updated: Filter : add spatial function serialization tests
Date Wed, 06 Nov 2019 15:57:29 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new cd32723  Filter : add spatial function serialization tests
cd32723 is described below

commit cd32723b2b3cf05bbd6a689e26040937dd7db7ac
Author: jsorel <johann.sorel@geomatys.com>
AuthorDate: Wed Nov 6 16:55:59 2019 +0100

    Filter : add spatial function serialization tests
---
 .../org/apache/sis/filter/SpatialFunction.java     | 55 ++++++++++++++++++++++
 .../org/apache/sis/filter/SpatialFunctionTest.java | 35 ++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/SpatialFunction.java b/core/sis-feature/src/main/java/org/apache/sis/filter/SpatialFunction.java
index 2e770c9..32794fa 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/filter/SpatialFunction.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/filter/SpatialFunction.java
@@ -288,6 +288,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class BBOX extends SpatialFunction implements org.opengis.filter.spatial.BBOX
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = -4806881904891000892L;
+
         //cache the bbox geometry
         private transient PreparedGeometry boundingGeometry;
         private final org.locationtech.jts.geom.Envelope boundingEnv;
@@ -409,6 +414,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Beyond extends SpatialFunction implements org.opengis.filter.spatial.Beyond
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = -610084000917390844L;
+
         private final double distance;
         private final String units;
         private final Unit unit;
@@ -476,6 +486,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Contains extends SpatialFunction implements org.opengis.filter.spatial.Contains
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = -5510684627928940359L;
+
         Contains(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
@@ -524,6 +539,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Crosses extends SpatialFunction implements org.opengis.filter.spatial.Crosses
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = -7022836273547341845L;
+
         Crosses(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
@@ -573,6 +593,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Disjoint extends SpatialFunction implements org.opengis.filter.spatial.Disjoint
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = 8822946475076920125L;
+
         Disjoint(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
@@ -622,6 +647,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class DWithin extends SpatialFunction implements org.opengis.filter.spatial.DWithin
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = 7327351792495760963L;
+
         private final double distance;
         private final String units;
         private final Unit unit;
@@ -689,6 +719,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Equals extends SpatialFunction implements org.opengis.filter.spatial.Equals
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = 6396428140074394187L;
+
         Equals(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
@@ -731,6 +766,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Intersects extends SpatialFunction implements org.opengis.filter.spatial.Intersects
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = 6685367450421799746L;
+
         Intersects(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
@@ -779,6 +819,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Overlaps extends SpatialFunction implements org.opengis.filter.spatial.Overlaps
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = 8793232792848445944L;
+
         Overlaps(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
@@ -827,6 +872,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Touches extends SpatialFunction implements org.opengis.filter.spatial.Touches
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = -2747074093157567315L;
+
         Touches(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
@@ -868,6 +918,11 @@ abstract class SpatialFunction extends BinaryFunction implements BinarySpatialOp
      */
     static final class Within extends SpatialFunction implements org.opengis.filter.spatial.Within
{
 
+        /**
+         * For cross-version compatibility.
+         */
+        private static final long serialVersionUID = 2089897118466562931L;
+
         Within(Expression expression1, Expression expression2) {
             super(expression1, expression2);
         }
diff --git a/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialFunctionTest.java
b/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialFunctionTest.java
index fbf20e0..5a3011c 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialFunctionTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/filter/SpatialFunctionTest.java
@@ -131,9 +131,11 @@ public final strictfp class SpatialFunctionTest extends TestCase {
     public void testBBOX() {
         BBOX bbox = FF.bbox(FF.literal(RIGHT_GEOMETRY), 1, 1, 6, 6, "EPSG:4326");
         assertTrue(bbox.evaluate(null));
+        assertSerializedEquals(bbox);
 
         bbox = FF.bbox(FF.literal(RIGHT_GEOMETRY), -3, -2, 4, 1, "EPSG:4326");
         assertFalse(bbox.evaluate(null));
+        assertSerializedEquals(bbox);
     }
 
     @Test
@@ -142,30 +144,37 @@ public final strictfp class SpatialFunctionTest extends TestCase {
 
         Beyond beyond = FF.beyond(FF.literal(RIGHT_GEOMETRY), FF.literal(GEOM_DISTANCE_1),
1.5d, "m");
         assertFalse(beyond.evaluate(null));
+        assertSerializedEquals(beyond);
 
         beyond = FF.beyond(FF.literal(RIGHT_GEOMETRY), FF.literal(GEOM_DISTANCE_3), 1.5d,
"m");
         assertTrue(beyond.evaluate(null));
+        assertSerializedEquals(beyond);
     }
 
     @Test
     public void testContains() {
         Contains contains = FF.contains(FF.literal(GEOM_CONTAINS),FF.literal(RIGHT_GEOMETRY));
         assertTrue(contains.evaluate(null));
+        assertSerializedEquals(contains);
 
         contains = FF.contains(FF.literal(GEOM_DISTANCE_1),FF.literal(RIGHT_GEOMETRY));
         assertFalse(contains.evaluate(null));
+        assertSerializedEquals(contains);
     }
 
     @Test
     public void testCrosses() {
         Crosses crosses = FF.crosses(FF.literal(GEOM_CONTAINS),FF.literal(RIGHT_GEOMETRY));
         assertFalse(crosses.evaluate(null));
+        assertSerializedEquals(crosses);
 
         crosses = FF.crosses(FF.literal(GEOM_CROSSES),FF.literal(RIGHT_GEOMETRY));
         assertTrue(crosses.evaluate(null));
+        assertSerializedEquals(crosses);
 
         crosses = FF.crosses(FF.literal(GEOM_DISTANCE_1),FF.literal(RIGHT_GEOMETRY));
         assertFalse(crosses.evaluate(null));
+        assertSerializedEquals(crosses);
     }
 
     @Test
@@ -174,98 +183,124 @@ public final strictfp class SpatialFunctionTest extends TestCase {
 
         DWithin within = FF.dwithin(FF.literal(RIGHT_GEOMETRY), FF.literal(GEOM_DISTANCE_1),
1.5d, "m");
         assertTrue(within.evaluate(null));
+        assertSerializedEquals(within);
 
         within = FF.dwithin(FF.literal(RIGHT_GEOMETRY), FF.literal(GEOM_DISTANCE_3), 1.5d,
"m");
         assertFalse(within.evaluate(null));
+        assertSerializedEquals(within);
     }
 
     @Test
     public void testDisjoint() {
         Disjoint disjoint = FF.disjoint(FF.literal(GEOM_CONTAINS),FF.literal(RIGHT_GEOMETRY));
         assertFalse(disjoint.evaluate(null));
+        assertSerializedEquals(disjoint);
 
         disjoint = FF.disjoint(FF.literal(GEOM_CROSSES),FF.literal(RIGHT_GEOMETRY));
         assertFalse(disjoint.evaluate(null));
+        assertSerializedEquals(disjoint);
 
         disjoint = FF.disjoint(FF.literal(GEOM_DISTANCE_1),FF.literal(RIGHT_GEOMETRY));
         assertTrue(disjoint.evaluate(null));
+        assertSerializedEquals(disjoint);
     }
 
     @Test
     public void testEquals() {
         Equals equal = FF.equal(FF.literal(GEOM_CONTAINS),FF.literal(RIGHT_GEOMETRY));
         assertFalse(equal.evaluate(null));
+        assertSerializedEquals(equal);
 
         equal = FF.equal(FF.literal(GEOM_CROSSES),FF.literal(RIGHT_GEOMETRY));
         assertFalse(equal.evaluate(null));
+        assertSerializedEquals(equal);
 
         equal = FF.equal(FF.literal(GF.createGeometry(RIGHT_GEOMETRY)),FF.literal(RIGHT_GEOMETRY));
         assertTrue(equal.evaluate(null));
+        assertSerializedEquals(equal);
     }
 
     @Test
     public void testIntersect() {
         Intersects intersect = FF.intersects(FF.literal(GEOM_CONTAINS), FF.literal(RIGHT_GEOMETRY));
         assertTrue(intersect.evaluate(null));
+        assertSerializedEquals(intersect);
 
         intersect = FF.intersects(FF.literal(GEOM_CROSSES), FF.literal(RIGHT_GEOMETRY));
         assertTrue(intersect.evaluate(null));
+        assertSerializedEquals(intersect);
 
         intersect = FF.intersects(FF.literal(GEOM_INTERSECT), FF.literal(RIGHT_GEOMETRY));
         assertTrue(intersect.evaluate(null));
+        assertSerializedEquals(intersect);
 
         intersect = FF.intersects(FF.literal(GEOM_DISTANCE_1), FF.literal(RIGHT_GEOMETRY));
         assertFalse(intersect.evaluate(null));
+        assertSerializedEquals(intersect);
 
         intersect = FF.intersects(FF.literal(GEOM_DISTANCE_3), FF.literal(RIGHT_GEOMETRY));
         assertFalse(intersect.evaluate(null));
+        assertSerializedEquals(intersect);
     }
 
     @Test
     public void testOverlaps() {
         Overlaps overlaps = FF.overlaps(FF.literal(GEOM_CONTAINS), FF.literal(RIGHT_GEOMETRY));
         assertFalse(overlaps.evaluate(null));
+        assertSerializedEquals(overlaps);
 
         overlaps = FF.overlaps(FF.literal(GEOM_DISTANCE_1), FF.literal(RIGHT_GEOMETRY));
         assertFalse(overlaps.evaluate(null));
+        assertSerializedEquals(overlaps);
 
         overlaps = FF.overlaps(FF.literal(GEOM_CROSSES), FF.literal(RIGHT_GEOMETRY));
         assertFalse(overlaps.evaluate(null));
+        assertSerializedEquals(overlaps);
 
         overlaps = FF.overlaps(FF.literal(GEOM_INTERSECT), FF.literal(RIGHT_GEOMETRY));
         assertTrue(overlaps.evaluate(null));
+        assertSerializedEquals(overlaps);
     }
 
     @Test
     public void testTouches() {
         Touches touches = FF.touches(FF.literal(GEOM_CONTAINS), FF.literal(RIGHT_GEOMETRY));
         assertFalse(touches.evaluate(null));
+        assertSerializedEquals(touches);
 
         touches = FF.touches(FF.literal(GEOM_CROSSES), FF.literal(RIGHT_GEOMETRY));
         assertFalse(touches.evaluate(null));
+        assertSerializedEquals(touches);
 
         touches = FF.touches(FF.literal(GEOM_DISTANCE_1), FF.literal(RIGHT_GEOMETRY));
         assertFalse(touches.evaluate(null));
+        assertSerializedEquals(touches);
 
         touches = FF.touches(FF.literal(GEOM_TOUCHES), FF.literal(RIGHT_GEOMETRY));
         assertTrue(touches.evaluate(null));
+        assertSerializedEquals(touches);
     }
 
     @Test
     public void testWithin() {
         Within within = FF.within(FF.literal(GEOM_CONTAINS), FF.literal(RIGHT_GEOMETRY));
         assertFalse(within.evaluate(null));
+        assertSerializedEquals(within);
 
         within = FF.within(FF.literal(GEOM_CROSSES), FF.literal(RIGHT_GEOMETRY));
         assertFalse(within.evaluate(null));
+        assertSerializedEquals(within);
 
         within = FF.within(FF.literal(GEOM_DISTANCE_1), FF.literal(RIGHT_GEOMETRY));
         assertFalse(within.evaluate(null));
+        assertSerializedEquals(within);
 
         within = FF.within(FF.literal(GEOM_TOUCHES), FF.literal(RIGHT_GEOMETRY));
         assertFalse(within.evaluate(null));
+        assertSerializedEquals(within);
 
         within = FF.within(FF.literal(RIGHT_GEOMETRY), FF.literal(GEOM_CONTAINS) );
         assertTrue(within.evaluate(null));
+        assertSerializedEquals(within);
     }
 }


Mime
View raw message