sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1828833 - in /sis/branches/JDK8: application/sis-console/src/test/java/org/apache/sis/console/ core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/ core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/ core/sis-met...
Date Tue, 10 Apr 2018 16:56:48 GMT
Author: desruisseaux
Date: Tue Apr 10 16:56:47 2018
New Revision: 1828833

URL: http://svn.apache.org/viewvc?rev=1828833&view=rev
Log:
Regroup XML test files in same directories, one directory per XML schema version.

Added:
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/TestUsingFile.java
  (with props)
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2007/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2007/Citation.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation
(legacy).xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2007/Extent.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent
(legacy).xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2007/Locales.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/internal/jaxb/lan/Locales
(legacy).xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2007/PositionalAccuracy.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy
(legacy).xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2007/ProcessStep.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep
(legacy).xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2007/ServiceIdentification.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification
(legacy).xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2016/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2016/Citation.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation.xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2016/Extent.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2016/Locales.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/internal/jaxb/lan/Locales.xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2016/PositionalAccuracy.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2016/ProcessStep.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/xml/2016/ServiceIdentification.xml
      - copied unchanged from r1828832, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/ServiceIdentification.xml
Removed:
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/internal/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/identification/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/
    sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/
Modified:
    sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/EnumAdapterTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/PT_LocaleTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
    sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java

Modified: sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/application/sis-console/src/test/java/org/apache/sis/console/MimeTypeCommandTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -18,24 +18,24 @@ package org.apache.sis.console;
 
 import java.net.URL;
 import org.apache.sis.internal.storage.gpx.MetadataTest;
-import org.apache.sis.metadata.iso.extent.DefaultExtentTest;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
+import static org.apache.sis.metadata.iso.extent.DefaultExtentTest.FILENAME;
 
 
 /**
  * Tests the {@link MimeTypeCommand} sub-command.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.4
  * @module
  */
 @DependsOn(CommandRunnerTest.class)
-public final strictfp class MimeTypeCommandTest extends TestCase {
+public final strictfp class MimeTypeCommandTest extends TestUsingFile {
     /**
      * Tests the sub-command on a metadata file.
      *
@@ -43,7 +43,7 @@ public final strictfp class MimeTypeComm
      */
     @Test
     public void testWithMetadataXML() throws Exception {
-        final URL url = DefaultExtentTest.getTestFile(true);
+        final URL url = TestUsingFile.class.getResource(XML2007+FILENAME);
         final MimeTypeCommand test = new MimeTypeCommand(0, CommandRunner.TEST, url.toString());
         test.run();
         final String output = test.outputBuffer.toString().trim();

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/EnumAdapterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/EnumAdapterTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/EnumAdapterTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/cat/EnumAdapterTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -16,7 +16,7 @@
  */
 package org.apache.sis.internal.jaxb.cat;
 
-import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -26,11 +26,11 @@ import static org.apache.sis.test.Assert
  * Tests the {@link EnumAdapter} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.6
+ * @version 1.0
  * @since   0.6
  * @module
  */
-public final strictfp class EnumAdapterTest extends XMLTestCase {
+public final strictfp class EnumAdapterTest extends TestCase {
     /**
      * Tests the {@link EnumAdapter#name(String)} method.
      */

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/LanguageCodeTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -80,8 +80,8 @@ public final strictfp class LanguageCode
      * Creates the XML (un)marshaller pool to be shared by all test methods.
      * The (un)marshallers locale and timezone will be set to fixed values.
      *
-     * <p>This test uses its own pool instead of {@link XMLTestCase#getMarshallerPool()}
because it
-     * uses {@link MetadataMock} instead of {@link org.apache.sis.metadata.iso.DefaultMetadata}.</p>
+     * <p>This test uses its own pool instead of {@link #getMarshallerPool()} because
it uses
+     * {@link MetadataMock} instead of {@link org.apache.sis.metadata.iso.DefaultMetadata}.</p>
      *
      * @throws JAXBException if an error occurred while creating the pool.
      *

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/PT_LocaleTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/PT_LocaleTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/PT_LocaleTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/lan/PT_LocaleTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -21,7 +21,7 @@ import java.util.Locale;
 import javax.xml.bind.JAXBException;
 import org.apache.sis.util.Version;
 import org.apache.sis.metadata.iso.DefaultMetadata;
-import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -36,7 +36,12 @@ import static org.apache.sis.test.Assert
  * @since   0.4
  * @module
  */
-public final strictfp class PT_LocaleTest extends XMLTestCase {
+public final strictfp class PT_LocaleTest extends TestUsingFile {
+    /**
+     * An XML file containing localized strings.
+     */
+    private static final String FILENAME = "Locales.xml";
+
     /**
      * The locales to use for the tests. For better test coverage we need at least:
      *
@@ -71,7 +76,7 @@ public final strictfp class PT_LocaleTes
      */
     @Test
     public void testMarshalling() throws JAXBException {
-        marshalAndCompare("Locales.xml", VERSION_2014,
+        marshalAndCompare(XML2016+FILENAME, VERSION_2014,
                           "mdb:contact", "mdb:dateInfo", "mdb:identificationInfo");
     }
 
@@ -82,7 +87,7 @@ public final strictfp class PT_LocaleTes
      */
     @Test
     public void testMarshallingLegacy() throws JAXBException {
-        marshalAndCompare("Locales (legacy).xml", VERSION_2007,
+        marshalAndCompare(XML2007+FILENAME, VERSION_2007,
                           "gmd:contact", "gmd:dateStamp", "gmd:identificationInfo");
     }
 
@@ -93,7 +98,7 @@ public final strictfp class PT_LocaleTes
      */
     @Test
     public void testUnmarshalling() throws JAXBException {
-        final DefaultMetadata metadata = unmarshalFile(DefaultMetadata.class, "Locales.xml");
+        final DefaultMetadata metadata = unmarshalFile(DefaultMetadata.class, XML2016+FILENAME);
         assertArrayEquals(LOCALES, metadata.getLanguages().toArray());
     }
 
@@ -104,7 +109,7 @@ public final strictfp class PT_LocaleTes
      */
     @Test
     public void testUnmarshallingLegacy() throws JAXBException {
-        final DefaultMetadata metadata = unmarshalFile(DefaultMetadata.class, "Locales (legacy).xml");
+        final DefaultMetadata metadata = unmarshalFile(DefaultMetadata.class, XML2007+FILENAME);
         assertArrayEquals(LOCALES, metadata.getLanguages().toArray());
     }
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -38,12 +38,12 @@ import org.apache.sis.xml.IdentifierMap;
 import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.metadata.iso.extent.Extents;
 import org.apache.sis.metadata.iso.DefaultIdentifier;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.iso.DefaultInternationalString;
 import org.apache.sis.util.Version;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestUtilities;
-import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.TestUtilities.getSingleton;
@@ -59,16 +59,11 @@ import static org.apache.sis.test.Metada
  * @since   0.3
  * @module
  */
-public final strictfp class DefaultCitationTest extends XMLTestCase {
+public final strictfp class DefaultCitationTest extends TestUsingFile {
     /**
-     * An XML file in this package containing a citation.
+     * An XML file containing a citation.
      */
-    private static final String XML_FILE = "Citation.xml";
-
-    /**
-     * An XML file in this package containing a citation in the format of legacy ISO 19139:2007
specification.
-     */
-    private static final String XML_FILE_LEGACY = "Citation (legacy).xml";
+    private static final String FILENAME = "Citation.xml";
 
     /**
      * Creates a citation with an arbitrary title, presentation form and other properties.
@@ -194,7 +189,7 @@ public final strictfp class DefaultCitat
      */
     @Test
     public void testMarshalling() throws JAXBException {
-        testMarshalling(XML_FILE, VERSION_2014);
+        testMarshalling(XML2016+FILENAME, VERSION_2014);
     }
 
     /**
@@ -208,7 +203,7 @@ public final strictfp class DefaultCitat
     @Test
     @DependsOnMethod("testMarshalling")
     public void testMarshallingLegacy() throws JAXBException {
-        testMarshalling(XML_FILE_LEGACY, VERSION_2007);
+        testMarshalling(XML2007+FILENAME, VERSION_2007);
     }
 
     /**
@@ -249,7 +244,7 @@ public final strictfp class DefaultCitat
      */
     @Test
     public void testUnmarshalling() throws JAXBException {
-        testUnmarshalling(XML_FILE);
+        testUnmarshalling(XML2016+FILENAME);
     }
 
     /**
@@ -263,7 +258,7 @@ public final strictfp class DefaultCitat
     @Test
     @DependsOnMethod("testUnmarshalling")
     public void testUnmarshallingLegacy() throws JAXBException {
-        testUnmarshalling(XML_FILE_LEGACY);
+        testUnmarshalling(XML2007+FILENAME);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.metadata.iso.extent;
 
-import java.net.URL;
 import java.util.Arrays;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.extent.Extent;
@@ -25,7 +24,7 @@ import org.apache.sis.util.iso.SimpleInt
 import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.NilObject;
-import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
@@ -44,20 +43,11 @@ import static org.apache.sis.test.TestUt
  * @module
  */
 @DependsOn(DefaultGeographicBoundingBoxTest.class)
-public final strictfp class DefaultExtentTest extends XMLTestCase {
+public final strictfp class DefaultExtentTest extends TestUsingFile {
     /**
-     * Returns the URL to a test file in XML.
-     * This is used for test methods outside this {@code DefaultExtentTest} file.
-     *
-     * @param  legacy  {@code true} for legacy ISO 19139:2007 format, or {@code false} for
ISO 19115-3 format.
-     * @return URL to a test file in XML.
+     * An XML file containing extent information.
      */
-    public static URL getTestFile(final boolean legacy) {
-        final String filename = legacy ? "Extent (legacy).xml" : "Extent.xml";
-        final URL resource = DefaultExtentTest.class.getResource(filename);
-        assertNotNull(filename, resource);
-        return resource;
-    }
+    public static final String FILENAME = "Extent.xml";
 
     /**
      * Tests {@link DefaultExtent#intersect(Extent)}.
@@ -97,14 +87,11 @@ public final strictfp class DefaultExten
      * Tests the (un)marshalling of a {@code <gmd:EX_Extent>} object.
      * This test opportunistically tests setting {@code "gml:id"} value.
      *
-     * <p><b>XML test file:</b>
-     * {@code "core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/extent/Extent.xml"}</p>
-     *
      * @throws JAXBException if an error occurred during the during marshalling / unmarshalling
processes.
      */
     @Test
     public void testXML() throws JAXBException {
-        roundtrip("Extent.xml", VERSION_2014);
+        roundtrip(XML2016+FILENAME, VERSION_2014);
     }
 
     /**
@@ -114,7 +101,7 @@ public final strictfp class DefaultExten
      */
     @Test
     public void testLegacyXML() throws JAXBException {
-        roundtrip("Extent (legacy).xml", VERSION_2007);
+        roundtrip(XML2007+FILENAME, VERSION_2007);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -28,9 +28,9 @@ import org.opengis.metadata.identificati
 import org.opengis.metadata.identification.DistributedComputingPlatform;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.apache.sis.xml.NilReason;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
 import static java.util.Collections.singleton;
@@ -51,16 +51,11 @@ import static org.apache.sis.test.TestUt
     DefaultCoupledResourceTest.class,
     org.apache.sis.metadata.iso.identification.DefaultDataIdentificationTest.class
 })
-public final strictfp class DefaultServiceIdentificationTest extends XMLTestCase {
+public final strictfp class DefaultServiceIdentificationTest extends TestUsingFile {
     /**
-     * An XML file in this package containing a service identification.
+     * An XML file containing a service identification.
      */
-    private static final String XML_FILE = "ServiceIdentification.xml";
-
-    /**
-     * Same as {@link #XML_FILE} but using legacy ISO 19139:2007 schema.
-     */
-    private static final String XML_FILE_LEGACY = "ServiceIdentification (legacy).xml";
+    private static final String FILENAME = "ServiceIdentification.xml";
 
     /**
      * Creates the service identification to use for testing purpose.
@@ -111,14 +106,11 @@ public final strictfp class DefaultServi
     /**
      * Tests the unmarshalling of a service metadata.
      *
-     * <p><b>XML test file:</b>
-     * {@code "core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/service/ServiceIdentification.xml"}</p>
-     *
      * @throws JAXBException if an error occurred during the during unmarshalling process.
      */
     @Test
     public void testUnmarshal() throws JAXBException {
-        final ServiceIdentification id = unmarshalFile(ServiceIdentification.class, XML_FILE);
+        final ServiceIdentification id = unmarshalFile(ServiceIdentification.class, XML2016+FILENAME);
         verify(id);
         final CoupledResource resource = getSingleton(id.getCoupledResources());
         assertTitleEquals("resourceReference", "WMS specification", getSingleton(resource.getResourceReferences()));
@@ -131,7 +123,7 @@ public final strictfp class DefaultServi
      */
     @Test
     public void testUnmarshalLegacy() throws JAXBException {
-        final ServiceIdentification id = unmarshalFile(ServiceIdentification.class, XML_FILE_LEGACY);
+        final ServiceIdentification id = unmarshalFile(ServiceIdentification.class, XML2007+FILENAME);
         verify(id);
         final CoupledResource resource = getSingleton(id.getCoupledResources());
         assertEquals("scopedName", "mySpace:ABC-123", String.valueOf(resource.getScopedName()));
@@ -144,7 +136,7 @@ public final strictfp class DefaultServi
      */
     @Test
     public void testMarshal() throws JAXBException {
-        assertMarshalEqualsFile(XML_FILE, create(), "xmlns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(XML2016+FILENAME, create(), "xmlns:*", "xsi:schemaLocation");
     }
 
     /**
@@ -154,6 +146,6 @@ public final strictfp class DefaultServi
      */
     @Test
     public void testMarshalLegacy() throws JAXBException {
-        assertMarshalEqualsFile(XML_FILE_LEGACY, create(), VERSION_2007, "xmlns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(XML2007+FILENAME, create(), VERSION_2007, "xmlns:*", "xsi:schemaLocation");
     }
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultProcessStepTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -20,7 +20,7 @@ import javax.xml.bind.JAXBException;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.internal.jaxb.gmi.LE_ProcessStep;
 import org.apache.sis.metadata.iso.DefaultIdentifier;
-import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.apache.sis.util.Version;
 import org.junit.Test;
 
@@ -36,18 +36,20 @@ import static org.opengis.test.Assert.*;
  * @since   0.3
  * @module
  */
-public final strictfp class DefaultProcessStepTest extends XMLTestCase {
+public final strictfp class DefaultProcessStepTest extends TestUsingFile {
+    /**
+     * An XML file containing process step information.
+     */
+    private static final String FILENAME = "ProcessStep.xml";
+
     /**
      * Tests the (un)marshalling of a metadata mixing elements from ISO 19115 and ISO 19115-2
standards.
      *
-     * <p><b>XML test file:</b>
-     * {@code "core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/lineage/ProcessStep.xml"}</p>
-     *
      * @throws JAXBException if an error occurred during the during marshalling / unmarshalling
processes.
      */
     @Test
     public void testXML() throws JAXBException {
-        roundtrip("ProcessStep.xml", VERSION_2014);
+        roundtrip(XML2016+FILENAME, VERSION_2014);
     }
 
     /**
@@ -58,7 +60,7 @@ public final strictfp class DefaultProce
      */
     @Test
     public void testLegacyXML() throws JAXBException {
-        roundtrip("ProcessStep (legacy).xml", VERSION_2007);
+        roundtrip(XML2007+FILENAME, VERSION_2007);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -22,7 +22,7 @@ import org.opengis.metadata.quality.Resu
 import org.opengis.util.InternationalString;
 import org.apache.sis.internal.jaxb.lan.FreeTextMarshallingTest;
 import org.apache.sis.util.Version;
-import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.apache.sis.test.DependsOn;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -42,15 +42,17 @@ import static org.apache.sis.test.TestUt
  * @module
  */
 @DependsOn(FreeTextMarshallingTest.class)
-public final strictfp class AbstractPositionalAccuracyTest extends XMLTestCase {
+public final strictfp class AbstractPositionalAccuracyTest extends TestUsingFile {
+    /**
+     * An XML file containing quality information.
+     */
+    private static final String FILENAME = "PositionalAccuracy.xml";
+
     /**
      * Tests the (un)marshalling of a text group with a default {@code <gco:CharacterString>}
element.
      * This test is somewhat a duplicate of {@link FreeTextMarshallingTest}, but the context
is more
      * elaborated.
      *
-     * <p><b>XML test file:</b>
-     * {@code "core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/quality/PositionalAccuracy.xml"}</p>
-     *
      * @throws JAXBException if an error occurred during the during marshalling / unmarshalling
processes.
      *
      * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
@@ -59,7 +61,7 @@ public final strictfp class AbstractPosi
     @Test
     @Ignore("Depends on SIS-394")
     public void testXML() throws JAXBException {
-        roundtrip("PositionalAccuracy.xml", VERSION_2014);
+        roundtrip(XML2016+FILENAME, VERSION_2014);
     }
 
     /**
@@ -72,7 +74,7 @@ public final strictfp class AbstractPosi
      */
     @Test
     public void testLegacyXML() throws JAXBException {
-        roundtrip("PositionalAccuracy (legacy).xml", VERSION_2007);
+        roundtrip(XML2007+FILENAME, VERSION_2007);
     }
 
     /**

Added: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/TestUsingFile.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/TestUsingFile.java?rev=1828833&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/TestUsingFile.java
(added)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/TestUsingFile.java
[UTF-8] Tue Apr 10 16:56:47 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.metadata.xml;
+
+import org.apache.sis.test.XMLTestCase;
+
+
+/**
+ * Base class of tests which contain some XML (un)marshalling of metadata as ISO 19115-3
compliant documents.
+ * Tests use the the files provided in the {@code "2007/"} or {@code "2016/"} sub-directories,
depending on
+ * whether ISO 19139:2007 or ISO 19115-3:2016 schema is used.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 1.0
+ * @since   1.0
+ * @module
+ */
+public abstract strictfp class TestUsingFile extends XMLTestCase {
+    /**
+     * The sub-directory of XML files encoded according the ISO 19115-3:2016 schema.
+     */
+    protected static final String XML2016 = "2016/";
+
+    /**
+     * The sub-directory of XML files encoded according the ISO 19139:2007 schema.
+     */
+    protected static final String XML2007 = "2007/";
+
+    /**
+     * For sub-class constructors only.
+     */
+    protected TestUsingFile() {
+    }
+}

Propchange: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/TestUsingFile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/xml/TestUsingFile.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java?rev=1828833&r1=1828832&r2=1828833&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/MimeTypeDetectorTest.java
[UTF-8] Tue Apr 10 16:56:47 2018
@@ -20,24 +20,24 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringReader;
 import org.apache.sis.xml.Namespaces;
-import org.apache.sis.metadata.iso.extent.DefaultExtentTest;
+import org.apache.sis.metadata.xml.TestUsingFile;
 import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
 import static java.util.Collections.singletonMap;
 import static org.junit.Assert.*;
+import static org.apache.sis.metadata.iso.extent.DefaultExtentTest.FILENAME;
 
 
 /**
  * Tests {@link MimeTypeDetector}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.4
  * @module
  */
-public final strictfp class MimeTypeDetectorTest extends TestCase {
+public final strictfp class MimeTypeDetectorTest extends TestUsingFile {
     /**
      * Tests a pseudo-XML file in the default namespace, read from a hard-coded string.
      *
@@ -87,7 +87,7 @@ public final strictfp class MimeTypeDete
     @DependsOnMethod("testGMDFromString")
     public void testGMDFromInputStream() throws IOException {
         final String type;
-        try (InputStream in = DefaultExtentTest.getTestFile(true).openStream()) {
+        try (InputStream in = TestUsingFile.class.getResourceAsStream(XML2007+FILENAME))
{
             assertEquals('<', in.read());
             assertEquals('?', in.read());
             final MimeTypeDetector detector = new MimeTypeDetector(singletonMap(Namespaces.GMD,
"application/vnd.iso.19139+xml")) {



Mime
View raw message