sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1700963 - in /sis/branches/JDK8/core/sis-referencing/src/test: java/org/apache/sis/referencing/operation/OperationMarshallingTest.java resources/org/apache/sis/referencing/operation/Conversion.xml
Date Thu, 03 Sep 2015 09:14:13 GMT
Author: desruisseaux
Date: Thu Sep  3 09:14:13 2015
New Revision: 1700963

URL: http://svn.apache.org/r1700963
Log:
Verify the parameter value in <gml:Conversion> test.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/OperationMarshallingTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/OperationMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/OperationMarshallingTest.java?rev=1700963&r1=1700962&r2=1700963&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/OperationMarshallingTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/OperationMarshallingTest.java
[UTF-8] Thu Sep  3 09:14:13 2015
@@ -25,6 +25,9 @@ import org.opengis.metadata.extent.Geogr
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
+import org.opengis.parameter.ParameterValue;
+import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.GeneralParameterValue;
 import org.opengis.referencing.operation.OperationMethod;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.internal.referencing.provider.Mercator1SP;
@@ -121,7 +124,7 @@ public final strictfp class OperationMar
     }
 
     /**
-     * Tests unmarshalling of a conversion.
+     * Tests unmarshalling of a defining conversion.
      *
      * @throws JAXBException if an error occurred during marshalling or unmarshalling.
      */
@@ -139,7 +142,41 @@ public final strictfp class OperationMar
         assertEquals("northBoundLatitude",   84, e.getNorthBoundLatitude(), STRICT);
         assertEquals("southBoundLatitude",  -80, e.getSouthBoundLatitude(), STRICT);
 
+        // This is a defining conversion, so we do not expect CRS.
+        assertNull("sourceCRS",        c.getSourceCRS());
+        assertNull("targetCRS",        c.getTargetCRS());
+        assertNull("interpolationCRS", c.getInterpolationCRS());
+        assertNull("mathTransform",    c.getMathTransform());
+
         // The most difficult part.
-        verifyMethod(c.getMethod());
+        final OperationMethod method = c.getMethod();
+        assertNotNull("method", method);
+        verifyMethod(method);
+
+        final ParameterValueGroup parameters = c.getParameterValues();
+        assertNotNull("parameters", parameters);
+        final Iterator<GeneralParameterValue> it = parameters.values().iterator();
+        verifyParameter(method, parameters,  -0.0, (ParameterValue<?>) it.next());
+        verifyParameter(method, parameters, -90.0, (ParameterValue<?>) it.next());
+        assertFalse("Unexpected parameter.", it.hasNext());
+    }
+
+    /**
+     * Verify a parameter value. The descriptor is expected to be the same instance than
the descriptors
+     * defined in the {@link ParameterValueGroup} and in the {@link OperationMethod}.
+     *
+     * @param method        The method of the enclosing operation.
+     * @param group         The group which contain the given parameter.
+     * @param expectedValue The expected parameter value.
+     * @param parameter     The parameter to verify.
+     */
+    private static void verifyParameter(final OperationMethod method, final ParameterValueGroup
group,
+            final double expectedValue, final ParameterValue<?> parameter)
+    {
+        final ParameterDescriptor<?> descriptor = parameter.getDescriptor();
+        final String name = descriptor.getName().getCode();
+        assertSame("parameterValues.descriptor", descriptor,  group.getDescriptor().descriptor(name));
+        assertSame("method.descriptor",          descriptor, method.getParameters().descriptor(name));
+        assertEquals("value", expectedValue, parameter.doubleValue(), STRICT);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml?rev=1700963&r1=1700962&r2=1700963&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml
(original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml
Thu Sep  3 09:14:13 2015
@@ -73,6 +73,7 @@
         <gml:OperationParameter gml:id="epsg-parameter-8801">
           <gml:identifier codeSpace="IOGP">urn:ogc:def:parameter:EPSG::8801</gml:identifier>
           <gml:name codeSpace="EPSG">Latitude of natural origin</gml:name>
+          <gml:remarks>This parameter is shown for completeness, but should never have
a value different than 0 for this projection.</gml:remarks>
         </gml:OperationParameter>
       </gml:parameter>
       <gml:parameter>
@@ -89,7 +90,7 @@
   </gml:method>
   <gml:parameterValue>
     <gml:ParameterValue>
-      <gml:value uom="urn:ogc:def:uom:EPSG::9102">0</gml:value>
+      <gml:value uom="urn:ogc:def:uom:EPSG::9102">-0</gml:value>    <!-- Intentionally
negative for testing purpose. -->
 
       <!-- All descriptors below this point are duplication of the descriptors already
defined above.
            For now we do not yet use the XML references, but this is something that we will
need to
@@ -101,14 +102,13 @@
         <gml:OperationParameter gml:id="LatitudeOfNaturalOrigin">
           <gml:identifier codeSpace="IOGP">urn:ogc:def:parameter:EPSG::8801</gml:identifier>
           <gml:name codeSpace="EPSG">Latitude of natural origin</gml:name>
-          <gml:remarks>This parameter is shown for completeness, but should never have
a value different than 0 for this projection.</gml:remarks>
         </gml:OperationParameter>
       </gml:operationParameter>
     </gml:ParameterValue>
   </gml:parameterValue>
   <gml:parameterValue>
     <gml:ParameterValue>
-      <gml:value uom="urn:ogc:def:uom:EPSG::9102">0</gml:value>
+      <gml:value uom="urn:ogc:def:uom:EPSG::9102">-90</gml:value>   <!-- Arbitrary
value for testing purpose. -->
       <gml:operationParameter>
         <gml:OperationParameter gml:id="LongitudeOfNaturalOrigin">
           <gml:identifier codeSpace="IOGP">urn:ogc:def:parameter:EPSG::8802</gml:identifier>



Mime
View raw message