sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1821181 - in /sis/branches/ISO-19115-3: application/sis-console/src/test/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/ ...
Date Mon, 15 Jan 2018 16:32:48 GMT
Author: desruisseaux
Date: Mon Jan 15 16:32:47 2018
New Revision: 1821181

URL: http://svn.apache.org/viewvc?rev=1821181&view=rev
Log:
Complete adaptation of commit 3a5a78b520f7d1827acc6bee6c42eb91a497e6f4 from Image Matter
(included tests for ISO 19115-3 in roughly 2/3 of the test classes for ISO metadata).

The project at this revision can be built but is known to have test failures.
Tests will pass only after we completed the port of all ISO 19115-3 work.

Added:
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent (legacy).xml
      - copied unchanged from r1821180, sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification (legacy).xml
      - copied unchanged from r1821180, sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml
Modified:
    sis/branches/ISO-19115-3/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_RestrictionCode.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml
    sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
    sis/branches/ISO-19115-3/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java

Modified: sis/branches/ISO-19115-3/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -43,12 +43,11 @@ public final strictfp class MimeTypeComm
      */
     @Test
     public void testWithMetadataXML() throws Exception {
-        final URL url = DefaultExtentTest.getResource("Extent.xml");
-        assertNotNull("Extent.xml", url);
+        final URL url = DefaultExtentTest.getTestFile(true);
         final MimeTypeCommand test = new MimeTypeCommand(0, CommandRunner.TEST, url.toString());
         test.run();
         final String output = test.outputBuffer.toString().trim();
-        assertTrue(output, output.endsWith("Extent.xml: application/vnd.iso.19139+xml"));
+        assertTrue(output, output.endsWith(".xml: application/vnd.iso.19139+xml"));
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_RestrictionCode.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_RestrictionCode.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_RestrictionCode.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_RestrictionCode.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -16,10 +16,13 @@
  */
 package org.apache.sis.internal.jaxb.code;
 
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import org.opengis.metadata.constraint.Restriction;
 import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
 import org.apache.sis.internal.jaxb.gmd.CodeListUID;
+import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -28,10 +31,11 @@ import org.apache.sis.internal.jaxb.gmd.
  * See package documentation for more information about the handling of {@code CodeList} in ISO 19115-3.
  *
  * @author  Cédric Briançon (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
+@XmlType(namespace = Namespaces.MCO)
 public final class MD_RestrictionCode extends CodeListAdapter<MD_RestrictionCode, Restriction> {
     /**
      * Empty constructor for JAXB only.
@@ -58,7 +62,7 @@ public final class MD_RestrictionCode ex
      */
     @Override
     protected MD_RestrictionCode wrap(final CodeListUID value) {
-        if ("licence".equals(value.codeListValue)) {
+        if ("licence".equals(value.codeListValue) && Context.isFlagSet(Context.current(), Context.LEGACY_METADATA)) {
             value.codeListValue = "license";
         }
         return new MD_RestrictionCode(value);

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultOnlineResource.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -17,17 +17,13 @@
 package org.apache.sis.metadata.iso.citation;
 
 import java.net.URI;
-import java.net.URISyntaxException;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.apache.sis.internal.jaxb.Context;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.OnLineFunction;
 import org.opengis.metadata.citation.OnlineResource;
-import org.apache.sis.internal.jaxb.FilterByVersion;
-import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.jaxb.gco.StringAdapter;
 import org.apache.sis.metadata.iso.ISOMetadata;
 
@@ -59,8 +55,7 @@ import org.apache.sis.metadata.iso.ISOMe
  */
 @SuppressWarnings("CloneableClassWithoutClone")                 // ModifiableMetadata needs shallow clones.
 @XmlType(name = "CI_OnlineResource_Type", propOrder = {
-    "linkageURL",
-    "linkageString",
+    "linkage",
     "protocol",
     "applicationProfile",
     "name",
@@ -267,7 +262,7 @@ public class DefaultOnlineResource exten
      * @return location for on-line access using a Uniform Resource Locator address or similar scheme, or {@code null}.
      */
     @Override
-    // @XmlElement at the end of this class.
+    @XmlElement(name = "linkage", required = true)
     public URI getLinkage() {
         return linkage;
     }
@@ -344,59 +339,4 @@ public class DefaultOnlineResource exten
         checkWritePermission();
         protocolRequest = newValue;
     }
-
-
-
-
-    //////////////////////////////////////////////////////////////////////////////////////////////////
-    ////////                                                                                  ////////
-    ////////                               XML support with JAXB                              ////////
-    ////////                                                                                  ////////
-    ////////        The following methods are invoked by JAXB using reflection (even if       ////////
-    ////////        they are private) or are helpers for other methods invoked by JAXB.       ////////
-    ////////        Those methods can be safely removed if Geographic Markup Language         ////////
-    ////////        (GML) support is not needed.                                              ////////
-    ////////                                                                                  ////////
-    //////////////////////////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Invoked at marshalling time for writing URL as defined by ISO 19139:2007.
-     * That legacy standard wraps the URL in a {@code <gmd:URL>} element.
-     */
-    @XmlElement(name = "linkage", namespace = LegacyNamespaces.GMD)
-    private URI getLinkageURL() {
-        return FilterByVersion.LEGACY_METADATA.accept() ? getLinkage() : null;
-    }
-
-    /**
-     * Invoked at ISO 19139:2007 unmarshalling time for storing the value of {@code <gmd:URL>} element.
-     */
-    @SuppressWarnings("unused")
-    private void setLinkageURL(final URI newValue) {
-        setLinkage(newValue);
-    }
-
-    /**
-     * Invoked at marshalling time for writing URL as defined by ISO 19115-3.
-     * That newer standard write the URL directly, without wrapping in {@code <gmd:URL>} element.
-     */
-    @XmlElement(name = "linkage", required = true)
-    private String getLinkageString() {
-        if (FilterByVersion.CURRENT_METADATA.accept()) {
-            final URI linkage = getLinkage();
-            if (linkage != null) {
-                return linkage.toString();
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Invoked at ISO 19115-3 unmarshalling time for parsing the URL.
-     */
-    @SuppressWarnings("unused")
-    private void setLinkageString(final String newValue) throws URISyntaxException {
-        final Context context = Context.current();
-        setLinkage(Context.converter(context).toURI(context, newValue));
-    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -293,7 +293,7 @@ public class DefaultOperationMetadata ex
      */
     @Override
     @SuppressWarnings({"unchecked", "rawtypes"})
-    @XmlElement(name = "parameters")
+    @XmlElement(name = "parameter")
     public Collection<ParameterDescriptor<?>> getParameters() {
         return parameters = nonNullCollection(parameters, (Class) ParameterDescriptor.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -22,6 +22,7 @@ import java.util.Collection;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.identification.TopicCategory;
 import org.apache.sis.metadata.iso.identification.DefaultDataIdentification;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
@@ -33,7 +34,8 @@ import static org.apache.sis.test.Assert
  * Tests the XML marshaling of {@code Enum}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.5
  * @module
  */
@@ -45,33 +47,33 @@ public final strictfp class EnumMarshall
      */
     @Test
     public void testTopicCategories() throws JAXBException {
-        final Collection<TopicCategory> expected = Arrays.asList(
+        final Collection<TopicCategory> topics = Arrays.asList(
                 TopicCategory.OCEANS,
                 TopicCategory.ENVIRONMENT,
                 TopicCategory.IMAGERY_BASE_MAPS_EARTH_COVER);   // We need to test at least one enum with many words.
 
         final DefaultDataIdentification id = new DefaultDataIdentification();
-        id.setTopicCategories(expected);
+        id.setTopicCategories(topics);
+        String expected =
+                "<mri:MD_DataIdentification xmlns:mri=\"" + Namespaces.MRI + "\">\n" +
+                "  <mri:topicCategory>\n" +
+                "    <mri:MD_TopicCategoryCode>environment</mri:MD_TopicCategoryCode>\n" +
+                "  </mri:topicCategory>\n" +
+                "  <mri:topicCategory>\n" +
+                "    <mri:MD_TopicCategoryCode>imageryBaseMapsEarthCover</mri:MD_TopicCategoryCode>\n" +
+                "  </mri:topicCategory>\n" +
+                "  <mri:topicCategory>\n" +
+                "    <mri:MD_TopicCategoryCode>oceans</mri:MD_TopicCategoryCode>\n" +
+                "  </mri:topicCategory>\n" +
+                "</mri:MD_DataIdentification>";
 
-        final String xml = marshal(id);
-        assertXmlEquals(
-                "<gmd:MD_DataIdentification xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
-                "  <gmd:topicCategory>\n" +
-                "    <gmd:MD_TopicCategoryCode>environment</gmd:MD_TopicCategoryCode>\n" +
-                "  </gmd:topicCategory>\n" +
-                "  <gmd:topicCategory>\n" +
-                "    <gmd:MD_TopicCategoryCode>imageryBaseMapsEarthCover</gmd:MD_TopicCategoryCode>\n" +
-                "  </gmd:topicCategory>\n" +
-                "  <gmd:topicCategory>\n" +
-                "    <gmd:MD_TopicCategoryCode>oceans</gmd:MD_TopicCategoryCode>\n" +
-                "  </gmd:topicCategory>\n" +
-                "</gmd:MD_DataIdentification>",
-                xml, "xmlns:*");
+        final String xml = marshal(id, LegacyNamespaces.ISO_19115_3);
+        assertXmlEquals(expected, xml, "xmlns:*");
         /*
          * Unmarshall the above XML and verify that we find all the topic categories.
          */
-        final Collection<TopicCategory> unmarshalled = unmarshal(DefaultDataIdentification.class, xml).getTopicCategories();
+        final Collection<TopicCategory> unmarshalled = unmarshal(DefaultDataIdentification.class, expected).getTopicCategories();
         assertInstanceOf("topicCategory", EnumSet.class, unmarshalled);
-        assertSetEquals(expected, unmarshalled);
+        assertSetEquals(topics, unmarshalled);
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -19,8 +19,8 @@ package org.apache.sis.internal.jaxb.met
 import javax.xml.bind.JAXBException;
 import org.opengis.util.MemberName;
 import org.opengis.parameter.ParameterDirection;
-import org.apache.sis.util.iso.Names;
 import org.apache.sis.xml.Namespaces;
+import org.apache.sis.util.iso.Names;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
@@ -31,7 +31,8 @@ import static org.apache.sis.test.Assert
  * Tests {@link ServiceParameter}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.5
  * @module
  */

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -17,9 +17,7 @@
 package org.apache.sis.metadata.iso;
 
 import javax.xml.bind.JAXBException;
-import org.opengis.metadata.Identifier;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
-import org.apache.sis.util.CharSequences;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
@@ -32,7 +30,8 @@ import static org.apache.sis.test.Metada
  * Tests {@link DefaultIdentifier}.
  *
  * @author  Martin Desruisseaux
- * @version 0.4
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.4
  * @module
  */
@@ -42,29 +41,23 @@ public final strictfp class DefaultIdent
      * The expected XML representation for this test.
      */
     private static final String XML =
-            "<gmd:MD_Identifier xmlns:gmd=\"" + Namespaces.GMD + "\" " +
+            "<mcc:MD_Identifier xmlns:mcc=\"" + Namespaces.MCC + "\" " +
+                               "xmlns:cit=\"" + Namespaces.CIT + "\" " +
                                "xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
-            "  <gmd:authority>\n" +
-            "    <gmd:CI_Citation>\n" +
-            "      <gmd:title>\n" +
+            "  <mcc:authority>\n" +
+            "    <cit:CI_Citation>\n" +
+            "      <cit:title>\n" +
             "        <gco:CharacterString>EPSG</gco:CharacterString>\n" +
-            "      </gmd:title>\n" +
-            "    </gmd:CI_Citation>\n" +
-            "  </gmd:authority>\n" +
-            "  <gmd:code>\n" +
+            "      </cit:title>\n" +
+            "    </cit:CI_Citation>\n" +
+            "  </mcc:authority>\n" +
+            "  <mcc:code>\n" +
             "    <gco:CharacterString>4326</gco:CharacterString>\n" +
-            "  </gmd:code>\n" +
-            "</gmd:MD_Identifier>";
+            "  </mcc:code>\n" +
+            "</mcc:MD_Identifier>";
 
     /**
-     * Asserts that XML marshalling of the given object produce the {@link #XML} string.
-     */
-    void testMarshal(final String type, final Identifier identifier) throws JAXBException {
-        assertXmlEquals(CharSequences.replace(XML, "MD_Identifier", type).toString(), marshal(identifier), "xmlns:*");
-    }
-
-    /**
-     * Test XML marshalling.
+     * Tests XML marshalling.
      *
      * @throws JAXBException if an error occurred during (un)marshalling.
      */
@@ -73,11 +66,11 @@ public final strictfp class DefaultIdent
         final DefaultIdentifier identifier = new DefaultIdentifier();
         identifier.setAuthority(new DefaultCitation("EPSG"));
         identifier.setCode("4326");
-        testMarshal("MD_Identifier", identifier);
+        assertXmlEquals(XML, marshal(identifier), "xmlns:*");
     }
 
     /**
-     * Test XML unmarshalling.
+     * Tests XML unmarshalling.
      *
      * @throws JAXBException if an error occurred during (un)marshalling.
      */

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -53,7 +53,8 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -24,10 +24,11 @@ import org.apache.sis.metadata.iso.citat
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.internal.simple.SimpleCitation;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.test.TestCase;
+import org.apache.sis.test.XMLTestCase;
 import org.opengis.test.Validators;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
@@ -40,7 +41,7 @@ import static org.opengis.metadata.Ident
  * Tests {@link ImmutableIdentifier}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -48,7 +49,7 @@ import static org.opengis.metadata.Ident
     DefaultIdentifierTest.class,
     org.apache.sis.metadata.iso.citation.CitationsTest.class
 })
-public final strictfp class ImmutableIdentifierTest extends TestCase {
+public final strictfp class ImmutableIdentifierTest extends XMLTestCase {
     /**
      * Returns the properties map to be used in argument to test methods.
      */
@@ -171,7 +172,21 @@ public final strictfp class ImmutableIde
     @Test
     public void testMarshal() throws JAXBException {
         final ImmutableIdentifier identifier = new ImmutableIdentifier(new DefaultCitation("EPSG"), null, "4326");
-        new DefaultIdentifierTest().testMarshal("RS_Identifier", identifier);
+        assertXmlEquals(
+                "<gmd:RS_Identifier xmlns:gmd=\"" + LegacyNamespaces.GMD + "\" " +
+                               "xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" +
+                "  <gmd:authority>\n" +
+                "    <gmd:CI_Citation>\n" +
+                "      <gmd:title>\n" +
+                "        <gco:CharacterString>EPSG</gco:CharacterString>\n" +
+                "      </gmd:title>\n" +
+                "    </gmd:CI_Citation>\n" +
+                "  </gmd:authority>\n" +
+                "  <gmd:code>\n" +
+                "    <gco:CharacterString>4326</gco:CharacterString>\n" +
+                "  </gmd:code>\n" +
+                "</gmd:RS_Identifier>",
+                marshal(identifier, LegacyNamespaces.ISO_19139), "xmlns:*");
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -37,7 +37,8 @@ import static org.apache.sis.test.TestUt
  * Tests {@link DefaultLegalConstraints}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.4
  * @module
  */
@@ -131,8 +132,28 @@ public final strictfp class DefaultLegal
      */
     @Test
     public void testLicenceCode() throws JAXBException {
-        final String xml =
-                "<gmd:MD_LegalConstraints xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
+        String xml =
+                "<mco:MD_LegalConstraints xmlns:mco=\"" + Namespaces.MCO + "\">\n" +
+                "  <mco:useConstraints>\n" +
+                "    <mco:MD_RestrictionCode"
+                        + " codeList=\"http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#MD_RestrictionCode\""
+                        + " codeListValue=\"licence\""
+                        + " codeSpace=\"eng\">Licence</mco:MD_RestrictionCode>\n" +
+                "  </mco:useConstraints>\n" +
+                "</mco:MD_LegalConstraints>\n";
+
+        final DefaultLegalConstraints c = new DefaultLegalConstraints();
+        c.setUseConstraints(singleton(Restriction.LICENCE));
+        assertXmlEquals(xml, marshal(c), "xmlns:*");
+        DefaultLegalConstraints actual = unmarshal(xml);
+        assertSame(Restriction.LICENCE, getSingleton(actual.getUseConstraints()));
+        assertEquals(c, actual);
+        /*
+         * Above code tested ISO 19115-3 (un)marshalling. Code below test legacy ISO 19139:2007 (un)marshalling.
+         * This is where the spelling difference appears. At unmarshalling, verify that we got back the original
+         * LICENCE code, not a new "LICENSE" code.
+         */
+        xml  =  "<gmd:MD_LegalConstraints xmlns:gmd=\"" + LegacyNamespaces.GMD + "\">\n" +
                 "  <gmd:useConstraints>\n" +
                 "    <gmd:MD_RestrictionCode"
                         + " codeList=\"http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode\""
@@ -141,13 +162,8 @@ public final strictfp class DefaultLegal
                 "  </gmd:useConstraints>\n" +
                 "</gmd:MD_LegalConstraints>\n";
 
-        final DefaultLegalConstraints c = new DefaultLegalConstraints();
-        c.setUseConstraints(singleton(Restriction.LICENCE));
         assertXmlEquals(xml, marshal(c, LegacyNamespaces.ISO_19139), "xmlns:*");
-        /*
-         * Unmarshall and ensure that we got back the original LICENCE code, not a new "LICENSE" code.
-         */
-        final DefaultLegalConstraints actual = unmarshal(xml);
+        actual = unmarshal(xml);
         assertSame(Restriction.LICENCE, getSingleton(actual.getUseConstraints()));
         assertEquals(c, actual);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -18,10 +18,11 @@ package org.apache.sis.metadata.iso.exte
 
 import java.net.URL;
 import java.util.Arrays;
-import java.io.IOException;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.extent.Extent;
+import org.apache.sis.util.Version;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.NilObject;
@@ -38,24 +39,22 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn(DefaultGeographicBoundingBoxTest.class)
 public final strictfp class DefaultExtentTest extends XMLTestCase {
     /**
-     * Returns the URL to the XML file of the given name.
-     * The argument shall be one of the files listed in the following directory:
+     * Returns the URL to a test file in XML.
+     * This is used for test methods outside this {@code DefaultExtentTest} file.
      *
-     * <ul>
-     *   <li>{@code "core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent"}</li>
-     * </ul>
-     *
-     * @param  filename  the name of the XML file.
-     * @return the URL to the given XML file.
+     * @param  legacy  {@code true} for legacy ISO 19139:2007 format, or {@code false} for ISO 19115-3 format.
+     * @return URL to a test file in XML.
      */
-    public static URL getResource(final String filename) {
+    public static URL getTestFile(final boolean legacy) {
+        final String filename = legacy ? "Extent (legacy).xml" : "Extent.xml";
         final URL resource = DefaultExtentTest.class.getResource(filename);
         assertNotNull(filename, resource);
         return resource;
@@ -102,11 +101,27 @@ public final strictfp class DefaultExten
      * <p><b>XML test file:</b>
      * {@code "core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml"}</p>
      *
-     * @throws IOException   if an error occurred while reading the XML file.
      * @throws JAXBException if an error occurred during the during marshalling / unmarshalling processes.
      */
     @Test
-    public void testXML() throws IOException, JAXBException {
+    public void testXML() throws JAXBException {
+        roundtrip("Extent.xml", LegacyNamespaces.ISO_19115_3);
+    }
+
+    /**
+     * Tests the (un)marshalling of a {@code <gmd:EX_Extent>} object using the legacy ISO 19139:2007 schema.
+     *
+     * @throws JAXBException if an error occurred during the during marshalling / unmarshalling processes.
+     */
+    @Test
+    public void testLegacyXML() throws JAXBException {
+        roundtrip("Extent (legacy).xml", LegacyNamespaces.ISO_19139);
+    }
+
+    /**
+     * Compares the marshalling and unmarshalling of a {@link DefaultExtent} with XML in the given file.
+     */
+    private void roundtrip(final String filename, final Version version) throws JAXBException {
         final DefaultGeographicBoundingBox bbox = new DefaultGeographicBoundingBox(-99, -79, 14.9844, 31);
         bbox.getIdentifierMap().put(IdentifierSpace.ID, "bbox");
         final DefaultTemporalExtent temporal = new DefaultTemporalExtent();
@@ -115,44 +130,34 @@ public final strictfp class DefaultExten
             temporal.setBounds(date("2010-01-27 13:26:10"), date("2010-08-27 13:26:10"));
         }
         final DefaultExtent extent = new DefaultExtent(null, bbox, null, temporal);
-        /*
-         * XML marshalling, and compare with the content of "ProcessStep.xml" file.
-         */
-        final String xml = marshal(extent);
-        assertTrue(xml.startsWith("<?xml"));
-        assertXmlEquals(getResource("Extent.xml"), xml, "xmlns:*", "xsi:schemaLocation");
-        /*
-         * Final comparison: ensure that we didn't lost any information.
-         */
-        assertEquals(extent, unmarshal(DefaultExtent.class, xml));
+        assertMarshalEqualsFile(filename, extent, version, "xmlns:*", "xsi:schemaLocation");
+        assertEquals(extent, unmarshalFile(DefaultExtent.class, filename));
     }
 
     /**
      * Tests XML marshalling of the {@link Extents#WORLD} constant, which is a {@code DefaultExtent} instance.
      *
      * @throws JAXBException if an error occurred during the during marshalling / unmarshalling processes.
-     *
-     * @since 0.6
      */
     @Test
     public void testWorldConstant() throws JAXBException {
         final String xml = marshal(Extents.WORLD);
-        assertXmlEquals("<gmd:EX_Extent" +
-                " xmlns:gco=\"" + Namespaces.GCO + '"' +
-                " xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
-                "  <gmd:description>\n" +
+        assertXmlEquals("<gex:EX_Extent" +
+                " xmlns:gex=\"" + Namespaces.GEX + '"' +
+                " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+                "  <gex:description>\n" +
                 "    <gco:CharacterString>World</gco:CharacterString>\n" +
-                "  </gmd:description>\n" +
-                "  <gmd:geographicElement>\n" +
-                "    <gmd:EX_GeographicBoundingBox>\n" +
-                "      <gmd:extentTypeCode>    <gco:Boolean> true </gco:Boolean></gmd:extentTypeCode>\n" +
-                "      <gmd:westBoundLongitude><gco:Decimal> -180 </gco:Decimal></gmd:westBoundLongitude>\n" +
-                "      <gmd:eastBoundLongitude><gco:Decimal>  180 </gco:Decimal></gmd:eastBoundLongitude>\n" +
-                "      <gmd:southBoundLatitude><gco:Decimal>  -90 </gco:Decimal></gmd:southBoundLatitude>\n" +
-                "      <gmd:northBoundLatitude><gco:Decimal>   90 </gco:Decimal></gmd:northBoundLatitude>\n" +
-                "    </gmd:EX_GeographicBoundingBox>\n" +
-                "  </gmd:geographicElement>\n" +
-                "</gmd:EX_Extent>",
+                "  </gex:description>\n" +
+                "  <gex:geographicElement>\n" +
+                "    <gex:EX_GeographicBoundingBox>\n" +
+                "      <gex:extentTypeCode>    <gco:Boolean> true </gco:Boolean></gex:extentTypeCode>\n" +
+                "      <gex:westBoundLongitude><gco:Decimal> -180 </gco:Decimal></gex:westBoundLongitude>\n" +
+                "      <gex:eastBoundLongitude><gco:Decimal>  180 </gco:Decimal></gex:eastBoundLongitude>\n" +
+                "      <gex:southBoundLatitude><gco:Decimal>  -90 </gco:Decimal></gex:southBoundLatitude>\n" +
+                "      <gex:northBoundLatitude><gco:Decimal>   90 </gco:Decimal></gex:northBoundLatitude>\n" +
+                "    </gex:EX_GeographicBoundingBox>\n" +
+                "  </gex:geographicElement>\n" +
+                "</gex:EX_Extent>",
                 xml, "xmlns:*", "xsi:schemaLocation");
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -18,13 +18,13 @@ package org.apache.sis.metadata.iso.iden
 
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.identification.RepresentativeFraction;
-import org.apache.sis.xml.XML;
+import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.Schemas;
 import org.apache.sis.test.LoggingWatcher;
+import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.test.TestCase;
 import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
@@ -36,12 +36,13 @@ import static org.apache.sis.test.Assert
  * Tests {@link DefaultResolution}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn(DefaultRepresentativeFractionTest.class)
-public final strictfp class DefaultResolutionTest extends TestCase {
+public final strictfp class DefaultResolutionTest extends XMLTestCase {
     /**
      * A JUnit {@link Rule} for listening to log events. This field is public because JUnit requires us to
      * do so, but should be considered as an implementation details (it should have been a private field).
@@ -107,9 +108,40 @@ public final strictfp class DefaultResol
      * instance which is expected to be marshalled as below (ignoring namespace declarations):
      *
      * {@preformat xml
+     *   <mri:MD_Resolution>
+     *     <mri:distance>
+     *       <gco:Distance uom="http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])">1000.0</gco:Distance>
+     *     </mri:distance>
+     *   </mri:MD_Resolution>
+     * }
+     *
+     * @throws JAXBException if an error occurred while marshalling the element.
+     */
+    @Test
+    public void testXML() throws JAXBException {
+        final DefaultResolution resolution = new DefaultResolution();
+        resolution.setDistance(1000.0);
+        final String xml = marshal(resolution);
+        assertXmlEquals(
+                "<mri:MD_Resolution xmlns:mri=\"" + Namespaces.MRI + '"' +
+                                  " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+                "  <mri:distance>\n" +
+                "    <gco:Distance uom=\"" + Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n" +
+                "  </mri:distance>\n" +
+                "</mri:MD_Resolution>", xml, "xmlns:*");
+
+        assertEquals(resolution, unmarshal(DefaultResolution.class, xml));
+    }
+
+    /**
+     * Tests XML (un)marshalling of a resolution element using legacy XML schema.
+     * This test creates a {@link DefaultResolution} instance which is expected to be marshalled as below
+     * (ignoring namespace declarations):
+     *
+     * {@preformat xml
      *   <gmd:MD_Resolution>
      *     <gmd:distance>
-     *       <gco:Distance uom=\"http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>
+     *       <gco:Distance uom="http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])">1000.0</gco:Distance>
      *     </gmd:distance>
      *   </gmd:MD_Resolution>
      * }
@@ -117,17 +149,10 @@ public final strictfp class DefaultResol
      * @throws JAXBException if an error occurred while marshalling the element.
      */
     @Test
-    public void testXML() throws JAXBException {
+    public void testLegacyXML() throws JAXBException {
         final DefaultResolution resolution = new DefaultResolution();
         resolution.setDistance(1000.0);
-        final String xml = XML.marshal(resolution);
-        assertTrue("<gmd:distance> element is missing. If this test fails randomly, "
-                + "see DefaultResolutionTest.testXML() javadoc for more information", xml.contains("distance"));
-        /*
-         * Following test is done as a matter of principle, but should not be a problem.
-         * The real issue is the <gmd:distance> which happen to be randomly missing for
-         * an unknown reason.
-         */
+        final String xml = marshal(resolution, LegacyNamespaces.ISO_19139);
         assertXmlEquals(
                 "<gmd:MD_Resolution xmlns:gmd=\"" + LegacyNamespaces.GMD + '"' +
                                   " xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" +
@@ -135,10 +160,7 @@ public final strictfp class DefaultResol
                 "    <gco:Distance uom=\"" + Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n" +
                 "  </gmd:distance>\n" +
                 "</gmd:MD_Resolution>", xml, "xmlns:*");
-        /*
-         * Unmarshal the element back to a Java object, as a safety.
-         * Should not be a problem neither.
-         */
-        assertEquals(resolution, XML.unmarshal(xml));
+
+        assertEquals(resolution, unmarshal(DefaultResolution.class, xml));
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -21,6 +21,7 @@ import org.opengis.util.NameFactory;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.identification.CouplingType;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.xml.NilReason;
 import org.apache.sis.test.DependsOn;
@@ -35,7 +36,8 @@ import static java.util.Collections.sing
  * Tests {@link DefaultServiceIdentification}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.5
  * @module
  */
@@ -50,6 +52,11 @@ public final strictfp class DefaultServi
     private static final String XML_FILE = "ServiceIdentification.xml";
 
     /**
+     * Same as {@link #XML_FILE} but using legacy ISO 19139:2007 schema.
+     */
+    private static final String XML_FILE_LEGACY = "ServiceIdentification (legacy).xml";
+
+    /**
      * Creates the service identification to use for testing purpose.
      */
     private static DefaultServiceIdentification create() {
@@ -77,6 +84,16 @@ public final strictfp class DefaultServi
     }
 
     /**
+     * Tests the marshalling of a service metadata to legacy ISO 19139:2007 schema.
+     *
+     * @throws JAXBException if an error occurred during the during marshalling process.
+     */
+    @Test
+    public void testMarshalLegacy() throws JAXBException {
+        assertMarshalEqualsFile(XML_FILE_LEGACY, create(), LegacyNamespaces.ISO_19139, "xlmns:*", "xsi:schemaLocation");
+    }
+
+    /**
      * Tests the unmarshalling of a service metadata.
      *
      * <p><b>XML test file:</b>
@@ -88,4 +105,14 @@ public final strictfp class DefaultServi
     public void testUnmarshal() throws JAXBException {
         assertTrue(create().equals(unmarshalFile(DefaultServiceIdentification.class, XML_FILE), ComparisonMode.DEBUG));
     }
+
+    /**
+     * Tests the unmarshalling of a service metadata from legacy ISO 19139:2007 schema.
+     *
+     * @throws JAXBException if an error occurred during the during unmarshalling process.
+     */
+    @Test
+    public void testUnmarshalLegacy() throws JAXBException {
+        assertTrue(create().equals(unmarshalFile(DefaultServiceIdentification.class, XML_FILE_LEGACY), ComparisonMode.DEBUG));
+    }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml Mon Jan 15 16:32:47 2018
@@ -18,43 +18,44 @@
   under the License.
 -->
 
-<gmd:EX_Extent
-    xmlns:gco = "http://www.isotc211.org/2005/gco"
-    xmlns:gmd = "http://www.isotc211.org/2005/gmd"
+<gex:EX_Extent
+    xmlns:gex = "http://standards.iso.org/iso/19115/-3/gex/1.0"
+    xmlns:gco = "http://standards.iso.org/iso/19115/-3/gco/1.0"
     xmlns:gml = "http://www.opengis.net/gml/3.2"
     xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation = "http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd">
+    xsi:schemaLocation = "http://standards.iso.org/iso/19115/-3/gex/1.0
+                          http://standards.iso.org/iso/19115/-3/gex/1.0/gex.xsd">
 
-  <gmd:geographicElement>
-    <gmd:EX_GeographicBoundingBox id="bbox">
-      <gmd:extentTypeCode>
+  <gex:geographicElement>
+    <gex:EX_GeographicBoundingBox id="bbox">
+      <gex:extentTypeCode>
         <gco:Boolean>true</gco:Boolean>
-      </gmd:extentTypeCode>
-      <gmd:westBoundLongitude>
+      </gex:extentTypeCode>
+      <gex:westBoundLongitude>
         <gco:Decimal>-99.0</gco:Decimal>
-      </gmd:westBoundLongitude>
-      <gmd:eastBoundLongitude>
+      </gex:westBoundLongitude>
+      <gex:eastBoundLongitude>
         <gco:Decimal>-79.0</gco:Decimal>
-      </gmd:eastBoundLongitude>
-      <gmd:southBoundLatitude>
+      </gex:eastBoundLongitude>
+      <gex:southBoundLatitude>
         <gco:Decimal>14.9844</gco:Decimal>
-      </gmd:southBoundLatitude>
-      <gmd:northBoundLatitude>
+      </gex:southBoundLatitude>
+      <gex:northBoundLatitude>
         <gco:Decimal>31.0</gco:Decimal>
-      </gmd:northBoundLatitude>
-    </gmd:EX_GeographicBoundingBox>
-  </gmd:geographicElement>
-  <gmd:temporalElement>
-    <gmd:EX_TemporalExtent>
+      </gex:northBoundLatitude>
+    </gex:EX_GeographicBoundingBox>
+  </gex:geographicElement>
+  <gex:temporalElement>
+    <gex:EX_TemporalExtent>
       <!-- TODO: This block needs the sis-temporal module.
-      <gmd:extent>
+      <gex:extent>
         <gml:TimePeriod gml:id="period">
           <gml:description>Acquisition period</gml:description>
           <gml:beginPosition>2010-01-27T08:26:10-05:00</gml:beginPosition>
           <gml:endPosition>2010-08-27T08:26:10-05:00</gml:endPosition>
         </gml:TimePeriod>
-      </gmd:extent>
+      </gex:extent>
       -->
-    </gmd:EX_TemporalExtent>
-  </gmd:temporalElement>
-</gmd:EX_Extent>
+    </gex:EX_TemporalExtent>
+  </gex:temporalElement>
+</gex:EX_Extent>

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml Mon Jan 15 16:32:47 2018
@@ -19,16 +19,17 @@
 -->
 
 <srv:SV_ServiceIdentification
-    xmlns:srv = "http://www.isotc211.org/2005/srv"
-    xmlns:gmd = "http://www.isotc211.org/2005/gmd"
-    xmlns:gco = "http://www.isotc211.org/2005/gco"
+    xmlns:srv = "http://standards.iso.org/iso/19115/-3/srv/2.0"
+    xmlns:mri = "http://standards.iso.org/iso/19115/-3/mri/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://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd">
+    xsi:schemaLocation = "http://standards.iso.org/iso/19115/-3/srv/2.0
+                          http://standards.iso.org/iso/19115/-3/srv/2.0/srv.xsd">
 
-  <gmd:citation gco:nilReason="missing"/>
-  <gmd:abstract>
+  <mri:citation gco:nilReason="missing"/>
+  <mri:abstract>
     <gco:CharacterString>A dummy service for testing purpose.</gco:CharacterString>
-  </gmd:abstract>
+  </mri:abstract>
 
   <srv:serviceType>
     <gco:LocalName>Web Map Server</gco:LocalName>
@@ -38,31 +39,62 @@
     <gco:CharacterString>1.0</gco:CharacterString>
   </srv:serviceTypeVersion>
 
+  <srv:couplingType>
+    <srv:SV_CouplingType codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#SV_CouplingType" codeListValue="loose" codeSpace="eng">Loose</srv:SV_CouplingType>
+  </srv:couplingType>
+
   <srv:coupledResource>
     <srv:SV_CoupledResource>
-      <srv:operationName>
-        <gco:CharacterString>Get Map</gco:CharacterString>
-      </srv:operationName>
-      <srv:identifier>
-        <gco:CharacterString>ABC-123</gco:CharacterString>
-      </srv:identifier>
       <gco:ScopedName>mySpace:ABC-123</gco:ScopedName>
+      <srv:operation>
+        <srv:SV_OperationMetadata>
+          <srv:operationName>
+            <gco:CharacterString>Get Map</gco:CharacterString>
+          </srv:operationName>
+          <srv:distributedComputingPlatform>
+            <srv:DCPList codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#DCPList" codeListValue="WebServices" codeSpace="eng">Web services</srv:DCPList>
+          </srv:distributedComputingPlatform>
+          <srv:connectPoint gco:nilReason="missing"/>
+          <srv:parameter>
+            <srv:SV_Parameter>
+              <srv:name>
+                <gco:aName>
+                  <gco:CharacterString>Version</gco:CharacterString>
+                </gco:aName>
+                <gco:attributeType>
+                  <gco:TypeName>
+                    <gco:aName>
+                      <gco:CharacterString>CharacterString</gco:CharacterString>
+                    </gco:aName>
+                  </gco:TypeName>
+                </gco:attributeType>
+              </srv:name>
+              <srv:direction>
+                <srv:SV_ParameterDirection>in</srv:SV_ParameterDirection>
+              </srv:direction>
+              <srv:optionality>
+                <gco:Boolean>true</gco:Boolean>
+              </srv:optionality>
+              <srv:repeatability>
+                <gco:Boolean>false</gco:Boolean>
+              </srv:repeatability>
+            </srv:SV_Parameter>
+          </srv:parameter>
+        </srv:SV_OperationMetadata>
+      </srv:operation>
     </srv:SV_CoupledResource>
   </srv:coupledResource>
 
-  <srv:couplingType>
-    <srv:SV_CouplingType codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#SV_CouplingType" codeListValue="loose">Loose</srv:SV_CouplingType>
-  </srv:couplingType>
-
   <srv:containsOperations>
     <srv:SV_OperationMetadata>
       <srv:operationName>
         <gco:CharacterString>Get Map</gco:CharacterString>
       </srv:operationName>
-      <srv:DCP>
-        <srv:DCPList codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#DCPList" codeListValue="WebServices">Web services</srv:DCPList>
-      </srv:DCP>
-      <srv:parameters>
+      <srv:distributedComputingPlatform>
+        <srv:DCPList codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#DCPList" codeListValue="WebServices" codeSpace="eng">Web services</srv:DCPList>
+      </srv:distributedComputingPlatform>
+      <srv:connectPoint gco:nilReason="missing"/>
+      <srv:parameter>
         <srv:SV_Parameter>
           <srv:name>
             <gco:aName>
@@ -80,24 +112,13 @@
             <srv:SV_ParameterDirection>in</srv:SV_ParameterDirection>
           </srv:direction>
           <srv:optionality>
-            <gco:CharacterString>Optional</gco:CharacterString>
+            <gco:Boolean>true</gco:Boolean>
           </srv:optionality>
           <srv:repeatability>
             <gco:Boolean>false</gco:Boolean>
           </srv:repeatability>
-
-          <!-- Deprecated element (removed from ISO 19115:2014), since it duplicates <gco:attributeType> above. -->
-          <srv:valueType>
-            <gco:TypeName>
-              <gco:aName>
-                <gco:CharacterString>CharacterString</gco:CharacterString>
-              </gco:aName>
-            </gco:TypeName>
-          </srv:valueType>
-
         </srv:SV_Parameter>
-      </srv:parameters>
-      <srv:connectPoint gco:nilReason="missing"/>
+      </srv:parameter>
     </srv:SV_OperationMetadata>
   </srv:containsOperations>
 </srv:SV_ServiceIdentification>

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt [UTF-8] Mon Jan 15 16:32:47 2018
@@ -320,6 +320,8 @@ http://standards.iso.org/iso/19115/-3/mc
     addressee
     disseminationConstraints
     statement
+  MD_RestrictionCode
+    <type>
   MD_SecurityConstraints
     <type>
     classification
@@ -398,8 +400,6 @@ http://standards.iso.org/iso/19115/-3/md
     portrayalCatalogueCitation
   MD_ProgressCode
     <type>
-  MD_RestrictionCode
-    <type>
   MD_SpatialRepresentationTypeCode
     <type>
   MD_TopologyLevelCode

Modified: sis/branches/ISO-19115-3/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java?rev=1821181&r1=1821180&r2=1821181&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java [UTF-8] Mon Jan 15 16:32:47 2018
@@ -87,7 +87,7 @@ public final strictfp class MimeTypeDete
     @DependsOnMethod("testGMDFromString")
     public void testGMDFromInputStream() throws IOException {
         final String type;
-        try (InputStream in = DefaultExtentTest.getResource("Extent.xml").openStream()) {
+        try (InputStream in = DefaultExtentTest.getTestFile(true).openStream()) {
             assertEquals('<', in.read());
             assertEquals('?', in.read());
             final MimeTypeDetector detector = new MimeTypeDetector(singletonMap(Namespaces.GMD, "application/vnd.iso.19139+xml")) {



Mime
View raw message