You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/10/13 16:38:20 UTC

svn commit: r1708411 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/referencing/crs/SubTypes.java test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java

Author: desruisseaux
Date: Tue Oct 13 14:38:19 2015
New Revision: 1708411

URL: http://svn.apache.org/viewvc?rev=1708411&view=rev
Log:
More tests for ConcatenatedOperation GML marshalling.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java?rev=1708411&r1=1708410&r2=1708411&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java [UTF-8] Tue Oct 13 14:38:19 2015
@@ -51,7 +51,7 @@ import org.apache.sis.referencing.cs.Axe
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 final class SubTypes implements Comparator<Object> {
@@ -119,6 +119,9 @@ final class SubTypes implements Comparat
             if (object instanceof GeocentricCRS) {
                 return DefaultGeocentricCRS.castOrCopy((GeocentricCRS) object);
             }
+            if (object instanceof DefaultGeodeticCRS) {     // Result of XML unmarshalling - keep as-is.
+                return (DefaultGeodeticCRS) object;
+            }
             /*
              * The GeographicCRS and GeocentricCRS types are not part of ISO 19111.
              * ISO uses a single type, GeodeticCRS, for both of them and infer the

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java?rev=1708411&r1=1708410&r2=1708411&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] Tue Oct 13 14:38:19 2015
@@ -16,13 +16,16 @@
  */
 package org.apache.sis.referencing.operation;
 
-import org.opengis.test.Validators;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import javax.xml.bind.JAXBException;
+import org.opengis.referencing.operation.CoordinateOperation;
+import org.opengis.test.Validators;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.ReferencingAssert.*;
+import static org.opengis.test.Assert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
 
 
 /**
@@ -43,7 +46,6 @@ public class DefaultConcatenatedOperatio
      */
     private static final String XML_FILE = "ConcatenatedOperation.xml";
 
-
     /**
      * Tests (un)marshalling of a concatenated operation.
      *
@@ -53,10 +55,23 @@ public class DefaultConcatenatedOperatio
     public void testXML() throws JAXBException {
         final DefaultConcatenatedOperation op = unmarshalFile(DefaultConcatenatedOperation.class, XML_FILE);
         Validators.validate(op);
-        if (false) assertEpsgNameAndIdentifierEqual("WGS 84", 4979, op);
+        assertEquals("operations.size()", 2, op.getOperations().size());
+        final CoordinateOperation step1 = op.getOperations().get(0);
+        final CoordinateOperation step2 = op.getOperations().get(1);
+        final CoordinateReferenceSystem sourceCRS = op.getSourceCRS();
+        final CoordinateReferenceSystem targetCRS = op.getTargetCRS();
+
+        assertIdentifierEquals(          "identifier", "test", "test", null, "concatenated", getSingleton(op       .getIdentifiers()));
+        assertIdentifierEquals("sourceCRS.identifier", "test", "test", null, "source",       getSingleton(sourceCRS.getIdentifiers()));
+        assertIdentifierEquals("targetCRS.identifier", "test", "test", null, "target",       getSingleton(targetCRS.getIdentifiers()));
+        assertIdentifierEquals(    "step1.identifier", "test", "test", null, "step-1",       getSingleton(step1    .getIdentifiers()));
+        assertIdentifierEquals(    "step2.identifier", "test", "test", null, "step-2",       getSingleton(step2    .getIdentifiers()));
+        assertSame("tmp CRS",   step1.getTargetCRS(), step2.getSourceCRS());
+        assertSame("sourceCRS", step1.getSourceCRS(), sourceCRS);
+        assertSame("targetCRS", step2.getTargetCRS(), targetCRS);
         /*
          * Test marshalling and compare with the original file.
          */
-//        assertMarshalEqualsFile(XML_FILE, op, "xmlns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(XML_FILE, op, "xmlns:*", "xsi:schemaLocation");
     }
 }