Author: desruisseaux
Date: Mon Feb 19 08:29:39 2018
New Revision: 1824720

URL: http://svn.apache.org/viewvc?rev=1824720&view=rev
Log:
Fix ProcessStep test.

Added:
    
sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep
 (legacy).xml
      - copied unchanged from r1824719, 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml
Modified:
    
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
    
sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java?rev=1824720&r1=1824719&r2=1824720&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
 [UTF-8] (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
 [UTF-8] Mon Feb 19 08:29:39 2018
@@ -19,7 +19,9 @@ package org.apache.sis.metadata.iso.line
 import javax.xml.bind.JAXBException;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.internal.jaxb.gmi.LE_ProcessStep;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
 import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.util.Version;
 import org.junit.Test;
 
 import static org.opengis.test.Assert.*;
@@ -36,11 +38,6 @@ import static org.opengis.test.Assert.*;
  */
 public final strictfp class DefaultProcessStepTest extends XMLTestCase {
     /**
-     * An XML file in this package containing a process step definition.
-     */
-    private static final String XML_FILE = "ProcessStep.xml";
-
-    /**
      * Tests the (un)marshalling of a metadata mixing elements from ISO 19115 
and ISO 19115-2 standards.
      *
      * <p><b>XML test file:</b>
@@ -50,21 +47,40 @@ public final strictfp class DefaultProce
      */
     @Test
     public void testXML() throws JAXBException {
+        roundtrip("ProcessStep.xml", VERSION_2014);
+    }
+
+    /**
+     * Tests the (un)marshalling of a metadata in legacy ISO 19139:2007 
document.
+     * This test uses the same metadata than {@link #testXML()}.
+     *
+     * @throws JAXBException if an error occurred during the during 
marshalling / unmarshalling processes.
+     */
+    @Test
+    public void testLegacyXML() throws JAXBException {
+        roundtrip("ProcessStep (legacy).xml", VERSION_2007);
+    }
+
+    /**
+     * Tests (un)marshalling in the given version.
+     */
+    private void roundtrip(final String filename, final Version version) 
throws JAXBException {
         final DefaultProcessing  processing  = new DefaultProcessing();
         final DefaultProcessStep processStep = new DefaultProcessStep("Some 
process step.");
         processing.setProcedureDescription(new SimpleInternationalString("Some 
procedure."));
+        processing.setIdentifier(new DefaultIdentifier("P4"));
         processStep.setProcessingInformation(processing);
         /*
          * XML marshalling, and compare with the content of "ProcessStep.xml" 
file.
          */
-        assertMarshalEqualsFile(XML_FILE, processStep, VERSION_2007, 
"xmlns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(filename, processStep, version, "xmlns:*", 
"xsi:schemaLocation");
         /*
          * XML unmarshalling: ensure that we didn't lost any information.
          * Note that since the XML uses the <gmi:…> namespace, we got an 
instance of LE_ProcessStep, which
          * in SIS implementation does not carry any useful information; it is 
just a consequence of the way
          * namespaces are managed. We will convert to the parent 
DefaultProcessStep type before comparison.
          */
-        DefaultProcessStep step = unmarshalFile(DefaultProcessStep.class, 
XML_FILE);
+        DefaultProcessStep step = unmarshalFile(DefaultProcessStep.class, 
filename);
         assertInstanceOf("The unmarshalled object is expected to be in GMI 
namespace.", LE_ProcessStep.class, step);
         step = new DefaultProcessStep(step);
         assertEquals(processStep, step);

Modified: 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml
URL: 
http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml?rev=1824720&r1=1824719&r2=1824720&view=diff
==============================================================================
--- 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml
 (original)
+++ 
sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml
 Mon Feb 19 08:29:39 2018
@@ -18,29 +18,29 @@
   under the License.
 -->
 
-<gmi:LE_ProcessStep
-    xmlns:gmd = "http://www.isotc211.org/2005/gmd";
-    xmlns:gco = "http://www.isotc211.org/2005/gco";
-    xmlns:gmi = "http://standards.iso.org/iso/19115/-2/gmi/1.0";
+<mrl:LE_ProcessStep
+    xmlns:mrl = "http://standards.iso.org/iso/19115/-3/mrl/1.0";
+    xmlns:mcc = "http://standards.iso.org/iso/19115/-3/mcc/1.0";
+    xmlns:gco = "http://standards.iso.org/iso/19115/-3/gco/1.0";
     xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance";
-    xsi:schemaLocation = "http://standards.iso.org/iso/19115/-2/gmi/1.0
-                          
http://standards.iso.org/iso/19115/-2/gmi/1.0/gmi.xsd";>
+    xsi:schemaLocation = "http://standards.iso.org/iso/19115/-3/mrl/1.0
+                          
http://standards.iso.org/iso/19115/-3/mrl/1.0/mrl.xsd";>
 
-  <gmd:description>
+  <mrl:description>
     <gco:CharacterString>Some process step.</gco:CharacterString>
-  </gmd:description>
-  <gmi:processingInformation>
-    <gmi:LE_Processing>
-      <gmi:identifier>
-        <gmd:MD_Identifier>
-          <gmd:code>
+  </mrl:description>
+  <mrl:processingInformation>
+    <mrl:LE_Processing>
+      <mrl:identifier>
+        <mcc:MD_Identifier>
+          <mcc:code>
             <gco:CharacterString>P4</gco:CharacterString>
-          </gmd:code>
-        </gmd:MD_Identifier>
-      </gmi:identifier>
-      <gmi:procedureDescription>
+          </mcc:code>
+        </mcc:MD_Identifier>
+      </mrl:identifier>
+      <mrl:procedureDescription>
         <gco:CharacterString>Some procedure.</gco:CharacterString>
-      </gmi:procedureDescription>
-    </gmi:LE_Processing>
-  </gmi:processingInformation>
-</gmi:LE_ProcessStep>
+      </mrl:procedureDescription>
+    </mrl:LE_Processing>
+  </mrl:processingInformation>
+</mrl:LE_ProcessStep>


Reply via email to