Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -44,7 +44,7 @@ import static org.apache.sis.test.Assert
  * Tests the {@link TreeTableFormat} applied to the formatting of metadata 
tree.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -94,14 +94,14 @@ public final strictfp class TreeTableFor
             "  │   └─Party………………………………………………………………… Testsuya Toyoda\n" +
             "  ├─Cited responsible party (2 of 2)\n" +
             "  │   ├─Role…………………………………………………………………… EDITOR\n" +
-            "  │   ├─Party………………………………………………………………… Kōdansha\n" +
-            "  │   └─Extent……………………………………………………………… World\n" +
-            "  │       └─Geographic element\n" +
-            "  │           ├─West bound longitude…… 180°W\n" +
-            "  │           ├─East bound longitude…… 180°E\n" +
-            "  │           ├─South bound latitude…… 90°S\n" +
-            "  │           ├─North bound latitude…… 90°N\n" +
-            "  │           └─Extent type code……………… true\n" +
+            "  │   ├─Extent……………………………………………………………… World\n" +
+            "  │   │   └─Geographic element\n" +
+            "  │   │       ├─West bound longitude…… 180°W\n" +
+            "  │   │       ├─East bound longitude…… 180°E\n" +
+            "  │   │       ├─South bound latitude…… 90°S\n" +
+            "  │   │       ├─North bound latitude…… 90°N\n" +
+            "  │   │       └─Extent type code……………… true\n" +
+            "  │   └─Party………………………………………………………………… Kōdansha\n" +
             "  ├─Presentation form (1 of 2)…………………… Document digital\n" +
             "  ├─Presentation form (2 of 2)…………………… Document hardcopy\n" +
             "  └─ISBN……………………………………………………………………………… 9782505004509\n", text);

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -36,7 +36,7 @@ import static org.apache.sis.test.TestUt
  * Unless otherwise specified, all tests use the {@link 
MetadataStandard#ISO_19115} constant.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -47,7 +47,7 @@ import static java.util.AbstractMap.Simp
  * Unless otherwise specified, all tests use the {@link 
MetadataStandard#ISO_19115} constant.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -77,8 +77,8 @@ public final strictfp class TypeMapTest
 //          new SimpleEntry<>("collectiveTitle",       
InternationalString.class),  -- deprecated as of ISO 19115:2014
             new SimpleEntry<>("ISBN",                  String.class),
             new SimpleEntry<>("ISSN",                  String.class),
-            new SimpleEntry<>("graphic",               BrowseGraphic.class),
-            new SimpleEntry<>("onlineResource",        OnlineResource.class)
+            new SimpleEntry<>("onlineResource",        OnlineResource.class),
+            new SimpleEntry<>("graphic",               BrowseGraphic.class)
         }, map.entrySet().toArray());
 
         assertEquals(InternationalString.class, map.get("alternateTitle"));

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -46,7 +46,7 @@ import static org.apache.sis.test.TestUt
  * Unless otherwise specified, all tests use the {@link 
MetadataStandard#ISO_19115} constant.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
  *
  * @see MetadataStandardTest#testValueMap()
  *
@@ -173,8 +173,8 @@ public final strictfp class ValueMapTest
             new SimpleEntry<>("citedResponsibleParties", 
singletonList(author)),
             new SimpleEntry<>("presentationForms",       emptySet()),
             new SimpleEntry<>("ISBN",                    "9782505004509"),
-            new SimpleEntry<>("graphics",                emptyList()),
-            new SimpleEntry<>("onlineResources",         emptyList())
+            new SimpleEntry<>("onlineResources",         emptyList()),
+            new SimpleEntry<>("graphics",                emptyList())
         }, all.entrySet().toArray());
     }
 
@@ -203,8 +203,8 @@ public final strictfp class ValueMapTest
             new SimpleEntry<>("citedResponsibleParties", 
singletonList(author)),
             new SimpleEntry<>("presentationForms",       emptySet()),
             new SimpleEntry<>("ISBN",                    "9782505004509"),
-            new SimpleEntry<>("graphics",                emptyList()),
-            new SimpleEntry<>("onlineResources",         emptyList())
+            new SimpleEntry<>("onlineResources",         emptyList()),
+            new SimpleEntry<>("graphics",                emptyList())
         }, all.entrySet().toArray());
     }
 
@@ -236,8 +236,8 @@ public final strictfp class ValueMapTest
 //          new SimpleEntry<>("collectiveTitle",         null),  -- deprecated 
as of ISO 19115:2014.
             new SimpleEntry<>("ISBN",                    "9782505004509"),
             new SimpleEntry<>("ISSN",                    null),
-            new SimpleEntry<>("graphics",                emptyList()),
-            new SimpleEntry<>("onlineResources",         emptyList())
+            new SimpleEntry<>("onlineResources",         emptyList()),
+            new SimpleEntry<>("graphics",                emptyList())
         }, all.entrySet().toArray());
     }
 

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -70,10 +70,10 @@ public final strictfp class APIVerifier
     @Test
     public void verifyISO1915() throws IOException, ClassNotFoundException, 
NoSuchMethodException {
         final Properties changes = new Properties();
-        final InputStream in = 
APIVerifier.class.getResourceAsStream("api-changes.properties");
-        assertNotNull("Missing test resource file.", in);
-        changes.load(in);
-        in.close();
+        try (InputStream in = 
APIVerifier.class.getResourceAsStream("api-changes.properties")) {
+            assertNotNull("Missing test resource file.", in);
+            changes.load(in);
+        }
         try {
             verifyAPI(MetadataStandard.ISO_19115, changes);
         } catch (AssertionError e) {

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -16,33 +16,28 @@
  */
 package org.apache.sis.metadata.iso;
 
-import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import org.opengis.util.CodeList;
 import org.opengis.annotation.UML;
-import org.opengis.annotation.Specification;
+import org.opengis.util.CodeList;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.metadata.MetadataStandard;
-import org.apache.sis.metadata.MetadataTestCase;
+import org.apache.sis.metadata.PropertyConsistencyCheck;
 import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.xml.Namespaces;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.junit.Assert.*;
-
 
 /**
  * Tests all known {@link ISOMetadata} subclasses for JAXB annotations and 
getter/setter methods.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn(org.apache.sis.metadata.PropertyAccessorTest.class)
-public final strictfp class AllMetadataTest extends MetadataTestCase {
+public final strictfp class AllMetadataTest extends PropertyConsistencyCheck {
     /**
      * A JUnit {@link Rule} for listening to log events. This field is public 
because JUnit requires us to
      * do so, but should be considered as an implementation details (it should 
have been a private field).
@@ -53,6 +48,7 @@ public final strictfp class AllMetadataT
     /**
      * Creates a new test case with all GeoAPI interfaces and code lists to 
test.
      */
+    @SuppressWarnings("deprecation")
     public AllMetadataTest() {
         super(MetadataStandard.ISO_19115,
             org.opengis.metadata.ApplicationSchemaInformation.class,
@@ -173,7 +169,6 @@ public final strictfp class AllMetadataT
             org.opengis.metadata.quality.QuantitativeResult.class,
             
org.opengis.metadata.quality.RelativeInternalPositionalAccuracy.class,
             org.opengis.metadata.quality.Result.class,
-            org.opengis.metadata.quality.Scope.class,
             org.opengis.metadata.quality.TemporalAccuracy.class,
             org.opengis.metadata.quality.TemporalConsistency.class,
             org.opengis.metadata.quality.TemporalValidity.class,
@@ -200,7 +195,9 @@ public final strictfp class AllMetadataT
     }
 
     /**
-     * Performs the test documented in the {@link MetadataTestCase} javadoc.
+     * {@inheritDoc}
+     * Once the test is completed, this method verifies that the expected 
warnings have been logged,
+     * and no unexpected logging occurred.
      */
     @Test
     @Override
@@ -214,87 +211,7 @@ public final strictfp class AllMetadataT
     }
 
     /**
-     * Returns the name of the XML element for the given UML element.
-     * This method checks for the special cases which are known to have 
different UML and XML names.
-     *
-     * @return {@inheritDoc}
-     */
-    @Override
-    protected String getExpectedXmlElementName(final Class<?> enclosing, final 
UML uml) {
-        String name = super.getExpectedXmlElementName(enclosing, uml);
-        switch (name) {
-            case "MD_Scope": {                  // ISO 19115:2014
-                name = "DQ_Scope";              // ISO 19115:2003
-                break;
-            }
-            case "distributedComputingPlatform": {
-                name = "DCP";
-                break;
-            }
-            case "stepDateTime": {
-                name = "dateTime";
-                break;
-            }
-            case "locale": {
-                if (enclosing == 
org.opengis.metadata.content.FeatureCatalogueDescription.class) {
-                    name = "language";
-                }
-                break;
-            }
-        }
-        return name;
-    }
-
-    /**
-     * Returns the expected namespace for an element defined by the given 
specification.
-     * For example the namespace of any type defined by {@link 
Specification#ISO_19115}
-     * is {@code "http://www.isotc211.org/2005/gmd"}.
-     *
-     * @return {@inheritDoc}
-     */
-    @Override
-    protected String getExpectedNamespace(final Class<?> impl, final 
Specification specification) {
-        if (impl == 
org.apache.sis.metadata.iso.identification.DefaultCoupledResource.class ||
-            impl == 
org.apache.sis.metadata.iso.identification.DefaultOperationChainMetadata.class 
||
-            impl == 
org.apache.sis.metadata.iso.identification.DefaultOperationMetadata.class ||
-            impl == 
org.apache.sis.metadata.iso.identification.DefaultServiceIdentification.class)
-        {
-            assertEquals(Specification.ISO_19115, specification);
-            return Namespaces.SRV;
-        }
-        return super.getExpectedNamespace(impl, specification);
-    }
-
-    /**
-     * Returns the type of the given element, or {@code null} if the type is 
not yet
-     * determined (the later cases could change in a future version).
-     *
-     * @return {@inheritDoc}
-     */
-    @Override
-    protected String getExpectedXmlTypeForElement(final Class<?> type, final 
Class<?> impl) {
-        final String rootName = type.getAnnotation(UML.class).identifier();
-        switch (rootName) {
-            // Following prefix was changed in ISO 19115 corrigendum,
-            // but ISO 19139 still use the old prefix.
-            case "SV_ServiceIdentification": {
-                return "MD_ServiceIdentification_Type";
-            }
-            // Following prefix was changed in ISO 19115:2014,
-            // but ISO 19139 still use the old prefix.
-            case "MD_Scope": {
-                return "DQ_Scope_Type";
-            }
-        }
-        final StringBuilder buffer = new StringBuilder(rootName.length() + 13);
-        if (impl.getSimpleName().startsWith("Abstract")) {
-            buffer.append("Abstract");
-        }
-        return buffer.append(rootName).append("_Type").toString();
-    }
-
-    /**
-     * Returns the ISO 19139 wrapper for the given GeoAPI type,
+     * Returns the ISO 19115-3 wrapper for the given GeoAPI type,
      * or {@code null} if no adapter is expected for the given type.
      *
      * @return {@inheritDoc}
@@ -310,32 +227,20 @@ public final strictfp class AllMetadataT
              */
             return null;
         }
-        String identifier = type.getAnnotation(UML.class).identifier();
-        if (identifier.equals("DQ_Scope")) {  // Old name in ISO 19115:2003
-            identifier = "MD_Scope";          // New name in ISO 19115:2014
-        }
         final String classname = "org.apache.sis.internal.jaxb." +
-              (CodeList.class.isAssignableFrom(type) ? "code" : "metadata") + 
'.' + identifier;
+                (CodeList.class.isAssignableFrom(type) ? "code" : "metadata") +
+                '.' + type.getAnnotation(UML.class).identifier();
         final Class<?> wrapper = Class.forName(classname);
-        assertTrue("Expected a final class for " + wrapper.getName(), 
Modifier.isFinal(wrapper.getModifiers()));
-        return wrapper;
-    }
-
-    /**
-     * Returns {@code true} if the given method is a non-standard extension.
-     * If {@code true}, then {@code method} does not need to have UML 
annotation.
-     *
-     * @param  method  the method to verify.
-     * @return {@code true} if the given method is an extension, or {@code 
false} otherwise.
-     *
-     * @since 0.5
-     */
-    @Override
-    protected boolean isExtension(final Method method) {
-        if 
(org.opengis.metadata.distribution.StandardOrderProcess.class.isAssignableFrom(method.getDeclaringClass()))
 {
-            return method.getName().equals("getCurrency");
+        Class<?>[] expectedFinalClasses = wrapper.getClasses();   // 
"Since2014" internal class.
+        if (expectedFinalClasses.length == 0) {
+            expectedFinalClasses = new Class<?>[] {wrapper};      // If no 
"Since2014", then wrapper itself should be final.
+        }
+        for (final Class<?> c : expectedFinalClasses) {
+            if (!Modifier.isFinal(c.getModifiers())) {
+                fail("Expected a final class for " + c.getName());
+            }
         }
-        return super.isExtension(method);
+        return wrapper;
     }
 
     /**

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

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -52,13 +52,24 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn(org.apache.sis.internal.metadata.OtherLocalesTest.class)
 public final strictfp class DefaultMetadataTest extends XMLTestCase implements 
WarningListener<Object> {
     /**
+     * A flag for tracing workarounds for allowing some tests to pass despite 
regression.
+     * This boolean should be set to {@code false} and removed after the 
following issues has been fixed:
+     *
+     * <ul>
+     *   <li><a 
href="https://issues.apache.org/jira/browse/SIS-402";>SIS-402</a></li>
+     * </ul>
+     */
+    public static final boolean REGRESSION = true;
+
+    /**
      * The resource key for the message of the warning that occurred while 
unmarshalling a XML fragment,
      * or {@code null} if none.
      */
@@ -118,9 +129,9 @@ public final strictfp class DefaultMetad
     @Test
     public void testEmptyCollection() throws JAXBException {
         final DefaultMetadata metadata = unmarshal(
-                "<gmd:MD_Metadata xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
-                "  <gmd:contact/>\n" +
-                "</gmd:MD_Metadata>");
+                "<mdb:MD_Metadata xmlns:mdb=\"" + Namespaces.MDB + "\">\n" +
+                "  <mdb:contact/>\n" +
+                "</mdb:MD_Metadata>");
         /*
          * Verify metadata property.
          */

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

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.metadata.iso.citation;
 
+import java.net.URI;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -28,6 +29,8 @@ import org.opengis.metadata.citation.Con
 import org.opengis.metadata.citation.DateType;
 import org.opengis.metadata.citation.Role;
 import org.opengis.metadata.citation.ResponsibleParty;
+import org.opengis.metadata.citation.OnLineFunction;
+import org.opengis.metadata.citation.OnlineResource;
 import org.opengis.metadata.citation.PresentationForm;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.xml.IdentifierMap;
@@ -36,6 +39,8 @@ import org.apache.sis.metadata.iso.exten
 import org.apache.sis.metadata.iso.DefaultIdentifier;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.iso.DefaultInternationalString;
+import org.apache.sis.util.Version;
+import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
@@ -48,7 +53,8 @@ import static org.apache.sis.test.Metada
  * Tests {@link DefaultCitation}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -59,6 +65,11 @@ public final strictfp class DefaultCitat
     private static final String XML_FILE = "Citation.xml";
 
     /**
+     * An XML file in this package containing a citation in the format of 
legacy ISO 19139:2007 specification.
+     */
+    private static final String XML_FILE_LEGACY = "Citation (legacy).xml";
+
+    /**
      * Creates a citation with an arbitrary title, presentation form and other 
properties.
      *
      * @return an arbitrary citation.
@@ -179,6 +190,19 @@ public final strictfp class DefaultCitat
     }
 
     /**
+     * Tests XML marshalling using the format derived form ISO 19115:2014 
model.
+     * This method also tests usage of {@code gml:id} and {@code xlink:href}.
+     *
+     * @throws JAXBException if an error occurred during marshalling.
+     *
+     * @since 1.0
+     */
+    @Test
+    public void testMarshalling() throws JAXBException {
+        testMarshalling(XML_FILE, VERSION_2014);
+    }
+
+    /**
      * Tests XML marshalling using the format derived form ISO 19115:2003 
model.
      * This method also tests usage of {@code gml:id} and {@code xlink:href}.
      *
@@ -187,8 +211,24 @@ public final strictfp class DefaultCitat
      * @since 0.7
      */
     @Test
-    public void testMarshalling() throws JAXBException {
-        final DefaultContact contact = new DefaultContact();
+    @DependsOnMethod("testMarshalling")
+    public void testMarshallingLegacy() throws JAXBException {
+        testMarshalling(XML_FILE_LEGACY, VERSION_2007);
+    }
+
+    /**
+     * Tests XML marshalling for the given metadata version.
+     *
+     * @param  file     file containing the expected metadata.
+     * @param  version  the metadata version to marshal.
+     */
+    private void testMarshalling(final String file, final Version version) 
throws JAXBException {
+        final DefaultOnlineResource rs = new 
DefaultOnlineResource(URI.create("https://tools.ietf.org/html/rfc1149";));
+        rs.setName("IP over Avian Carriers");
+        rs.setDescription(new SimpleInternationalString("High delay, low 
throughput, and low altitude service."));
+        rs.setFunction(OnLineFunction.OFFLINE_ACCESS);
+
+        final DefaultContact contact = new DefaultContact(rs);
         contact.setContactInstructions(new SimpleInternationalString("Send 
carrier pigeon."));
         contact.getIdentifierMap().putSpecialized(IdentifierSpace.ID, 
"ip-protocol");
         final DefaultCitation c = new DefaultCitation("Fight against poverty");
@@ -198,7 +238,24 @@ public final strictfp class DefaultCitat
         r2.setParties(Collections.singleton(new DefaultIndividual("Robin 
Hood",  null, contact)));
         c.setCitedResponsibleParties(Arrays.asList(r1, r2));
         c.getDates().add(new 
DefaultCitationDate(TestUtilities.date("2015-10-17 00:00:00"), 
DateType.valueOf("adopted")));
-        assertMarshalEqualsFile(XML_FILE, c, "xlmns:*", "xsi:schemaLocation");
+        
c.getPresentationForms().add(PresentationForm.valueOf("physicalObject"));
+        /*
+         * Check that XML file built by the marshaller is the same as the 
example file.
+         */
+        assertMarshalEqualsFile(file, c, version, "xmlns:*", 
"xsi:schemaLocation");
+    }
+
+    /**
+     * Tests XML unmarshalling using the format derived form ISO 19115:2014 
model.
+     * This method also tests usage of {@code gml:id} and {@code xlink:href}.
+     *
+     * @throws JAXBException if an error occurred during unmarshalling.
+     *
+     * @since 1.0
+     */
+    @Test
+    public void testUnmarshalling() throws JAXBException {
+        testUnmarshalling(XML_FILE);
     }
 
     /**
@@ -210,19 +267,37 @@ public final strictfp class DefaultCitat
      * @since 0.7
      */
     @Test
-    public void testUnmarshalling() throws JAXBException {
-        final DefaultCitation c = unmarshalFile(DefaultCitation.class, 
XML_FILE);
+    @DependsOnMethod("testUnmarshalling")
+    public void testUnmarshallingLegacy() throws JAXBException {
+        testUnmarshalling(XML_FILE_LEGACY);
+    }
+
+    /**
+     * Tests XML unmarshalling for a metadata version.
+     * The version is not specified since it should be detected automatically.
+     *
+     * @param  file  file containing the metadata to unmarshal.
+     */
+    private void testUnmarshalling(final String file) throws JAXBException {
+        final DefaultCitation c = unmarshalFile(DefaultCitation.class, file);
         assertTitleEquals("title", "Fight against poverty", c);
 
         final CitationDate date = getSingleton(c.getDates());
         assertEquals("date", date.getDate(), TestUtilities.date("2015-10-17 
00:00:00"));
-        assertEquals("dateType", date.getDateType(), 
DateType.valueOf("adopted"));
+        assertEquals("dateType", DateType.valueOf("adopted"), 
date.getDateType());
+        assertEquals("presentationForm", 
PresentationForm.valueOf("physicalObject"), 
getSingleton(c.getPresentationForms()));
 
         final Iterator<ResponsibleParty> it = 
c.getCitedResponsibleParties().iterator();
         final Contact contact = assertResponsibilityEquals(Role.ORIGINATOR, 
"Maid Marian", it.next());
-        assertEquals("Contact instruction", "Send carrier pigeon.", 
contact.getContactInstructions().toString());
+        assertEquals("Contact instruction", "Send carrier pigeon.", 
String.valueOf(contact.getContactInstructions()));
+
+        final OnlineResource resource = contact.getOnlineResource();
+        assertEquals("Resource name", "IP over Avian Carriers", 
String.valueOf(resource.getName()));
+        assertEquals("Resource description", "High delay, low throughput, and 
low altitude service.", String.valueOf(resource.getDescription()));
+        assertEquals("Resource linkage", 
"https://tools.ietf.org/html/rfc1149";, String.valueOf(resource.getLinkage()));
+        assertEquals("Resource function", OnLineFunction.OFFLINE_ACCESS, 
resource.getFunction());
 
-        // Thanks to xlink:href, the Contact shall be the same instance than 
above.
+        // Thanks to xlink:href, the Contact shall be the same instance as 
above.
         assertSame("contact", contact, 
assertResponsibilityEquals(Role.valueOf("funder"), "Robin Hood", it.next()));
         assertFalse(it.hasNext());
     }

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -81,7 +81,7 @@ public final strictfp class DefaultConta
      * Initializes the test for catching warning messages.
      */
     private void init() {
-        context = new Context(0, null, null, null, null, null, null, this);
+        context = new Context(0, null, null, null, null, null, null, null, 
this);
     }
 
     /**

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -19,7 +19,7 @@ package org.apache.sis.metadata.iso.cita
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.citation.Role;
 import org.apache.sis.test.XMLTestCase;
-import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.junit.Test;
 
 import static java.util.Collections.singleton;
@@ -30,7 +30,8 @@ import static org.apache.sis.test.Assert
  * Tests {@link DefaultResponsibility} and its marshalling as a legacy {@link 
DefaultResponsibleParty}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.5
  * @module
  */
@@ -47,9 +48,9 @@ public final strictfp class DefaultRespo
         final DefaultCitation citation = new DefaultCitation();
         r.setParties(singleton(party));
         citation.setCitedResponsibleParties(singleton(r));
-        final String xml = marshal(citation);
-        assertXmlEquals("<gmd:CI_Citation xmlns:gco=\"" + Namespaces.GCO + '"' 
+
-                                        " xmlns:gmd=\"" + Namespaces.GMD + 
"\">\n" +
+        final String xml = marshal(citation, VERSION_2007);
+        assertXmlEquals("<gmd:CI_Citation xmlns:gco=\"" + LegacyNamespaces.GCO 
+ '"' +
+                                        " xmlns:gmd=\"" + LegacyNamespaces.GMD 
+ "\">\n" +
                 "  <gmd:citedResponsibleParty>\n" +
                 "    <gmd:CI_ResponsibleParty>\n" +
                 "      <gmd:individualName>\n" +

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -24,6 +24,7 @@ import org.apache.sis.xml.XML;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.MarshallerPool;
 import org.apache.sis.util.logging.WarningListener;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
@@ -36,7 +37,8 @@ import static org.apache.sis.test.TestUt
  * Tests {@link DefaultLegalConstraints}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.4
  * @module
  */
@@ -79,7 +81,7 @@ public final strictfp class DefaultLegal
     }
 
     /**
-     * Unmarshalls the given XML fragment.
+     * Unmarshals the given XML fragment.
      */
     private DefaultLegalConstraints unmarshal(final String xml) throws 
JAXBException {
         final MarshallerPool pool = getMarshallerPool();
@@ -101,14 +103,14 @@ public final strictfp class DefaultLegal
     @Test
     public void testUnmarshallEmptyCodeListValue() throws JAXBException {
         final DefaultLegalConstraints c = unmarshal(
-                "<gmd:MD_LegalConstraints xmlns:gmd=\"" + Namespaces.GMD + 
"\">\n" +
-                "  <gmd:accessConstraints>\n" +
-                "    <gmd:MD_RestrictionCode 
codeListValue=\"intellectualPropertyRights\" 
codeList=\"http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode\"/>\n"
 +
-                "  </gmd:accessConstraints>\n" +
-                "  <gmd:useConstraints>\n" + // Below is an intentionally 
empty code list value (SIS-157)
-                "    <gmd:MD_RestrictionCode codeListValue=\"\" 
codeList=\"http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode\"/>\n"
 +
-                "  </gmd:useConstraints>\n" +
-                "</gmd:MD_LegalConstraints>");
+                "<mco:MD_LegalConstraints xmlns:mco=\"" + Namespaces.MCO + 
"\">\n" +
+                "  <mco:accessConstraints>\n" +
+                "    <mco:MD_RestrictionCode 
codeListValue=\"intellectualPropertyRights\" 
codeList=\"http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#MD_RestrictionCode\"/>\n"
 +
+                "  </mco:accessConstraints>\n" +
+                "  <mco:useConstraints>\n" +            // Below is an 
intentionally empty code list value (SIS-157)
+                "    <mco:MD_RestrictionCode codeListValue=\"\" 
codeList=\"http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#MD_RestrictionCode\"/>\n"
 +
+                "  </mco:useConstraints>\n" +
+                "</mco:MD_LegalConstraints>");
         /*
          * Verify metadata property.
          */
@@ -130,8 +132,27 @@ public final strictfp class DefaultLegal
      */
     @Test
     public void testLicenceCode() throws JAXBException {
-        final String xml =
-                "<gmd:MD_LegalConstraints xmlns:gmd=\"" + Namespaces.GMD + 
"\">\n" +
+        String xml =
+                "<mco:MD_LegalConstraints xmlns:mco=\"" + Namespaces.MCO + 
"\">\n" +
+                "  <mco:useConstraints>\n" +
+                "    <mco:MD_RestrictionCode"
+                        + " 
codeList=\"http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#MD_RestrictionCode\"";
+                        + " 
codeListValue=\"licence\">License</mco:MD_RestrictionCode>\n" +
+                "  </mco:useConstraints>\n" +
+                "</mco:MD_LegalConstraints>\n";
+
+        final DefaultLegalConstraints c = new DefaultLegalConstraints();
+        c.setUseConstraints(singleton(Restriction.LICENSE));
+        assertXmlEquals(xml, marshal(c), "xmlns:*");
+        DefaultLegalConstraints actual = unmarshal(xml);
+        assertSame(Restriction.LICENSE, 
getSingleton(actual.getUseConstraints()));
+        assertEquals(c, actual);
+        /*
+         * Above code tested ISO 19115-3 (un)marshalling. Code below test 
legacy ISO 19139:2007 (un)marshalling.
+         * This is where the spelling difference appears. At unmarshalling, 
verify that we got back the original
+         * LICENCE code, not a new "LICENSE" code.
+         */
+        xml  =  "<gmd:MD_LegalConstraints xmlns:gmd=\"" + LegacyNamespaces.GMD 
+ "\">\n" +
                 "  <gmd:useConstraints>\n" +
                 "    <gmd:MD_RestrictionCode"
                         + " 
codeList=\"http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode\"";
@@ -139,13 +160,8 @@ public final strictfp class DefaultLegal
                 "  </gmd:useConstraints>\n" +
                 "</gmd:MD_LegalConstraints>\n";
 
-        final DefaultLegalConstraints c = new DefaultLegalConstraints();
-        c.setUseConstraints(singleton(Restriction.LICENSE));
-        assertXmlEquals(xml, marshal(c), "xmlns:*");
-        /*
-         * Unmarshall and ensure that we got back the original LICENCE code, 
not a new "LICENSE" code.
-         */
-        final DefaultLegalConstraints actual = unmarshal(xml);
+        assertXmlEquals(xml, marshal(c, VERSION_2007), "xmlns:*");
+        actual = unmarshal(xml);
         assertSame(Restriction.LICENSE, 
getSingleton(actual.getUseConstraints()));
         assertEquals(c, actual);
     }

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

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -18,17 +18,19 @@ package org.apache.sis.metadata.iso.iden
 
 import java.net.URI;
 import java.io.StringReader;
-import java.io.StringWriter;
 import java.util.logging.LogRecord;
+import javax.xml.bind.Marshaller;
 import javax.xml.bind.JAXBException;
 import javax.xml.transform.stream.StreamSource;
-import javax.xml.transform.stream.StreamResult;
+import org.opengis.metadata.identification.BrowseGraphic;
 import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.util.logging.Logging;
-import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.test.TestCase;
+import org.apache.sis.util.Version;
+import org.apache.sis.xml.MarshallerPool;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.XML;
+import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.test.DependsOnMethod;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -39,13 +41,39 @@ import static java.util.Collections.sing
  * Tests {@link DefaultBrowseGraphic}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.4
  * @module
  */
-public final strictfp class DefaultBrowseGraphicTest extends TestCase {
+public final strictfp class DefaultBrowseGraphicTest extends XMLTestCase {
     /**
-     * Tests XML marshalling of {@code <gmx:MimeFileType>} inside {@code 
<gmd:MD_BrowseGraphic>}.
+     * {@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 BrowseGraphic browse, String expected) throws 
JAXBException {
+        final String  actual;
+        final Version version;
+        if (legacy) {
+            expected = toLegacyXML(expected);
+            version  = VERSION_2007;
+        } else {
+            version  = VERSION_2014;
+        }
+        actual = marshal(browse, version);
+        assertXmlEquals(expected, actual, "xmlns:*");
+        assertEquals(browse, unmarshal(BrowseGraphic.class, actual));
+    }
+
+    /**
+     * Tests XML marshalling of {@code <gcx:MimeFileType>} inside {@code 
<mcc:MD_BrowseGraphic>}.
+     * This method uses the XML schema defined by ISO 19115-3.
      *
      * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
      */
@@ -53,124 +81,149 @@ public final strictfp class DefaultBrows
     public void testMimeFileType() throws JAXBException {
         final DefaultBrowseGraphic browse = new DefaultBrowseGraphic();
         browse.setFileType("image/tiff");
-        final String xml = XML.marshal(browse);
-        assertXmlEquals(
-                "<gmd:MD_BrowseGraphic xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                                     " xmlns:gmx=\"" + Namespaces.GMX + 
"\">\n" +
-                "  <gmd:fileType>\n" +
-                "    <gmx:MimeFileType 
type=\"image/tiff\">image/tiff</gmx:MimeFileType>\n" +
-                "  </gmd:fileType>\n" +
-                "</gmd:MD_BrowseGraphic>", xml, "xmlns:*");
-        /*
-         * Unmarshal the element back to a Java object and compare to the 
original.
-         */
-        assertEquals(browse, XML.unmarshal(xml));
+        roundtrip(browse,
+                "<mcc:MD_BrowseGraphic xmlns:mcc=\"" + Namespaces.MCC + '"' +
+                                     " xmlns:gcx=\"" + Namespaces.GCX + 
"\">\n" +
+                "  <mcc:fileType>\n" +
+                "    <gcx:MimeFileType 
type=\"image/tiff\">image/tiff</gcx:MimeFileType>\n" +
+                "  </mcc:fileType>\n" +
+                "</mcc:MD_BrowseGraphic>");
     }
 
     /**
-     * Tests XML marshalling of {@code <gmx:FileName>} inside {@code 
<gmd:MD_BrowseGraphic>}.
+     * Tests XML marshalling of {@code <gmx:MimeFileType>} inside {@code 
<gmd:MD_BrowseGraphic>}.
+     * This method uses the XML schema defined by ISO 19139:2007.
+     *
+     * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
+     */
+    @Test
+    @DependsOnMethod("testMimeFileType")
+    public void testMimeFileType_Legacy() throws JAXBException {
+        legacy = true;
+        testMimeFileType();
+    }
+
+    /**
+     * Tests XML marshalling of {@code <gcx:FileName>} inside {@code 
<mcc:MD_BrowseGraphic>}.
+     * This method uses the XML schema defined by ISO 19115-3.
      *
      * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
      */
     @Test
     public void testFileName() throws JAXBException {
-        final URI uri = URI.create("file:/catalog/image.png");
-        final DefaultBrowseGraphic browse = new DefaultBrowseGraphic(uri);
-        final String xml = XML.marshal(browse);
-        assertXmlEquals(
-                "<gmd:MD_BrowseGraphic xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                                     " xmlns:gmx=\"" + Namespaces.GMX + 
"\">\n" +
-                "  <gmd:fileName>\n" +
-                "    <gmx:FileName 
src=\"file:/catalog/image.png\">image.png</gmx:FileName>\n" +
-                "  </gmd:fileName>\n" +
-                "</gmd:MD_BrowseGraphic>", xml, "xmlns:*");
-        /*
-         * Unmarshal the element back to a Java object and compare to the 
original.
-         */
-        assertEquals(browse, XML.unmarshal(xml));
+        roundtrip(new 
DefaultBrowseGraphic(URI.create("file:/catalog/image.png")),
+                "<mcc:MD_BrowseGraphic xmlns:mcc=\"" + Namespaces.MCC + '"' +
+                                     " xmlns:gcx=\"" + Namespaces.GCX + 
"\">\n" +
+                "  <mcc:fileName>\n" +
+                "    <gcx:FileName 
src=\"file:/catalog/image.png\">image.png</gcx:FileName>\n" +
+                "  </mcc:fileName>\n" +
+                "</mcc:MD_BrowseGraphic>");
     }
 
     /**
-     * Tests unmarshalling of {@code <gmx:FileName>} without {@code src} 
attribute.
+     * Tests XML marshalling of {@code <gmx:FileName>} inside {@code 
<gmd:MD_BrowseGraphic>}.
+     * This method uses the XML schema defined by ISO 19139:2007.
+     *
+     * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
+     */
+    @Test
+    @DependsOnMethod("testFileName")
+    public void testFileName_Legacy() throws JAXBException {
+        legacy = true;
+        testFileName();
+    }
+
+    /**
+     * Tests unmarshalling of {@code <gcx:FileName>} without {@code src} 
attribute.
      *
      * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
      */
     @Test
     @DependsOnMethod("testFileName")
     public void testFileNameWithoutSrc() throws JAXBException {
-        final DefaultBrowseGraphic browse = (DefaultBrowseGraphic) 
XML.unmarshal(
-                "<gmd:MD_BrowseGraphic xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                                     " xmlns:gmx=\"" + Namespaces.GMX + 
"\">\n" +
-                "  <gmd:fileName>\n" +
-                "    <gmx:FileName>file:/catalog/image.png</gmx:FileName>\n" +
-                "  </gmd:fileName>\n" +
-                "</gmd:MD_BrowseGraphic>");
+        final DefaultBrowseGraphic browse = 
unmarshal(DefaultBrowseGraphic.class,
+                "<mcc:MD_BrowseGraphic xmlns:mcc=\"" + Namespaces.MCC + '"' +
+                                     " xmlns:gcx=\"" + Namespaces.GCX + 
"\">\n" +
+                "  <mcc:fileName>\n" +
+                "    <gcx:FileName>file:/catalog/image.png</gcx:FileName>\n" +
+                "  </mcc:fileName>\n" +
+                "</mcc:MD_BrowseGraphic>");
 
         assertEquals(URI.create("file:/catalog/image.png"), 
browse.getFileName());
     }
 
     /**
-     * Tests XML marshalling of {@code <gmx:FileName>} and {@code 
<gmx:MimeFileType>} together.
+     * Tests XML marshalling of {@code <gcx:FileName>} and {@code 
<gcx:MimeFileType>} together.
+     * This method uses the XML schema defined by ISO 19115-3.
      *
      * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
      */
     @Test
     @DependsOnMethod({"testFileName", "testMimeFileType"})
     public void testFileNameAndType() throws JAXBException {
-        final URI uri = URI.create("file:/catalog/image.png");
-        final DefaultBrowseGraphic browse = new DefaultBrowseGraphic(uri);
+        final DefaultBrowseGraphic browse = new 
DefaultBrowseGraphic(URI.create("file:/catalog/image.png"));
         browse.setFileType("image/tiff");
-        final String xml = XML.marshal(browse);
-        assertXmlEquals(
-                "<gmd:MD_BrowseGraphic xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                                     " xmlns:gmx=\"" + Namespaces.GMX + 
"\">\n" +
-                "  <gmd:fileName>\n" +
-                "    <gmx:FileName 
src=\"file:/catalog/image.png\">image.png</gmx:FileName>\n" +
-                "  </gmd:fileName>\n" +
-                "  <gmd:fileType>\n" +
-                "    <gmx:MimeFileType 
type=\"image/tiff\">image/tiff</gmx:MimeFileType>\n" +
-                "  </gmd:fileType>\n" +
-                "</gmd:MD_BrowseGraphic>", xml, "xmlns:*");
-        /*
-         * Unmarshal the element back to a Java object and compare to the 
original.
-         */
-        assertEquals(browse, XML.unmarshal(xml));
+        roundtrip(browse,
+                "<mcc:MD_BrowseGraphic xmlns:mcc=\"" + Namespaces.MCC + '"' +
+                                     " xmlns:gcx=\"" + Namespaces.GCX + 
"\">\n" +
+                "  <mcc:fileName>\n" +
+                "    <gcx:FileName 
src=\"file:/catalog/image.png\">image.png</gcx:FileName>\n" +
+                "  </mcc:fileName>\n" +
+                "  <mcc:fileType>\n" +
+                "    <gcx:MimeFileType 
type=\"image/tiff\">image/tiff</gcx:MimeFileType>\n" +
+                "  </mcc:fileType>\n" +
+                "</mcc:MD_BrowseGraphic>");
+    }
+
+    /**
+     * Tests XML marshalling of {@code <gmx:FileName>} and {@code 
<gmx:MimeFileType>} together.
+     * This method uses the XML schema defined by ISO 19139:2007.
+     *
+     * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
+     */
+    @Test
+    @DependsOnMethod({"testFileName_Legacy", "testMimeFileType_Legacy"})
+    public void testFileNameAndType_Legacy() throws JAXBException {
+        legacy = true;
+        testFileNameAndType();
     }
 
     /**
      * Tests XML marshalling of filename substituted by {@code 
<gco:CharacterString>}
-     * inside {@code <gmd:MD_BrowseGraphic>}.
+     * inside {@code <mcc:MD_BrowseGraphic>}.
      *
      * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
      */
     @Test
     @DependsOnMethod("testFileNameAndType")
     public void testStringSubstitution() throws JAXBException {
-        final URI uri = URI.create("file:/catalog/image.png");
-        final DefaultBrowseGraphic browse = new DefaultBrowseGraphic(uri);
+        final DefaultBrowseGraphic browse = new 
DefaultBrowseGraphic(URI.create("file:/catalog/image.png"));
         browse.setFileType("image/tiff");
-        final StringWriter buffer = new StringWriter();
-        XML.marshal(browse, new StreamResult(buffer),
-                singletonMap(XML.STRING_SUBSTITUTES, new String[] {"filename", 
"mimetype"}));
-        final String xml = buffer.toString();
+
+        final MarshallerPool pool = getMarshallerPool();
+        final Marshaller marshaller = pool.acquireMarshaller();
+        marshaller.setProperty(XML.STRING_SUBSTITUTES, new String[] 
{"filename", "mimetype"});
+        final String xml = marshal(marshaller, browse);
+        pool.recycle(marshaller);
+
         assertXmlEquals(
-                "<gmd:MD_BrowseGraphic xmlns:gmd=\"" + Namespaces.GMD + '"' +
+                "<mcc:MD_BrowseGraphic xmlns:mcc=\"" + Namespaces.MCC + '"' +
                                      " xmlns:gco=\"" + Namespaces.GCO + 
"\">\n" +
-                "  <gmd:fileName>\n" +
+                "  <mcc:fileName>\n" +
                 "    
<gco:CharacterString>file:/catalog/image.png</gco:CharacterString>\n" +
-                "  </gmd:fileName>\n" +
-                "  <gmd:fileType>\n" +
+                "  </mcc:fileName>\n" +
+                "  <mcc:fileType>\n" +
                 "    <gco:CharacterString>image/tiff</gco:CharacterString>\n" +
-                "  </gmd:fileType>\n" +
-                "</gmd:MD_BrowseGraphic>", xml, "xmlns:*");
+                "  </mcc:fileType>\n" +
+                "</mcc:MD_BrowseGraphic>", xml, "xmlns:*");
         /*
          * Unmarshal the element back to a Java object and compare to the 
original.
          */
-        assertEquals(browse, XML.unmarshal(xml));
+        assertEquals(browse, unmarshal(BrowseGraphic.class, xml));
     }
 
     /**
-     * Tests the unmarshaller with the same URI in both {@code 
<gco:CharacterString>} and {@code <gmx:FileName>}.
+     * Tests the unmarshaller with the same URI in both {@code 
<gco:CharacterString>} and {@code <gcx:FileName>}.
      * Since the URI is the same, the unmarshaller should not produce any 
warning since there is no ambiguity.
      *
      * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
@@ -180,14 +233,14 @@ public final strictfp class DefaultBrows
     public void testDuplicatedValues() throws JAXBException {
         final Warning listener = new Warning();
         final DefaultBrowseGraphic browse = listener.unmarshal(
-                "<gmd:MD_BrowseGraphic xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                                     " xmlns:gmx=\"" + Namespaces.GMX + '"' +
+                "<mcc:MD_BrowseGraphic xmlns:mcc=\"" + Namespaces.MCC + '"' +
+                                     " xmlns:gcx=\"" + Namespaces.GCX + '"' +
                                      " xmlns:gco=\"" + Namespaces.GCO + 
"\">\n" +
-                "  <gmd:fileName>\n" +
-                "    <gmx:FileName 
src=\"file:/catalog/image.png\">image.png</gmx:FileName>\n" +
+                "  <mcc:fileName>\n" +
+                "    <gcx:FileName 
src=\"file:/catalog/image.png\">image.png</gcx:FileName>\n" +
                 "    
<gco:CharacterString>file:/catalog/image.png</gco:CharacterString>\n" +
-                "  </gmd:fileName>\n" +
-                "</gmd:MD_BrowseGraphic>");
+                "  </mcc:fileName>\n" +
+                "</mcc:MD_BrowseGraphic>");
 
         assertEquals(URI.create("file:/catalog/image.png"), 
browse.getFileName());
         assertFalse("Expected no warning.", listener.receivedWarning);
@@ -195,21 +248,21 @@ public final strictfp class DefaultBrows
 
     /**
      * Ensures that the unmarshaller produces a warning when {@code 
<gco:CharacterString>} and
-     * {@code <gmx:FileName>} both exist inside the same {@code 
<gmd:MD_BrowseGraphic>}.
+     * {@code <gcx:FileName>} both exist inside the same {@code 
<gmd:MD_BrowseGraphic>}.
      *
      * @throws JAXBException if an error occurred while (un)marshalling the 
{@code BrowseGraphic}.
      */
     @Test
     @DependsOnMethod("testStringSubstitution")
     public void testWarnings() throws JAXBException {
-        testWarnings("<gmx:FileName 
src=\"file:/catalog/image.png\">image.png</gmx:FileName>",
+        testWarnings("<gcx:FileName 
src=\"file:/catalog/image.png\">image.png</gcx:FileName>",
                      
"<gco:CharacterString>file:/catalog/image2.png</gco:CharacterString>");
         /*
          * Test again with the same element value, but in reverse order.
          * We do that for ensuring that FileName still has precedence.
          */
         
testWarnings("<gco:CharacterString>file:/catalog/image2.png</gco:CharacterString>",
-                     "<gmx:FileName 
src=\"file:/catalog/image.png\">image.png</gmx:FileName>");
+                     "<gcx:FileName 
src=\"file:/catalog/image.png\">image.png</gcx:FileName>");
     }
 
     /**
@@ -218,14 +271,14 @@ public final strictfp class DefaultBrows
     private void testWarnings(final String first, final String second) throws 
JAXBException {
         final Warning listener = new Warning();
         final DefaultBrowseGraphic browse = listener.unmarshal(
-                "<gmd:MD_BrowseGraphic xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                                     " xmlns:gmx=\"" + Namespaces.GMX + '"' +
+                "<mcc:MD_BrowseGraphic xmlns:mcc=\"" + Namespaces.MCC + '"' +
+                                     " xmlns:gcx=\"" + Namespaces.GCX + '"' +
                                      " xmlns:gco=\"" + Namespaces.GCO + 
"\">\n" +
-                "  <gmd:fileName>\n" +
+                "  <mcc:fileName>\n" +
                 "    " + first + "\n" +
                 "    " + second + "\n" +
-                "  </gmd:fileName>\n" +
-                "</gmd:MD_BrowseGraphic>");
+                "  </mcc:fileName>\n" +
+                "</mcc:MD_BrowseGraphic>");
 
         assertEquals(URI.create("file:/catalog/image.png"), 
browse.getFileName());
         assertTrue("Expected a warning.", listener.receivedWarning);

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultCoupledResourceTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -36,7 +36,7 @@ import static org.junit.Assert.*;
  * Tests {@link DefaultCoupledResource}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
  * @since   0.5
  * @module
  */
@@ -45,7 +45,7 @@ public final strictfp class DefaultCoupl
     /**
      * Creates the resource to use for testing purpose.
      */
-    static DefaultCoupledResource create() {
+    static DefaultCoupledResource create(final NameFactory factory) {
         final DefaultOperationMetadata operation = new 
DefaultOperationMetadata();
         operation.setOperationName("Get Map");
         
operation.setDistributedComputingPlatforms(singleton(UnsupportedCodeList.valueOf("WEB_SERVICES")));
@@ -53,7 +53,6 @@ public final strictfp class DefaultCoupl
         
operation.setConnectPoints(singleton(NilReason.MISSING.createNilObject(OnlineResource.class)));
 
         final DefaultCoupledResource resource = new DefaultCoupledResource();
-        final NameFactory factory = 
DefaultFactories.forBuildin(NameFactory.class);
         resource.setScopedName((ScopedName) factory.createGenericName(null, 
"mySpace", "ABC-123"));
         resource.setOperation(operation);
         return resource;
@@ -64,7 +63,7 @@ public final strictfp class DefaultCoupl
      */
     @Test
     public void testOperationNameResolve() {
-        final DefaultCoupledResource resource  = 
DefaultCoupledResourceTest.create();
+        final DefaultCoupledResource resource  = 
create(DefaultFactories.forBuildin(NameFactory.class));
         final DefaultOperationMetadata operation = resource.getOperation();
         /*
          * Test OperationName replacement when the name matches.

Modified: 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
URL: 
http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java?rev=1825355&r1=1825354&r2=1825355&view=diff
==============================================================================
--- 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
 [UTF-8] (original)
+++ 
sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentificationTest.java
 [UTF-8] Mon Feb 26 11:28:17 2018
@@ -45,7 +45,7 @@ import org.opengis.metadata.identificati
  * Tests {@link DefaultDataIdentification}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -142,23 +142,23 @@ public final strictfp class DefaultDataI
                 "  │   │   └─Date type………………………………… Creation\n" +
                 "  │   └─Identifier………………………………………… SST_Global.nc\n" +
                 "  ├─Abstract………………………………………………………… NCEP SST Global 5.0 x 2.5 
degree model data\n" +
+                "  ├─Spatial representation type……… Grid\n" +
+                "  ├─Extent……………………………………………………………… World\n" +
+                "  │   └─Geographic element\n" +
+                "  │       ├─West bound longitude…… 180°W\n" +
+                "  │       ├─East bound longitude…… 180°E\n" +
+                "  │       ├─South bound latitude…… 90°S\n" +
+                "  │       ├─North bound latitude…… 90°N\n" +
+                "  │       └─Extent type code……………… true\n" +
                 "  ├─Descriptive keywords\n" +
                 "  │   ├─Keyword………………………………………………… EARTH SCIENCE > Oceans > 
Ocean Temperature > Sea Surface Temperature\n" +
                 "  │   ├─Type………………………………………………………… Theme\n" +
                 "  │   └─Thesaurus name……………………………… GCMD Science Keywords\n" +
                 "  ├─Resource constraints\n" +
                 "  │   └─Use limitation……………………………… Freely available\n" +
-                "  ├─Spatial representation type……… Grid\n" +
                 "  ├─Language (1 of 2)………………………………… en_US\n" +
                 "  ├─Language (2 of 2)………………………………… en\n" +
-                "  ├─Character set…………………………………………… US-ASCII\n" +
-                "  └─Extent……………………………………………………………… World\n" +
-                "      └─Geographic element\n" +
-                "          ├─West bound longitude…… 180°W\n" +
-                "          ├─East bound longitude…… 180°E\n" +
-                "          ├─South bound latitude…… 90°S\n" +
-                "          ├─North bound latitude…… 90°N\n" +
-                "          └─Extent type code……………… true\n",
+                "  └─Character set…………………………………………… US-ASCII\n",
             TestUtilities.formatNameAndValue(create().asTreeTable()));
     }
 

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


Reply via email to