sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1821010 - in /sis/branches/ISO-19115-3/core: sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/ sis-u...
Date Fri, 12 Jan 2018 17:48:32 GMT
Author: desruisseaux
Date: Fri Jan 12 17:48:32 2018
New Revision: 1821010

URL: http://svn.apache.org/viewvc?rev=1821010&view=rev
Log:
Adaptation of part 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-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/MetadataMock.java
      - copied, changed from r1821009, sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
Removed:
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/package-info.java

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -122,7 +122,7 @@ public final strictfp class CodeListMars
      */
     @Test
     public void testISO_URL() throws JAXBException {
-        final String expected = getResponsiblePartyXML(Schemas.ISO_19139_ROOT);
+        final String expected = getResponsiblePartyXML("http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/");
         final Responsibility rp = (Responsibility) XML.unmarshal(expected);
         assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole());
 
@@ -130,7 +130,7 @@ public final strictfp class CodeListMars
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.setProperty(XML.METADATA_VERSION, LegacyNamespaces.ISO_19139);
         marshaller.setProperty(XML.SCHEMAS, Collections.singletonMap("gmd",
-                "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas"));
// Intentionally omit trailing '/'.
+                "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas"));
    // Intentionally omit trailing '/'.
         final String actual = marshal(marshaller, rp);
         pool.recycle(marshaller);
         assertXmlEquals(expected, actual, "xmlns:*");

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -17,10 +17,13 @@
 package org.apache.sis.metadata.iso.identification;
 
 import javax.xml.bind.JAXBException;
-import org.apache.sis.xml.XML;
+import org.opengis.metadata.identification.RepresentativeFraction;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.IdentifierSpace;
-import org.apache.sis.test.TestCase;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.util.Version;
+import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.test.DependsOnMethod;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -30,11 +33,36 @@ import static org.apache.sis.test.Assert
  * Tests {@link DefaultRepresentativeFraction}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.4
  * @module
  */
-public final strictfp class DefaultRepresentativeFractionTest extends TestCase {
+public final strictfp class DefaultRepresentativeFractionTest extends XMLTestCase {
+    /**
+     * {@code false} if testing ISO 19115-3 document, or {@code true} if testing ISO 19139:2007
document.
+     */
+    private boolean legacy;
+
+    /**
+     * Verifies that marshalling the given metadata produces the expected XML document,
+     * then verifies that unmarshalling that document gives back the original metadata object.
+     * If {@link #legacy} is {@code true}, then this method will use ISO 19139:2007 schema.
+     */
+    private void roundtrip(final RepresentativeFraction browse, String expected) throws JAXBException
{
+        final String  actual;
+        final Version version;
+        if (legacy) {
+            expected = toLegacyXML(expected);
+            version  = LegacyNamespaces.ISO_19139;
+        } else {
+            version  = LegacyNamespaces.ISO_19115_3;
+        }
+        actual = marshal(browse, version);
+        assertXmlEquals(expected, actual, "xmlns:*");
+        assertEquals(browse, unmarshal(RepresentativeFraction.class, actual));
+    }
+
     /**
      * Test {@link DefaultRepresentativeFraction#setScale(double)}.
      */
@@ -50,27 +78,36 @@ public final strictfp class DefaultRepre
     }
 
     /**
-     * Tests XML marshalling of identifiers.
+     * Tests XML marshalling using ISO 19115-3 schema.
+     * This XML fragment contains an identifier.
      *
-     * @throws JAXBException Should never happen.
+     * @throws JAXBException if an error occurred during marshalling.
      */
     @Test
-    public void testIdentifiers() throws JAXBException {
+    public void testMarshalling() throws JAXBException {
         final DefaultRepresentativeFraction fraction = new DefaultRepresentativeFraction(8);
         fraction.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "scale");
-        final String xml = XML.marshal(fraction);
-        assertXmlEquals(
-                "<gmd:MD_RepresentativeFraction xmlns:gmd=\"" + Namespaces.GMD + '"' +
+        roundtrip(fraction,
+                "<mri:MD_RepresentativeFraction xmlns:mri=\"" + Namespaces.MRI + '"' +
                                               " xmlns:gco=\"" + Namespaces.GCO + '"' +
                                               " id=\"scale\">\n" +
-                "  <gmd:denominator>\n" +
+                "  <mri:denominator>\n" +
                 "    <gco:Integer>8</gco:Integer>\n" +
-                "  </gmd:denominator>\n" +
-                "</gmd:MD_RepresentativeFraction>", xml, "xmlns:*");
-        /*
-         * Unmarshal the element back to a Java object and compare to the original.
-         */
-        assertEquals(fraction, XML.unmarshal(xml));
+                "  </mri:denominator>\n" +
+                "</mri:MD_RepresentativeFraction>");
+    }
+
+    /**
+     * Tests XML marshalling using ISO 19139:2007 schema.
+     * This XML fragment contains an identifier.
+     *
+     * @throws JAXBException if an error occurred during marshalling.
+     */
+    @Test
+    @DependsOnMethod("testMarshalling")
+    public void testMarshallingLegacy() throws JAXBException {
+        legacy = true;
+        testMarshalling();
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -53,12 +53,8 @@ public final class Schemas {
     public static final String GML_XSD = "http://schemas.opengis.net/gml/3.2.1/gml.xsd";
 
     /**
-     * The XSD definition for 193139 metadata objects.
-     */
-    public static final String METADATA_XSD_LEGACY = "http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd";
-
-    /**
      * The XSD definition for the root of ISO 19115-3 metadata objects.
+     * Most metadata XSD paths start with {@value #METADATA_ROOT}, but not all.
      */
     public static final String METADATA_XSD_BASE           = "http://standards.iso.org/iso/19115/-3/mdb/1.0/mdb.xsd",
                                METADATA_XSD_SPATIAL        = "http://standards.iso.org/iso/19115/-3/msr/1.0/msr.xsd",
@@ -74,25 +70,30 @@ public final class Schemas {
                                METADATA_XSD_ACQUISITION    = "http://standards.iso.org/iso/19115/-3/mac/1.0/mac.xsd";
 
     /**
-     * The root directory of OGC metadata schemas.
+     * The root directory of ISO 19115 metadata schemas.
      * This is the schema used by default in Apache SIS.
      */
-    public static final String METADATA_ROOT_LEGACY = "http://schemas.opengis.net/iso/19139/20070417/";
+    public static final String METADATA_ROOT = "http://standards.iso.org/iso/19115/";
 
     /**
      * The root directory of OGC metadata schemas.
      * This is the schema used by default in Apache SIS.
+     * Some alternatives to this URL are:
+     *
+     * <ul>
+     *   <li>http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/</li>
+     *   <li>http://www.isotc211.org/2005/</li>
+     * </ul>
      */
-    public static final String METADATA_ROOT = "http://standards.iso.org/iso/19115/";
+    public static final String METADATA_ROOT_LEGACY = "http://schemas.opengis.net/iso/19139/20070417/";
 
     /**
-     * The root directory of ISO 19115-3 metadata schemas.
-     * This is sometime used as an alternative to {@link #METADATA_ROOT_LEGACY}.
+     * The string to append to {@link #METADATA_ROOT} for obtaining the path to the definitions
of code lists.
      */
-    public static final String ISO_19139_ROOT = "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/";
+    public static final String CODELISTS_PATH = "resources/Codelist/cat/codelists.xml";
 
     /**
-     * The string to append to {@link #METADATA_ROOT_LEGACY} or {@link #ISO_19139_ROOT} for
obtaining the path
+     * The string to append to {@link #METADATA_ROOT_LEGACY} or one of its alternative for
obtaining the path
      * to the definitions of code lists.
      *
      * <p>A localized version of this file exists also with the {@code "ML_gmxCodelists.xml"}
filename
@@ -103,14 +104,7 @@ public final class Schemas {
     public static final String CODELISTS_PATH_LEGACY = "resources/Codelist/gmxCodelists.xml";
 
     /**
-     * The string to append to {@link #METADATA_ROOT} for obtaining the path to the definitions
of code lists.
-     *
-     * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
-     */
-    public static final String CODELISTS_PATH = "resources/Codelist/cat/codelists.xml";
-
-    /**
-     * The string to append to {@link #METADATA_ROOT} or {@link #ISO_19139_ROOT} for obtaining
the path
+     * The string to append to {@link #METADATA_ROOT} or one of its alternative for obtaining
the path
      * to the definitions of units of measurement.
      *
      * <p>A localized version of this file exists also with the {@code "ML_gmxUom.xml"}
filename

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -35,7 +35,7 @@ import org.apache.sis.measure.Units;
 
 /**
  * A measurement value together with its unit of measure.
- * This is used for marshalling an element defined by ISO-19103.
+ * This is used for marshalling an element defined by ISO 19103.
  *
  * <p>This class duplicates {@code org.apache.sis.measure.Measure}, but we have to
do that way
  * because that {@code Measure} extends {@link Number} and we are not allowed to use the
@@ -48,7 +48,7 @@ import org.apache.sis.measure.Units;
  *
  * {@preformat xml
  *   <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>
  * }
  *
@@ -63,7 +63,7 @@ import org.apache.sis.measure.Units;
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  *
  * @see org.apache.sis.internal.jaxb.gml.MeasureList
  * @see org.apache.sis.internal.jaxb.gco.UnitAdapter
@@ -121,7 +121,7 @@ public final class Measure {
     }
 
     /**
-     * Constructs a string representation of the units as defined in the ISO-19103 standard.
+     * Constructs a string representation of the units as defined in the ISO 19103 standard.
      * This method is invoked during XML marshalling. For example if the units are "metre",
      * then this method returns one of the following strings, in preference order:
      *
@@ -129,10 +129,11 @@ public final class Measure {
      *     urn:ogc:def:uom:EPSG::9001
      * }
      *
-     * or
+     * or one of the following:
      *
      * {@preformat text
      *     http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])
+     *     http://www.isotc211.org/2005/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])
      * }
      *
      * @return the string representation of the unit of measure.
@@ -165,15 +166,26 @@ public final class Measure {
         if (unit == null || unit.equals(Units.UNITY)) {
             return "";
         }
-        // Changed to METADATA_ROOT_LEGACY while updating to ISO 19115-3
-        final StringBuilder buffer = Context.schema(Context.current(), "gmd", Schemas.METADATA_ROOT_LEGACY)
-                                            .append(Schemas.UOM_PATH).append("#xpointer(//*[@gml:id='");
+        final StringBuilder link;
+        final Context context = Context.current();
+        /*
+         * We have not yet found an ISO 19115-3 URL for units of measurement.
+         * If we find one, we should use a block like below:
+         *
+         * if (Context.isFlagSet(context, Context.LEGACY_METADATA)) {
+         *     link = ... new URL ...
+         * } else {
+         *     link = current code
+         * }
+         */
+        link = Context.schema(context, "gmd", Schemas.METADATA_ROOT_LEGACY);
+        link.append(Schemas.UOM_PATH).append("#xpointer(//*[@gml:id='");
         try {
-            UCUM.format(unit, buffer);
+            UCUM.format(unit, link);
         } catch (IOException e) {
             throw new AssertionError(e);        // Should never happen since we wrote to
a StringBuilder.
         }
-        return buffer.append("'])").toString();
+        return link.append("'])").toString();
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8]
(original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8]
Fri Jan 12 17:48:32 2018
@@ -143,12 +143,12 @@ public final class XML extends Static {
      *
      * <ul>
      *   <li>The value of the {@code codeList} attribute when marshalling subclasses
of
-     *       {@link org.opengis.util.CodeList} in ISO 19115-3 compliant XML document.</li>
-     *   <li>The value of the {@code uom} attribute when marshalling measures (for
example
-     *       {@code <gco:Distance>}) in ISO 19115-3 compliant XML document.</li>
+     *       {@link org.opengis.util.CodeList}.</li>
+     *   <li>The value of the {@code uom} attribute when marshalling measures
+     *       (for example {@code <gco:Distance>}).</li>
      * </ul>
      *
-     * As of SIS 0.3, only one {@code Map} key is recognized: {@code "gmd"}, which stands
+     * Only one {@code Map} key is currently recognized: {@code "gmd"}, which stands
      * for the legacy ISO 19139:2007 schemas. Additional keys, if any, are ignored.
      * Future SIS versions may recognize more keys.
      *
@@ -157,6 +157,7 @@ public final class XML extends Static {
      *   <caption>Supported schemas</caption>
      *   <tr><th>Map key</th> <th>Typical values (choose only one)</th></tr>
      *   <tr><td><b>gmd</b></td><td>
+     *     http://www.isotc211.org/2005/<br>
      *     http://schemas.opengis.net/iso/19139/20070417/<br>
      *     http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/<br>
      *     http://eden.ign.fr/xsd/fra/20060922/

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -30,7 +30,6 @@ import org.apache.sis.internal.jaxb.Sche
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.test.mock.MetadataMock;
 import org.junit.BeforeClass;
 import org.junit.AfterClass;
 import org.junit.Test;
@@ -42,6 +41,8 @@ import static org.apache.sis.internal.ut
 
 /**
  * Tests the XML marshaling of {@code Locale} when used for a language.
+ * The locale is marshalled as a character string. This format was used by ISO 19139:2007
+ * but is not used anymore in ISO 19115-3 (the newer version use {@code PT_Locale} instead).
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.0
@@ -122,14 +123,14 @@ public final strictfp class LanguageCode
 
     /**
      * Tests marshalling of {@code <gmd:LanguageCode>}.
-     * The result shall be as documented in {@link #testLanguageCode()}.
+     * The result shall be as documented in {@link #testMarshalLanguageCode()}.
      *
      * @throws JAXBException if an error occurs while marshalling the language.
      *
-     * @see #testMarshallCharacterString()
+     * @see #testMarshalCharacterString()
      */
     @Test
-    public void testMarshallLanguageCode() throws JAXBException {
+    public void testMarshalLanguageCode() throws JAXBException {
         final MetadataMock metadata = new MetadataMock(Locale.JAPANESE);
         final Marshaller marshaller = pool.acquireMarshaller();
         assertNull(marshaller.getProperty(XML.STRING_SUBSTITUTES));
@@ -151,10 +152,10 @@ public final strictfp class LanguageCode
      *
      * @throws JAXBException if an error occurs while unmarshalling the language.
      *
-     * @see #testMarshallLanguageCode()
+     * @see #testMarshalLanguageCode()
      */
     @Test
-    public void testLanguageCode() throws JAXBException {
+    public void testUnmarshalLanguageCode() throws JAXBException {
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final String xml = getMetadataXML(LANGUAGE_CODE);
         final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
@@ -176,7 +177,7 @@ public final strictfp class LanguageCode
      * @throws JAXBException if an error occurs while unmarshalling the language.
      */
     @Test
-    @DependsOnMethod("testLanguageCode")
+    @DependsOnMethod("testMarshalLanguageCode")
     public void testLanguageCodeWithoutAttributes() throws JAXBException {
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final String xml = getMetadataXML(LANGUAGE_CODE_WITHOUT_ATTRIBUTE);
@@ -187,14 +188,14 @@ public final strictfp class LanguageCode
 
     /**
      * Tests marshalling of {@code <gco:CharacterString>}, which require explicit marshaller
configuration.
-     * The result shall be as documented in {@link #testCharacterString()}.
+     * The result shall be as documented in {@link #testUnmarshalCharacterString()}.
      *
      * @throws JAXBException if an error occurs while marshalling the language.
      *
-     * @see #testMarshallLanguageCode()
+     * @see #testMarshalLanguageCode()
      */
     @Test
-    public void testMarshallCharacterString() throws JAXBException {
+    public void testMarshalCharacterString() throws JAXBException {
         final MetadataMock metadata = new MetadataMock(Locale.JAPANESE);
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.setProperty(XML.METADATA_VERSION, LegacyNamespaces.ISO_19139);
@@ -219,7 +220,7 @@ public final strictfp class LanguageCode
      * @throws JAXBException if an error occurs while unmarshalling the language.
      */
     @Test
-    public void testCharacterString() throws JAXBException {
+    public void testUnmarshalCharacterString() throws JAXBException {
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final String xml = getMetadataXML(CHARACTER_STRING);
         final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);

Copied: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/MetadataMock.java
(from r1821009, sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java)
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/MetadataMock.java?p2=sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/MetadataMock.java&p1=sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java&r1=1821009&r2=1821010&rev=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/MetadataMock.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.test.mock;
+package org.apache.sis.internal.jaxb.gmd;
 
 import java.util.Locale;
 import java.util.Collection;
@@ -22,14 +22,13 @@ import java.util.Collections;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.opengis.metadata.Metadata;
-import org.apache.sis.internal.jaxb.gmd.LocaleAdapter;
 import org.apache.sis.internal.simple.SimpleMetadata;
 import org.apache.sis.xml.Namespaces;
 
 
 /**
- * A dummy implementation of {@link Metadata} with minimal XML (un)marshalling capability.
+ * A dummy implementation of {@link org.opengis.metadata.Metadata} with minimal XML (un)marshalling
capability.
+ * Used for testing marshalling of legacy ISO 19139:2007 attributes.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 1.0
@@ -37,13 +36,14 @@ import org.apache.sis.xml.Namespaces;
  * @module
  */
 @XmlRootElement(name = "MD_Metadata", namespace = Namespaces.MDB)
-public final strictfp class MetadataMock extends SimpleMetadata {
+final strictfp class MetadataMock extends SimpleMetadata {
     /**
-     * The language used for documenting metadata.
+     * The language used for documenting metadata. The namespace should be {@code "gmd"},
+     * but we use the newer namespace because of the way {@code FilteredStreamResolver} work.
      */
     @XmlElement(namespace = Namespaces.MDB)
     @XmlJavaTypeAdapter(LocaleAdapter.class)
-    public Locale language;
+    private Locale language;
 
     /**
      * Creates an initially empty metadata.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -384,6 +384,8 @@ public abstract strictfp class XMLTestCa
     private static final String[] TO_LEGACY_XML = {
         Namespaces.CIT, LegacyNamespaces.GMD, "cit",  "gmd",
         Namespaces.MCC, LegacyNamespaces.GMD, "mcc",  "gmd",
+        Namespaces.MRI, LegacyNamespaces.GMD, "mri",  "gmd",
+        Namespaces.GCO, LegacyNamespaces.GCO,      // "gco"
         Namespaces.GCX, LegacyNamespaces.GMX, "gcx",  "gmx",
         Schemas.METADATA_ROOT,  Schemas.METADATA_ROOT_LEGACY,           // For code lists
         Schemas.CODELISTS_PATH, Schemas.CODELISTS_PATH_LEGACY

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/package-info.java?rev=1821010&r1=1821009&r2=1821010&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/package-info.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/test/mock/package-info.java
[UTF-8] Fri Jan 12 17:48:32 2018
@@ -33,7 +33,6 @@
  */
 @XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns =
{
     @XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
-    @XmlNs(prefix = "gmd", namespaceURI = Namespaces.GMD),
     @XmlNs(prefix = "gco", namespaceURI = Namespaces.GCO)
 })
 @XmlAccessorType(XmlAccessType.NONE)



Mime
View raw message