sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1831975 [1/2] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/test/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/ core/sis-metadata/s...
Date Mon, 21 May 2018 14:51:06 GMT
Author: desruisseaux
Date: Mon May 21 14:51:05 2018
New Revision: 1831975

URL: http://svn.apache.org/viewvc?rev=1831975&view=rev
Log:
Merge the revision of netCDF tests from JDK8 branch.
https://github.com/opengeospatial/geoapi/issues/25

Added:
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/ContentVerifier.java   (with props)
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestData.java   (with props)
Removed:
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/IOTestCase.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/FormattedOutputCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java
    sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapEntry.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/TypeRegistration.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
    sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
    sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java
    sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 21 14:51:05 2018
@@ -2,5 +2,5 @@
 /sis/branches/ISO-19115-3:1804459-1825252
 /sis/branches/JDK6:1394364-1758914
 /sis/branches/JDK7:1394913-1822221
-/sis/branches/JDK8:1584960-1831433
+/sis/branches/JDK8:1584960-1831967
 /sis/branches/JDK9:1773327-1803064

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/FormattedOutputCommand.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/FormattedOutputCommand.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/FormattedOutputCommand.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/FormattedOutputCommand.java [UTF-8] Mon May 21 14:51:05 2018
@@ -20,6 +20,7 @@ import java.util.Locale;
 import java.util.EnumSet;
 import java.io.Console;
 import java.io.IOException;
+import java.util.function.Predicate;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.Metadata;
@@ -54,7 +55,7 @@ import org.apache.sis.xml.XML;
  * The output format is controlled by {@link OutputFormat} enumeration.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.8
  * @module
  */
@@ -221,6 +222,7 @@ abstract class FormattedOutputCommand ex
                         ValueExistencePolicy.COMPACT);
                 final TreeTableFormat tf = new TreeTableFormat(locale, timezone);
                 tf.setColumns(TableColumn.NAME, TableColumn.VALUE);
+                tf.setNodeFilter(getNodeFilter());
                 tf.format(tree, out);
                 break;
             }
@@ -280,6 +282,14 @@ abstract class FormattedOutputCommand ex
     }
 
     /**
+     * Returns the filter for simplifying the tree table to be formatted, or {@code null} if none.
+     * This is used only for the tree in text format (not for XML output).
+     */
+    Predicate<TreeTable.Node> getNodeFilter() {
+        return null;
+    }
+
+    /**
      * Returns {@code true} if {@link #out} is sending its output to the console.
      * If not, then we are probably writing to a file or the user specified his own encoding.
      * In such case, we will send the XML output to an {@code OutputStream} instead than to a

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataCommand.java [UTF-8] Mon May 21 14:51:05 2018
@@ -18,16 +18,19 @@ package org.apache.sis.console;
 
 import java.util.Collections;
 import java.util.EnumSet;
+import java.util.function.Predicate;
 import org.opengis.metadata.Metadata;
 import org.opengis.referencing.ReferenceSystem;
 import org.apache.sis.metadata.iso.DefaultMetadata;
+import org.apache.sis.util.collection.TableColumn;
+import org.apache.sis.util.collection.TreeTable;
 
 
 /**
  * The "metadata" sub-command.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -76,4 +79,16 @@ final class MetadataCommand extends Form
         }
         return 0;
     }
+
+    /**
+     * Returns the filter for simplifying the tree table to be formatted.
+     * This is used only for the tree in text format (not for XML output).
+     *
+     * <p>We omit the "Metadata standard" node because it is hard-coded to the same value in all Apache SIS {@code DataStore}
+     * implementations, and that hard-coded value is verbose. The value will be shown in XML output, which is verbose anyway.</p>
+     */
+    @Override
+    Predicate<TreeTable.Node> getNodeFilter() {
+        return (node) -> !"metadataStandard".equals(node.getValue(TableColumn.IDENTIFIER));
+    }
 }

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/package-info.java [UTF-8] Mon May 21 14:51:05 2018
@@ -47,7 +47,7 @@
  * and Management Using JMX Technology</a> page.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */

Modified: sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java [UTF-8] Mon May 21 14:51:05 2018
@@ -30,7 +30,7 @@ import static org.junit.Assert.*;
  * Tests the {@link MetadataCommand} sub-command.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -44,8 +44,7 @@ public final strictfp class MetadataComm
     @Test
     @Ignore("Requires GeoAPI 3.1")
     public void testNetCDF() throws Exception {
-        final URL url = MetadataCommandTest.class.getResource("NCEP-SST.nc");
-        assertNotNull("NCEP-SST.nc", url);
+        final URL url = new URL("Cube2D_geographic_packed.nc"); // TestData.NETCDF_2D_GEOGRAPHIC.location();
         final MetadataCommand test = new MetadataCommand(0, CommandRunner.TEST, url.toString());
         test.run();
         verifyNetCDF("Metadata", test.outputBuffer.toString());
@@ -57,7 +56,6 @@ public final strictfp class MetadataComm
      */
     private static void verifyNetCDF(final String expectedHeader, final String result) {
         assertTrue(expectedHeader,                           result.startsWith(expectedHeader));
-        assertTrue("ISO 19115",                              result.contains("ISO 19115"));
         assertTrue("Sea Surface Temperature Analysis Model", result.contains("Sea Surface Temperature Analysis Model"));
         assertTrue("GCMD Science Keywords",                  result.contains("GCMD Science Keywords"));
         assertTrue("NOAA/NWS/NCEP",                          result.contains("NOAA/NWS/NCEP"));
@@ -72,7 +70,7 @@ public final strictfp class MetadataComm
     @Ignore("Requires GeoAPI 3.1")
     @DependsOnMethod("testNetCDF")
     public void testFormatXML() throws Exception {
-        final URL url = MetadataCommandTest.class.getResource("NCEP-SST.nc");
+        final URL url = new URL("Cube2D_geographic_packed.nc") ; // TestData.NETCDF_2D_GEOGRAPHIC.location();
         final MetadataCommand test = new MetadataCommand(0, CommandRunner.TEST, url.toString(), "--format", "XML");
         test.run();
         verifyNetCDF("<?xml", test.outputBuffer.toString());

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] Mon May 21 14:51:05 2018
@@ -98,9 +98,16 @@ public final class Context extends Marsh
     public static final int LEGACY_METADATA = 0x20;
 
     /**
+     * Whether the unmarshalling process should accept any metadata or GML version if the user did not
+     * specified an explicit version. Accepting any version may have surprising results since namespace
+     * substitutions may be performed on the fly.
+     */
+    public static final int LENIENT_UNMARSHAL = 0x40;
+
+    /**
      * Bit where to store whether {@link #finish()} shall invoke {@code Semaphores.clear(Semaphores.NULL_COLLECTION)}.
      */
-    private static final int CLEAR_SEMAPHORE = 0x40;
+    private static final int CLEAR_SEMAPHORE = 0x80;
 
     /**
      * The thread-local context. Elements are created in the constructor, and removed in a

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapEntry.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapEntry.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapEntry.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapEntry.java [UTF-8] Mon May 21 14:51:05 2018
@@ -73,7 +73,7 @@ final class IdentifierMapEntry extends A
      */
     @Override
     public String getCodeSpace() {
-        return Citations.getCodeSpace(getAuthority());
+        return Citations.toCodeSpace(getAuthority());
     }
 
     /**
@@ -98,7 +98,7 @@ final class IdentifierMapEntry extends A
         Immutable(Citation authority, String code) {super(authority, code);}
         @Override public Citation            getAuthority()   {return getKey();}
         @Override public String              getCode()        {return getValue();}
-        @Override public String              getCodeSpace()   {return Citations.getCodeSpace(getAuthority());}
+        @Override public String              getCodeSpace()   {return Citations.toCodeSpace(getAuthority());}
         @Override public String              getVersion()     {return null;}
     }
 }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/SpecializedIdentifier.java [UTF-8] Mon May 21 14:51:05 2018
@@ -196,7 +196,7 @@ public final class SpecializedIdentifier
      */
     @Override
     public String getCodeSpace() {
-        return Citations.getCodeSpace(authority);
+        return Citations.toCodeSpace(authority);
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/TypeRegistration.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/TypeRegistration.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/TypeRegistration.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/TypeRegistration.java [UTF-8] Mon May 21 14:51:05 2018
@@ -194,7 +194,7 @@ public abstract class TypeRegistration {
      * Completes the given properties with an entry for {@link #ROOT_ADAPTERS} if not already present.
      * If a {@code ROOT_ADAPTERS} entry is already present, then the map is returned unchanged.
      *
-     * <p>This method store a direct reference to the internal {@code TypeRegistration[]} array in the given map.
+     * <p>This method stores a reference to the internal {@code TypeRegistration[]} array in a copy of the given map.
      * <strong>That array shall not be modified.</strong> This method is currently for Apache SIS internal usage only,
      * because the {@code TypeRegistration} class is not part of public API. However if we add this functionality in a
      * future SIS release (probably as an interface rather than exposing {@code TypeRegistration} itself), then we may

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/NameMeaning.java [UTF-8] Mon May 21 14:51:05 2018
@@ -170,7 +170,7 @@ public final class NameMeaning extends S
              * new name for that organization).
              */
             final Citation c = Citations.fromName(key);
-            codeSpace = Citations.getCodeSpace(c);
+            codeSpace = Citations.toCodeSpace(c);
             if (AUTHORITIES.get(codeSpace) == null) {
                 return null;            // Not an authority that we recognize for the OGC namespace.
             }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/SimpleIdentifier.java [UTF-8] Mon May 21 14:51:05 2018
@@ -105,7 +105,7 @@ public class SimpleIdentifier implements
      */
     @Override
     public String getCodeSpace() {
-        return org.apache.sis.metadata.iso.citation.Citations.getCodeSpace(authority);
+        return org.apache.sis.metadata.iso.citation.Citations.toCodeSpace(authority);
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] Mon May 21 14:51:05 2018
@@ -191,7 +191,7 @@ public class DefaultIdentifier extends I
     public DefaultIdentifier(final Citation authority, final String code) {
         this.authority = authority;
         this.code = code;
-        codeSpace = Citations.getCodeSpace(authority);
+        codeSpace = Citations.toCodeSpace(authority);
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] Mon May 21 14:51:05 2018
@@ -325,7 +325,7 @@ public class ImmutableIdentifier extends
          */
         value = properties.get(CODESPACE_KEY);
         if (value == null) {
-            codeSpace = Citations.getCodeSpace(authority);
+            codeSpace = Citations.toCodeSpace(authority);
         } else if (value instanceof String) {
             codeSpace = trimWhitespaces((String) value);
         } else {

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] Mon May 21 14:51:05 2018
@@ -69,7 +69,7 @@ import static org.apache.sis.internal.ut
  * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.7
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -705,13 +705,24 @@ public final class Citations extends Sta
      * @return a non-empty code space for the given citation without leading or trailing whitespaces,
      *         or {@code null} if the given citation is null or does not have any Unicode identifier or title.
      *
-     * @since 0.8
+     * @since 1.0
      */
-    public static String getCodeSpace(final Citation citation) {
+    public static String toCodeSpace(final Citation citation) {
         if (citation instanceof IdentifierSpace<?>) {
             return ((IdentifierSpace<?>) citation).getName();
         } else {
             return getUnicodeIdentifier(citation);
         }
     }
+
+    /**
+     * @deprecated Renamed as {@link #toCodeSpace(Citation)}. The previous name was confusing because this
+     * method does not return the namespace of the given citation, but instead represents it as a namespace.
+     *
+     * @since 0.8
+     */
+    @Deprecated
+    public static String getCodeSpace(final Citation citation) {
+        return toCodeSpace(citation);
+    }
 }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] Mon May 21 14:51:05 2018
@@ -250,11 +250,11 @@ abstract class Pooled {
      */
     final TransformVersion getTransformVersion() {
         /*
-         * If no version is specified, then the default behavior will be:
+         * If no version is specified and unmarshalling is lenient, then the default behavior will be:
          *   - enable namespace replacement on unmarshalling (in order to accept all versions)
          *   - disable namespace replacement on marshalling (in order to use latest version).
          */
-        final boolean byDefault = (bitMasks & Context.MARSHALLING) == 0;
+        final boolean byDefault = (bitMasks & (Context.MARSHALLING | Context.LENIENT_UNMARSHAL)) == Context.LENIENT_UNMARSHAL;
         /*
          * Bitwise combination of legacy schemas to support:
          *   1: namespace replacement needed for GML
@@ -348,6 +348,14 @@ abstract class Pooled {
                     converter = (ValueConverter) value;
                     return;
                 }
+                case XML.LENIENT_UNMARSHAL: {
+                    if ((value instanceof CharSequence) ? Boolean.parseBoolean(value.toString()) : (Boolean) value) {
+                        bitMasks |= Context.LENIENT_UNMARSHAL;
+                    } else {
+                        bitMasks &= ~Context.LENIENT_UNMARSHAL;
+                    }
+                    return;
+                }
                 case XML.STRING_SUBSTITUTES: {
                     bitMasks &= ~(Context.SUBSTITUTE_LANGUAGE |
                                   Context.SUBSTITUTE_COUNTRY  |
@@ -402,14 +410,15 @@ abstract class Pooled {
     @SuppressWarnings("ReturnOfCollectionOrArrayField")     // Because unmodifiable.
     public final Object getProperty(String name) throws PropertyException {
         switch (name) {
-            case XML.LOCALE:           return locale;
-            case XML.TIMEZONE:         return timezone;
-            case XML.SCHEMAS:          return schemas;
-            case XML.GML_VERSION:      return versionGML;
-            case XML.METADATA_VERSION: return versionMetadata;
-            case XML.RESOLVER:         return resolver;
-            case XML.CONVERTER:        return converter;
-            case XML.WARNING_LISTENER: return warningListener;
+            case XML.LOCALE:            return locale;
+            case XML.TIMEZONE:          return timezone;
+            case XML.SCHEMAS:           return schemas;
+            case XML.GML_VERSION:       return versionGML;
+            case XML.METADATA_VERSION:  return versionMetadata;
+            case XML.RESOLVER:          return resolver;
+            case XML.CONVERTER:         return converter;
+            case XML.WARNING_LISTENER:  return warningListener;
+            case XML.LENIENT_UNMARSHAL: return (bitMasks & Context.LENIENT_UNMARSHAL) != 0;
             case XML.STRING_SUBSTITUTES: {
                 int n = 0;
                 final String[] substitutes = new String[4];

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Mon May 21 14:51:05 2018
@@ -19,6 +19,7 @@ package org.apache.sis.xml;
 import java.util.Map;
 import java.util.Locale;
 import java.util.TimeZone;
+import java.util.Collections;
 import java.util.logging.LogRecord;             // For javadoc
 import java.net.URL;
 import java.io.File;
@@ -229,6 +230,27 @@ public final class XML extends Static {
     public static final String METADATA_VERSION = "org.apache.sis.xml.version.metadata";
 
     /**
+     * Specifies whether the unmarshalling process should accept any metadata or GML supported version
+     * if the user did not specified an explicit version. The value can be a {@link Boolean} instance,
+     * or {@code "true"} or {@code "false"} as a {@link String}. If this value is not specified, then
+     * the default is {@code true} for all {@code XML.unmarshal} methods and {@code false} otherwise.
+     *
+     * <p>Metadata and Geographic Markup Language have slightly different XML encoding depending on the
+     * OGC/ISO version in use. Often the namespaces are different, but not only. Internally, Apache SIS
+     * supports only the schema versions documented in this {@linkplain XML class javadoc}, for example
+     * the ISO 19115-3:2016 version of metadata schema.  For unmarshalling a document encoded according
+     * an older metadata schema (e.g. ISO 19139:2007), a transformation is applied on-the-fly.  However
+     * this transformation may sometime produce undesirable results or make debugging more difficult.
+     * For this reason {@link MarshallerPool} applies the transformation only if explicitely requested,
+     * either by setting a {@link #METADATA_VERSION} or {@link #GML_VERSION} explicitely, or by setting
+     * this {@code LENIENT_UNMARSHAL} property to {@code true} if the version to unmarshal is not known
+     * in advance.</p>
+     *
+     * @since 1.0
+     */
+    public static final String LENIENT_UNMARSHAL = "org.apache.sis.xml.lenient";
+
+    /**
      * Allows client code to replace {@code xlink} or {@code uuidref} attributes by the actual objects to use.
      * The value for this property shall be an instance of {@link ReferenceResolver}.
      *
@@ -398,7 +420,7 @@ public final class XML extends Static {
             synchronized (XML.class) {
                 pool = POOL;                            // Double-check idiom: see javadoc.
                 if (pool == null) {
-                    POOL = pool = new MarshallerPool(null);
+                    POOL = pool = new MarshallerPool(Collections.singletonMap(LENIENT_UNMARSHAL, Boolean.TRUE));
                 }
             }
         }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java [UTF-8] Mon May 21 14:51:05 2018
@@ -91,6 +91,7 @@ public final strictfp class LanguageCode
         final Map<String,Object> properties = new HashMap<>(4);
         assertNull(properties.put(XML.LOCALE, Locale.UK));
         assertNull(properties.put(XML.TIMEZONE, UTC));
+        assertNull(properties.put(XML.LENIENT_UNMARSHAL, Boolean.TRUE));
         pool = new MarshallerPool(JAXBContext.newInstance(MetadataMock.class), properties);
     }
 

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java [UTF-8] Mon May 21 14:51:05 2018
@@ -134,7 +134,7 @@ public final strictfp class CitationsTes
     }
 
     /**
-     * Tests {@link Citations#getCodeSpace(Citation)} with some ignorable characters.
+     * Tests {@link Citations#toCodeSpace(Citation)} with some ignorable characters.
      * Ignorable character used in this test are:
      *
      * <ul>
@@ -146,12 +146,12 @@ public final strictfp class CitationsTes
     @DependsOnMethod("testGetIdentifier")
     public void testGetCodeSpace() {
         final SimpleCitation citation = new SimpleCitation(" Valid\u2060Id\u200Bentifier ");
-        assertEquals("ValidIdentifier", Citations.getCodeSpace(citation));
+        assertEquals("ValidIdentifier", Citations.toCodeSpace(citation));
 
         assertNull("Shall not be taken as a valid identifier.",
-                Citations.getCodeSpace(new SimpleCitation("Proj.4")));
+                Citations.toCodeSpace(new SimpleCitation("Proj.4")));
         assertEquals("Shall fallback on the the identifier space name.",
-                "TheProj4Space", Citations.getCodeSpace(new Proj4()));
+                "TheProj4Space", Citations.toCodeSpace(new Proj4()));
     }
 
     /**
@@ -170,27 +170,27 @@ public final strictfp class CitationsTes
     }
 
     /**
-     * Tests {@link Citations#getCodeSpace(Citation)} on the constants
+     * Tests {@link Citations#toCodeSpace(Citation)} on the constants
      * declared in the {@link Citations} class.
      */
     @Test
     @DependsOnMethod({"testGetUnicodeIdentifier", "testGetIdentifier"})
     public void testGetConstantCodeSpace() {
-        assertEquals("SIS",         Citations.getCodeSpace(SIS));
-        assertEquals("OGC",         Citations.getCodeSpace(WMS));
-        assertEquals("OGC",         Citations.getCodeSpace(OGC));
-        assertEquals("IOGP",        Citations.getCodeSpace(IOGP));
-        assertEquals("EPSG",        Citations.getCodeSpace(EPSG));
-        assertEquals("ESRI",        Citations.getCodeSpace(ESRI));
-        assertEquals("NetCDF",      Citations.getCodeSpace(NETCDF));
-        assertEquals("GeoTIFF",     Citations.getCodeSpace(GEOTIFF));
-        assertEquals("MapInfo",     Citations.getCodeSpace(MAP_INFO));
-        assertEquals("ISBN",        Citations.getCodeSpace(ISBN));
-        assertEquals("ISSN",        Citations.getCodeSpace(ISSN));
-        assertEquals("Proj4",       Citations.getCodeSpace(PROJ4));
-        assertEquals("S57",         Citations.getCodeSpace(S57));
-        assertNull  ("ISO_19115-1", Citations.getCodeSpace(ISO_19115.get(0)));
-        assertNull  ("ISO_19115-2", Citations.getCodeSpace(ISO_19115.get(1)));
+        assertEquals("SIS",         Citations.toCodeSpace(SIS));
+        assertEquals("OGC",         Citations.toCodeSpace(WMS));
+        assertEquals("OGC",         Citations.toCodeSpace(OGC));
+        assertEquals("IOGP",        Citations.toCodeSpace(IOGP));
+        assertEquals("EPSG",        Citations.toCodeSpace(EPSG));
+        assertEquals("ESRI",        Citations.toCodeSpace(ESRI));
+        assertEquals("NetCDF",      Citations.toCodeSpace(NETCDF));
+        assertEquals("GeoTIFF",     Citations.toCodeSpace(GEOTIFF));
+        assertEquals("MapInfo",     Citations.toCodeSpace(MAP_INFO));
+        assertEquals("ISBN",        Citations.toCodeSpace(ISBN));
+        assertEquals("ISSN",        Citations.toCodeSpace(ISSN));
+        assertEquals("Proj4",       Citations.toCodeSpace(PROJ4));
+        assertEquals("S57",         Citations.toCodeSpace(S57));
+        assertNull  ("ISO_19115-1", Citations.toCodeSpace(ISO_19115.get(0)));
+        assertNull  ("ISO_19115-2", Citations.toCodeSpace(ISO_19115.get(1)));
     }
 
     /**

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/XMLTestCase.java [UTF-8] Mon May 21 14:51:05 2018
@@ -138,6 +138,7 @@ public abstract strictfp class XMLTestCa
             final Map<String,Object> properties = new HashMap<>(4);
             assertNull(properties.put(XML.LOCALE, Locale.UK));
             assertNull(properties.put(XML.TIMEZONE, TIMEZONE));
+            assertNull(properties.put(XML.LENIENT_UNMARSHAL, Boolean.TRUE));
             defaultPool = new MarshallerPool(properties);
         }
         return defaultPool;

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/util/iso/NameMarshallingTest.java [UTF-8] Mon May 21 14:51:05 2018
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.util.iso;
 
+import java.util.Collections;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBContext;
@@ -64,7 +65,8 @@ public final strictfp class NameMarshall
      */
     private String marshal(final GenericName name) throws JAXBException {
         if (pool == null) {
-            pool = new MarshallerPool(JAXBContext.newInstance(IdentifiedObjectMock.class), null);
+            pool = new MarshallerPool(JAXBContext.newInstance(IdentifiedObjectMock.class),
+                    Collections.singletonMap(XML.LENIENT_UNMARSHAL, Boolean.TRUE));
         }
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.setProperty(XML.METADATA_VERSION, VERSION_2007);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] Mon May 21 14:51:05 2018
@@ -28,7 +28,7 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
 
-import static org.apache.sis.metadata.iso.citation.Citations.getCodeSpace;
+import static org.apache.sis.metadata.iso.citation.Citations.toCodeSpace;
 
 
 /**
@@ -242,7 +242,7 @@ public final class Code {
                                 }
                             }
                         } else {
-                            code.codeSpace = getCodeSpace(authority);
+                            code.codeSpace = toCodeSpace(authority);
                         }
                         code.code = urn;
                         return code;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] Mon May 21 14:51:05 2018
@@ -331,7 +331,7 @@ public abstract class Builder<B extends
             version    = getVersion();
         } else {
             // Do not use the version information since it applies to the default authority rather than the given one.
-            codeSpace = Citations.getCodeSpace(authority);
+            codeSpace = Citations.toCodeSpace(authority);
             version   = null;
         }
         return createIdentifier(authority, codeSpace, identifier, version);
@@ -557,7 +557,7 @@ public abstract class Builder<B extends
                 version    = getVersion();
             } else {
                 // Do not use the version information since it applies to the default authority rather than the given one.
-                codeSpace = Citations.getCodeSpace(authority);
+                codeSpace = Citations.toCodeSpace(authority);
                 version   = null;
             }
             if (isDeprecated) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java [UTF-8] Mon May 21 14:51:05 2018
@@ -427,7 +427,7 @@ public final class IdentifiedObjects ext
         }
         IdentifiedObjectFinder finder;
         try {
-            finder = newFinder(Citations.getCodeSpace(authority));
+            finder = newFinder(Citations.toCodeSpace(authority));
         } catch (NoSuchAuthorityFactoryException e) {
             warning("lookupURN", e);
             finder = newFinder(null);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] Mon May 21 14:51:05 2018
@@ -226,7 +226,7 @@ public class NamedIdentifier extends Imm
      *          The code can not be null.
      */
     public NamedIdentifier(final Citation authority, final CharSequence code) {
-        super(authority, Citations.getCodeSpace(authority), toString(code));
+        super(authority, Citations.toCodeSpace(authority), toString(code));
         if (code instanceof InternationalString) {
             name = createName(authority, super.getCodeSpace(), code);
             isNameSupplied = true;                              // Because 'code' is an international string.
@@ -318,7 +318,7 @@ public class NamedIdentifier extends Imm
      */
     private static GenericName createName(final Citation authority, String codeSpace, final CharSequence code) {
         if (codeSpace == null) {
-            codeSpace = Citations.getCodeSpace(authority);          // Whitespaces trimed by Citations.
+            codeSpace = Citations.toCodeSpace(authority);           // Whitespaces trimed by Citations.
         }
         final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
         if (codeSpace != null) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] Mon May 21 14:51:05 2018
@@ -466,7 +466,7 @@ public class AbstractDatum extends Abstr
             if (name == null) { // Should never happen, but be safe.
                 return super.formatTo(formatter);
             }
-            if ("ESRI".equalsIgnoreCase(Citations.getCodeSpace(authority)) && !name.startsWith(ESRI_PREFIX)) {
+            if ("ESRI".equalsIgnoreCase(Citations.toCodeSpace(authority)) && !name.startsWith(ESRI_PREFIX)) {
                 name = ESRI_PREFIX + name;
             }
         }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] Mon May 21 14:51:05 2018
@@ -143,7 +143,7 @@ public abstract class GeodeticAuthorityF
      * @return the namespaces recognized by this factory, or an empty set if none.
      */
     public Set<String> getCodeSpaces() {
-        final String authority = org.apache.sis.metadata.iso.citation.Citations.getCodeSpace(getAuthority());
+        final String authority = org.apache.sis.metadata.iso.citation.Citations.toCodeSpace(getAuthority());
         return (authority != null) ? Collections.singleton(authority) : Collections.emptySet();
     }
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] Mon May 21 14:51:05 2018
@@ -519,7 +519,7 @@ public class MultiAuthoritiesFactory ext
         if (factory instanceof GeodeticAuthorityFactory) {
             return ((GeodeticAuthorityFactory) factory).getCodeSpaces();
         } else {
-            final String authority = Citations.getCodeSpace(factory.getAuthority());
+            final String authority = Citations.toCodeSpace(factory.getAuthority());
             return (authority != null) ? Collections.singleton(authority) : Collections.emptySet();
         }
     }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Mon May 21 14:51:05 2018
@@ -979,7 +979,7 @@ check:      for (int isTarget=0; ; isTar
                  * on MathTransform WKT neither for more reliable debugging.
                  */
                 final boolean filter = WKTUtilities.isEPSG(parameters.getDescriptor(), false) &&   // NOT method.getName()
-                        Constants.EPSG.equalsIgnoreCase(Citations.getCodeSpace(formatter.getNameAuthority()));
+                        Constants.EPSG.equalsIgnoreCase(Citations.toCodeSpace(formatter.getNameAuthority()));
                 formatter.newLine();
                 formatter.indent(+1);
                 for (final GeneralParameterValue param : parameters.values()) {

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] Mon May 21 14:51:05 2018
@@ -125,7 +125,7 @@ public final strictfp class CommonAuthor
         assertTrue (Citations.identifierMatches(authority, "WMS"));
         assertFalse(Citations.identifierMatches(authority, "OGP"));
         assertFalse(Citations.identifierMatches(authority, "EPSG"));
-        assertEquals(Constants.OGC, Citations.getCodeSpace(authority));
+        assertEquals(Constants.OGC, Citations.toCodeSpace(authority));
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] Mon May 21 14:51:05 2018
@@ -26,6 +26,7 @@ import java.util.Locale;
 import java.util.TimeZone;
 import java.util.Currency;
 import java.util.ConcurrentModificationException;
+import java.util.function.Predicate;
 import java.io.IOException;
 import java.text.Format;
 import java.text.ParsePosition;
@@ -100,7 +101,7 @@ import static org.apache.sis.util.Charac
  * than the user object of a parent node <var>A</var>, then the children of the <var>C</var> node will not be formatted.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -162,6 +163,15 @@ public class TreeTableFormat extends Tab
     private transient String treeBlank, treeLine, treeCross, treeEnd;
 
     /**
+     * A filter for specifying whether a node should be formatted, or {@code null} if no filtering is applied.
+     * This is ignored at parsing time.
+     *
+     * @see #getNodeFilter()
+     * @see #setNodeFilter(Predicate)
+     */
+    private Predicate<TreeTable.Node> nodeFilter;
+
+    /**
      * The set to be given to {@link Writer} constructor,
      * created when first needed and reused for subsequent formating.
      */
@@ -292,6 +302,32 @@ public class TreeTableFormat extends Tab
     }
 
     /**
+     * Returns the filter that specify whether a node should be formatted or ignored.
+     * This is the predicate specified in the last call to {@link #setNodeFilter(Predicate)}.
+     * If no filter has been set, then this method returns {@code null}.
+     *
+     * @return a filter for specifying whether a node should be formatted, or {@code null} if no filtering is applied.
+     *
+     * @since 1.0
+     */
+    public Predicate<TreeTable.Node> getNodeFilter() {
+        return nodeFilter;
+    }
+
+    /**
+     * Sets a filter specifying whether a node should be formatted or ignored.
+     * Filters are tested at formatting time for all children of the root node (but not for the root node itself).
+     * Filters are ignored at parsing time.
+     *
+     * @param  filter  filter for specifying whether a node should be formatted, or {@code null} for no filtering.
+     *
+     * @since 1.0
+     */
+    public void setNodeFilter(final Predicate<TreeTable.Node> filter) {
+        this.nodeFilter = filter;
+    }
+
+    /**
      * Returns the locale to use for code lists, international strings and exception messages.
      */
     final Locale getDisplayLocale() {
@@ -795,11 +831,11 @@ public class TreeTableFormat extends Tab
             final boolean omitCheck = node.getClass().isAnnotationPresent(Acyclic.class);
             if (omitCheck || recursivityGuard.add(node)) {
                 final Iterator<? extends TreeTable.Node> it = node.getChildren().iterator();
-                boolean hasNext = it.hasNext();
-                while (hasNext) {
-                    final TreeTable.Node child = it.next();
-                    hasNext = it.hasNext();
-                    isLast[level] = !hasNext;                   // Must be set before the call to 'format' below.
+                TreeTable.Node next = next(it);
+                while (next != null) {
+                    final TreeTable.Node child = next;
+                    next = next(it);
+                    isLast[level] = (next == null);                 // Must be set before the call to 'format' below.
                     format(child, level+1);
                 }
                 if (!omitCheck && !recursivityGuard.remove(node)) {
@@ -863,6 +899,21 @@ public class TreeTableFormat extends Tab
     }
 
     /**
+     * Returns the next filtered element from the given iterator, or {@code null} if none.
+     */
+    private TreeTable.Node next(final Iterator<? extends TreeTable.Node> it) {
+        while (it.hasNext()) {
+            final TreeTable.Node next = it.next();
+            if (next != null) {
+                if (nodeFilter == null || nodeFilter.test(next)) {
+                    return next;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns a clone of this format.
      *
      * @return a clone of this format.

Added: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/ContentVerifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/ContentVerifier.java?rev=1831975&view=auto
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/ContentVerifier.java (added)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/ContentVerifier.java [UTF-8] Mon May 21 14:51:05 2018
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.test;
+
+import static org.junit.Assume.assumeTrue;
+
+import org.opengis.metadata.Metadata;
+
+
+/**
+ * Place-holder for a GeoAPI 3.1 class. Used only for allowing the code to compile.
+ * For real test execution, see the development branches on GeoAPI 4.0-SNAPSHOT.
+ */
+public class ContentVerifier {
+    public void addPropertyToIgnore(Class<?> type, String property) {
+        assumeTrue("This test requires GeoAPI 3.1.", false);
+    }
+
+    public void addMetadataToVerify(Metadata actual) {
+        assumeTrue("This test requires GeoAPI 3.1.", false);
+    }
+
+    public void assertMetadataEquals(final String path, final Object value, final Object... others) {
+        assumeTrue("This test requires GeoAPI 3.1.", false);
+    }
+}

Propchange: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/ContentVerifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/ContentVerifier.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] Mon May 21 14:51:05 2018
@@ -213,13 +213,25 @@ public final strictfp class TestUtilitie
      */
     public static Date date(final String date) {
         ArgumentChecks.ensureNonNull("date", date);
+        final Date t;
         try {
             synchronized (dateFormat) {
-                return dateFormat.parse(date);
+                t = dateFormat.parse(date);
             }
         } catch (ParseException e) {
             throw new AssertionError(e);
         }
+        /*
+         * The milliseconds are not part of the pattern used by this method because they are rarely specified.
+         * If a test needs to specify milliseconds, add the manually here. Note that this naive hack requires
+         * all milliseconds digits to be provided, e.g. ".900" - not ".9".
+         */
+        final int s = date.lastIndexOf('.');
+        if (s >= 0) {
+            final int ms = Integer.parseInt(date.substring(s + 1));
+            t.setTime(t.getTime() + ms);
+        }
+        return t;
     }
 
     /**

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Variable.java [UTF-8] Mon May 21 14:51:05 2018
@@ -158,6 +158,8 @@ public abstract class Variable extends N
      * Returns the names of all attributes associated to this variable.
      *
      * @return names of all attributes associated to this variable.
+     *
+     * @todo Remove this method if it still not used.
      */
     public abstract Collection<String> getAttributeNames();
 

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Mon May 21 14:51:05 2018
@@ -814,7 +814,7 @@ public final class ChannelDecoder extend
             final Set<VariableInfo> axes = new LinkedHashSet<>(4);
             final Map<List<Dimension>, GridGeometryInfo> dimsToGG = new LinkedHashMap<>();
 nextVar:    for (final VariableInfo variable : variables) {
-                if (variable.isCoordinateSystemAxis()) {
+                if (variable.isCoordinateSystemAxis() || variable.dimensions.length == 0) {
                     continue;
                 }
                 final List<Dimension> dimensions = Arrays.asList(variable.dimensions);

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] Mon May 21 14:51:05 2018
@@ -111,6 +111,7 @@ final class VariableInfo extends Variabl
     /**
      * The grid geometry associated to this variable,
      * computed by {@link ChannelDecoder#getGridGeometries()} when first needed.
+     * May stay {@code null} if the variable is not a data cube.
      */
     GridGeometryInfo gridGeometry;
 

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/VariableWrapper.java [UTF-8] Mon May 21 14:51:05 2018
@@ -25,6 +25,7 @@ import ucar.ma2.InvalidRangeException;
 import ucar.nc2.Attribute;
 import ucar.nc2.Dimension;
 import ucar.nc2.VariableIF;
+import ucar.nc2.dataset.VariableEnhanced;
 import org.apache.sis.math.Vector;
 import org.apache.sis.internal.netcdf.DataType;
 import org.apache.sis.internal.netcdf.Variable;
@@ -38,21 +39,37 @@ import org.apache.sis.storage.DataStoreC
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
 final class VariableWrapper extends Variable {
     /**
-     * The netCDF variable.
+     * The netCDF variable. This is typically an instance of {@link VariableEnhanced}.
      */
     private final VariableIF variable;
 
     /**
+     * The variable without enhancements. May be the same instance than {@link #variable}
+     * if that variable was not enhanced. This field is preferred to {@code variable} for
+     * fetching attribute values because the {@code "scale_factor"} and {@code "add_offset"}
+     * attributes are hidden by {@link VariableEnhanced}. In order to allow metadata reader
+     * to find them, we query attributes in the original variable instead.
+     */
+    private final VariableIF raw;
+
+    /**
      * Creates a new variable wrapping the given netCDF interface.
      */
-    VariableWrapper(final VariableIF variable) {
-        this.variable = variable;
+    VariableWrapper(VariableIF v) {
+        variable = v;
+        if (v instanceof VariableEnhanced) {
+            v = ((VariableEnhanced) v).getOriginalVariable();
+            if (v == null) {
+                v = variable;
+            }
+        }
+        raw = v;
     }
 
     /**
@@ -148,7 +165,7 @@ final class VariableWrapper extends Vari
      */
     @Override
     public Object[] getAttributeValues(final String attributeName, final boolean numeric) {
-        final Attribute attribute = variable.findAttributeIgnoreCase(attributeName);
+        final Attribute attribute = raw.findAttributeIgnoreCase(attributeName);
         if (attribute != null) {
             boolean hasValues = false;
             final Object[] values = new Object[attribute.getLength()];

Modified: sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] Mon May 21 14:51:05 2018
@@ -106,7 +106,7 @@ import static org.apache.sis.storage.net
  * </ul>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -589,7 +589,7 @@ split:  while ((start = CharSequences.sk
             decoder.setSearchPath(path);
             final ResponsibleParty party = createResponsibleParty(CREATOR, true);
             if (party != pointOfContact) {
-                addPointOfContact(party, Scope.ALL);
+                addPointOfContact(party, Scope.RESOURCE);
                 if (pointOfContact == null) {
                     pointOfContact = party;
                 }
@@ -968,9 +968,9 @@ split:  while ((start = CharSequences.sk
             authority = null;
         }
         if (authority == null) {
-            addTitleOrIdentifier(identifier, Scope.ALL);
+            addTitleOrIdentifier(identifier, Scope.RESOURCE);
         } else {
-            addIdentifier(authority, identifier, Scope.ALL);
+            addIdentifier(authority, identifier, Scope.RESOURCE);
         }
     }
 

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java [UTF-8] Mon May 21 14:51:05 2018
@@ -30,10 +30,10 @@ import static org.apache.sis.storage.net
  * Tests the {@link Decoder} implementation. The default implementation tests
  * {@link org.apache.sis.internal.netcdf.ucar.DecoderWrapper} since the UCAR
  * library is our reference implementation. However subclasses can override the
- * {@link #createDecoder(String)} method in order to test a different implementation.
+ * {@link #createDecoder(TestData)} method in order to test a different implementation.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -46,20 +46,13 @@ public strictfp class DecoderTest extend
      */
     @Test
     public void testStringValue() throws IOException, DataStoreException {
-        selectDataset(NCEP);
-        assertAttributeEquals("Sea Surface Temperature Analysis Model",      TITLE);
-        assertAttributeEquals("NCEP SST Global 5.0 x 2.5 degree model data", SUMMARY);
-        assertAttributeEquals("NCEP SST Global 5.0 x 2.5 degree model data", "SUMMARY"); // test case-insensitive search
-        assertAttributeEquals("NOAA/NWS/NCEP",                               CREATOR.NAME);
-        assertAttributeEquals(/* Empty string in file   */ (String) null,    CREATOR.EMAIL);
-        assertAttributeEquals(/* Non-existent attribute */ (String) null,    CONTRIBUTOR.NAME);
-
-        if (isSupplementalFormatSupported("HDF5")) {
-            selectDataset(CIP);
-            assertAttributeEquals(/* Only control character */ (String) null,   TITLE);
-            assertAttributeEquals("UCAR",                                      "INSTITUTION");
-            assertAttributeEquals("U.S. National Weather Service - NCEP (WMC)", HISTORY);
-        }
+        selectDataset(TestData.NETCDF_2D_GEOGRAPHIC);
+        assertAttributeEquals("Test data from Sea Surface Temperature Analysis Model", TITLE);
+        assertAttributeEquals("Global, two-dimensional model data",                    SUMMARY);
+        assertAttributeEquals("Global, two-dimensional model data",                    "SUMMARY");    // test case-insensitive search
+        assertAttributeEquals("NOAA/NWS/NCEP",                                         CREATOR.NAME);
+        assertAttributeEquals((String) null,                                           CREATOR.EMAIL);
+        assertAttributeEquals((String) null,                                           CONTRIBUTOR.NAME);
     }
 
     /**
@@ -70,14 +63,13 @@ public strictfp class DecoderTest extend
      */
     @Test
     public void testNumericValue() throws IOException, DataStoreException {
-        selectDataset(NCEP);
+        selectDataset(TestData.NETCDF_2D_GEOGRAPHIC);
         assertAttributeEquals(Double.valueOf( -90), LATITUDE .MINIMUM);
         assertAttributeEquals(Double.valueOf( +90), LATITUDE .MAXIMUM);
         assertAttributeEquals(Double.valueOf(-180), LONGITUDE.MINIMUM);
         assertAttributeEquals(Double.valueOf(+180), LONGITUDE.MAXIMUM);
         assertAttributeEquals((Double) null,        LATITUDE .RESOLUTION);
         assertAttributeEquals((Double) null,        LONGITUDE.RESOLUTION);
-        assertAttributeEquals(Double.valueOf(1),    "version"); // Specific to the NCEP file.
     }
 
     /**
@@ -88,9 +80,10 @@ public strictfp class DecoderTest extend
      */
     @Test
     public void testDateValue() throws IOException, DataStoreException {
-        selectDataset(NCEP);
+        selectDataset(TestData.NETCDF_2D_GEOGRAPHIC);
         assertAttributeEquals(date("2005-09-22 00:00:00"), DATE_CREATED);
-        assertAttributeEquals((Date) null,                 DATE_MODIFIED);
+        assertAttributeEquals(date("2018-05-15 13:00:00"), DATE_MODIFIED);
+        assertAttributeEquals((Date) null,                 DATE_ISSUED);
     }
 
     /**
@@ -101,7 +94,7 @@ public strictfp class DecoderTest extend
      */
     @Test
     public void testNumberToDate() throws IOException, DataStoreException {
-        final Decoder decoder = selectDataset(NCEP);
+        final Decoder decoder = selectDataset(TestData.NETCDF_2D_GEOGRAPHIC);
         assertArrayEquals(new Date[] {
             date("2005-09-22 00:00:00")
         }, decoder.numberToDate("hours since 1992-1-1", 120312));
@@ -121,7 +114,7 @@ public strictfp class DecoderTest extend
      */
     @Test
     public void testGetTitleAndID() throws IOException, DataStoreException {
-        final Decoder decoder = selectDataset(NCEP);
+        final Decoder decoder = selectDataset(TestData.NETCDF_2D_GEOGRAPHIC);
         /*
          * Actually we really want a null value, even if the NCEP file contains 'title' and 'id' attributes,
          * because the decoder methods are supposed to check only for the "_Title" and "_Id" attributes as a

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java [UTF-8] Mon May 21 14:51:05 2018
@@ -31,10 +31,10 @@ import static org.apache.sis.test.TestUt
  * Tests the {@link GridGeometry} implementation. The default implementation tests
  * {@code org.apache.sis.internal.netcdf.ucar.GridGeometryWrapper} since the UCAR
  * library is our reference implementation. However subclasses can override the
- * {@link #createDecoder(String)} method in order to test a different implementation.
+ * {@link #createDecoder(TestData)} method in order to test a different implementation.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -61,36 +61,68 @@ public strictfp class GridGeometryTest e
      */
     @Test
     public void testDimensions() throws IOException, DataStoreException {
-        final GridGeometry geometry = getSingleton(filter(selectDataset(NCEP).getGridGeometries()));
-        assertEquals("getSourceDimensions()", 3, geometry.getSourceDimensions());
-        assertEquals("getTargetDimensions()", 3, geometry.getTargetDimensions());
+        GridGeometry geometry = getSingleton(filter(selectDataset(TestData.NETCDF_2D_GEOGRAPHIC).getGridGeometries()));
+        assertEquals("getSourceDimensions()", 2, geometry.getSourceDimensions());
+        assertEquals("getTargetDimensions()", 2, geometry.getTargetDimensions());
+
+        geometry = getSingleton(filter(selectDataset(TestData.NETCDF_4D_PROJECTED).getGridGeometries()));
+        assertEquals("getSourceDimensions()", 4, geometry.getSourceDimensions());
+        assertEquals("getTargetDimensions()", 4, geometry.getTargetDimensions());
     }
 
     /**
-     * Tests {@link GridGeometry#getAxes()}.
+     * Tests {@link GridGeometry#getAxes()} on a two-dimensional dataset.
      *
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
     @DependsOnMethod("testDimensions")
-    public void testAxes() throws IOException, DataStoreException {
-        final Axis[] axes = getSingleton(filter(selectDataset(NCEP).getGridGeometries())).getAxes();
-        assertEquals(3, axes.length);
-        final Axis x = axes[2];
-        final Axis y = axes[1];
-        final Axis t = axes[0];
+    public void testAxes2D() throws IOException, DataStoreException {
+        final Axis[] axes = getSingleton(filter(selectDataset(TestData.NETCDF_2D_GEOGRAPHIC).getGridGeometries())).getAxes();
+        assertEquals(2, axes.length);
+        final Axis x = axes[1];
+        final Axis y = axes[0];
 
         assertSame(AttributeNames.LONGITUDE, x.attributeNames);
         assertSame(AttributeNames.LATITUDE,  y.attributeNames);
-        assertSame(AttributeNames.TIME,      t.attributeNames);
 
-        assertArrayEquals(new int[] {2}, x.sourceDimensions);
-        assertArrayEquals(new int[] {1}, y.sourceDimensions);
-        assertArrayEquals(new int[] {0}, t.sourceDimensions);
+        assertArrayEquals(new int[] {1}, x.sourceDimensions);
+        assertArrayEquals(new int[] {0}, y.sourceDimensions);
 
         assertArrayEquals(new int[] {73}, x.sourceSizes);
         assertArrayEquals(new int[] {73}, y.sourceSizes);
+    }
+
+    /**
+     * Tests {@link GridGeometry#getAxes()} on a four-dimensional dataset.
+     *
+     * @throws IOException if an I/O error occurred while opening the file.
+     * @throws DataStoreException if a logical error occurred.
+     */
+    @Test
+    @DependsOnMethod("testDimensions")
+    public void testAxes4D() throws IOException, DataStoreException {
+        final Axis[] axes = getSingleton(filter(selectDataset(TestData.NETCDF_4D_PROJECTED).getGridGeometries())).getAxes();
+        assertEquals(4, axes.length);
+        final Axis x = axes[3];
+        final Axis y = axes[2];
+        final Axis z = axes[1];
+        final Axis t = axes[0];
+
+        assertNull("Not geographic",        x.attributeNames);
+        assertNull("Not geographic",        y.attributeNames);
+        assertSame(AttributeNames.VERTICAL, z.attributeNames);
+        assertSame(AttributeNames.TIME,     t.attributeNames);
+
+        assertArrayEquals(new int[] {3}, x.sourceDimensions);
+        assertArrayEquals(new int[] {2}, y.sourceDimensions);
+        assertArrayEquals(new int[] {1}, z.sourceDimensions);
+        assertArrayEquals(new int[] {0}, t.sourceDimensions);
+
+        assertArrayEquals(new int[] {38}, x.sourceSizes);
+        assertArrayEquals(new int[] {19}, y.sourceSizes);
+        assertArrayEquals(new int[] { 4}, z.sourceSizes);
         assertArrayEquals(new int[] { 1}, t.sourceSizes);
     }
 }

Modified: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java?rev=1831975&r1=1831974&r2=1831975&view=diff
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] (original)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] Mon May 21 14:51:05 2018
@@ -18,7 +18,7 @@ package org.apache.sis.internal.netcdf;
 
 import java.util.Date;
 import java.util.Map;
-import java.util.HashMap;
+import java.util.EnumMap;
 import java.util.Iterator;
 import java.io.IOException;
 import java.lang.reflect.UndeclaredThrowableException;
@@ -29,26 +29,27 @@ import org.apache.sis.internal.netcdf.uc
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.setup.GeometryLibrary;
 import ucar.nc2.dataset.NetcdfDataset;
+import ucar.nc2.NetcdfFile;
 import org.junit.AfterClass;
 
 import static org.junit.Assert.*;
 
 
 /**
- * Base class of netCDF tests. Subclasses shall override the {@link #createDecoder(String)}.
+ * Base class of netCDF tests. Subclasses shall override the {@link #createDecoder(TestData)}.
  *
  * <p>This class is <strong>not</strong> thread safe - do not run subclasses in parallel.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
-public abstract strictfp class TestCase extends IOTestCase {
+public abstract strictfp class TestCase extends org.apache.sis.test.TestCase {
     /**
      * A dummy list of listeners which can be given to the {@link Decoder} constructor.
      */
-    public static EmptyWarningListeners<DataStore> LISTENERS = new EmptyWarningListeners<>(null, Modules.NETCDF);
+    protected static EmptyWarningListeners<DataStore> LISTENERS = new EmptyWarningListeners<>(null, Modules.NETCDF);
 
     /**
      * The {@code searchPath} argument value to be given to the {@link Decoder#setSearchPath(String[])}
@@ -57,12 +58,12 @@ public abstract strictfp class TestCase
     private static final String[] GLOBAL = new String[1];
 
     /**
-     * The decoders cached by {@link #selectDataset(String)}.
+     * The decoders cached by {@link #selectDataset(TestData)}.
      */
-    private static final Map<String,Decoder> DECODERS = new HashMap<>();
+    private static final Map<TestData,Decoder> DECODERS = new EnumMap<>(TestData.class);
 
     /**
-     * The decoder to test, which is set by {@link #selectDataset(String)}.
+     * The decoder to test, which is set by {@link #selectDataset(TestData)}.
      * This field must be set before any {@code assert} method is invoked.
      */
     private Decoder decoder;
@@ -74,55 +75,60 @@ public abstract strictfp class TestCase
     }
 
     /**
-     * Returns {@code true} if the given supplemental formats (THREDDS, HDF5) is supported.
-     * The default implementation returns {@code true} since the UCAR library supports all
-     * supplemental formats tested in this suite. Subclasses working only with the netCDF
-     * classic or 64-bits format can unconditionally returns {@code false}.
+     * Creates a netCDF reader from the UCAR library for the specified data set.
+     * We use the UCAR library as a reference implementation for the tests.
      *
-     * @param  format  either {@code "THREDDS"} or {@code "HDF5"}.
-     * @return {@code true} if the given supplemental format is supported.
+     * @param  file  the dataset as one of the {@code NETCDF_*} constants.
+     * @return the decoder for the specified dataset.
+     * @throws IOException if an I/O error occurred while opening the file.
      */
-    protected boolean isSupplementalFormatSupported(final String format) {
-        return true;
+    protected static NetcdfFile createUCAR(final TestData file) throws IOException {
+        /*
+         * Binary netCDF files need to be read either from a file, or from a byte array in memory.
+         * Reading from a file is not possible if the test file is in geoapi-conformance JAR file.
+         * But since those test files are less than 15 kilobytes, loading them in memory is okay.
+         */
+        String location = file.location().toString();
+        location = location.substring(location.lastIndexOf('/') + 1);
+        return NetcdfFile.openInMemory(location, file.content());
     }
 
     /**
-     * Invoked when a new {@link Decoder} instance needs to be created for dataset of the given name.
-     * The {@code name} parameter can be one of the following values:
+     * Invoked when a new {@link Decoder} instance needs to be created for the specified dataset.
+     * The {@code file} parameter can be one of the following values:
      *
      * <ul>
-     *   <li>{@link #NCEP}    for a netCDF binary file.</li>
-     *   <li>{@link #CIP}     for a netCDF binary file.</li>
+     *   <li>{@link TestData#NETCDF_2D_GEOGRAPHIC} — uses a geographic CRS for global data over the world.</li>
+     *   <li>{@link TestData#NETCDF_4D_PROJECTED}  — uses a projected CRS with elevation and time.</li>
      * </ul>
      *
-     * The default implementation first delegates to {@link #open(String)}, then wraps the result
-     * in a {@link DecoderWrapper}. We proceeded that way because the UCAR library is used as the
-     * reference implementation. However subclasses can override if they want to test a different
-     * library.
+     * Default implementation opens the file with UCAR netCDF library and wraps the UCAR object in {@link DecoderWrapper}.
+     * We proceeded that way because we use UCAR library as the reference implementation.
+     * Subclasses override this method for testing with Apache SIS implementation.
      *
-     * @param  name  the file name as one of the above-cited constants.
-     * @return the decoder for the given name.
+     * @param  file  the dataset as one of the above-cited constants.
+     * @return the decoder for the specified dataset.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
-    protected Decoder createDecoder(final String name) throws IOException, DataStoreException {
-        return new DecoderWrapper(new NetcdfDataset(open(name)), GeometryLibrary.JAVA2D, LISTENERS);
+    protected Decoder createDecoder(final TestData file) throws IOException, DataStoreException {
+        return new DecoderWrapper(new NetcdfDataset(createUCAR(file)), GeometryLibrary.JAVA2D, LISTENERS);
     }
 
     /**
      * Selects the dataset to use for the tests. If a decoder for the given name has already been
      * opened, then this method returns that decoder. Otherwise a new decoder is created by a call
-     * to {@link #createDecoder(String)}, then cached.
+     * to {@link #createDecoder(TestData)}, then cached.
      *
      * <p>The {@linkplain Decoder#setSearchPath(String[]) search path} of the returned decoder
      * is initialized to the global attributes only.</p>
      *
-     * @param  name  the file name as one of the constants enumerated in the {@link #createDecoder(String)} method.
+     * @param  name  the file as one of the constants enumerated in the {@link #createDecoder(TestData)} method.
      * @return the decoder for the given name.
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
-    protected final Decoder selectDataset(final String name) throws IOException, DataStoreException {
+    protected final Decoder selectDataset(final TestData name) throws IOException, DataStoreException {
         synchronized (DECODERS) {               // Paranoiac safety, but should not be used in multi-threads environment.
             decoder = DECODERS.get(name);
             if (decoder == null) {
@@ -181,7 +187,7 @@ public abstract strictfp class TestCase
 
     /**
      * Asserts that the textual value of the named attribute is equals to the expected value.
-     * The {@link #selectDataset(String)} method must be invoked at least once before this method.
+     * The {@link #selectDataset(TestData)} method must be invoked at least once before this method.
      *
      * @param  expected       the expected attribute value.
      * @param  attributeName  the name of the attribute to test.
@@ -193,7 +199,7 @@ public abstract strictfp class TestCase
 
     /**
      * Asserts that the numeric value of the named attribute is equals to the expected value.
-     * The {@link #selectDataset(String)} method must be invoked at least once before this method.
+     * The {@link #selectDataset(TestData)} method must be invoked at least once before this method.
      *
      * @param  expected       the expected attribute value.
      * @param  attributeName  the name of the attribute to test.
@@ -205,7 +211,7 @@ public abstract strictfp class TestCase
 
     /**
      * Asserts that the temporal value of the named attribute is equals to the expected value.
-     * The {@link #selectDataset(String)} method must be invoked at least once before this method.
+     * The {@link #selectDataset(TestData)} method must be invoked at least once before this method.
      *
      * @param  expected       the expected attribute value.
      * @param  attributeName  the name of the attribute to test.

Added: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestData.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestData.java?rev=1831975&view=auto
==============================================================================
--- sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestData.java (added)
+++ sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestData.java [UTF-8] Mon May 21 14:51:05 2018
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.netcdf;
+
+import java.net.URL;
+import java.io.InputStream;
+
+import static org.junit.Assume.*;
+
+
+/**
+ * Place-holder for a GeoAPI 3.1 class. Used only for allowing the code to compile.
+ * For real test execution, see the development branches on GeoAPI 4.0-SNAPSHOT.
+ */
+public enum TestData {
+    NETCDF_2D_GEOGRAPHIC,
+
+    NETCDF_4D_PROJECTED;
+
+    public URL location() {
+        assumeTrue("This test requires GeoAPI 3.1.", false);
+        return null;
+    }
+
+    public InputStream open() {
+        assumeTrue("This test requires GeoAPI 3.1.", false);
+        return null;
+    }
+
+    public byte[] content() {
+        assumeTrue("This test requires GeoAPI 3.1.", false);
+        return null;
+    }
+}

Propchange: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/trunk/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestData.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8



Mime
View raw message