sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1821259 - in /sis/branches/ISO-19115-3/core: sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/ si...
Date Tue, 16 Jan 2018 15:48:34 GMT
Author: desruisseaux
Date: Tue Jan 16 15:48:34 2018
New Revision: 1821259

URL: http://svn.apache.org/viewvc?rev=1821259&view=rev
Log:
Adaptation of commit 39e5464004f8531b707e273570aa841c9074ef2e from Image Matter
(complete first pass on tests for ISO 19115-3).

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/quality/PositionalAccuracy (legacy).xml
      - copied unchanged from r1821258, sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml
Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java
    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/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/FreeTextMarshallingTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamResolver.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/resources/org/apache/sis/xml/NamespaceContent.txt
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/NamespacesTest.java

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -114,8 +114,8 @@
  * @since   0.3
  * @module
  */
-@XmlSchema(location=Schemas.METADATA_XSD_QUALITY, elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.DQC, xmlns = {
-    @XmlNs(prefix = "dqc", namespaceURI = Namespaces.DQC),
+@XmlSchema(location=Schemas.METADATA_XSD_QUALITY, elementFormDefault=XmlNsForm.QUALIFIED, namespace=Namespaces.MDQ, xmlns = {
+    @XmlNs(prefix = "mdq", namespaceURI = Namespaces.MDQ),
     @XmlNs(prefix = "cit", namespaceURI = Namespaces.CIT),
     @XmlNs(prefix = "mrc", namespaceURI = Namespaces.MRC),
     @XmlNs(prefix = "mrd", namespaceURI = Namespaces.MRD),

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -18,11 +18,10 @@ package org.apache.sis.metadata.iso.line
 
 import java.util.Arrays;
 import javax.xml.bind.JAXBException;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.metadata.iso.DefaultIdentifier;
 import org.apache.sis.test.XMLTestCase;
-import org.apache.sis.xml.Namespaces;
-import org.apache.sis.xml.XML;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -33,7 +32,7 @@ import static org.apache.sis.test.Assert
  * {@code "gmi"} namespace that GeoAPI merged with the object of same name in the {@code "gmd"} namespace.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -54,10 +53,10 @@ public final strictfp class DefaultLinea
          * If this simpler case, only ISO 19115 elements are defined (no ISO 19115-2).
          * Consequently the XML name shall be "gmd:LI_Source".
          */
-        String actual = XML.marshal(lineage);
+        String actual = marshal(lineage, LegacyNamespaces.ISO_19139);
         assertXmlEquals(
-            "<gmd:LI_Lineage xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                           " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+            "<gmd:LI_Lineage xmlns:gmd=\"" + LegacyNamespaces.GMD + '"' +
+                           " xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" +
             "  <gmd:source>\n" +
             "    <gmd:LI_Source>\n" +
             "      <gmd:description>\n" +
@@ -70,11 +69,11 @@ public final strictfp class DefaultLinea
          * Now add a ISO 19115-2 specific property. The XML name shall become "gmi:LE_Source".
          */
         source.setProcessedLevel(new DefaultIdentifier("DummyLevel"));
-        actual = XML.marshal(lineage);
+        actual = marshal(lineage, LegacyNamespaces.ISO_19139);
         assertXmlEquals(
-            "<gmd:LI_Lineage xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                           " xmlns:gmi=\"" + Namespaces.GMI + '"' +
-                           " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+            "<gmd:LI_Lineage xmlns:gmd=\"" + LegacyNamespaces.GMD + '"' +
+                           " xmlns:gmi=\"" + LegacyNamespaces.GMI + '"' +
+                           " xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" +
             "  <gmd:source>\n" +
             "    <gmi:LE_Source>\n" +
             "      <gmd:description>\n" +

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=1821259&r1=1821258&r2=1821259&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] Tue Jan 16 15:48:34 2018
@@ -19,6 +19,7 @@ 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.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
@@ -30,7 +31,7 @@ import static org.opengis.test.Assert.*;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -57,7 +58,7 @@ public final strictfp class DefaultProce
         /*
          * XML marshalling, and compare with the content of "ProcessStep.xml" file.
          */
-        assertMarshalEqualsFile(XML_FILE, processStep, "xlmns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(XML_FILE, processStep, LegacyNamespaces.ISO_19139, "xlmns:*", "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

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -20,6 +20,8 @@ import java.util.Locale;
 import javax.xml.bind.JAXBException;
 import org.opengis.util.InternationalString;
 import org.apache.sis.xml.FreeTextMarshallingTest;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.util.Version;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
@@ -33,18 +35,14 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn(FreeTextMarshallingTest.class)
 public final strictfp class AbstractPositionalAccuracyTest extends XMLTestCase {
     /**
-     * An XML file in this package containing a positional accuracy definition.
-     */
-    private static final String XML_FILE = "PositionalAccuracy.xml";
-
-    /**
      * Tests the (un)marshalling of a text group with a default {@code <gco:CharacterString>} element.
      * This test is somewhat a duplicate of {@link FreeTextMarshallingTest}, but the context is more
      * elaborated.
@@ -59,7 +57,25 @@ public final strictfp class AbstractPosi
      */
     @Test
     public void testXML() throws JAXBException {
-        final AbstractElement metadata = unmarshalFile(AbstractElement.class, XML_FILE);
+        roundtrip("PositionalAccuracy.xml", LegacyNamespaces.ISO_19115_3);
+    }
+
+    /**
+     * Tests the (un)marshalling of a text group from/to legacy ISO 19139:2007 schema.
+     *
+     * @throws JAXBException if an error occurred during the during marshalling / unmarshalling processes.
+     */
+    @Test
+    public void testLegacyXML() throws JAXBException {
+        roundtrip("PositionalAccuracy (legacy).xml", LegacyNamespaces.ISO_19139);
+    }
+
+    /**
+     * Unmarshals the given file and verify the content.
+     * Then marshals the object and verify that we get equivalent XML.
+     */
+    private void roundtrip(final String filename, final Version version) throws JAXBException {
+        final AbstractElement metadata = unmarshalFile(AbstractElement.class, filename);
         final InternationalString nameOfMeasure = getSingleton(metadata.getNamesOfMeasure());
         /*
          * Programmatic verification of the text group.
@@ -77,6 +93,6 @@ public final strictfp class AbstractPosi
         /*
          * Marshalling: ensure that we didn't lost any information.
          */
-        assertMarshalEqualsFile(XML_FILE, metadata, "xmlns:*", "xsi:schemaLocation", "xsi:type");
+        assertMarshalEqualsFile(filename, metadata, version, "xmlns:*", "xsi:schemaLocation", "xsi:type");
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -22,6 +22,7 @@ import org.opengis.metadata.Identifier;
 import org.opengis.metadata.acquisition.Instrument;
 import org.opengis.metadata.identification.DataIdentification;
 import org.opengis.metadata.identification.InitiativeType;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.metadata.SensorType;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.test.DependsOnMethod;
@@ -42,28 +43,56 @@ import static org.apache.sis.test.Assert
  */
 public final strictfp class CharSequenceSubstitutionTest extends XMLTestCase {
     /**
-     * Tests unmarshalling of anchor in an identifier element. The {@code xlink:href} attribute
-     * is lost because the Java type of the {@code gmd:code} attribute is {@link String}.
+     * Tests unmarshalling of {@code "RS_Identifier"} element. This element was defined in legacy ISO 19139:2007
+     * but has been removed in ISO 19115-3. That element is extensively used for Coordinate Reference Systems in
+     * GML 3.2.
      *
      * @throws JAXBException if the unmarshalling failed.
      */
     @Test
-    @DependsOnMethod("testAnchor")
-    public void testAnchorForString() throws JAXBException {
+    @DependsOnMethod("testAnchorForString")
+    public void testLegacy() throws JAXBException {
         final String expected =
-                "<gmd:RS_Identifier xmlns:gcx=\""   + Namespaces.GCX   + '"' +
-                                  " xmlns:gmd=\""   + Namespaces.GMD   + '"' +
-                                  " xmlns:gco=\""   + Namespaces.GCO   + '"' +
+                "<gmd:RS_Identifier xmlns:gmd=\""   + LegacyNamespaces.GMD + '"' +
+                                  " xmlns:gmx=\""   + LegacyNamespaces.GMX + '"' +
+                                  " xmlns:gco=\""   + LegacyNamespaces.GCO + '"' +
                                   " xmlns:xlink=\"" + Namespaces.XLINK + "\">\n" +
                 "  <gmd:code>\n" +
-                "    <gcx:Anchor xlink:href=\"SDN:L101:2:4326\">EPSG:4326</gcx:Anchor>\n" +
+                "    <gmx:Anchor xlink:href=\"SDN:L101:2:4326\">EPSG:4326</gmx:Anchor>\n" +
                 "  </gmd:code>\n" +
                 "  <gmd:codeSpace>\n" +
                 "    <gco:CharacterString>L101</gco:CharacterString>\n" +
                 "  </gmd:codeSpace>\n" +
                 "</gmd:RS_Identifier>";
 
-        final Identifier id = (Identifier) XML.unmarshal(expected);
+        final Identifier id = unmarshal(Identifier.class, expected);
+        assertEquals("codespace", "L101", id.getCodeSpace());
+        assertEquals("code", "EPSG:4326", id.getCode());
+    }
+
+    /**
+     * Tests unmarshalling of anchor in an identifier element. The {@code xlink:href} attribute
+     * is lost because the Java type of the {@code gmd:code} attribute is {@link String}.
+     *
+     * @throws JAXBException if the unmarshalling failed.
+     */
+    @Test
+    @DependsOnMethod("testAnchor")
+    public void testAnchorForString() throws JAXBException {
+        final String expected =
+                "<mdb:MD_Identifier xmlns:mdb=\""   + Namespaces.MDB + '"' +
+                                  " xmlns:gcx=\""   + Namespaces.GCX + '"' +
+                                  " xmlns:gco=\""   + Namespaces.GCO + '"' +
+                                  " xmlns:xlink=\"" + Namespaces.XLINK + "\">\n" +
+                "  <mdb:code>\n" +
+                "    <gcx:Anchor xlink:href=\"SDN:L101:2:4326\">EPSG:4326</gcx:Anchor>\n" +
+                "  </mdb:code>\n" +
+                "  <mdb:codeSpace>\n" +
+                "    <gco:CharacterString>L101</gco:CharacterString>\n" +
+                "  </mdb:codeSpace>\n" +
+                "</mdb:MD_Identifier>";
+
+        final Identifier id = unmarshal(Identifier.class, expected);
         assertEquals("codespace", "L101", id.getCodeSpace());
         assertEquals("code", "EPSG:4326", id.getCode());
     }
@@ -77,28 +106,28 @@ public final strictfp class CharSequence
     @Test
     public void testAnchor() throws JAXBException {
         final String expected =
-                "<gmd:CI_Address xmlns:gcx=\""   + Namespaces.GCX   + '"' +
-                               " xmlns:gmd=\""   + Namespaces.GMD   + '"' +
+                "<cit:CI_Address xmlns:cit=\""   + Namespaces.CIT   + '"' +
+                               " xmlns:gcx=\""   + Namespaces.GCX   + '"' +
                                " xmlns:gco=\""   + Namespaces.GCO   + '"' +
                                " xmlns:xlink=\"" + Namespaces.XLINK + "\">\n" +
-                "  <gmd:deliveryPoint>\n" +
+                "  <cit:deliveryPoint>\n" +
                 "    <gco:CharacterString>Centre IFREMER de Brest BP 70</gco:CharacterString>\n" +
-                "  </gmd:deliveryPoint>\n" +
-                "  <gmd:city>\n" +
+                "  </cit:deliveryPoint>\n" +
+                "  <cit:city>\n" +
                 "    <gco:CharacterString>Plouzané</gco:CharacterString>\n" +
-                "  </gmd:city>\n" +
-                "  <gmd:postalCode>\n" +
+                "  </cit:city>\n" +
+                "  <cit:postalCode>\n" +
                 "    <gco:CharacterString>29280</gco:CharacterString>\n" +
-                "  </gmd:postalCode>\n" +
-                "  <gmd:country>\n" +
+                "  </cit:postalCode>\n" +
+                "  <cit:country>\n" +
                 "    <gcx:Anchor xlink:href=\"SDN:C320:2:FR\">France</gcx:Anchor>\n" +
-                "  </gmd:country>\n" +
-                "  <gmd:electronicMailAddress>\n" +
+                "  </cit:country>\n" +
+                "  <cit:electronicMailAddress>\n" +
                 "    <gco:CharacterString>(hiden)@ifremer.fr</gco:CharacterString>\n" +
-                "  </gmd:electronicMailAddress>\n" +
-                "</gmd:CI_Address>";
+                "  </cit:electronicMailAddress>\n" +
+                "</cit:CI_Address>";
 
-        final Address address = (Address) XML.unmarshal(expected);
+        final Address address = unmarshal(Address.class, expected);
         assertEquals("Plouzané", address.getCity().toString());
         assertEquals("France", address.getCountry().toString());
         assertEquals(1, address.getElectronicMailAddresses().size());
@@ -111,7 +140,7 @@ public final strictfp class CharSequence
         anchor.setType(XLink.Type.AUTO);
         assertEquals(XLink.Type.LOCATOR, anchor.getType());
 
-        final String actual = XML.marshal(address);
+        final String actual = marshal(address);
         assertXmlEquals(expected, actual, "xmlns:*");
     }
 
@@ -125,19 +154,19 @@ public final strictfp class CharSequence
     @Test
     public void testCodeList() throws JAXBException {
         final String expected =
-                "<gmd:MD_DataIdentification xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
-                "  <gmd:purpose>\n" +
-                "    <gmd:DS_InitiativeTypeCode\n" +
-                "        codeList=\"http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#DS_InitiativeTypeCode\"\n" +
-                "        codeListValue=\"investigation\">Investigation</gmd:DS_InitiativeTypeCode>\n" +
-                "  </gmd:purpose>\n" +
-                "</gmd:MD_DataIdentification>";
+                "<mri:MD_DataIdentification xmlns:mri=\"" + Namespaces.MRI + "\">\n" +
+                "  <mri:purpose>\n" +
+                "    <mri:DS_InitiativeTypeCode\n" +
+                "        codeList=\"http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#DS_InitiativeTypeCode\"\n" +
+                "        codeListValue=\"investigation\">Investigation</mri:DS_InitiativeTypeCode>\n" +
+                "  </mri:purpose>\n" +
+                "</mri:MD_DataIdentification>";
 
-        final DataIdentification id = (DataIdentification) XML.unmarshal(expected);
+        final DataIdentification id = unmarshal(DataIdentification.class, expected);
         assertEquals("purpose", "Investigation", String.valueOf(id.getPurpose()));
         assertSame("purpose", InitiativeType.INVESTIGATION, Types.forCodeTitle(id.getPurpose()));
 
-        final String actual = XML.marshal(id);
+        final String actual = marshal(id);
         assertXmlEquals(expected, actual, "xmlns:*");
     }
 
@@ -161,7 +190,7 @@ public final strictfp class CharSequence
                 "  </gmi:type>\n" +
                 "</gmi:MI_Instrument>";
 
-        final Instrument instrument = (Instrument) XML.unmarshal(expected);
+        final Instrument instrument = unmarshal(Instrument.class, expected);
         assertEquals("type", "RADIOMETER", String.valueOf(instrument.getType()));
         assertInstanceOf("type", SensorType.class, Types.forCodeTitle(instrument.getType()));
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/FreeTextMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/FreeTextMarshallingTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/FreeTextMarshallingTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/FreeTextMarshallingTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -30,7 +30,7 @@ import static org.apache.sis.test.Assert
  * Tests the XML marshalling of {@code FreeText}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  *
  * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-107">GEOTK-107</a>
  * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-152">GEOTK-152</a>
@@ -60,26 +60,29 @@ public final strictfp class FreeTextMars
     @Test
     public void testStandard() throws JAXBException {
         final String expected =
-                "<gmd:CI_Citation xmlns:gmd=\"" + Namespaces.GMD + "\" xmlns:gco=\"" + Namespaces.GCO + "\" xmlns:xsi=\"" + Namespaces.XSI + "\">\n" +
-                "  <gmd:title xsi:type=\"gmd:PT_FreeText_PropertyType\">\n" +
+                "<cit:CI_Citation xmlns:lan=\"" + Namespaces.LAN + '"'
+                              + " xmlns:cit=\"" + Namespaces.CIT + '"'
+                              + " xmlns:gco=\"" + Namespaces.GCO + '"'
+                              + " xmlns:xsi=\"" + Namespaces.XSI + "\">\n" +
+                "  <cit:title xsi:type=\"lan:PT_FreeText_PropertyType\">\n" +
                 "    <gco:CharacterString>OpenSource Project</gco:CharacterString>\n" +
-                "    <gmd:PT_FreeText>\n" +
-                "      <gmd:textGroup>\n" +
-                "        <gmd:LocalisedCharacterString locale=\"#locale-eng\">OpenSource Project</gmd:LocalisedCharacterString>\n" +
-                "      </gmd:textGroup>\n" +
-                "      <gmd:textGroup>\n" +
-                "        <gmd:LocalisedCharacterString locale=\"#locale-ita\">Progetto OpenSource</gmd:LocalisedCharacterString>\n" +
-                "      </gmd:textGroup>\n" +
-                "      <gmd:textGroup>\n" +
-                "        <gmd:LocalisedCharacterString locale=\"#locale-fra\">Projet OpenSource</gmd:LocalisedCharacterString>\n" +
-                "      </gmd:textGroup>\n" +
-                "    </gmd:PT_FreeText>\n" +
-                "  </gmd:title>\n" +
-                "</gmd:CI_Citation>\n";
+                "    <lan:PT_FreeText>\n" +
+                "      <lan:textGroup>\n" +
+                "        <lan:LocalisedCharacterString locale=\"#locale-eng\">OpenSource Project</lan:LocalisedCharacterString>\n" +
+                "      </lan:textGroup>\n" +
+                "      <lan:textGroup>\n" +
+                "        <lan:LocalisedCharacterString locale=\"#locale-ita\">Progetto OpenSource</lan:LocalisedCharacterString>\n" +
+                "      </lan:textGroup>\n" +
+                "      <lan:textGroup>\n" +
+                "        <lan:LocalisedCharacterString locale=\"#locale-fra\">Projet OpenSource</lan:LocalisedCharacterString>\n" +
+                "      </lan:textGroup>\n" +
+                "    </lan:PT_FreeText>\n" +
+                "  </cit:title>\n" +
+                "</cit:CI_Citation>\n";
 
-        final Citation citation = (Citation) XML.unmarshal(expected);
+        final Citation citation = unmarshal(Citation.class, expected);
         assertEquals(getExpectedI18N(), citation.getTitle());
-        final String actual = XML.marshal(citation);
+        final String actual = marshal(citation);
         assertXmlEquals(expected, actual, "xmlns:*");
     }
 
@@ -94,20 +97,23 @@ public final strictfp class FreeTextMars
     @Test
     public void testLegacy() throws JAXBException {
         final String legacy =
-                "<gmd:CI_Citation xmlns:gmd=\"" + Namespaces.GMD + "\" xmlns:gco=\"" + Namespaces.GCO + "\" xmlns:xsi=\"" + Namespaces.XSI + "\">\n" +
-                "  <gmd:title xsi:type=\"gmd:PT_FreeText_PropertyType\">\n" +
+                "<cit:CI_Citation xmlns:lan=\"" + Namespaces.LAN + '"'
+                              + " xmlns:cit=\"" + Namespaces.CIT + '"'
+                              + " xmlns:gco=\"" + Namespaces.GCO + '"'
+                              + " xmlns:xsi=\"" + Namespaces.XSI + "\">\n" +
+                "  <cit:title xsi:type=\"lan:PT_FreeText_PropertyType\">\n" +
                 "    <gco:CharacterString>OpenSource Project</gco:CharacterString>\n" +
-                "    <gmd:PT_FreeText>\n" +
-                "      <gmd:textGroup>\n" +
-                "        <gmd:LocalisedCharacterString locale=\"#locale-eng\">OpenSource Project</gmd:LocalisedCharacterString>\n" +
-                "        <gmd:LocalisedCharacterString locale=\"#locale-ita\">Progetto OpenSource</gmd:LocalisedCharacterString>\n" +
-                "        <gmd:LocalisedCharacterString locale=\"#locale-fra\">Projet OpenSource</gmd:LocalisedCharacterString>\n" +
-                "      </gmd:textGroup>\n" +
-                "    </gmd:PT_FreeText>\n" +
-                "  </gmd:title>\n" +
-                "</gmd:CI_Citation>\n";
+                "    <lan:PT_FreeText>\n" +
+                "      <lan:textGroup>\n" +
+                "        <lan:LocalisedCharacterString locale=\"#locale-eng\">OpenSource Project</lan:LocalisedCharacterString>\n" +
+                "        <lan:LocalisedCharacterString locale=\"#locale-ita\">Progetto OpenSource</lan:LocalisedCharacterString>\n" +
+                "        <lan:LocalisedCharacterString locale=\"#locale-fra\">Projet OpenSource</lan:LocalisedCharacterString>\n" +
+                "      </lan:textGroup>\n" +
+                "    </lan:PT_FreeText>\n" +
+                "  </cit:title>\n" +
+                "</cit:CI_Citation>\n";
 
-        final Citation citation = (Citation) XML.unmarshal(legacy);
+        final Citation citation = unmarshal(Citation.class, legacy);
         assertEquals(getExpectedI18N(), citation.getTitle());
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/NilReasonMarshallingTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -33,7 +33,7 @@ import static org.apache.sis.test.Metada
  * Tests the XML marshalling of object having {@code nilReason} attribute.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @version 1.0
  *
  * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-149">GEOTK-149</a>
  *
@@ -49,15 +49,15 @@ public final strictfp class NilReasonMar
     @Test
     public void testMissing() throws JAXBException {
         final String expected =
-                "<gmd:CI_Citation xmlns:gmd=\"" + Namespaces.GMD + '"' +
+                "<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + '"' +
                                 " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
-                "  <gmd:title>\n" +
+                "  <cit:title>\n" +
                 "    <gco:CharacterString>A title</gco:CharacterString>\n" +
-                "  </gmd:title>\n" +
-                "  <gmd:series gco:nilReason=\"missing\"/>\n" +
-                "</gmd:CI_Citation>";
+                "  </cit:title>\n" +
+                "  <cit:series gco:nilReason=\"missing\"/>\n" +
+                "</cit:CI_Citation>";
 
-        final Citation citation = (Citation) XML.unmarshal(expected);
+        final Citation citation = unmarshal(Citation.class, expected);
         assertTitleEquals("citation", "A title", citation);
 
         final Series series = citation.getSeries();
@@ -71,9 +71,9 @@ public final strictfp class NilReasonMar
         assertEquals("Series[missing]", series.toString());
         assertNull("All attributes are expected to be null.", series.getName());
 
-        final String actual = XML.marshal(citation);
+        final String actual = marshal(citation);
         assertXmlEquals(expected, actual, "xmlns:*");
-        assertEquals(citation, XML.unmarshal(actual));
+        assertEquals(citation, unmarshal(Citation.class, actual));
     }
 
     /**
@@ -87,15 +87,15 @@ public final strictfp class NilReasonMar
     @DependsOnMethod("testMissing")
     public void testMissingBoolean() throws JAXBException {
         final String expected =
-                "<gmd:DQ_ConformanceResult xmlns:gmd=\"" + Namespaces.GMD + '"' +
+                "<mdq:DQ_ConformanceResult xmlns:mdq=\"" + Namespaces.MDQ + '"' +
                                          " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
-                "  <gmd:explanation>\n" +
+                "  <mdq:explanation>\n" +
                 "    <gco:CharacterString>An explanation</gco:CharacterString>\n" +
-                "  </gmd:explanation>\n" +
-                "  <gmd:pass gco:nilReason=\"missing\"/>\n" +
-                "</gmd:DQ_ConformanceResult>";
+                "  </mdq:explanation>\n" +
+                "  <mdq:pass gco:nilReason=\"missing\"/>\n" +
+                "</mdq:DQ_ConformanceResult>";
 
-        final ConformanceResult result = (ConformanceResult) XML.unmarshal(expected);
+        final ConformanceResult result = unmarshal(ConformanceResult.class, expected);
         assertEquals("explanation", "An explanation", result.getExplanation().toString());
 
         final Boolean pass = result.pass();
@@ -104,9 +104,9 @@ public final strictfp class NilReasonMar
         assertNotSame("Expected a sentinel value.", Boolean.FALSE, pass);
         assertSame("nilReason", NilReason.MISSING, NilReason.forObject(pass));
 
-        final String actual = XML.marshal(result);
+        final String actual = marshal(result);
         assertXmlEquals(expected, actual, "xmlns:*");
-        assertEquals(result, XML.unmarshal(actual));
+        assertEquals(result, unmarshal(ConformanceResult.class, actual));
     }
 
     /**
@@ -121,12 +121,12 @@ public final strictfp class NilReasonMar
     @SuppressWarnings("UnnecessaryBoxing")
     public void testMissingInteger() throws JAXBException {
         final String expected =
-                "<gmd:MD_Dimension xmlns:gmd=\"" + Namespaces.GMD + '"' +
+                "<msr:MD_Dimension xmlns:msr=\"" + Namespaces.MSR + '"' +
                                  " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
-                "  <gmd:dimensionSize gco:nilReason=\"unknown\"/>\n" +
-                "</gmd:MD_Dimension>";
+                "  <msr:dimensionSize gco:nilReason=\"unknown\"/>\n" +
+                "</msr:MD_Dimension>";
 
-        final Dimension result = (Dimension) XML.unmarshal(expected);
+        final Dimension result = unmarshal(Dimension.class, expected);
 
         final Integer size = result.getDimensionSize();
         assertNotNull("Expected a sentinel value.", size);
@@ -134,9 +134,9 @@ public final strictfp class NilReasonMar
         assertNotSame("Expected a sentinel value.", Integer.valueOf(0), size);
         assertSame("nilReason", NilReason.UNKNOWN, NilReason.forObject(size));
 
-        final String actual = XML.marshal(result);
+        final String actual = marshal(result);
         assertXmlEquals(expected, actual, "xmlns:*");
-        assertEquals(result, XML.unmarshal(actual));
+        assertEquals(result, unmarshal(Dimension.class, actual));
     }
 
     /**
@@ -148,13 +148,13 @@ public final strictfp class NilReasonMar
     @DependsOnMethod("testMissing")
     public void testMissingDouble() throws JAXBException {
         final String expected =
-                "<gmd:MD_Band xmlns:gmd=\"" + Namespaces.GMD + '"' +
+                "<mrc:MD_Band xmlns:mrc=\"" + Namespaces.MRC + '"' +
                             " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
-                "  <gmd:minValue gco:nilReason=\"unknown\"/>\n" +
-                "  <gmd:peakResponse gco:nilReason=\"missing\"/>\n" +
-                "</gmd:MD_Band>";
+                "  <mrc:minValue gco:nilReason=\"unknown\"/>\n" +
+                "  <mrc:peakResponse gco:nilReason=\"missing\"/>\n" +
+                "</mrc:MD_Band>";
 
-        final Band result = (Band) XML.unmarshal(expected);
+        final Band result = unmarshal(Band.class, expected);
 
         final Double minValue = result.getMinValue();
         assertNotNull("Expected a sentinel value.", minValue);
@@ -166,9 +166,9 @@ public final strictfp class NilReasonMar
         assertTrue("Nil value shall be NaN.", peakResponse.isNaN());
         assertSame("nilReason", NilReason.UNKNOWN, NilReason.forObject(peakResponse));
 
-        final String actual = XML.marshal(result);
+        final String actual = marshal(result);
         assertXmlEquals(expected, actual, "xmlns:*");
-        assertEquals(result, XML.unmarshal(actual));
+        assertEquals(result, unmarshal(Band.class, actual));
     }
 
     /**
@@ -180,15 +180,15 @@ public final strictfp class NilReasonMar
     @DependsOnMethod("testMissing")
     public void testOther() throws JAXBException {
         final String expected =
-                "<gmd:CI_Citation xmlns:gmd=\"" + Namespaces.GMD + '"' +
+                "<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + '"' +
                                 " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
-                "  <gmd:title>\n" +
+                "  <cit:title>\n" +
                 "    <gco:CharacterString>A title</gco:CharacterString>\n" +
-                "  </gmd:title>\n" +
-                "  <gmd:series gco:nilReason=\"other:myReason\"/>\n" +
-                "</gmd:CI_Citation>";
+                "  </cit:title>\n" +
+                "  <cit:series gco:nilReason=\"other:myReason\"/>\n" +
+                "</cit:CI_Citation>";
 
-        final Citation citation = (Citation) XML.unmarshal(expected);
+        final Citation citation = unmarshal(Citation.class, expected);
         assertTitleEquals("citation", "A title", citation);
 
         final Series series = citation.getSeries();
@@ -201,9 +201,9 @@ public final strictfp class NilReasonMar
         assertEquals("Series[other:myReason]", series.toString());
         assertNull("All attributes are expected to be null.", series.getName());
 
-        final String actual = XML.marshal(citation);
+        final String actual = marshal(citation);
         assertXmlEquals(expected, actual, "xmlns:*");
-        assertEquals(citation, XML.unmarshal(actual));
+        assertEquals(citation, unmarshal(Citation.class, actual));
     }
 
     /**
@@ -215,15 +215,15 @@ public final strictfp class NilReasonMar
     @DependsOnMethod("testMissing")
     public void testURI() throws JAXBException {
         final String expected =
-                "<gmd:CI_Citation xmlns:gmd=\"" + Namespaces.GMD + '"' +
+                "<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + '"' +
                                 " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
-                "  <gmd:title>\n" +
+                "  <cit:title>\n" +
                 "    <gco:CharacterString>A title</gco:CharacterString>\n" +
-                "  </gmd:title>\n" +
-                "  <gmd:series gco:nilReason=\"http://www.myreason.org\"/>\n" +
-                "</gmd:CI_Citation>";
+                "  </cit:title>\n" +
+                "  <cit:series gco:nilReason=\"http://www.myreason.org\"/>\n" +
+                "</cit:CI_Citation>";
 
-        final Citation citation = (Citation) XML.unmarshal(expected);
+        final Citation citation = unmarshal(Citation.class, expected);
         assertTitleEquals("citation", "A title", citation);
 
         final Series series = citation.getSeries();
@@ -236,8 +236,8 @@ public final strictfp class NilReasonMar
         assertEquals("Series[http://www.myreason.org]", series.toString());
         assertNull("All attributes are expected to be null.", series.getName());
 
-        final String actual = XML.marshal(citation);
+        final String actual = marshal(citation);
         assertXmlEquals(expected, actual, "xmlns:*");
-        assertEquals(citation, XML.unmarshal(actual));
+        assertEquals(citation, unmarshal(Citation.class, actual));
     }
 }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/UUIDMarshallingTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -32,7 +32,7 @@ import static org.apache.sis.test.Metada
  * Tests the XML marshalling of object having {@code uuid} or {@code uuidref} attributes.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @version 1.0
  *
  * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-165">GEOTK-165</a>
  *
@@ -50,50 +50,50 @@ public final strictfp class UUIDMarshall
      * A XML with a {@code uuid} identifier in the {@code <gmd:CI_Series>} element.
      */
     private static final String IDENTIFIED_XML =
-            "<gmd:CI_Citation xmlns:gmd=\""   + Namespaces.GMD + '"' +
-                            " xmlns:gco=\""   + Namespaces.GCO + "\">\n" +
-            "  <gmd:title>\n" +
+            "<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + '"' +
+                            " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+            "  <cit:title>\n" +
             "    <gco:CharacterString>My data</gco:CharacterString>\n" +
-            "  </gmd:title>\n" +
-            "  <gmd:series>\n" +
-            "    <gmd:CI_Series uuid=\"" + UUID_VALUE + "\">\n" +
-            "      <gmd:name>\n" +
+            "  </cit:title>\n" +
+            "  <cit:series>\n" +
+            "    <cit:CI_Series uuid=\"" + UUID_VALUE + "\">\n" +
+            "      <cit:name>\n" +
             "        <gco:CharacterString>My aggregate dataset</gco:CharacterString>\n" +
-            "      </gmd:name>\n" +
-            "    </gmd:CI_Series>\n" +
-            "  </gmd:series>\n" +
-            "</gmd:CI_Citation>";
+            "      </cit:name>\n" +
+            "    </cit:CI_Series>\n" +
+            "  </cit:series>\n" +
+            "</cit:CI_Citation>";
 
     /**
      * A XML with a {@code uuidref} identifier in the {@code <gmd:series>} element.
      * This XML declares the method body anyway, which is kind of contradictory with usage of reference.
      */
     private static final String REFERENCED_XML_WITH_BODY =
-            "<gmd:CI_Citation xmlns:gmd=\""   + Namespaces.GMD + '"' +
-                            " xmlns:gco=\""   + Namespaces.GCO + "\">\n" +
-            "  <gmd:title>\n" +
+            "<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + '"' +
+                            " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+            "  <cit:title>\n" +
             "    <gco:CharacterString>My data</gco:CharacterString>\n" +
-            "  </gmd:title>\n" +
-            "  <gmd:series uuidref=\"" + UUID_VALUE + "\">\n" +
-            "    <gmd:CI_Series>\n" +
-            "      <gmd:name>\n" +
+            "  </cit:title>\n" +
+            "  <cit:series uuidref=\"" + UUID_VALUE + "\">\n" +
+            "    <cit:CI_Series>\n" +
+            "      <cit:name>\n" +
             "        <gco:CharacterString>My aggregate dataset</gco:CharacterString>\n" +
-            "      </gmd:name>\n" +
-            "    </gmd:CI_Series>\n" +
-            "  </gmd:series>\n" +
-            "</gmd:CI_Citation>";
+            "      </cit:name>\n" +
+            "    </cit:CI_Series>\n" +
+            "  </cit:series>\n" +
+            "</cit:CI_Citation>";
 
     /**
      * A XML with a {@code uuidref} identifier in the {@code <gmd:series>} element.
      */
     private static final String REFERENCED_XML =
-            "<gmd:CI_Citation xmlns:gmd=\""   + Namespaces.GMD + '"' +
-                            " xmlns:gco=\""   + Namespaces.GCO + "\">\n" +
-            "  <gmd:title>\n" +
+            "<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + '"' +
+                            " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+            "  <cit:title>\n" +
             "    <gco:CharacterString>My data</gco:CharacterString>\n" +
-            "  </gmd:title>\n" +
-            "  <gmd:series uuidref=\"" + UUID_VALUE + "\"/>\n" +
-            "</gmd:CI_Citation>";
+            "  </cit:title>\n" +
+            "  <cit:series uuidref=\"" + UUID_VALUE + "\"/>\n" +
+            "</cit:CI_Citation>";
 
     /**
      * Tests (un)marshalling of an object identified by the {@code uuid} attribute.
@@ -101,18 +101,18 @@ public final strictfp class UUIDMarshall
      * in the {@code <gmd:CI_Series>} element of the following XML fragment:
      *
      * {@preformat xml
-     *   <gmd:CI_Citation>
-     *     <gmd:title>
+     *   <cit:CI_Citation>
+     *     <cit:title>
      *       <gco:CharacterString>My data</gco:CharacterString>
-     *     </gmd:title>
-     *     <gmd:series>
-     *       <gmd:CI_Series uuid="f8f5fcb1-d57b-4013-b3a4-4eaa40df6dcf">
-     *         <gmd:name>
+     *     </cit:title>
+     *     <cit:series>
+     *       <cit:CI_Series uuid="f8f5fcb1-d57b-4013-b3a4-4eaa40df6dcf">
+     *         <cit:name>
      *           <gco:CharacterString>My aggregate dataset</gco:CharacterString>
-     *         </gmd:name>
-     *       </gmd:CI_Series>
-     *     </gmd:series>
-     *   </gmd:CI_Citation>
+     *         </cit:name>
+     *       </cit:CI_Series>
+     *     </cit:series>
+     *   </cit:CI_Citation>
      * }
      *
      * On an implementation note, the {@code uuid} and other attributes of the {@code <gmd:CI_Series>}
@@ -152,18 +152,18 @@ public final strictfp class UUIDMarshall
      * in the {@code <gmd:series>} property of the following XML fragment:</p>
      *
      * {@preformat xml
-     *   <gmd:CI_Citation>
-     *     <gmd:title>
+     *   <cit:CI_Citation>
+     *     <cit:title>
      *       <gco:CharacterString>My data</gco:CharacterString>
-     *     </gmd:title>
-     *     <gmd:series uuidref="f8f5fcb1-d57b-4013-b3a4-4eaa40df6dcf">
-     *       <gmd:CI_Series>
-     *         <gmd:name>
+     *     </cit:title>
+     *     <cit:series uuidref="f8f5fcb1-d57b-4013-b3a4-4eaa40df6dcf">
+     *       <cit:CI_Series>
+     *         <cit:name>
      *           <gco:CharacterString>My aggregate dataset</gco:CharacterString>
-     *         </gmd:name>
-     *       </gmd:CI_Series>
-     *     </gmd:series>
-     *   </gmd:CI_Citation>
+     *         </cit:name>
+     *       </cit:CI_Series>
+     *     </cit:series>
+     *   </cit:CI_Citation>
      * }
      *
      * On an implementation note, the {@code uuidref}, {@code xlink:href} and other attributes of the

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -37,7 +37,7 @@ import static org.apache.sis.test.TestUt
  * Tests the XML marshalling of object having {@code xlink} attribute.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @version 1.0
  *
  * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-165">GEOTK-165</a>
  *
@@ -50,26 +50,27 @@ public final strictfp class XLinkMarshal
      * A XML with a {@code xlink:href} without element definition.
      */
     private static final String LINK_ONLY_XML =
-            "<gmd:MD_Metadata xmlns:gmd=\""   + Namespaces.GMD + '"' +
+            "<mdb:MD_Metadata xmlns:mdb=\""   + Namespaces.MDB + '"' +
                             " xmlns:xlink=\"" + Namespaces.XLINK + "\">\n" +
-            "  <gmd:identificationInfo xlink:href=\"http://test.net\"/>\n" +
-            "</gmd:MD_Metadata>";
+            "  <mdb:identificationInfo xlink:href=\"http://test.net\"/>\n" +
+            "</mdb:MD_Metadata>";
 
     /**
      * A XML with a {@code xlink:href} without element definition.
      */
     private static final String LINK_WITH_ELEMENT_XML =
-            "<gmd:MD_Metadata xmlns:gmd=\""   + Namespaces.GMD + '"' +
+            "<mdb:MD_Metadata xmlns:mdb=\""   + Namespaces.MDB + '"' +
+                            " xmlns:mri=\""   + Namespaces.MRI + '"' +
                             " xmlns:gco=\""   + Namespaces.GCO + '"' +
                             " xmlns:xlink=\"" + Namespaces.XLINK + "\">\n" +
-            "  <gmd:identificationInfo xlink:href=\"http://test.net\">\n" +
-            "    <gmd:MD_DataIdentification>\n" +
-            "      <gmd:abstract>\n" +
+            " <mdb:identificationInfo xlink:href=\"http://test.net\">\n" +
+            "    <mri:MD_DataIdentification>\n" +
+            "      <mri:abstract>\n" +
             "        <gco:CharacterString>This is a test.</gco:CharacterString>\n" +
-            "      </gmd:abstract>\n" +
-            "    </gmd:MD_DataIdentification>\n" +
-            "  </gmd:identificationInfo>\n" +
-            "</gmd:MD_Metadata>";
+            "      </mri:abstract>\n" +
+            "    </mri:MD_DataIdentification>\n" +
+            "  </mdb:identificationInfo>\n" +
+            "</mdb:MD_Metadata>";
 
     /**
      * Verifies if the given metadata contains the expected {@code xlink:href} attribute value.
@@ -90,9 +91,9 @@ public final strictfp class XLinkMarshal
      * The XML fragment is:
      *
      * {@preformat xml
-     *   <gmd:MD_Metadata>
-     *     <gmd:identificationInfo xlink:href="http://test.net"/>
-     *   </gmd:MD_Metadata>
+     *   <mdb:MD_Metadata>
+     *     <mdb:identificationInfo xlink:href="http://test.net"/>
+     *   </mdb:MD_Metadata>
      * }
      *
      * @throws JAXBException if an error occurred during (un)marshalling.
@@ -107,7 +108,7 @@ public final strictfp class XLinkMarshal
         final DefaultMetadata metadata = new DefaultMetadata();
         metadata.setIdentificationInfo(Collections.singleton(identification));
 
-        assertXmlEquals(LINK_ONLY_XML, XML.marshal(metadata), "xmlns:*");
+        assertXmlEquals(LINK_ONLY_XML, marshal(metadata), "xmlns:*");
         verify(true, unmarshal(DefaultMetadata.class, LINK_ONLY_XML));
     }
 
@@ -116,15 +117,15 @@ public final strictfp class XLinkMarshal
      * The XML fragment is:
      *
      * {@preformat xml
-     *   <gmd:MD_Metadata>
-     *     <gmd:identificationInfo xlink:href="http://test.net">
-     *       <gmd:MD_DataIdentification>
-     *         <gmd:abstract>
+     *   <mdb:MD_Metadata>
+     *     <mdb:identificationInfo xlink:href="http://test.net">
+     *       <mdb:MD_DataIdentification>
+     *         <mdb:abstract>
      *           <gco:CharacterString>This is a test.</gco:CharacterString>
-     *         </gmd:abstract>
-     *       </gmd:MD_DataIdentification>
-     *     </gmd:identificationInfo>
-     *   </gmd:MD_Metadata>
+     *         </mdb:abstract>
+     *       </mdb:MD_DataIdentification>
+     *     </mdb:identificationInfo>
+     *   </mdb:MD_Metadata>
      * }
      *
      * @throws JAXBException if an error occurred during (un)marshalling.
@@ -140,7 +141,7 @@ public final strictfp class XLinkMarshal
         final DefaultMetadata metadata = new DefaultMetadata();
         metadata.setIdentificationInfo(Collections.singleton(identification));
 
-        assertXmlEquals(LINK_WITH_ELEMENT_XML, XML.marshal(metadata), "xmlns:*");
+        assertXmlEquals(LINK_WITH_ELEMENT_XML, marshal(metadata), "xmlns:*");
         final DefaultMetadata unmarshal = unmarshal(DefaultMetadata.class, LINK_WITH_ELEMENT_XML);
         verify(false, unmarshal);
         assertTrue(metadata.equals(unmarshal, ComparisonMode.DEBUG));

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml Tue Jan 16 15:48:34 2018
@@ -18,55 +18,67 @@
   under the License.
 -->
 
-<gmd:DQ_RelativeInternalPositionalAccuracy
-    xmlns:gmd = "http://www.isotc211.org/2005/gmd"
-    xmlns:gco = "http://www.isotc211.org/2005/gco"
+<mdq:DQ_RelativeInternalPositionalAccuracy
+    xmlns:mdq="http://standards.iso.org/iso/19157/-2/mdq/1.0"
+    xmlns:mcc="http://standards.iso.org/iso/19115/-3/mcc/1.0"
+    xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/1.0"
+    xmlns:lan="http://standards.iso.org/iso/19115/-3/lan/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/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd">
+    xsi:schemaLocation = "http://standards.iso.org/iso/19157/-2/mdq/1.0 http://standards.iso.org/iso/19157/-2/mdq/1.0/mdq.xsd
+                          http://standards.iso.org/iso/19115/-3/lan/1.0 http://standards.iso.org/iso/19115/-3/lan/1.0/lan.xsd">
 
   <!--
-    The <nameOfMeasure> element below is the main purpose of MetadataMarshallingTest.testPositionalAccuracy().
-    The <result> element was added only in order to allow validation of this XML file, with the addition of an
-    opportunist check of xsi:type declaration.
+    The <measure> element below is the main purpose of MetadataMarshallingTest.testPositionalAccuracy().
+    The <result> element was added only in order to allow validation of this XML file, with the addition
+    of an opportunist check of xsi:type declaration.
   -->
-  <gmd:nameOfMeasure xsi:type="gmd:PT_FreeText_PropertyType">
-    <gco:CharacterString>Quantitative quality measure focusing on the effective class percent regarded to the total surface size</gco:CharacterString>
-    <gmd:PT_FreeText>
-      <gmd:textGroup>
-        <gmd:LocalisedCharacterString locale="#locale-fra">Mesure qualité quantitative de type pourcentage de représentation de la classe par rapport à la surface totale</gmd:LocalisedCharacterString>
-      </gmd:textGroup>
-    </gmd:PT_FreeText>
-  </gmd:nameOfMeasure>
-  <gmd:result>
+  <mdq:measure>
+   <mdq:DQ_MeasureReference>
+      <mdq:measureIdentification>
+         <mcc:MD_Identifier>
+            <mcc:code xsi:type="lan:PT_FreeText_PropertyType">
+              <gco:CharacterString>Quantitative quality measure focusing on the effective class percent regarded to the total surface size</gco:CharacterString>
+              <lan:PT_FreeText>
+                <lan:textGroup>
+                  <lan:LocalisedCharacterString locale="#locale-fra">Mesure qualité quantitative de type pourcentage de représentation de la classe par rapport à la surface totale</lan:LocalisedCharacterString>
+                </lan:textGroup>
+              </lan:PT_FreeText>
+            </mcc:code>
+         </mcc:MD_Identifier>
+      </mdq:measureIdentification>
+   </mdq:DQ_MeasureReference>
+  </mdq:measure>
+  <mdq:result>
     <!--
       The xsi:type declaration below is useless, but we put it
       in order to test that it does not break unmarshalling.
     -->
-    <gmd:DQ_ConformanceResult xsi:type="gmd:DQ_ConformanceResult_Type">
-      <gmd:specification>
-        <gmd:CI_Citation>
-          <gmd:title>
+    <mdq:DQ_ConformanceResult xsi:type="mdq:DQ_ConformanceResult_Type">
+      <mdq:specification>
+        <cit:CI_Citation>
+          <cit:title>
             <gco:CharacterString>Some documentation for a conformance test.</gco:CharacterString>
-          </gmd:title>
-          <gmd:date>
-            <gmd:CI_Date>
-              <gmd:date>
+          </cit:title>
+          <cit:date>
+            <cit:CI_Date>
+              <cit:date>
                 <!-- Dummy date for the purpose of this test. -->
                 <gco:DateTime>2009-08-12T19:40:17.653+02:00</gco:DateTime>
-              </gmd:date>
-              <gmd:dateType>
-                <gmd:CI_DateTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">Creation</gmd:CI_DateTypeCode>
-              </gmd:dateType>
-            </gmd:CI_Date>
-          </gmd:date>
-        </gmd:CI_Citation>
-      </gmd:specification>
-      <gmd:explanation>
+              </cit:date>
+              <cit:dateType>
+                <cit:CI_DateTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">Creation</cit:CI_DateTypeCode>
+              </cit:dateType>
+            </cit:CI_Date>
+          </cit:date>
+        </cit:CI_Citation>
+      </mdq:specification>
+      <mdq:explanation>
         <gco:CharacterString>We should explain here what a test conformance means.</gco:CharacterString>
-      </gmd:explanation>
-      <gmd:pass>
+      </mdq:explanation>
+      <mdq:pass>
         <gco:Boolean>true</gco:Boolean>
-      </gmd:pass>
-    </gmd:DQ_ConformanceResult>
-  </gmd:result>
-</gmd:DQ_RelativeInternalPositionalAccuracy>
+      </mdq:pass>
+    </mdq:DQ_ConformanceResult>
+  </mdq:result>
+</mdq:DQ_RelativeInternalPositionalAccuracy>

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -234,7 +234,7 @@ public class GO_CharacterString {
      *
      * <div class="note"><b>Note:</b>
      * we have to rely on a somewhat complicated mechanism because the code lists implementations in GeoAPI
-     * do not hae JAXB annotations. If those annotations are added in a future GeoAPI implementation, then
+     * do not have JAXB annotations. If those annotations are added in a future GeoAPI implementation, then
      * we could replace this mechanism by a simple property annotated with {@code XmlElementRef}.</div>
      *
      * @since 0.7
@@ -247,23 +247,15 @@ public class GO_CharacterString {
         }
         final ControlledVocabulary code = Types.forCodeTitle(text);
         final String name = Types.getListName(code);
-        final String namespace;
         /*
-         * The namespace is usually GMD, but we also have some other namespaces link GMI.
+         * The namespace is often MDB, but we also have some other namespaces link CIT.
          * The real namespace is declared in the @XmlElement annotation of the getElement
          * method in the JAXB adapter. We could use reflection, but we do not in order to
          * avoid potential class loading issue and also because not all CodeList are in the
          * same package.
          */
-        if (name.startsWith("MD_") || name.startsWith("CI_") || name.startsWith("DS_")) {
-            namespace = Namespaces.GMD;
-        } else if (name.startsWith("MI_")) {
-            namespace = Namespaces.GMI;
-        } else if (name.startsWith("SV_") || name.equals("DCPList")) {
-            namespace = Namespaces.SRV;
-        } else if (name.startsWith("CS_") || name.startsWith("CD_") || name.startsWith("SC_")) {
-            namespace = Namespaces.GML;
-        } else {
+        String namespace = Namespaces.guessForType(name);
+        if (namespace == null) {
             namespace = XMLConstants.NULL_NS_URI;
         }
         return new JAXBElement<>(new QName(namespace, name), CodeListUID.class,

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html [UTF-8] Tue Jan 16 15:48:34 2018
@@ -49,8 +49,8 @@
           for internal cross-references. It is not useful by itself as a persistent unique identifier.</li>
 
       <li><code>uuid</code> is an optional attribute available on every object-with-identity, provided in
-          the <strong>GMD</strong> schemas that implement ISO 19115 in XML. May be used as a persistent
-          unique identifier, but only available within GMD context.</li>
+          the <strong>GCO</strong> schemas that implement ISO 19115 in XML. May be used as a persistent
+          unique identifier, but only available within GCO context.</li>
     </ul>
 
     <p>However according the <a href="http://schemas.opengis.net/iso/19139/20070417/gco/gcoBase.xsd">OGC schema</a>,

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamResolver.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamResolver.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamResolver.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/FilteredStreamResolver.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -220,6 +220,17 @@ final class FilteredStreamResolver exten
     }
 
     /**
+     * Returns the namespace of the given ISO type, or {@code null} if unknown.
+     *
+     * @param  type  a class name defined by ISO 19115 or related standards (e.g. {@code "CI_Citation"}.
+     * @return a namespace for the given type, or {@code null} if unknown.
+     */
+    static String namespace(final String type) {
+        final Map<String,String> attributes = NAMESPACES.get(type);
+        return (attributes != null) ? attributes.get(TYPE_KEY) : null;
+    }
+
+    /**
      * Return the namespace used by implementation (the SIS classes with JAXB annotations)
      * in the context of the current part of the XML document being read.
      *

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -609,4 +609,54 @@ public final class Namespaces extends St
         }
         return defaultValue;
     }
+
+    /**
+     * Guesses the namespace for a type of the given ISO name. The argument given to this method
+     * must be a class name defined by ISO 19115 or other standards to be added in the future.
+     * Those ISO class names usually start with a two letter prefix, e.g. {@code "CI"}
+     * in {@link org.apache.sis.metadata.iso.citation.DefaultCitation CI_Citation}.
+     *
+     * <p>This method uses heuristic rules, first looking at the prefix, then the rest of the name in case of ambiguity.
+     * A namespace is returned on a <em>best effort</em> basis only; this method may or may not check the full name, and
+     * values returned by this method may change in future SIS versions (e.g. when new standards become supported by SIS
+     * or when existing standards are upgraded). This method should be used in last resort only, when this information
+     * can not be obtained easily in a more reliable way.</p>
+     *
+     * @param  type  a class name defined by ISO 19115 or related standards (e.g. {@code "CI_Citation"}.
+     * @return a <em>possible</em> namespace for the given type, or {@code null} if unknown.
+     *
+     * @since 1.0
+     */
+    public static String guessForType(final String type) {
+        /*
+         * Implementation note: we could invoke FilteredStreamResolver.namespace(type) unconditionally,
+         * but that method may be removed in a future SIS version if we replace FilteredStreamResolver
+         * by XSD (https://issues.apache.org/jira/projects/SIS/issues/SIS-381). By using a switch now,
+         * we reduce the behavioral change is SIS-381 is applied. It can also reduce classes loading.
+         */
+        if (type != null && type.length() >= 3) {
+            if (type.charAt(2) == '_') {
+                switch ((type.charAt(0) << Character.SIZE) | type.charAt(1)) {
+                    case ('C' << Character.SIZE) | 'I': return CIT;
+                    case ('E' << Character.SIZE) | 'X': return GEX;
+                    case ('F' << Character.SIZE) | 'C': return GFC;
+                    case ('L' << Character.SIZE) | 'E':
+                    case ('L' << Character.SIZE) | 'I': return MRL;
+                    case ('D' << Character.SIZE) | 'S': // Usually MDA except for DS_InitiativeTypeCode
+                    case ('M' << Character.SIZE) | 'D':
+                    case ('M' << Character.SIZE) | 'I': return FilteredStreamResolver.namespace(type);
+                    case ('M' << Character.SIZE) | 'X': return MDT;
+                    case ('P' << Character.SIZE) | 'T': return LAN;
+                    case ('S' << Character.SIZE) | 'V': return SRV;
+                    case ('C' << Character.SIZE) | 'S':
+                    case ('C' << Character.SIZE) | 'D':
+                    case ('S' << Character.SIZE) | 'C': return GML;
+                }
+            } else {
+                // Needs to handle at least DCPList
+                return FilteredStreamResolver.namespace(type);
+            }
+        }
+        return null;
+    }
 }

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=1821259&r1=1821258&r2=1821259&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] Tue Jan 16 15:48:34 2018
@@ -4,6 +4,13 @@
 # Lines with two-spaces  indentation are classes.
 # Lines with four-spaces indentation are attributes.
 #
+http://www.isotc211.org/2005/gmd
+  RS_Identifier
+    <type>
+    authority
+    code
+    codeSpace
+    version
 http://standards.iso.org/iso/19115/-3/cit/1.0
   CI_Address
     <type>
@@ -440,12 +447,6 @@ http://standards.iso.org/iso/19115/-3/md
     referenceSystemInfo
     resourceLineage
     spatialRepresentationInfo
-  RS_Identifier
-    <type>
-    authority
-    code
-    codeSpace
-    version
   URL
     <type>
 http://standards.iso.org/iso/19115/-3/mex/1.0
@@ -1003,7 +1004,7 @@ http://standards.iso.org/iso/19115/-3/sr
     serviceStandard
     serviceType
     serviceTypeVersion
-http://standards.iso.org/iso/19157/-2/dqc/1.0
+http://standards.iso.org/iso/19157/-2/mdq/1.0
   DQ_AbsoluteExternalPositionalAccuracy
     <type>
     dateTime

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/NamespacesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/NamespacesTest.java?rev=1821259&r1=1821258&r2=1821259&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/NamespacesTest.java [UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/xml/NamespacesTest.java [UTF-8] Tue Jan 16 15:48:34 2018
@@ -26,7 +26,7 @@ import static org.junit.Assert.*;
  * Tests the {@link Namespaces} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.8
  * @module
  */
@@ -38,4 +38,18 @@ public final strictfp class NamespacesTe
     public void testGetPreferredPrefix() {
         assertEquals("gml", Namespaces.getPreferredPrefix("http://www.opengis.net/gml/3.2", null));
     }
+
+    /**
+     * Tests {@link Namespaces#guessForType(String)}. This method uses {@code assertSame(…)} instead than
+     * {@code assertEquals(…)} for verifying that {@link FilteredStreamResolver} invoked {@link String#intern()}.
+     */
+    @Test
+    public void testGuessForType() {
+        assertSame("CI_Citation",           Namespaces.CIT, Namespaces.guessForType("CI_Citation"));
+        assertSame("EX_Extent",             Namespaces.GEX, Namespaces.guessForType("EX_Extent"));
+        assertSame("MD_Metadata",           Namespaces.MDB, Namespaces.guessForType("MD_Metadata"));
+        assertSame("MD_DataIdentification", Namespaces.MRI, Namespaces.guessForType("MD_DataIdentification"));
+        assertSame("DS_InitiativeTypeCode", Namespaces.MRI, Namespaces.guessForType("DS_InitiativeTypeCode"));
+        assertSame("DCPList",               Namespaces.SRV, Namespaces.guessForType("DCPList"));
+    }
 }



Mime
View raw message