sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1826246 [4/4] - in /sis/trunk: ./ core/sis-metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/ core/sis-metadata/src/main/java/org/apache/sis/internal/geoapi/evolution/ core/sis-metadata/src/main/java/org/apache/sis/i...
Date Thu, 08 Mar 2018 15:30:30 GMT
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Thu Mar
 8 15:30:28 2018
@@ -34,8 +34,6 @@ import java.io.ObjectOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import javax.swing.tree.TreeNode;
-import javax.xml.parsers.ParserConfigurationException;
-import org.xml.sax.SAXException;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.ComparisonMode;
@@ -48,7 +46,7 @@ import org.apache.sis.util.Classes;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Alexis Manin (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -354,102 +352,6 @@ public strictfp class Assert extends Geo
     }
 
     /**
-     * Parses two XML trees as DOM documents, and compares the nodes.
-     * The inputs given to this method can be any of the following types:
-     *
-     * <ul>
-     *   <li>{@link org.w3c.dom.Node}: used directly without further processing.</li>
-     *   <li>{@link java.io.File}, {@link java.net.URL} or {@link java.net.URI}: the
-     *       stream is opened and parsed as a XML document.</li>
-     *   <li>{@link String}: The string content is parsed directly as a XML document.</li>
-     * </ul>
-     *
-     * The comparison will ignore comments and the optional attributes given in arguments.
-     *
-     * <div class="section">Ignored attributes substitution</div>
-     * For convenience, this method replaces some well known prefixes in the {@code ignoredAttributes}
-     * array by their full namespace URLs. For example this method replaces{@code "xsi:schemaLocation"}
-     * by {@code "http://www.w3.org/2001/XMLSchema-instance:schemaLocation"}.
-     * If such substitution is not desired, consider using {@link XMLComparator} directly
instead.
-     *
-     * <p>The current substitution map is as below (may be expanded in any future SIS
version):</p>
-     *
-     * <table class="sis">
-     *   <caption>Predefined prefix mapping</caption>
-     *   <tr><th>Prefix</th> <th>URL</th></tr>
-     *   <tr><td>xmlns</td>  <td>{@code "http://www.w3.org/2000/xmlns"}</td></tr>
-     *   <tr><td>xlink</td>  <td>{@value org.apache.sis.xml.Namespaces#XLINK}</td></tr>
-     *   <tr><td>xsi</td>    <td>{@value org.apache.sis.xml.Namespaces#XSI}</td></tr>
-     *   <tr><td>gml</td>    <td>{@value org.apache.sis.xml.Namespaces#GML}</td></tr>
-     *   <tr><td>gmd</td>    <td>{@value org.apache.sis.xml.Namespaces#GMD}</td></tr>
-     *   <tr><td>gmx</td>    <td>{@value org.apache.sis.xml.Namespaces#GMX}</td></tr>
-     *   <tr><td>gmi</td>    <td>{@value org.apache.sis.xml.Namespaces#GMI}</td></tr>
-     *   <tr><td>gco</td>    <td>{@value org.apache.sis.xml.Namespaces#GCO}</td></tr>
-     * </table>
-     *
-     * <p>For example in order to ignore the namespace, type and schema location declaration,
-     * the following strings can be given to the {@code ignoredAttributes} argument:</p>
-     *
-     * {@preformat text
-     *   "xmlns:*", "xsi:schemaLocation", "xsi:type"
-     * }
-     *
-     * @param  expected           the expected XML document.
-     * @param  actual             the XML document to compare.
-     * @param  ignoredAttributes  the fully-qualified names of attributes to ignore
-     *                            (typically {@code "xmlns:*"} and {@code "xsi:schemaLocation"}).
-     *
-     * @see XMLComparator
-     */
-    public static void assertXmlEquals(final Object expected, final Object actual, final
String... ignoredAttributes) {
-        assertXmlEquals(expected, actual, TestCase.STRICT, null, ignoredAttributes);
-    }
-
-    /**
-     * Parses two XML trees as DOM documents, and compares the nodes with the given tolerance
-     * threshold for numerical values. The inputs given to this method can be any of the
types
-     * documented {@linkplain #assertXmlEquals(Object, Object, String[]) above}. This method
-     * will ignore comments and the optional attributes given in arguments as documented
in the
-     * above method.
-     *
-     * @param  expected           the expected XML document.
-     * @param  actual             the XML document to compare.
-     * @param  tolerance          the tolerance threshold for comparison of numerical values.
-     * @param  ignoredNodes       the fully-qualified names of the nodes to ignore, or {@code
null} if none.
-     * @param  ignoredAttributes  the fully-qualified names of attributes to ignore
-     *                            (typically {@code "xmlns:*"} and {@code "xsi:schemaLocation"}).
-     *
-     * @see XMLComparator
-     */
-    public static void assertXmlEquals(final Object expected, final Object actual,
-            final double tolerance, final String[] ignoredNodes, final String[] ignoredAttributes)
-    {
-        final XMLComparator comparator;
-        try {
-            comparator = new XMLComparator(expected, actual);
-        } catch (IOException | ParserConfigurationException | SAXException e) {
-            // We don't throw directly those exceptions since failing to parse the XML file
can
-            // be considered as part of test failures and the JUnit exception for such failures
-            // is AssertionError. Having no checked exception in "assert" methods allow us
to
-            // declare the checked exceptions only for the library code being tested.
-            throw new AssertionError(e);
-        }
-        comparator.tolerance = tolerance;
-        comparator.ignoreComments = true;
-        if (ignoredNodes != null) {
-            for (final String node : ignoredNodes) {
-                comparator.ignoredNodes.add(XMLComparator.substitutePrefix(node));
-            }
-        }
-        if (ignoredAttributes != null) {
-            for (final String attribute : ignoredAttributes) {
-                comparator.ignoredAttributes.add(XMLComparator.substitutePrefix(attribute));
-            }
-        }
-        comparator.compare();
-    }
-
-    /**
      * Serializes the given object in memory, deserializes it and ensures that the deserialized
      * object is equals to the original one. This method does not write anything to the disk.
      *

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] Thu Mar  8 15:30:28 2018
@@ -33,7 +33,6 @@ import org.junit.BeforeClass;
     // Following are testing the test tools.
     org.apache.sis.internal.test.AssertTest.class,
     org.apache.sis.internal.test.TestUtilitiesTest.class,
-    org.apache.sis.internal.test.XMLComparatorTest.class,
 
     // Most basic functions of SIS library.
     org.apache.sis.internal.system.LoggersTest.class,
@@ -88,19 +87,9 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.util.DefinitionURITest.class,
     org.apache.sis.internal.util.XPathsTest.class,
     org.apache.sis.internal.util.CitationsTest.class,
-    org.apache.sis.util.iso.TypesTest.class,
     org.apache.sis.util.iso.SimpleInternationalStringTest.class,
     org.apache.sis.util.iso.DefaultInternationalStringTest.class,
     org.apache.sis.internal.util.LocalizedParseExceptionTest.class,
-    org.apache.sis.util.iso.DefaultLocalNameTest.class,
-    org.apache.sis.util.iso.DefaultScopedNameTest.class,
-    org.apache.sis.util.iso.DefaultNameFactoryTest.class,
-    org.apache.sis.util.iso.NamesTest.class,
-    org.apache.sis.util.iso.TypeNamesTest.class,
-    org.apache.sis.internal.simple.SimpleIdentifierTest.class,
-    org.apache.sis.util.iso.DefaultRecordTypeTest.class,
-    org.apache.sis.util.iso.DefaultRecordSchemaTest.class,
-    org.apache.sis.util.iso.DefaultRecordTest.class,
 
     // Measurements and formatting.
     org.apache.sis.measure.SexagesimalConverterTest.class,
@@ -140,26 +129,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.converter.ArrayConverterTest.class,
     org.apache.sis.internal.converter.ConverterRegistryTest.class,
     org.apache.sis.internal.converter.SystemRegistryTest.class,
-    org.apache.sis.internal.converter.NumberConverterTest.class,        // Shall be after
SystemRegistryTest.
-
-    // XML most basic types.
-    org.apache.sis.xml.NamespacesTest.class,
-    org.apache.sis.xml.XLinkTest.class,
-    org.apache.sis.xml.NilReasonTest.class,
-    org.apache.sis.xml.LegacyCodesTest.class,
-    org.apache.sis.xml.ValueConverterTest.class,
-    org.apache.sis.xml.OGCNamespacePrefixMapperTest.class,
-    org.apache.sis.xml.MarshallerPoolTest.class,
-    org.apache.sis.xml.TransformingNamespacesTest.class,
-    org.apache.sis.internal.jaxb.XmlUtilitiesTest.class,
-    org.apache.sis.internal.jaxb.IdentifierMapAdapterTest.class,
-    org.apache.sis.internal.jaxb.ModifiableIdentifierMapTest.class,
-    org.apache.sis.internal.jaxb.gco.StringAdapterTest.class,
-    org.apache.sis.internal.jaxb.gco.PropertyTypeTest.class,
-    org.apache.sis.internal.jaxb.gmd.LanguageCodeTest.class,
-    org.apache.sis.internal.jaxb.gml.TimePeriodTest.class,
-    org.apache.sis.internal.jaxb.gml.MeasureTest.class,
-    org.apache.sis.util.iso.NameMarshallingTest.class
+    org.apache.sis.internal.converter.NumberConverterTest.class         // Shall be after
SystemRegistryTest.
 })
 public final strictfp class UtilityTestSuite extends TestSuite {
     /**

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java [UTF-8]
(original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java [UTF-8]
Thu Mar  8 15:30:28 2018
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.util;
 
-import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -76,14 +75,18 @@ public final strictfp class VersionTest
      */
     @Test
     public void testGML() {
-        assertTrue(LegacyNamespaces.VERSION_3_2.compareTo(LegacyNamespaces.VERSION_3_2_1,
2) == 0);
-        assertTrue(LegacyNamespaces.VERSION_3_2.compareTo(LegacyNamespaces.VERSION_3_2_1
  )  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2_1
  )  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2_1,
2)  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2_1,
1) == 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2  
  )  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2, 
 2)  < 0);
-        assertTrue(LegacyNamespaces.VERSION_3_0.compareTo(LegacyNamespaces.VERSION_3_2, 
 1) == 0);
+        final Version V3_0   = new Version("3.0"),
+                      V3_2   = new Version("3.2"),
+                      V3_2_1 = new Version("3.2.1");
+
+        assertTrue(V3_2.compareTo(V3_2_1, 2) == 0);
+        assertTrue(V3_2.compareTo(V3_2_1   )  < 0);
+        assertTrue(V3_0.compareTo(V3_2_1   )  < 0);
+        assertTrue(V3_0.compareTo(V3_2_1, 2)  < 0);
+        assertTrue(V3_0.compareTo(V3_2_1, 1) == 0);
+        assertTrue(V3_0.compareTo(V3_2     )  < 0);
+        assertTrue(V3_0.compareTo(V3_2,   2)  < 0);
+        assertTrue(V3_0.compareTo(V3_2,   1) == 0);
     }
 
     /**

Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java
[UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/CodeListSetTest.java
[UTF-8] Thu Mar  8 15:30:28 2018
@@ -26,7 +26,6 @@ import org.opengis.referencing.cs.AxisDi
 import org.opengis.metadata.citation.OnLineFunction;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOnMethod;
-import org.apache.sis.util.iso.LargeCodeList;
 import org.junit.Test;
 
 import static org.junit.Assert.*;

Modified: sis/trunk/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/build.xml?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/build.xml (original)
+++ sis/trunk/ide-project/NetBeans/build.xml Thu Mar  8 15:30:28 2018
@@ -33,7 +33,7 @@
   -->
   <target name="-post-compile">
     <copy todir="${build.classes.dir}/org/apache/sis/util/iso">
-      <fileset dir="${project.root}/core/sis-utility/src/main/resources/org/apache/sis/util/iso">
+      <fileset dir="${project.root}/core/sis-metadata/src/main/resources/org/apache/sis/util/iso">
         <include name="class-index.properties"/>
       </fileset>
     </copy>
@@ -71,10 +71,10 @@
       <!-- Other resources (properties files, SQL scripts, native libraries). -->
       <fileset dir="${project.root}/core/sis-utility/src/main/resources">
         <include name="**/*.properties"/>
-        <include name="**/*.lst"/>
       </fileset>
       <fileset dir="${project.root}/core/sis-metadata/src/main/resources">
         <include name="**/*.sql"/>
+        <include name="**/*.lst"/>
       </fileset>
       <fileset dir="${project.root}/core/sis-referencing/src/main/resources">
         <include name="**/*.sql"/>

Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/StoreTest.java
[UTF-8] Thu Mar  8 15:30:28 2018
@@ -24,6 +24,7 @@ import org.opengis.metadata.identificati
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.storage.StorageConnector;
 import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -49,8 +50,8 @@ public final strictfp class StoreTest ex
     public static final String XML =
             "<?xml version=\"1.0\" standalone=\"yes\"?>\n" +
             "<gmd:MD_Metadata\n" +
-            "  xmlns:gmd = \"" + Namespaces.GMD + "\"\n"  +
-            "  xmlns:gco = \"" + Namespaces.GCO + "\"\n"  +
+            "  xmlns:gmd = \"" + LegacyNamespaces.GMD + "\"\n"  +
+            "  xmlns:gco = \"" + LegacyNamespaces.GCO + "\"\n"  +
             "  xmlns:xsi = \"" + Namespaces.XSI + "\"\n>" +
             "  <gmd:language>\n" +
             "    <gmd:LanguageCode codeListValue=\"eng\">English</gmd:LanguageCode>\n"
+

Modified: sis/trunk/storage/sis-xmlstore/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/pom.xml?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/pom.xml (original)
+++ sis/trunk/storage/sis-xmlstore/pom.xml Thu Mar  8 15:30:28 2018
@@ -117,6 +117,15 @@ Read and write files in the GPX format.
       <artifactId>esri-geometry-api</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <!-- Test dependencies -->
+    <dependency>
+      <groupId>org.apache.sis.core</groupId>
+      <artifactId>sis-metadata</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/FormattedWriter.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/FormattedWriter.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/FormattedWriter.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/FormattedWriter.java
[UTF-8] Thu Mar  8 15:30:28 2018
@@ -19,7 +19,6 @@ package org.apache.sis.internal.storage.
 import java.util.Arrays;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.stream.XMLStreamException;
-import org.apache.sis.internal.util.StreamWriterDelegate;
 
 
 /**

Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/NamespaceEraser.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/NamespaceEraser.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/NamespaceEraser.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/NamespaceEraser.java
[UTF-8] Thu Mar  8 15:30:28 2018
@@ -19,7 +19,6 @@ package org.apache.sis.internal.storage.
 import javax.xml.XMLConstants;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.stream.XMLStreamException;
-import org.apache.sis.internal.util.StreamWriterDelegate;
 
 
 /**

Modified: sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java?rev=1826246&r1=1826245&r2=1826246&view=diff
==============================================================================
--- sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
[UTF-8] (original)
+++ sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java
[UTF-8] Thu Mar  8 15:30:28 2018
@@ -36,7 +36,7 @@ import org.junit.BeforeClass;
 import org.junit.AfterClass;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 // Branch-dependent imports
 import org.apache.sis.feature.AbstractFeature;



Mime
View raw message