sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1541906 - in /sis/branches/JDK7/core/sis-referencing/src: main/java/org/apache/sis/referencing/ test/java/org/apache/sis/referencing/ test/java/org/apache/sis/test/suite/
Date Thu, 14 Nov 2013 13:54:14 GMT
Author: desruisseaux
Date: Thu Nov 14 13:54:14 2013
New Revision: 1541906

URL: http://svn.apache.org/r1541906
Log:
GeodeticObjectsTest.testGeodeticDatumMock() was actually more a StandardDefinitions test.

Added:
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
      - copied, changed from r1541888, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java?rev=1541906&r1=1541905&r2=1541906&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticObjects.java
[UTF-8] Thu Nov 14 13:54:14 2013
@@ -220,7 +220,7 @@ public enum GeodeticObjects {
     /**
      * The EPSG code of the ellipsoid.
      */
-    private final short ellipsoid;
+    final short ellipsoid;
 
     /**
      * The cached object. This is initially {@code null}, then set to various kind of objects
depending

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java?rev=1541906&r1=1541905&r2=1541906&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
[UTF-8] Thu Nov 14 13:54:14 2013
@@ -17,13 +17,10 @@
 package org.apache.sis.referencing;
 
 import java.util.Date;
-import org.opengis.referencing.datum.Ellipsoid;
-import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.TemporalDatum;
-import org.opengis.test.Validators;
-import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
+import org.opengis.test.Validators;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -40,7 +37,8 @@ import static org.apache.sis.test.TestUt
  */
 @DependsOn({
   org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class,
-  org.apache.sis.referencing.datum.DefaultVerticalDatumTest.class
+  org.apache.sis.referencing.datum.DefaultVerticalDatumTest.class,
+  StandardDefinitionsTest.class
 })
 public final strictfp class GeodeticObjectsTest extends TestCase {
     /**
@@ -49,39 +47,6 @@ public final strictfp class GeodeticObje
     private static final double DAY_LENGTH = 24 * 60 * 60 * 1000;
 
     /**
-     * Compares the {@link GeodeticDatumMock} constants with the {@link GeodeticObjects}
ones.
-     * This is more a {@code GeodeticDatumMock} test than a {@code GeodeticObjects} one,
but can
-     * hardly be defined elsewhere since we need some reference objects for comparing the
values.
-     */
-    @Test
-    public void testGeodeticDatumMocks() {
-        final GeodeticDatum[] mocks = new GeodeticDatum[] {
-            GeodeticDatumMock.WGS84,
-            GeodeticDatumMock.WGS72,
-            GeodeticDatumMock.NAD83,
-            GeodeticDatumMock.NAD27,
-            GeodeticDatumMock.SPHERE
-        };
-        final GeodeticObjects[] enums = new GeodeticObjects[] {
-            GeodeticObjects.WGS84,
-            GeodeticObjects.WGS72,
-            GeodeticObjects.NAD83,
-            GeodeticObjects.NAD27,
-            GeodeticObjects.SPHERE
-        };
-        assertEquals(mocks.length, enums.length);
-        for (int i=0; i<mocks.length; i++) {
-            final Ellipsoid mock = mocks[i].getEllipsoid();
-            final Ellipsoid ref  = enums[i].ellipsoid();
-            assertEquals("semiMajorAxis",     ref.getSemiMajorAxis(),     mock.getSemiMajorAxis(),
0);
-            assertEquals("semiMinorAxis",     ref.getSemiMinorAxis(),     mock.getSemiMinorAxis(),
0);
-            assertEquals("inverseFlattening", ref.getInverseFlattening(), mock.getInverseFlattening(),
1E-11);
-            assertEquals("isIvfDefinitive",   ref.isIvfDefinitive(),      mock.isIvfDefinitive());
-            assertEquals("isSphere",          ref.isSphere(),             mock.isSphere());
-        }
-    }
-
-    /**
      * Verifies the epoch values of temporal enumeration compared to the Julian epoch.
      *
      * @see <a href="http://en.wikipedia.org/wiki/Julian_day">Wikipedia: Julian day</a>

Copied: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
(from r1541888, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java?p2=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java&p1=sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java&r1=1541888&r2=1541906&rev=1541906&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectsTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
[UTF-8] Thu Nov 14 13:54:14 2013
@@ -16,45 +16,37 @@
  */
 package org.apache.sis.referencing;
 
-import java.util.Date;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.GeodeticDatum;
-import org.opengis.referencing.datum.TemporalDatum;
-import org.opengis.test.Validators;
 import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
+import org.opengis.test.Validators;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static org.apache.sis.test.TestUtilities.*;
 
 
 /**
- * Tests the {@link GeodeticObjects} class.
+ * Tests the {@link StandardDefinitions} class.
  *
- * @author  Martin Desruisseaux (IRD, Geomatys)
- * @since   0.4 (derived from geotk-2.2)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
  * @version 0.4
  * @module
  */
 @DependsOn({
-  org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class,
-  org.apache.sis.referencing.datum.DefaultVerticalDatumTest.class
+  org.apache.sis.referencing.datum.DefaultEllipsoidTest.class
 })
-public final strictfp class GeodeticObjectsTest extends TestCase {
+public final strictfp class StandardDefinitionsTest extends TestCase {
     /**
-     * Length of a day in milliseconds.
-     */
-    private static final double DAY_LENGTH = 24 * 60 * 60 * 1000;
-
-    /**
-     * Compares the {@link GeodeticDatumMock} constants with the {@link GeodeticObjects}
ones.
-     * This is more a {@code GeodeticDatumMock} test than a {@code GeodeticObjects} one,
but can
-     * hardly be defined elsewhere since we need some reference objects for comparing the
values.
+     * Compares the values created by {@link StandardDefinitions#createEllipsoid(short)}
against
+     * the {@link GeodeticObjects} constants. Actually this is more a {@code GeodeticDatumMock}
+     * test than a {@code StandardDefinitions} one - in case of test failure, both classes
could
+     * be at fault.
      */
     @Test
-    public void testGeodeticDatumMocks() {
+    public void testCreateEllipsoid() {
         final GeodeticDatum[] mocks = new GeodeticDatum[] {
             GeodeticDatumMock.WGS84,
             GeodeticDatumMock.WGS72,
@@ -72,39 +64,13 @@ public final strictfp class GeodeticObje
         assertEquals(mocks.length, enums.length);
         for (int i=0; i<mocks.length; i++) {
             final Ellipsoid mock = mocks[i].getEllipsoid();
-            final Ellipsoid ref  = enums[i].ellipsoid();
-            assertEquals("semiMajorAxis",     ref.getSemiMajorAxis(),     mock.getSemiMajorAxis(),
0);
-            assertEquals("semiMinorAxis",     ref.getSemiMinorAxis(),     mock.getSemiMinorAxis(),
0);
-            assertEquals("inverseFlattening", ref.getInverseFlattening(), mock.getInverseFlattening(),
1E-11);
-            assertEquals("isIvfDefinitive",   ref.isIvfDefinitive(),      mock.isIvfDefinitive());
-            assertEquals("isSphere",          ref.isSphere(),             mock.isSphere());
+            final Ellipsoid def  = StandardDefinitions.createEllipsoid(enums[i].ellipsoid);
+            Validators.validate(def);
+            assertEquals("semiMajorAxis",     mock.getSemiMajorAxis(),     def.getSemiMajorAxis(),
0);
+            assertEquals("semiMinorAxis",     mock.getSemiMinorAxis(),     def.getSemiMinorAxis(),
0);
+            assertEquals("inverseFlattening", mock.getInverseFlattening(), def.getInverseFlattening(),
mock.isIvfDefinitive() ? 0 : 1E-11);
+            assertEquals("isIvfDefinitive",   mock.isIvfDefinitive(),      def.isIvfDefinitive());
+            assertEquals("isSphere",          mock.isSphere(),             def.isSphere());
         }
     }
-
-    /**
-     * Verifies the epoch values of temporal enumeration compared to the Julian epoch.
-     *
-     * @see <a href="http://en.wikipedia.org/wiki/Julian_day">Wikipedia: Julian day</a>
-     */
-    @Test
-    public void testTemporal() {
-        final double epoch = GeodeticObjects.Temporal.JULIAN.datum().getOrigin().getTime()
/ DAY_LENGTH;
-        assertTrue(epoch < 0);
-        assertEquals(2400000.5, julian("1858-11-17 00:00:00", GeodeticObjects.Temporal.MODIFIED_JULIAN)
 - epoch, 0);
-        assertEquals(2440000.5, julian("1968-05-24 00:00:00", GeodeticObjects.Temporal.TRUNCATED_JULIAN)
- epoch, 0);
-        assertEquals(2415020.0, julian("1899-12-31 12:00:00", GeodeticObjects.Temporal.DUBLIN_JULIAN)
   - epoch, 0);
-        assertEquals(2440587.5, julian("1970-01-01 00:00:00", GeodeticObjects.Temporal.UNIX)
            - epoch, 0);
-    }
-
-    /**
-     * Validates the datum of the given definition, compares its epoch with the given ISO
date
-     * and returns its Julian day.
-     */
-    private static double julian(final String epoch, final GeodeticObjects.Temporal def)
{
-        final TemporalDatum datum = def.datum();
-        Validators.validate(datum);
-        final Date origin = datum.getOrigin();
-        assertEquals(def.name(), epoch, format(origin));
-        return origin.getTime() / DAY_LENGTH;
-    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1541906&r1=1541905&r2=1541906&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Thu Nov 14 13:54:14 2013
@@ -54,6 +54,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.datum.DefaultEllipsoidTest.class,
     org.apache.sis.referencing.datum.DefaultVerticalDatumTest.class,
     org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class,
+    org.apache.sis.referencing.StandardDefinitionsTest.class,
     org.apache.sis.referencing.GeodeticObjectsTest.class,
 
     org.apache.sis.geometry.AbstractDirectPositionTest.class,



Mime
View raw message