sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1422799 - in /sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry: AbstractEnvelopeTest.java Envelope2DTest.java GeneralEnvelopeTest.java ImmutableEnvelopeTest.java
Date Mon, 17 Dec 2012 08:50:37 GMT
Author: desruisseaux
Date: Mon Dec 17 08:50:36 2012
New Revision: 1422799

URL: http://svn.apache.org/viewvc?rev=1422799&view=rev
Log:
Aded serialization tests.

Added:
    sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
  (with props)
    sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
  (with props)
Modified:
    sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
    sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java

Modified: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java?rev=1422799&r1=1422798&r2=1422799&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
(original)
+++ sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/AbstractEnvelopeTest.java
Mon Dec 17 08:50:36 2012
@@ -19,6 +19,7 @@ package org.apache.sis.geometry;
 import java.awt.geom.Rectangle2D;
 import org.opengis.geometry.Envelope;
 import org.opengis.geometry.DirectPosition;
+import org.opengis.referencing.crs.GeographicCRS;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Ignore;
@@ -51,6 +52,13 @@ public final strictfp class AbstractEnve
     private static final int GENERAL=0, IMMUTABLE=1, RECTANGLE=2, LAST=3;
 
     /**
+     * The coordinate reference system used for the tests.
+     *
+     * @todo Need to be assigned when we will have ported the CRS implementations.
+     */
+    static final GeographicCRS WGS84 = null;
+
+    /**
      * Creates an envelope of the given type. The type shall be one of the
      * {@link #GENERAL}, {@link #IMMUTABLE} or {@link #RECTANGLE} constants.
      */
@@ -61,15 +69,16 @@ public final strictfp class AbstractEnve
         switch (type) {
             case GENERAL: {
                 final GeneralEnvelope envelope = new GeneralEnvelope(2);
+                envelope.setCoordinateReferenceSystem(WGS84);
                 envelope.setRange(0, xmin, xmax);
                 envelope.setRange(1, ymin, ymax);
                 return envelope;
             }
             case IMMUTABLE: {
-                return new ImmutableEnvelope(new double[] {xmin, ymin}, new double[] {xmax,
ymax}, null);
+                return new ImmutableEnvelope(new double[] {xmin, ymin}, new double[] {xmax,
ymax}, WGS84);
             }
             case RECTANGLE: {
-                return new Envelope2D(xmin, ymin, xmax - xmin, ymax - ymin, null);
+                return new Envelope2D(xmin, ymin, xmax - xmin, ymax - ymin, WGS84);
             }
             default: throw new IllegalArgumentException(String.valueOf(type));
         }

Added: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java?rev=1422799&view=auto
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
(added)
+++ sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
Mon Dec 17 08:50:36 2012
@@ -0,0 +1,48 @@
+/*
+ * 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.geometry;
+
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.apache.sis.referencing.Assert.*;
+import static org.apache.sis.geometry.AbstractEnvelopeTest.WGS84;
+
+
+/**
+ * Tests the {@link Envelope2D} class.
+ * Most of tests are actually performed by {@link AbstractEnvelopeTest}, which compare
+ * {@link GeneralEnvelope} results with {@code Envelope2D} results for ensuring consistency.
+ * This class adds only some tests that are specific to {@code Envelope2D} instances.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+@DependsOn(AbstractEnvelopeTest.class)
+public final strictfp class Envelope2DTest extends TestCase {
+    /**
+     * Tests {@code Envelope2D} serialization.
+     */
+    @Test
+    public void testSerialization() {
+        final Envelope2D envelope = new Envelope2D(-20, -10, 40, 20, WGS84);
+        assertNotSame(envelope, assertSerializedEquals(envelope));
+    }
+}

Propchange: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/Envelope2DTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java?rev=1422799&r1=1422798&r2=1422799&view=diff
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
(original)
+++ sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralEnvelopeTest.java
Mon Dec 17 08:50:36 2012
@@ -26,6 +26,7 @@ import org.junit.Test;
 import static java.lang.Double.NaN;
 import static org.apache.sis.referencing.Assert.*;
 import static org.apache.sis.math.MathFunctions.isNegative;
+import static org.apache.sis.geometry.AbstractEnvelopeTest.WGS84;
 
 
 /**
@@ -57,6 +58,7 @@ public final strictfp class GeneralEnvel
      */
     private static GeneralEnvelope create(final double xmin, final double ymin, final double
xmax, final double ymax) {
         final GeneralEnvelope envelope = new GeneralEnvelope(2);
+        envelope.setCoordinateReferenceSystem(WGS84);
         envelope.setEnvelope(xmin, ymin, xmax, ymax);
         return envelope;
     }
@@ -486,4 +488,15 @@ public final strictfp class GeneralEnvel
         e2.setRange(0, -40, +61);
         assertEquals(e1, e2);
     }
+
+    /**
+     * Tests {@code GeneralEnvelope} serialization.
+     */
+    @Test
+    public void testSerialization() {
+        final GeneralEnvelope envelope = new GeneralEnvelope(
+                new double[] {-20, -10},
+                new double[] { 20,  10});
+        assertNotSame(envelope, assertSerializedEquals(envelope));
+    }
 }

Added: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java?rev=1422799&view=auto
==============================================================================
--- sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
(added)
+++ sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
Mon Dec 17 08:50:36 2012
@@ -0,0 +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.geometry;
+
+import org.apache.sis.test.DependsOn;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.apache.sis.referencing.Assert.*;
+import static org.apache.sis.geometry.AbstractEnvelopeTest.WGS84;
+
+
+/**
+ * Tests the {@link ImmutableEnvelope} class.
+ * Most of tests are actually performed by {@link AbstractEnvelopeTest}.
+ * This class adds only some tests that are specific to {@code ImmutableEnvelope} instances.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+@DependsOn(AbstractEnvelopeTest.class)
+public final strictfp class ImmutableEnvelopeTest extends TestCase {
+    /**
+     * Tests {@code ImmutableEnvelope} serialization.
+     */
+    @Test
+    public void testSerialization() {
+        final ImmutableEnvelope envelope = new ImmutableEnvelope(
+                new double[] {-20, -10},
+                new double[] { 20,  10}, WGS84);
+        assertNotSame(envelope, assertSerializedEquals(envelope));
+    }
+}

Propchange: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/sis-referencing/src/test/java/org/apache/sis/geometry/ImmutableEnvelopeTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message