sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1481937 - in /sis/branches/JDK7: ./ core/sis-metadata/src/test/java/org/apache/sis/test/suite/ core/sis-referencing/src/test/java/org/apache/sis/test/suite/ core/sis-utility/src/test/java/org/apache/sis/test/ core/sis-utility/src/test/java...
Date Mon, 13 May 2013 15:44:53 GMT
Author: desruisseaux
Date: Mon May 13 15:44:53 2013
New Revision: 1481937

URL: http://svn.apache.org/r1481937
Log:
Skeleton of test suite for NetCDF (mostly declaration of dependencies).

Added:
    sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/DecoderTest.java
  (with props)
    sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/
    sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/
    sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
    sis/branches/JDK7/pom.xml
    sis/branches/JDK7/storage/pom.xml
    sis/branches/JDK7/storage/sis-netcdf/pom.xml
    sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/CRSBuilderUCAR.java

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] Mon May 13 15:44:53 2013
@@ -59,6 +59,6 @@ public final strictfp class MetadataTest
      */
     @BeforeClass
     public static void verifyTestList() {
-        verifyTestList(MetadataTestSuite.class);
+        verifyTestList(MetadataTestSuite.class, BASE_TEST_CLASSES);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Mon May 13 15:44:53 2013
@@ -47,6 +47,6 @@ public final strictfp class ReferencingT
      */
     @BeforeClass
     public static void verifyTestList() {
-        verifyTestList(ReferencingTestSuite.class);
+        verifyTestList(ReferencingTestSuite.class, BASE_TEST_CLASSES);
     }
 }

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8]
(original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/TestSuite.java [UTF-8]
Mon May 13 15:44:53 2013
@@ -18,6 +18,7 @@ package org.apache.sis.test;
 
 import java.util.Map;
 import java.util.IdentityHashMap;
+import org.apache.sis.util.Classes;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 
@@ -35,6 +36,15 @@ import static org.junit.Assert.*;
 @RunWith(Suite.class)
 public abstract strictfp class TestSuite {
     /**
+     * The default set of base classes that all test cases are expected to extends.
+     * This is the usual argument value to the {@link #verifyTestList(Class, Class<?>[])}
method.
+     */
+    protected static final Class<?>[] BASE_TEST_CLASSES = {
+        TestCase.class,
+        org.opengis.test.TestCase.class
+    };
+
+    /**
      * Creates a new test suite.
      */
     protected TestSuite() {
@@ -60,12 +70,14 @@ public abstract strictfp class TestSuite
      * }
      *
      * @param suite The suite for which to verify order.
+     * @param baseTestClasses The set of base classes that all test cases are expected to
extends.
+     *        This is usually {@link #BASE_TEST_CLASSES}.
      */
-    protected static void verifyTestList(final Class<? extends TestSuite> suite) {
+    protected static void verifyTestList(final Class<? extends TestSuite> suite, final
Class<?>[] baseTestClasses) {
         final Class<?>[] testCases = suite.getAnnotation(Suite.SuiteClasses.class).value();
         final Map<Class<?>,Boolean> done = new IdentityHashMap<>(testCases.length);
         for (final Class<?> testCase : testCases) {
-            if (!TestCase.class.isAssignableFrom(testCase) && !org.opengis.test.TestCase.class.isAssignableFrom(testCase))
{
+            if (!Classes.isAssignableToAny(testCase, baseTestClasses)) {
                 fail("Class " + testCase.getCanonicalName() + " does not extends TestCase.");
             }
             final DependsOn dependencies = testCase.getAnnotation(DependsOn.class);

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] Mon May 13 15:44:53 2013
@@ -115,6 +115,6 @@ public final strictfp class UtilityTestS
      */
     @BeforeClass
     public static void verifyTestList() {
-        verifyTestList(UtilityTestSuite.class);
+        verifyTestList(UtilityTestSuite.class, BASE_TEST_CLASSES);
     }
 }

Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Mon May
13 15:44:53 2013
@@ -54,6 +54,7 @@ jcip.version         = 1.0
 osgi.version         = 5.0.0
 netcdf.version       = 4.3.16
 joda-time.version    = 2.0
+slf4j.version        = 1.6.4
 junit.version        = 4.10
 
 #
@@ -80,16 +81,20 @@ javac.test.classpath=\
     ${javac.classpath}:\
     ${maven.repository}/junit/junit/${junit.version}/junit-${junit.version}.jar:\
     ${maven.repository}/org/opengis/geoapi-conformance/${geoapi.version}/geoapi-conformance-${geoapi.version}.jar:\
+    ${maven.repository}/org/opengis/wrapper/geoapi-netcdf/${geoapi.version}/geoapi-netcdf-${geoapi.version}.jar:\
+    ${maven.repository}/org/opengis/wrapper/geoapi-netcdf/${geoapi.version}/geoapi-netcdf-${geoapi.version}-tests.jar:\
     ${build.classes.dir}
 javac.test.processorpath=\
     ${javac.test.classpath}
 run.classpath=\
     ${javac.classpath}:\
-    ${build.classes.dir}:\
-    ${maven.repository}/joda-time/joda-time/${joda-time.version}/joda-time-${joda-time.version}.jar
+    ${build.classes.dir}
 run.test.classpath=\
     ${javac.test.classpath}:\
-    ${build.test.classes.dir}
+    ${build.test.classes.dir}:\
+    ${maven.repository}/joda-time/joda-time/${joda-time.version}/joda-time-${joda-time.version}.jar:\
+    ${maven.repository}/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar:\
+    ${maven.repository}/org/slf4j/slf4j-jdk14/${slf4j.version}/slf4j-jdk14-${slf4j.version}.jar
 debug.classpath=\
     ${run.classpath}
 debug.test.classpath=\

Modified: sis/branches/JDK7/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/pom.xml?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/pom.xml (original)
+++ sis/branches/JDK7/pom.xml Mon May 13 15:44:53 2013
@@ -345,6 +345,12 @@ Apache SIS is a toolkit for describing l
         <version>${netcdf.version}</version>
         <scope>provided</scope>
       </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-jdk14</artifactId>
+        <version>1.6.4</version> <!-- Must matches the version used by NetCDF.
-->
+        <scope>runtime</scope> <!-- Should never be needed at compile time.
-->
+      </dependency>
     </dependencies>
   </dependencyManagement>
 

Modified: sis/branches/JDK7/storage/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/pom.xml?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/storage/pom.xml (original)
+++ sis/branches/JDK7/storage/pom.xml Mon May 13 15:44:53 2013
@@ -87,6 +87,15 @@
       <groupId>org.opengis</groupId>
       <artifactId>geoapi-pending</artifactId>
     </dependency>
+
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>org.apache.sis</groupId>
+      <artifactId>sis-utility</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 

Modified: sis/branches/JDK7/storage/sis-netcdf/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/pom.xml?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/pom.xml (original)
+++ sis/branches/JDK7/storage/sis-netcdf/pom.xml Mon May 13 15:44:53 2013
@@ -83,6 +83,26 @@ Bridge between NetCDF CF convention and 
       <groupId>edu.ucar</groupId>
       <artifactId>netcdf</artifactId>
     </dependency>
+
+    <!-- Leverage GeoAPI tests. -->
+    <dependency>
+      <groupId>org.opengis.wrapper</groupId>
+      <artifactId>geoapi-netcdf</artifactId>
+      <version>${geoapi.version}</version>
+      <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>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-jdk14</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <!--  UCAR repository from which to download the NetCDF library. -->

Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/CRSBuilderUCAR.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/CRSBuilderUCAR.java?rev=1481937&r1=1481936&r2=1481937&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/CRSBuilderUCAR.java
[UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/CRSBuilderUCAR.java
[UTF-8] Mon May 13 15:44:53 2013
@@ -58,14 +58,6 @@ final class CRSBuilderUCAR extends Warni
     private List<CoordinateAxis> axes;
 
     /**
-     * Domain of the variable for which we are wrapping a coordinate system, in natural
-     * order (reverse of NetCDF order). This are often, but not necessarily, the NetCDF
-     * {@linkplain CoordinateSystem#getDomain() coordinate system domain} except for the
-     * dimension ordering. If {@code null}, will be inferred from the {@link #netcdfCS}.
-     */
-    private List<Dimension> domain;
-
-    /**
      * Creates a new CRS builder.
      *
      * @param parent Where to send the warnings, or {@code null} if none.
@@ -112,24 +104,6 @@ final class CRSBuilderUCAR extends Warni
     }
 
     /**
-     * Returns the domain of the variable for which we are wrapping a coordinate system.
This is often,
-     * but not necessarily, the NetCDF {@linkplain CoordinateSystem#getDomain() coordinate
system domain}
-     * except for the dimension ordering.
-     *
-     * <p>By default, the returned list is modifiable. Any changes in the content of
this list will be
-     * reflected in the wrappers to be {@linkplain #build() build}. This is useful if the
caller
-     * wants to reduce the domain rank.</p>
-     *
-     * @return The domain in natural order (reverse of NetCDF order), or {@code null} if
unknown.
-     */
-    private List<Dimension> getDomain() {
-        if (domain == null && netcdfCS != null) {
-            Collections.reverse(domain = new ArrayList<>(netcdfCS.getDomain()));
-        }
-        return domain;
-    }
-
-    /**
      * Returns the dimensions of all axes, together with an axis associated to each dimension.
      * If more than one axis use the same dimension, then the first axis has precedence.
      *

Added: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/DecoderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/DecoderTest.java?rev=1481937&view=auto
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/DecoderTest.java
(added)
+++ sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/DecoderTest.java
[UTF-8] Mon May 13 15:44:53 2013
@@ -0,0 +1,71 @@
+/*
+ * 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.storage.netcdf;
+
+import java.io.IOException;
+import ucar.nc2.NetcdfFile;
+import org.opengis.wrapper.netcdf.IOTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link Decoder} implementations.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+public final strictfp class DecoderTest extends IOTestCase {
+    /**
+     * The decoder to test.
+     */
+    private Decoder decoder;
+
+    /**
+     * Tests the {@link DecoderUCAR} implementation.
+     *
+     * @throws IOException If an error occurred while reading the NetCDF file.
+     */
+    @Test
+    public void testUCAR() throws IOException {
+        final NetcdfFile file = open(IOTestCase.NCEP);
+        try {
+            decoder = new DecoderUCAR(null, file);
+            runAllTests();
+        } finally {
+            file.close();
+        }
+    }
+
+    /**
+     * Runs all the tests defined below this method.
+     */
+    private void runAllTests() throws IOException {
+        decoder.setSearchPath(new String[1]);
+        testStringValue();
+    }
+
+    /**
+     * Tests {@link Decoder#stringValue(String)}.
+     */
+    private void testStringValue() throws IOException {
+        assertEquals("Sea Surface Temperature Analysis Model", decoder.stringValue(AttributeNames.TITLE));
+    }
+}

Propchange: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/DecoderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/DecoderTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java?rev=1481937&view=auto
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
(added)
+++ sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
[UTF-8] Mon May 13 15:44:53 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.suite;
+
+import org.opengis.wrapper.netcdf.IOTestCase;
+import org.apache.sis.test.TestSuite;
+import org.junit.runners.Suite;
+import org.junit.BeforeClass;
+
+
+/**
+ * All tests from the {@code sis-referencing} module, in approximative dependency order.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+@Suite.SuiteClasses({
+    org.apache.sis.storage.netcdf.DecoderTest.class
+})
+public final strictfp class NetcdfTestSuite extends TestSuite {
+    /**
+     * Verifies the list of tests before to run the suite.
+     * See {@link #verifyTestList(Class)} for more information.
+     */
+    @BeforeClass
+    public static void verifyTestList() {
+        verifyTestList(NetcdfTestSuite.class, new Class<?>[] {
+            IOTestCase.class
+        });
+    }
+}

Propchange: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/test/suite/NetcdfTestSuite.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8



Mime
View raw message