sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1819786 - in /sis/branches/ISO-19115-3/core: sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/ si...
Date Mon, 01 Jan 2018 21:55:13 GMT
Author: desruisseaux
Date: Mon Jan  1 21:55:13 2018
New Revision: 1819786

URL: http://svn.apache.org/viewvc?rev=1819786&view=rev
Log:
Commit efc8e8121710508654a842d1a7c9496ee94d7952 from Image Matter
(fix a few tests, fix codelist and metadata base paths when working with ISO 19139)

The project at this revision can be built but is known to have test failure.
Tests will pass only after we completed the port of all ISO 19115-3 work.

Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListUID.java
    sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
    sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java?rev=1819786&r1=1819785&r2=1819786&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
[UTF-8] Mon Jan  1 21:55:13 2018
@@ -19,7 +19,7 @@ package org.apache.sis.metadata.iso.cita
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.citation.Role;
 import org.apache.sis.test.XMLTestCase;
-import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.junit.Test;
 
 import static java.util.Collections.singleton;
@@ -30,7 +30,8 @@ import static org.apache.sis.test.Assert
  * Tests {@link DefaultResponsibility} and its marshalling as a legacy {@link DefaultResponsibleParty}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.5
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.5
  * @module
  */
@@ -46,9 +47,9 @@ public final strictfp class DefaultRespo
         final DefaultResponsibility  r = new DefaultResponsibility(Role.AUTHOR, null, party);
         final DefaultCitation citation = new DefaultCitation();
         citation.setCitedResponsibleParties(singleton(r));
-        final String xml = marshal(citation);
-        assertXmlEquals("<gmd:CI_Citation xmlns:gco=\"" + Namespaces.GCO + '"' +
-                                        " xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
+        final String xml = marshal(citation, LegacyNamespaces.ISO_19139);
+        assertXmlEquals("<gmd:CI_Citation xmlns:gco=\"" + LegacyNamespaces.GCO + '"' +
+                                        " xmlns:gmd=\"" + LegacyNamespaces.GMD + "\">\n"
+
                 "  <gmd:citedResponsibleParty>\n" +
                 "    <gmd:CI_ResponsibleParty>\n" +
                 "      <gmd:individualName>\n" +

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java?rev=1819786&r1=1819785&r2=1819786&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
[UTF-8] Mon Jan  1 21:55:13 2018
@@ -19,7 +19,7 @@ package org.apache.sis.metadata.iso.iden
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.identification.RepresentativeFraction;
 import org.apache.sis.xml.XML;
-import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.Schemas;
 import org.apache.sis.test.LoggingWatcher;
@@ -129,10 +129,10 @@ public final strictfp class DefaultResol
          * an unknown reason.
          */
         assertXmlEquals(
-                "<gmd:MD_Resolution xmlns:gmd=\"" + Namespaces.GMD + '"' +
-                                  " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+                "<gmd:MD_Resolution xmlns:gmd=\"" + LegacyNamespaces.GMD + '"' +
+                                  " xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" +
                 "  <gmd:distance>\n" +
-                "    <gco:Distance uom=\"" + Schemas.METADATA_ROOT_OLD + Schemas.UOM_PATH
+ "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n" +
+                "    <gco:Distance uom=\"" + Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH
+ "#xpointer(//*[@gml:id='m'])\">1000.0</gco:Distance>\n" +
                 "  </gmd:distance>\n" +
                 "</gmd:MD_Resolution>", xml, "xmlns:*");
         /*

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java?rev=1819786&r1=1819785&r2=1819786&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Schemas.java
[UTF-8] Mon Jan  1 21:55:13 2018
@@ -56,7 +56,7 @@ public final class Schemas {
      * The XSD definition for 193139 metadata objects.
      */
     @Deprecated
-    public static final String METADATA_XSD = "http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd";
+    public static final String METADATA_XSD_LEGACY = "http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd";
 
     /**
      * The XSD definition for the root of ISO 19115-3 metadata objects.
@@ -79,7 +79,7 @@ public final class Schemas {
      * This is the schema used by default in Apache SIS.
      */
     @Deprecated
-    public static final String METADATA_ROOT_OLD = "http://schemas.opengis.net/iso/19139/20070417/";
+    public static final String METADATA_ROOT_LEGACY = "http://schemas.opengis.net/iso/19139/20070417/";
 
     /**
      * The root directory of OGC metadata schemas.
@@ -89,13 +89,13 @@ public final class Schemas {
 
     /**
      * The root directory of ISO 19115-3 metadata schemas.
-     * This is sometime used as an alternative to {@link #METADATA_ROOT_OLD}.
+     * This is sometime used as an alternative to {@link #METADATA_ROOT_LEGACY}.
      */
     @Deprecated
     public static final String ISO_19139_ROOT = "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/";
 
     /**
-     * The string to append to {@link #METADATA_ROOT_OLD} or {@link #ISO_19139_ROOT} for
obtaining the path
+     * The string to append to {@link #METADATA_ROOT_LEGACY} or {@link #ISO_19139_ROOT} for
obtaining the path
      * to the definitions of code lists.
      *
      * <p>A localized version of this file exists also with the {@code "ML_gmxCodelists.xml"}
filename
@@ -104,7 +104,7 @@ public final class Schemas {
      * @see <a href="https://issues.apache.org/jira/browse/SIS-154">SIS-154</a>
      */
     @Deprecated
-    public static final String CODELISTS_PATH_OLD = "resources/Codelist/gmxCodelists.xml";
+    public static final String CODELISTS_PATH_LEGACY = "resources/Codelist/gmxCodelists.xml";
 
     /**
      * The string to append to {@link #METADATA_ROOT} for obtaining the path to the definitions
of code lists.

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListUID.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListUID.java?rev=1819786&r1=1819785&r2=1819786&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListUID.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListUID.java
[UTF-8] Mon Jan  1 21:55:13 2018
@@ -41,7 +41,8 @@ import org.apache.sis.internal.jaxb.Sche
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  *
  * @see CodeListAdapter
  *
@@ -66,9 +67,16 @@ public final class CodeListUID {
      * @return the URL to the given code list in the given schema.
      */
     private static String schema(final Context context, final String identifier) {
-        return Context.schema(context, "gmd", Schemas.METADATA_ROOT)
-                .append(Schemas.CODELISTS_PATH)     // Future SIS version may switch between
localized/unlocalized file.
-                .append('#').append(identifier).toString();
+        final String prefix, path;
+        if (Context.isFlagSet(context, Context.LEGACY_METADATA)) {
+            prefix = "gmd";
+            path = Schemas.CODELISTS_PATH_LEGACY;   // Future SIS version may switch between
localized/unlocalized file.
+        } else {
+            prefix = "mdb";
+            path = Schemas.CODELISTS_PATH;
+        }
+        return Context.schema(context, prefix, Schemas.METADATA_ROOT)
+                .append(path).append('#').append(identifier).toString();
     }
 
     /**

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java?rev=1819786&r1=1819785&r2=1819786&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/Measure.java
[UTF-8] Mon Jan  1 21:55:13 2018
@@ -165,8 +165,8 @@ public final class Measure {
         if (unit == null || unit.equals(Units.UNITY)) {
             return "";
         }
-        // Changed to METADATA_ROOT_OLD while updating to ISO 19115-3
-        final StringBuilder buffer = Context.schema(Context.current(), "gmd", Schemas.METADATA_ROOT_OLD)
+        // Changed to METADATA_ROOT_LEGACY while updating to ISO 19115-3
+        final StringBuilder buffer = Context.schema(Context.current(), "gmd", Schemas.METADATA_ROOT_LEGACY)
                                             .append(Schemas.UOM_PATH).append("#xpointer(//*[@gml:id='");
         try {
             UCUM.format(unit, buffer);

Modified: sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java?rev=1819786&r1=1819785&r2=1819786&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gml/MeasureTest.java
[UTF-8] Mon Jan  1 21:55:13 2018
@@ -61,7 +61,7 @@ public final strictfp class MeasureTest
         assertEquals(Units.METRE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9001", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals(Schemas.METADATA_ROOT_OLD + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])",
measure.getUOM());
 
         measure.unit = null;
         measure.asXPointer = false;
@@ -69,12 +69,12 @@ public final strictfp class MeasureTest
         assertEquals(Units.DEGREE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9102", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals(Schemas.METADATA_ROOT_OLD + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='deg'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='deg'])",
measure.getUOM());
 
         measure.unit = null;
         measure.asXPointer = true;
         measure.setUOM("gmxUom.xml#kg");                        // Not really an existing
unit in 'gmxUom'.
         assertEquals(Units.KILOGRAM, measure.unit);
-        assertEquals(Schemas.METADATA_ROOT_OLD + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='kg'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT_LEGACY + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='kg'])",
measure.getUOM());
     }
 }



Mime
View raw message