sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1553983 - in /sis/branches/JDK7/core/sis-referencing/src: main/java/org/apache/sis/referencing/datum/ test/java/org/apache/sis/referencing/ test/java/org/apache/sis/referencing/datum/ test/resources/org/apache/sis/referencing/datum/
Date Sun, 29 Dec 2013 00:15:46 GMT
Author: desruisseaux
Date: Sun Dec 29 00:15:46 2013
New Revision: 1553983

URL: http://svn.apache.org/r1553983
Log:
Added test for VerticalDatum unmarshalling.

Added:
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean
Sea Level.xml   (with props)
Modified:
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/WGS
84.xml

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1553983&r1=1553982&r2=1553983&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Sun Dec 29 00:15:46 2013
@@ -67,9 +67,10 @@ import java.util.Objects;
  * @see org.apache.sis.referencing.crs.AbstractCRS
  */
 @XmlType(name="AbstractDatumType")
-@XmlSeeAlso(
-    DefaultGeodeticDatum.class
-)
+@XmlSeeAlso({
+    DefaultGeodeticDatum.class,
+    DefaultVerticalDatum.class
+})
 public class AbstractDatum extends AbstractIdentifiedObject implements Datum {
     /**
      * Serial number for inter-operability with different versions.

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java?rev=1553983&r1=1553982&r2=1553983&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] Sun Dec 29 00:15:46 2013
@@ -25,6 +25,7 @@ import org.opengis.referencing.Reference
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
+import org.opengis.referencing.datum.VerticalDatum;
 
 import static org.apache.sis.test.Assert.*;
 
@@ -181,7 +182,7 @@ public final strictfp class GeodeticObje
      * <tr><td>{@linkplain ReferenceIdentifier#getCode() Code} of the {@linkplain
GeodeticDatum#getName() name}</td>
      *     <td>{@code "World Geodetic System 1984"}</td></tr>
      * <tr><td>{@linkplain GeodeticDatum#getDomainOfValidity() Domain of validity}</td>
-     *     <td>{@linkplain #assertIsWorld(GeographicBoundingBox) Is world}</td></tr>
+     *     <td>{@linkplain #assertIsWorld(GeographicBoundingBox) Is world} or absent</td></tr>
      * <tr><td>{@linkplain GeodeticDatum#getPrimeMeridian() Prime meridian}</td>
      *     <td>{@linkplain #assertIsGreenwich(PrimeMeridian) Is Greenwich}</td></tr>
      * <tr><td>{@linkplain GeodeticDatum#getEllipsoid() Ellipsoid}</td>
@@ -196,4 +197,23 @@ public final strictfp class GeodeticObje
         assertIsGreenwich(datum.getPrimeMeridian());
         assertIsWGS84    (datum.getEllipsoid());
     }
+
+    /**
+     * Asserts that the given datum is the Mean Sea Level one.
+     * This method verifies the following properties:
+     *
+     * <table class="sis">
+     * <tr><th>Property</th> <th>Expected value</th></tr>
+     * <tr><td>{@linkplain ReferenceIdentifier#getCode() Code} of the {@linkplain
GeodeticDatum#getName() name}</td>
+     *     <td>{@code "Mean Sea Level"}</td></tr>
+     * <tr><td>{@linkplain GeodeticDatum#getDomainOfValidity() Domain of validity}</td>
+     *     <td>{@linkplain #assertIsWorld(GeographicBoundingBox) Is world} or absent</td></tr>
+     * </table>
+     *
+     * @param datum The datum to verify.
+     */
+    public static void assertIsMeanSeaLevel(final VerticalDatum datum) {
+        assertEquals("name", "Mean Sea Level", datum.getName().getCode());
+        assertIsWorld(datum.getDomainOfValidity());
+    }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java?rev=1553983&r1=1553982&r2=1553983&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
[UTF-8] Sun Dec 29 00:15:46 2013
@@ -17,13 +17,17 @@
 package org.apache.sis.referencing.datum;
 
 import java.lang.reflect.Field;
+import javax.xml.bind.JAXBException;
+import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.referencing.datum.VerticalDatumType;
 import org.apache.sis.internal.referencing.VerticalDatumTypes;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
-import static org.apache.sis.referencing.Assert.*;
 import static java.util.Collections.singletonMap;
+import static org.apache.sis.referencing.Assert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
+import static org.apache.sis.referencing.GeodeticObjectVerifier.*;
 
 
 /**
@@ -75,4 +79,23 @@ public final strictfp class DefaultVerti
         datum = new DefaultVerticalDatum(singletonMap(DefaultVerticalDatum.NAME_KEY, "Ellipsoidal"),
VerticalDatumTypes.ELLIPSOIDAL);
         assertWktEquals(datum, "VERT_DATUM[“Ellipsoidal”, 2002]");
     }
+
+    /**
+     * Tests unmarshalling.
+     *
+     * @throws JAXBException If an error occurred during unmarshalling.
+     */
+    @Test
+    public void testUnmarshalling() throws JAXBException {
+        final DefaultVerticalDatum datum = unmarshall(DefaultVerticalDatum.class, "Mean Sea
Level.xml");
+        assertIsMeanSeaLevel(datum);
+        assertIsWorld((GeographicBoundingBox) getSingleton(datum.getDomainOfValidity().getGeographicElements()));
+        /*
+         * Values in the following tests are specific to our XML file.
+         * The actual texts in the EPSG database are more descriptive.
+         */
+        assertEquals("remarks",          "Approximates geoid.",             datum.getRemarks().toString());
+        assertEquals("scope",            "Hydrography.",                    datum.getScope().toString());
+        assertEquals("anchorDefinition", "Averaged over a 19-year period.", datum.getAnchorPoint().toString());
+    }
 }

Added: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean
Sea Level.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean%20Sea%20Level.xml?rev=1553983&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean
Sea Level.xml (added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean
Sea Level.xml Sun Dec 29 00:15:46 2013
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<gml:VerticalDatum xsi:schemaLocation = "http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/datums.xsd"
+                   xmlns:gml          = "http://www.opengis.net/gml/3.2"
+                   xmlns:gmd          = "http://www.isotc211.org/2005/gmd"
+                   xmlns:gco          = "http://www.isotc211.org/2005/gco"
+                   xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
+                   gml:id             = "epsg-datum-6326">
+
+  <gml:identifier codeSpace="OGP">urn:ogc:def:datum:EPSG::5100</gml:identifier>
+  <gml:name>Mean Sea Level</gml:name>
+  <gml:remarks>Approximates geoid.</gml:remarks>
+  <gml:domainOfValidity>
+    <gmd:EX_Extent>
+      <gmd:description>
+        <gco:CharacterString>World.</gco:CharacterString>
+      </gmd:description>
+      <gmd:geographicElement>
+        <gmd:EX_GeographicBoundingBox>
+          <gmd:westBoundLongitude><gco:Decimal>-180</gco:Decimal></gmd:westBoundLongitude>
+          <gmd:eastBoundLongitude><gco:Decimal>+180</gco:Decimal></gmd:eastBoundLongitude>
+          <gmd:southBoundLatitude><gco:Decimal> -90</gco:Decimal></gmd:southBoundLatitude>
+          <gmd:northBoundLatitude><gco:Decimal> +90</gco:Decimal></gmd:northBoundLatitude>
+        </gmd:EX_GeographicBoundingBox>
+      </gmd:geographicElement>
+    </gmd:EX_Extent>
+  </gml:domainOfValidity>
+  <gml:scope>Hydrography.</gml:scope>
+  <gml:anchorDefinition>Averaged over a 19-year period.</gml:anchorDefinition>
+</gml:VerticalDatum>

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean
Sea Level.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/Mean
Sea Level.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/WGS
84.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/WGS%2084.xml?rev=1553983&r1=1553982&r2=1553983&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/WGS
84.xml (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/datum/WGS
84.xml Sun Dec 29 00:15:46 2013
@@ -22,7 +22,6 @@
                    xmlns:gmd          = "http://www.isotc211.org/2005/gmd"
                    xmlns:gco          = "http://www.isotc211.org/2005/gco"
                    xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
-                   xmlns:xlink        = "http://www.w3.org/1999/xlink"
                    gml:id             = "epsg-datum-6326">
 
   <gml:identifier codeSpace="OGP">urn:ogc:def:datum:EPSG::6326</gml:identifier>



Mime
View raw message