sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1831907 - in /sis/branches/JDK8: application/sis-console/ application/sis-console/src/test/java/org/apache/sis/console/ storage/sis-netcdf/ storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ storage/sis-netcdf/src/test/j...
Date Sat, 19 May 2018 16:16:32 GMT
Author: desruisseaux
Date: Sat May 19 16:16:31 2018
New Revision: 1831907

URL: http://svn.apache.org/viewvc?rev=1831907&view=rev
Log:
Do not depends anymore on geoapi-netcdf test JAR.
https://github.com/opengeospatial/geoapi/issues/25

Removed:
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java
Modified:
    sis/branches/JDK8/application/sis-console/pom.xml
    sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java
    sis/branches/JDK8/storage/sis-netcdf/pom.xml
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
    sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java
    sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java

Modified: sis/branches/JDK8/application/sis-console/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/pom.xml?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/pom.xml (original)
+++ sis/branches/JDK8/application/sis-console/pom.xml Sat May 19 16:16:31 2018
@@ -148,25 +148,6 @@
 
     <!-- Test dependencies -->
     <dependency>
-      <!-- For UCAR netCDF -->
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-jdk14</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.opengis.wrapper</groupId>
-      <artifactId>geoapi-netcdf</artifactId>
-      <version>${geoapi.version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>tec.units</groupId>
-          <artifactId>unit-ri</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
       <groupId>org.apache.sis.core</groupId>
       <artifactId>sis-metadata</artifactId>
       <version>${project.version}</version>

Modified: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java [UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MetadataCommandTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -17,7 +17,7 @@
 package org.apache.sis.console;
 
 import java.net.URL;
-import org.opengis.wrapper.netcdf.IOTestCase;
+import org.opengis.test.dataset.TestData;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -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
  */
@@ -42,10 +42,8 @@ public final strictfp class MetadataComm
      * @throws Exception if an error occurred while creating the command.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testNetCDF() throws Exception {
-        final URL url = IOTestCase.class.getResource(IOTestCase.NCEP);
-        assertNotNull(IOTestCase.NCEP, url);
+        final URL url = TestData.NETCDF_2D_GEOGRAPHIC.location();
         final MetadataCommand test = new MetadataCommand(0, CommandRunner.TEST, url.toString());
         test.run();
         verifyNetCDF("Metadata", test.outputBuffer.toString());
@@ -69,9 +67,8 @@ public final strictfp class MetadataComm
      */
     @Test
     @DependsOnMethod("testNetCDF")
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testFormatXML() throws Exception {
-        final URL url = IOTestCase.class.getResource(IOTestCase.NCEP);
+        final URL url = 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/branches/JDK8/storage/sis-netcdf/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/pom.xml?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/pom.xml (original)
+++ sis/branches/JDK8/storage/sis-netcdf/pom.xml Sat May 19 16:16:31 2018
@@ -134,19 +134,6 @@
       </exclusions>
     </dependency>
     <dependency>
-      <groupId>org.opengis.wrapper</groupId>
-      <artifactId>geoapi-netcdf</artifactId>
-      <version>${geoapi.version}</version>
-      <type>test-jar</type>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>tec.units</groupId>
-          <artifactId>unit-ri</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-jdk14</artifactId>
       <scope>test</scope>

Modified: sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java [UTF-8] Sat May 19 16:16:31 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/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/VariableInfo.java [UTF-8] Sat May 19 16:16:31 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/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/DecoderTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -19,6 +19,7 @@ package org.apache.sis.internal.netcdf;
 import java.util.Date;
 import java.io.IOException;
 import org.apache.sis.storage.DataStoreException;
+import org.opengis.test.dataset.TestData;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -30,7 +31,7 @@ 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 1.0
@@ -45,22 +46,14 @@ public strictfp class DecoderTest extend
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     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);
-// TODO     assertAttributeEquals(/* Only control character */ (String) null,   TITLE);
-            assertAttributeEquals("UCAR",                                      "INSTITUTION");
-// TODO     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,16 +63,14 @@ public strictfp class DecoderTest extend
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     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.
     }
 
     /**
@@ -89,11 +80,11 @@ public strictfp class DecoderTest extend
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     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);
     }
 
     /**
@@ -103,9 +94,8 @@ public strictfp class DecoderTest extend
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     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));
@@ -124,9 +114,8 @@ public strictfp class DecoderTest extend
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     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/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/GridGeometryTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -21,6 +21,7 @@ import org.apache.sis.storage.DataStoreE
 import org.apache.sis.storage.netcdf.AttributeNames;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.DependsOnMethod;
+import org.opengis.test.dataset.TestData;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -31,7 +32,7 @@ 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 1.0
@@ -60,39 +61,69 @@ public strictfp class GridGeometryTest e
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     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")
-    @org.junit.Ignore("To be modified after GeoAPI update.")
-    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/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/TestCase.java [UTF-8] Sat May 19 16:16:31 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;
@@ -28,15 +28,16 @@ import org.apache.sis.util.logging.Empty
 import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.setup.GeometryLibrary;
-import org.opengis.wrapper.netcdf.IOTestCase;
+import org.opengis.test.dataset.TestData;
 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>
  *
@@ -45,11 +46,11 @@ import static org.junit.Assert.*;
  * @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[])}
@@ -58,12 +59,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;
@@ -75,60 +76,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.
-     *
-     * @deprecated Not needed anymore after GeoAPI update.
+     * @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.
      */
-    @Deprecated
-    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 #THREDDS} for a NcML file.</li>
-     *   <li>{@link #NCEP}    for a netCDF binary file.</li>
-     *   <li>{@link #CIP}     for a netCDF binary file.</li>
-     *   <li>{@link #LANDSAT} 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) {
@@ -187,7 +188,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.
@@ -199,7 +200,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.
@@ -211,7 +212,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.

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/VariableTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -18,8 +18,11 @@ package org.apache.sis.internal.netcdf;
 
 import java.io.IOException;
 import org.apache.sis.math.Vector;
+import org.apache.sis.util.Workaround;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
 import org.apache.sis.test.DependsOn;
+import org.opengis.test.dataset.TestData;
 import org.junit.Test;
 
 import static org.opengis.test.Assert.*;
@@ -29,7 +32,7 @@ import static org.opengis.test.Assert.*;
  * Tests the {@link Variable} implementation. The default implementation tests
  * {@code org.apache.sis.internal.netcdf.ucar.VariableWrapper} 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 1.0
@@ -45,7 +48,41 @@ public strictfp class VariableTest exten
     private static final int NUM_BASIC_PROPERTY_COLUMNS = 6;
 
     /**
-     * Tests the basic properties of all variables found in the {@link #NCEP} file.
+     * Whether the {@code "runtime"} variable in {@link TestData#NETCDF_4D_PROJECTED} is considered an axis or not.
+     * The UCAR library considers it as an axis because it has an {@code "_CoordinateAxisType"} attribute.
+     * Apache SIS does not consider it as an axis because that variable does not match any dimension and is not used
+     * in any other variable.
+     */
+    protected boolean isRuntimeAnAxis;
+
+    /**
+     * Creates a new test.
+     */
+    public VariableTest() {
+        isRuntimeAnAxis = true;
+    }
+
+    /**
+     * Gets the variable from the given decoder, reordering them if the decoder is a wrapper for UCAR library.
+     * We perform this reordering because UCAR library does not always return the variables in the order they
+     * are declared. In the case of the {@link TestData#NETCDF_4D_PROJECTED} file, the CIP variable is expected
+     * last but UCAR library put it second.
+     */
+    @Workaround(library = "UCAR", version = "4.6.11")
+    private Variable[] getVariablesCIP(final Decoder decoder) {
+        Variable[] variables = decoder.getVariables();
+        if (decoder instanceof DecoderWrapper) {
+            variables = variables.clone();
+            final Variable cip = variables[1];
+            final int last = variables.length - 1;
+            System.arraycopy(variables, 2, variables, 1, last - 1);
+            variables[last] = cip;
+        }
+        return variables;
+    }
+
+    /**
+     * Tests the basic properties of all variables found in the {@link TestData#NETCDF_4D_PROJECTED} file.
      * The tested methods are:
      *
      * <ul>
@@ -61,37 +98,17 @@ public strictfp class VariableTest exten
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testBasicProperties() throws IOException, DataStoreException {
         assertBasicPropertiesEqual(new Object[] {
-        // __name______________description_________________________________datatype_______dim__axis?__raster?
-            "reftime",        "reference time",                            DataType.DOUBLE, 1, false, false,
-            "datetime",       "reference date and time",                   DataType.CHAR,   2, false, false,
-            "forecasttime",   "forecast date and time",                    DataType.CHAR,   2, false, false,
-            "model_id",       "generating process ID number",              DataType.INT,    1, false, false,
-            "nav_model",      "navigation model name",                     DataType.CHAR,   2, false, false,
-            "grid_type_code", "GRIB-1 GDS data representation type",       DataType.INT,    1, false, false,
-            "grid_type",      "GRIB-1 grid type",                          DataType.CHAR,   2, false, false,
-            "grid_name",      "grid name",                                 DataType.CHAR,   2, false, false,
-            "grid_center",    "GRIB-1 originating center ID",              DataType.INT,    1, false, false,
-            "grid_number",    "GRIB-1 catalogued grid numbers",            DataType.INT,    2, false, false,
-            "i_dim",          "longitude dimension name",                  DataType.CHAR,   2, false, false,
-            "j_dim",          "latitude dimension name",                   DataType.CHAR,   2, false, false,
-            "Ni",             "number of points along a latitude circle",  DataType.INT,    1, false, false,
-            "Nj",             "number of points along a longitude circle", DataType.INT,    1, false, false,
-            "La1",            "latitude of first grid point",              DataType.FLOAT,  1, false, false,
-            "Lo1",            "longitude of first grid point",             DataType.FLOAT,  1, false, false,
-            "La2",            "latitude of last grid point",               DataType.FLOAT,  1, false, false,
-            "Lo2",            "longitude of last grid point",              DataType.FLOAT,  1, false, false,
-            "Di",             "longitudinal direction increment",          DataType.FLOAT,  1, false, false,
-            "Dj",             "latitudinal direction increment",           DataType.FLOAT,  1, false, false,
-            "ResCompFlag",    "resolution and component flags",            DataType.BYTE,   1, false, false,
-            "SST",            "Sea temperature",                           DataType.FLOAT,  3, false, true,
-            "valtime",        "valid time",                                DataType.DOUBLE, 1, true,  false,
-            "valtime_offset", "hours from reference time",                 DataType.DOUBLE, 1, true,  false,
-            "lat",            "latitude",                                  DataType.FLOAT,  1, true,  false,
-            "lon",            "longitude",                                 DataType.FLOAT,  1, true,  false
-        }, selectDataset(NCEP).getVariables());
+        // __name______________description_____________________datatype_______dim__axis?__raster?
+            "grid_mapping_0", null,                            DataType.INT,    0, false, false,
+            "x0",             "projection_x_coordinate",       DataType.FLOAT,  1, true,  false,
+            "y0",             "projection_y_coordinate",       DataType.FLOAT,  1, true,  false,
+            "z0",             "Flight levels in 100s of feet", DataType.FLOAT,  1, true,  false,
+            "time",           "Data time",                     DataType.DOUBLE, 1, true,  false,
+            "runtime",        "Data generation time",          DataType.DOUBLE, 1, isRuntimeAnAxis, false,
+            "CIP",            "Current Icing Product",         DataType.FLOAT,  4, false, true
+        }, getVariablesCIP(selectDataset(TestData.NETCDF_4D_PROJECTED)));
     }
 
     /**
@@ -120,24 +137,44 @@ public strictfp class VariableTest exten
     }
 
     /**
-     * Tests {@link Variable#getGridDimensionNames()} and {@link Variable#getGridEnvelope()}.
-     * Current implementation tests on the {@code "SST"} variable.
+     * Tests {@link Variable#getGridDimensionNames()} and {@link Variable#getGridEnvelope()}
+     * on a simple two-dimensional dataset.
      *
      * @throws IOException if an I/O error occurred while opening the file.
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
-    public void testGridDimensions() throws IOException, DataStoreException {
-        final Variable variable = selectDataset(NCEP).getVariables()[21];
+    public void testGridRange2D() throws IOException, DataStoreException {
+        final Variable variable = selectDataset(TestData.NETCDF_2D_GEOGRAPHIC).getVariables()[0];
         assertEquals("SST", variable.getName());
 
         assertArrayEquals("getGridDimensionNames()", new String[] {
-            "record", "lat", "lon"
+            "lat", "lon"
         }, variable.getGridDimensionNames());
 
         assertArrayEquals("getGridEnvelope()", new int[] {
-            1, 73, 73
+            73, 73
+        }, variable.getGridEnvelope());
+    }
+
+    /**
+     * Tests {@link Variable#getGridDimensionNames()} and {@link Variable#getGridEnvelope()}
+     * on a compound four-dimensional dataset.
+     *
+     * @throws IOException if an I/O error occurred while opening the file.
+     * @throws DataStoreException if a logical error occurred.
+     */
+    @Test
+    public void testGridRange4D() throws IOException, DataStoreException {
+        final Variable variable = getVariablesCIP(selectDataset(TestData.NETCDF_4D_PROJECTED))[6];
+        assertEquals("CIP", variable.getName());
+
+        assertArrayEquals("getGridDimensionNames()", new String[] {
+            "time", "z0", "y0", "x0"
+        }, variable.getGridDimensionNames());
+
+        assertArrayEquals("getGridEnvelope()", new int[] {
+            1, 4, 19, 38
         }, variable.getGridEnvelope());
     }
 
@@ -148,20 +185,19 @@ public strictfp class VariableTest exten
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testGetAttributes() throws IOException, DataStoreException {
-        final Variable[] variables = selectDataset(NCEP).getVariables();
-        Variable variable = variables[9];
-        assertEquals("grid_number", variable.getName());
-        assertArrayEquals("grid_number:_FillValue", new Number[] { -9999 }, variable.getAttributeValues("_FillValue", true));
-        assertArrayEquals("grid_number:_FillValue", new String[] {"-9999"}, variable.getAttributeValues("_FillValue", false));
-
-        variable = variables[21];
-        assertEquals("SST", variable.getName());
-        assertArrayEquals("SST:_FillValue", new Number[] { -9999f  }, variable.getAttributeValues("_FillValue", true));
-        assertArrayEquals("SST:_FillValue", new String[] {"-9999.0"}, variable.getAttributeValues("_FillValue", false));
-        assertArrayEquals("SST:units",      new String[] {"degK"},    variable.getAttributeValues("units",      false));
-        assertArrayEquals("SST:units",      new Number[] {      },    variable.getAttributeValues("units",      true));
+        final Variable[] variables = getVariablesCIP(selectDataset(TestData.NETCDF_4D_PROJECTED));
+        Variable variable = variables[6];
+        assertEquals("CIP", variable.getName());
+        assertArrayEquals("CIP:_FillValue", new Number[] { -1f  }, variable.getAttributeValues("_FillValue", true));
+        assertArrayEquals("CIP:_FillValue", new String[] {"-1.0"}, variable.getAttributeValues("_FillValue", false));
+        assertArrayEquals("CIP:units",      new String[] {   "%"}, variable.getAttributeValues("units",      false));
+        assertArrayEquals("CIP:units",      new Number[] {      }, variable.getAttributeValues("units",      true));
+
+        variable = variables[0];
+        assertEquals("grid_mapping_0", variable.getName());
+        assertArrayEquals("standard_parallel", new Number[] { 25.f,   25.05f}, variable.getAttributeValues("standard_parallel", true));
+        assertArrayEquals("standard_parallel", new String[] {"25.0", "25.05"}, variable.getAttributeValues("standard_parallel", false));
     }
 
     /**
@@ -171,9 +207,8 @@ public strictfp class VariableTest exten
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testRead1D() throws IOException, DataStoreException {
-        final Variable variable = selectDataset(NCEP).getVariables()[25];
+        final Variable variable = selectDataset(TestData.NETCDF_2D_GEOGRAPHIC).getVariables()[2];
         assertEquals("lon", variable.getName());
         final Vector data = variable.read();
         assertEquals("lon", Float.class, data.getElementType());

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/ChannelDecoderTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -20,15 +20,13 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.ByteBuffer;
 import java.nio.channels.Channels;
-import org.opengis.wrapper.netcdf.IOTestCase;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.DecoderTest;
 import org.apache.sis.internal.storage.io.ChannelDataInput;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.setup.GeometryLibrary;
 import org.apache.sis.test.DependsOn;
-
-import static org.junit.Assert.*;
+import org.opengis.test.dataset.TestData;
 
 
 /**
@@ -37,56 +35,42 @@ import static org.junit.Assert.*;
  * passed.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn(DecoderTest.class)
 public final strictfp class ChannelDecoderTest extends DecoderTest {
     /**
-     * Creates a new decoder for dataset of the given name.
+     * Creates a new decoder for the specified dataset.
      *
-     * @return the decoder for the given name.
+     * @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.
      */
     @Override
-    protected Decoder createDecoder(final String name) throws IOException, DataStoreException {
-        return createChannelDecoder(name);
+    protected Decoder createDecoder(final TestData file) throws IOException, DataStoreException {
+        return createChannelDecoder(file);
     }
 
     /**
-     * Creates a new {@link ChannelDecoder} instance for dataset of the given name.
-     * The {@code name} parameter can be one of the following values:
+     * Creates a new {@link ChannelDecoder} instance for the specified dataset.
+     * The {@code file} parameter can be one of the following values:
      *
      * <ul>
-     *   <li>{@link #THREDDS} for a NcML file.</li>
-     *   <li>{@link #NCEP}    for a netCDF binary file.</li>
-     *   <li>{@link #CIP}     for a netCDF binary file.</li>
-     *   <li>{@link #LANDSAT} 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>
      *
-     * @param  name  the file name as one of the above-cited constants.
-     * @return the decoder for the given name.
+     * @param  file  the file 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.
      */
-    public static Decoder createChannelDecoder(final String name) throws IOException, DataStoreException {
-        final InputStream in = IOTestCase.class.getResourceAsStream(name);
-        assertNotNull(name, in);
-        final ChannelDataInput input = new ChannelDataInput(name,
+    public static Decoder createChannelDecoder(final TestData file) throws IOException, DataStoreException {
+        final InputStream in = file.open();
+        final ChannelDataInput input = new ChannelDataInput(file.name(),
                 Channels.newChannel(in), ByteBuffer.allocate(4096), false);
         return new ChannelDecoder(input, null, GeometryLibrary.JAVA2D, LISTENERS);
     }
-
-    /**
-     * Unconditionally returns {@code false} since {@link ChannelDecoder}
-     * supports only the classic and 64 bits netCDF formats.
-     *
-     * @return {@code false}.
-     */
-    @Override
-    protected boolean isSupplementalFormatSupported(final String format) {
-        return false;
-    }
 }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/GridGeometryInfoTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -23,6 +23,7 @@ import org.apache.sis.internal.netcdf.Gr
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.test.DependsOn;
+import org.opengis.test.dataset.TestData;
 
 
 /**
@@ -31,33 +32,22 @@ import org.apache.sis.test.DependsOn;
  * passed.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn({VariableInfoTest.class, GridGeometryTest.class})
 public final strictfp class GridGeometryInfoTest extends GridGeometryTest {
     /**
-     * Creates a new decoder for dataset of the given name.
+     * Creates a new decoder for the specified dataset.
      *
-     * @return the decoder for the given name.
+     * @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.
      */
     @Override
-    protected Decoder createDecoder(final String name) throws IOException, DataStoreException {
-        return ChannelDecoderTest.createChannelDecoder(name);
-    }
-
-    /**
-     * Unconditionally returns {@code false} since {@link ChannelDecoder}
-     * supports only the classic and 64 bits netCDF formats.
-     *
-     * @return {@code false}.
-     */
-    @Override
-    protected boolean isSupplementalFormatSupported(final String format) {
-        return false;
+    protected Decoder createDecoder(final TestData file) throws IOException, DataStoreException {
+        return ChannelDecoderTest.createChannelDecoder(file);
     }
 
     /**

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/internal/netcdf/impl/VariableInfoTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -21,6 +21,7 @@ import org.apache.sis.internal.netcdf.De
 import org.apache.sis.internal.netcdf.VariableTest;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.test.DependsOn;
+import org.opengis.test.dataset.TestData;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -32,33 +33,29 @@ import static org.junit.Assert.*;
  * passed.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn({ChannelDecoderTest.class, VariableTest.class})
 public final strictfp class VariableInfoTest extends VariableTest {
     /**
-     * Creates a new decoder for dataset of the given name.
-     *
-     * @return the decoder for the given dataset.
-     * @throws IOException if an I/O error occurred while opening the file.
-     * @throws DataStoreException if a logical error occurred.
+     * Creates a new test.
      */
-    @Override
-    protected Decoder createDecoder(final String name) throws IOException, DataStoreException {
-        return ChannelDecoderTest.createChannelDecoder(name);
+    public VariableInfoTest() {
+        isRuntimeAnAxis = false;
     }
 
     /**
-     * Unconditionally returns {@code false} since {@link ChannelDecoder}
-     * supports only the classic and 64 bits netCDF formats.
+     * Creates a new decoder for the specified dataset.
      *
-     * @return {@code false}.
+     * @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.
      */
     @Override
-    protected boolean isSupplementalFormatSupported(final String format) {
-        return false;
+    protected Decoder createDecoder(final TestData file) throws IOException, DataStoreException {
+        return ChannelDecoderTest.createChannelDecoder(file);
     }
 
     /**

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -17,17 +17,14 @@
 package org.apache.sis.storage.netcdf;
 
 import java.io.IOException;
-import ucar.nc2.dataset.NetcdfDataset;
 import org.opengis.metadata.Metadata;
-import org.opengis.wrapper.netcdf.IOTestCase;
 import org.apache.sis.internal.netcdf.TestCase;
 import org.apache.sis.internal.netcdf.Decoder;
-import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
 import org.apache.sis.internal.netcdf.impl.ChannelDecoderTest;
 import org.apache.sis.metadata.iso.DefaultMetadata;
 import org.apache.sis.storage.DataStoreException;
-import org.apache.sis.setup.GeometryLibrary;
 import org.apache.sis.test.DependsOn;
+import org.opengis.test.dataset.TestData;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -47,7 +44,7 @@ import static org.apache.sis.test.TestUt
     ChannelDecoderTest.class,
     org.apache.sis.internal.netcdf.impl.VariableInfoTest.class
 })
-public final strictfp class MetadataReaderTest extends IOTestCase {
+public final strictfp class MetadataReaderTest extends TestCase {
     /**
      * Tests {@link MetadataReader#split(String)}.
      */
@@ -65,10 +62,9 @@ public final strictfp class MetadataRead
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testEmbedded() throws IOException, DataStoreException {
         final Metadata metadata;
-        try (Decoder input = ChannelDecoderTest.createChannelDecoder(NCEP)) {
+        try (Decoder input = ChannelDecoderTest.createChannelDecoder(TestData.NETCDF_2D_GEOGRAPHIC)) {
             metadata = new MetadataReader(input).read();
         }
         compareToExpected(metadata);
@@ -85,7 +81,7 @@ public final strictfp class MetadataRead
     @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testUCAR() throws IOException, DataStoreException {
         final Metadata metadata;
-        try (Decoder input = new DecoderWrapper(new NetcdfDataset(open(NCEP)), GeometryLibrary.JAVA2D, TestCase.LISTENERS)) {
+        try (Decoder input = createDecoder(TestData.NETCDF_2D_GEOGRAPHIC)) {
             metadata = new MetadataReader(input).read();
         }
         compareToExpected(metadata);
@@ -93,10 +89,9 @@ public final strictfp class MetadataRead
 
     /**
      * Compares the string representation of the given metadata object with the expected one.
-     * The given metadata shall have been created from the {@link #NCEP} dataset.
+     * The given metadata shall have been created from the {@link TestData#NETCDF_2D_GEOGRAPHIC} dataset.
      */
     static void compareToExpected(final Metadata actual) {
-        if (true) return;   // TODO: need to be revised.
         final String text = formatNameAndValue(DefaultMetadata.castOrCopy(actual).asTreeTable());
         assertMultilinesEquals(
             "Metadata\n" +
@@ -124,25 +119,26 @@ public final strictfp class MetadataRead
             "  │   │   └─Organisation…………………………………………………………… International Organization for Standardization\n" +
             "  │   └─Presentation form………………………………………………………… Document digital\n" +
             "  ├─Spatial representation info\n" +
-            "  │   ├─Number of dimensions………………………………………………… 3\n" +
-            "  │   ├─Axis dimension properties (1 of 3)…………… Column\n" +
+            "  │   ├─Number of dimensions………………………………………………… 2\n" +
+            "  │   ├─Axis dimension properties (1 of 2)…………… Column\n" +
             "  │   │   └─Dimension size……………………………………………………… 73\n" +
-            "  │   ├─Axis dimension properties (2 of 3)…………… Row\n" +
+            "  │   ├─Axis dimension properties (2 of 2)…………… Row\n" +
             "  │   │   └─Dimension size……………………………………………………… 73\n" +
-            "  │   ├─Axis dimension properties (3 of 3)…………… Time\n" +
-            "  │   │   └─Dimension size……………………………………………………… 1\n" +
             "  │   ├─Cell geometry…………………………………………………………………… Area\n" +
             "  │   └─Transformation parameter availability…… false\n" +
             "  ├─Identification info\n" +
-            "  │   ├─Citation………………………………………………………………………………… Sea Surface Temperature Analysis Model\n" +
-            "  │   │   ├─Date………………………………………………………………………………… 2005-09-22 00:00:00\n" +
+            "  │   ├─Citation………………………………………………………………………………… Test data from Sea Surface Temperature Analysis Model\n" +
+            "  │   │   ├─Date (1 of 2)………………………………………………………… 2005-09-22 00:00:00\n" +
             "  │   │   │   └─Date type………………………………………………………… Creation\n" +
+            "  │   │   ├─Date (2 of 2)………………………………………………………… 2018-05-15 13:00:00\n" +
+            "  │   │   │   └─Date type………………………………………………………… Revision\n" +
             "  │   │   ├─Identifier………………………………………………………………… NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +
             "  │   │   │   └─Authority………………………………………………………… edu.ucar.unidata\n" +
             "  │   │   └─Cited responsible party\n" +
             "  │   │       ├─Role……………………………………………………………………… Originator\n" +
-            "  │   │       └─Individual……………………………………………………… NOAA/NWS/NCEP\n" +  // TODO: actually we can not distinguish individual from organization.
-            "  │   ├─Abstract………………………………………………………………………………… NCEP SST Global 5.0 x 2.5 degree model data\n" +
+            "  │   │       └─Individual……………………………………………………… NOAA/NWS/NCEP\n" +
+            "  │   ├─Abstract………………………………………………………………………………… Global, two-dimensional model data\n" +
+            "  │   ├─Purpose…………………………………………………………………………………… GeoAPI conformance tests\n" +
             "  │   ├─Point of contact\n" +
             "  │   │   ├─Role………………………………………………………………………………… Point of contact\n" +
             "  │   │   └─Individual………………………………………………………………… NOAA/NWS/NCEP\n" +
@@ -161,21 +157,26 @@ public final strictfp class MetadataRead
             "  │   │   ├─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" +
+            "  │   ├─Resource constraints\n" +
+            "  │   │   └─Use limitation……………………………………………………… Freely available\n" +
+            "  │   └─Supplemental information……………………………………… For testing purpose only.\n" +
             "  ├─Content info\n" +
             "  │   └─Attribute group\n" +
             "  │       └─Attribute…………………………………………………………………… SST\n" +
             "  │           ├─Description…………………………………………………… Sea temperature\n" +
             "  │           ├─Name……………………………………………………………………… sea_water_temperature\n" +
-            "  │           └─Units…………………………………………………………………… K\n" +
+            "  │           ├─Units…………………………………………………………………… °C\n" +
+            "  │           ├─Scale factor………………………………………………… 0.0011\n" +
+            "  │           ├─Offset………………………………………………………………… -1.85\n" +
+            "  │           └─Transfer function type……………………… Linear\n" +
             "  ├─Data quality info\n" +
             "  │   ├─Scope\n" +
             "  │   │   └─Level……………………………………………………………………………… Dataset\n" +
             "  │   └─Lineage\n" +
-            "  │       └─Statement…………………………………………………………………… 2003-04-07 12:12:50 - created by gribtocdl" +
-            "              2005-09-26T21:50:00 - edavis - add attributes for dataset discovery\n" +
-            "  └─Metadata scope\n" +
-            "      └─Resource scope………………………………………………………………… Dataset\n", text);
+            "  │       └─Statement…………………………………………………………………… Decimated and modified by GeoAPI for inclusion in conformance test suite.\n" +
+            "  ├─Metadata scope\n" +
+            "  │   └─Resource scope………………………………………………………………… Dataset\n" +
+            "  └─Date info………………………………………………………………………………………… 2018-05-15 13:01:00\n" +
+            "      └─Date type……………………………………………………………………………… Revision\n", text);
     }
 }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreProviderTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -18,7 +18,6 @@ package org.apache.sis.storage.netcdf;
 
 import java.io.IOException;
 import ucar.nc2.NetcdfFile;
-import org.opengis.wrapper.netcdf.IOTestCase;
 import org.apache.sis.internal.netcdf.TestCase;
 import org.apache.sis.internal.netcdf.Decoder;
 import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
@@ -29,6 +28,7 @@ import org.apache.sis.storage.StorageCon
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.util.Version;
 import org.apache.sis.test.DependsOn;
+import org.opengis.test.dataset.TestData;
 import org.junit.Test;
 
 import static org.opengis.test.Assert.*;
@@ -38,14 +38,14 @@ import static org.opengis.test.Assert.*;
  * Tests {@link NetcdfStoreProvider}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.4
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @DependsOn({
     ChannelDecoderTest.class
 })
-public final strictfp class NetcdfStoreProviderTest extends IOTestCase {
+public final strictfp class NetcdfStoreProviderTest extends TestCase {
     /**
      * Tests {@link NetcdfStoreProvider#probeContent(StorageConnector)} for an input stream which shall
      * be recognized as a classic netCDF file.
@@ -53,9 +53,8 @@ public final strictfp class NetcdfStoreP
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testProbeContentFromStream() throws DataStoreException {
-        final StorageConnector c = new StorageConnector(IOTestCase.class.getResourceAsStream(NCEP));
+        final StorageConnector c = new StorageConnector(TestData.NETCDF_2D_GEOGRAPHIC.location());
         final NetcdfStoreProvider provider = new NetcdfStoreProvider();
         final ProbeResult probe = provider.probeContent(c);
         assertTrue  ("isSupported", probe.isSupported());
@@ -72,7 +71,7 @@ public final strictfp class NetcdfStoreP
      */
     @Test
     public void testProbeContentFromUCAR() throws IOException, DataStoreException {
-        try (NetcdfFile file = open(NCEP)) {
+        try (NetcdfFile file = createUCAR(TestData.NETCDF_2D_GEOGRAPHIC)) {
             final StorageConnector c = new StorageConnector(file);
             final NetcdfStoreProvider provider = new NetcdfStoreProvider();
             final ProbeResult probe = provider.probeContent(c);
@@ -90,11 +89,10 @@ public final strictfp class NetcdfStoreP
      * @throws DataStoreException if a logical error occurred.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testDecoderFromStream() throws IOException, DataStoreException {
-        final StorageConnector c = new StorageConnector(IOTestCase.class.getResourceAsStream(NCEP));
-        try (Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c)) {
-            assertInstanceOf(NCEP, ChannelDecoder.class, decoder);
+        final StorageConnector c = new StorageConnector(TestData.NETCDF_2D_GEOGRAPHIC.open());
+        try (Decoder decoder = NetcdfStoreProvider.decoder(LISTENERS, c)) {
+            assertInstanceOf("decoder", ChannelDecoder.class, decoder);
         }
     }
 
@@ -107,9 +105,9 @@ public final strictfp class NetcdfStoreP
      */
     @Test
     public void testDecoderFromUCAR() throws IOException, DataStoreException {
-        final StorageConnector c = new StorageConnector(open(NCEP));
-        try (Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c)) {
-            assertInstanceOf(NCEP, DecoderWrapper.class, decoder);
+        final StorageConnector c = new StorageConnector(createUCAR(TestData.NETCDF_2D_GEOGRAPHIC));
+        try (Decoder decoder = NetcdfStoreProvider.decoder(LISTENERS, c)) {
+            assertInstanceOf("decoder", DecoderWrapper.class, decoder);
         }
     }
 }

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/NetcdfStoreTest.java [UTF-8] Sat May 19 16:16:31 2018
@@ -17,11 +17,12 @@
 package org.apache.sis.storage.netcdf;
 
 import org.opengis.metadata.Metadata;
-import org.opengis.wrapper.netcdf.IOTestCase;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.util.Version;
+import org.opengis.test.dataset.TestData;
 import org.junit.Test;
 
 import static org.opengis.test.Assert.*;
@@ -39,15 +40,15 @@ import static org.opengis.test.Assert.*;
     MetadataReaderTest.class,
     NetcdfStoreProviderTest.class
 })
-public final strictfp class NetcdfStoreTest extends IOTestCase {
+public final strictfp class NetcdfStoreTest extends TestCase {
     /**
      * Returns a new netCDF store to test.
      *
      * @param  dataset the name of the datastore to load.
      * @throws DataStoreException if an error occurred while reading the netCDF file.
      */
-    private static NetcdfStore create(final String dataset) throws DataStoreException {
-        return new NetcdfStore(null, new StorageConnector(IOTestCase.class.getResource(dataset)));
+    private static NetcdfStore create(final TestData dataset) throws DataStoreException {
+        return new NetcdfStore(null, new StorageConnector(dataset.location()));
     }
 
     /**
@@ -56,10 +57,9 @@ public final strictfp class NetcdfStoreT
      * @throws DataStoreException if an error occurred while reading the netCDF file.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testGetMetadata() throws DataStoreException {
         final Metadata metadata;
-        try (NetcdfStore store = create(NCEP)) {
+        try (NetcdfStore store = create(TestData.NETCDF_2D_GEOGRAPHIC)) {
             metadata = store.getMetadata();
             assertSame("Should be cached.", metadata, store.getMetadata());
         }
@@ -72,10 +72,9 @@ public final strictfp class NetcdfStoreT
      * @throws DataStoreException if an error occurred while reading the netCDF file.
      */
     @Test
-    @org.junit.Ignore("To be modified after GeoAPI update.")
     public void testGetConventionVersion() throws DataStoreException {
         final Version version;
-        try (NetcdfStore store = create(CIP)) {
+        try (NetcdfStore store = create(TestData.NETCDF_2D_GEOGRAPHIC)) {
             version = store.getConventionVersion();
         }
         assertEquals("major", 1, version.getMajor());

Modified: sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java?rev=1831907&r1=1831906&r2=1831907&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java [UTF-8] Sat May 19 16:16:31 2018
@@ -16,9 +16,7 @@
  */
 package org.apache.sis.test.suite;
 
-import org.opengis.wrapper.netcdf.IOTestCase;
 import org.apache.sis.test.TestSuite;
-import org.apache.sis.test.TestCase;
 import org.junit.runners.Suite;
 import org.junit.BeforeClass;
 
@@ -27,7 +25,7 @@ import org.junit.BeforeClass;
  * All tests from the {@code sis-netcdf} module, in approximative dependency order.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -40,7 +38,6 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.netcdf.impl.VariableInfoTest.class,
     org.apache.sis.internal.netcdf.impl.GridGeometryInfoTest.class,
     org.apache.sis.storage.netcdf.MetadataReaderTest.class,
-    org.apache.sis.storage.netcdf.ConformanceTest.class,
     org.apache.sis.storage.netcdf.NetcdfStoreProviderTest.class,
     org.apache.sis.storage.netcdf.NetcdfStoreTest.class
 })
@@ -52,9 +49,6 @@ public final strictfp class NetcdfTestSu
     @BeforeClass
     public static void verifyTestList() {
         assertNoMissingTest(NetcdfTestSuite.class);
-        verifyTestList(NetcdfTestSuite.class, new Class<?>[] {
-            TestCase.class,
-            IOTestCase.class
-        });
+        verifyTestList(NetcdfTestSuite.class);
     }
 }



Mime
View raw message