sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1820012 - in /sis/branches/ISO-19115-3/core/sis-metadata/src/test: java/org/apache/sis/metadata/iso/citation/ resources/org/apache/sis/metadata/iso/citation/
Date Wed, 03 Jan 2018 21:11:07 GMT
Author: desruisseaux
Date: Wed Jan  3 21:11:07 2018
New Revision: 1820012

URL: http://svn.apache.org/viewvc?rev=1820012&view=rev
Log:
Adaptation of commit e25bb7fa27fd4305d2fdb82828fbdb2edaae5018 from Image Matter
(add very simple test case for ISO 19115-3 CI_Citation)

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.

Added:
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation
(legacy).xml
      - copied unchanged from r1820011, sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation.xml
Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation.xml

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java?rev=1820012&r1=1820011&r2=1820012&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java
[UTF-8] Wed Jan  3 21:11:07 2018
@@ -38,6 +38,8 @@ import org.apache.sis.metadata.iso.exten
 import org.apache.sis.metadata.iso.DefaultIdentifier;
 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;
@@ -50,7 +52,8 @@ import static org.apache.sis.test.Metada
  * Tests {@link DefaultCitation}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Cullen Rombach (Image Matters)
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -61,6 +64,11 @@ public final strictfp class DefaultCitat
     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";
+
+    /**
      * Creates a citation with an arbitrary title, presentation form and other properties.
      *
      * @return an arbitrary citation.
@@ -175,6 +183,19 @@ public final strictfp class DefaultCitat
     }
 
     /**
+     * Tests XML marshalling using the format derived form ISO 19115:2014 model.
+     * This method also tests usage of {@code gml:id} and {@code xlink:href}.
+     *
+     * @throws JAXBException if an error occurred during marshalling.
+     *
+     * @since 1.0
+     */
+    @Test
+    public void testMarshalling() throws JAXBException {
+        testMarshalling(XML_FILE, LegacyNamespaces.ISO_19115_3);
+    }
+
+    /**
      * Tests XML marshalling using the format derived form ISO 19115:2003 model.
      * This method also tests usage of {@code gml:id} and {@code xlink:href}.
      *
@@ -183,7 +204,18 @@ public final strictfp class DefaultCitat
      * @since 0.7
      */
     @Test
-    public void testMarshalling() throws JAXBException {
+    @DependsOnMethod("testMarshalling")
+    public void testMarshallingLegacy() throws JAXBException {
+        testMarshalling(XML_FILE_LEGACY, LegacyNamespaces.ISO_19139);
+    }
+
+    /**
+     * Tests XML marshalling for the given metadata version.
+     *
+     * @param  file     file containing the expected metadata.
+     * @param  version  the metadata version to marshal.
+     */
+    private void testMarshalling(final String file, final Version version) throws JAXBException
{
         final DefaultContact contact = new DefaultContact();
         contact.setContactInstructions(new SimpleInternationalString("Send carrier pigeon."));
         contact.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "ip-protocol");
@@ -193,7 +225,20 @@ public final strictfp class DefaultCitat
                 new DefaultResponsibility(Role.FUNDER,     null, new DefaultIndividual("Robin
Hood",  null, contact))
         ));
         c.getDates().add(new DefaultCitationDate(TestUtilities.date("2015-10-17 00:00:00"),
DateType.ADOPTED));
-        assertMarshalEqualsFile(XML_FILE, c, LegacyNamespaces.ISO_19139, "xlmns:*", "xsi:schemaLocation");
+        assertMarshalEqualsFile(file, c, version, "xlmns:*", "xsi:schemaLocation");
+    }
+
+    /**
+     * Tests XML unmarshalling using the format derived form ISO 19115:2014 model.
+     * This method also tests usage of {@code gml:id} and {@code xlink:href}.
+     *
+     * @throws JAXBException if an error occurred during unmarshalling.
+     *
+     * @since 1.0
+     */
+    @Test
+    public void testUnmarshalling() throws JAXBException {
+        testUnmarshalling(XML_FILE);
     }
 
     /**
@@ -205,8 +250,19 @@ public final strictfp class DefaultCitat
      * @since 0.7
      */
     @Test
-    public void testUnmarshalling() throws JAXBException {
-        final DefaultCitation c = unmarshalFile(DefaultCitation.class, XML_FILE);
+    @DependsOnMethod("testUnmarshalling")
+    public void testUnmarshallingLegacy() throws JAXBException {
+        testUnmarshalling(XML_FILE_LEGACY);
+    }
+
+    /**
+     * Tests XML unmarshalling for a metadata version.
+     * The version is not specified since it should be detected automatically.
+     *
+     * @param  file  file containing the metadata to unmarshal.
+     */
+    private void testUnmarshalling(final String file) throws JAXBException {
+        final DefaultCitation c = unmarshalFile(DefaultCitation.class, file);
         assertTitleEquals("title", "Fight against poverty", c);
 
         final CitationDate date = getSingleton(c.getDates());

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation.xml
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation.xml?rev=1820012&r1=1820011&r2=1820012&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation.xml
(original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/citation/Citation.xml
Wed Jan  3 21:11:07 2018
@@ -18,56 +18,65 @@
   under the License.
 -->
 
-<gmd:CI_Citation
-    xmlns:gco          = "http://www.isotc211.org/2005/gco"
-    xmlns:gmd          = "http://www.isotc211.org/2005/gmd"
-    xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
-    xmlns:xlink        = "http://www.w3.org/1999/xlink"
-    xsi:schemaLocation = "http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd">
+<cit:CI_Citation
+    xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/1.0"
+    xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xsi:schemaLocation = "http://standards.iso.org/iso/19115/-3/cit/1.0
+                          http://standards.iso.org/iso/19115/-3/cit/1.0/cit.xsd">
 
-  <gmd:title>
+  <cit:title>
     <gco:CharacterString>Fight against poverty</gco:CharacterString>
-  </gmd:title>
-  <gmd:date>
-    <gmd:CI_Date>
-      <gmd:date>
+  </cit:title>
+  <cit:date>
+    <cit:CI_Date>
+      <cit:date>
         <!-- International Day for the Eradication of Poverty -->
         <gco:DateTime>2015-10-17T02:00:00+02:00</gco:DateTime>
-      </gmd:date>
-      <gmd:dateType>
-        <gmd:CI_DateTypeCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
-                             codeListValue="adopted">Adopted</gmd:CI_DateTypeCode>
-      </gmd:dateType>
-    </gmd:CI_Date>
-  </gmd:date>
-  <gmd:citedResponsibleParty>
-    <gmd:CI_ResponsibleParty>
-      <gmd:individualName>
-        <gco:CharacterString>Maid Marian</gco:CharacterString>
-      </gmd:individualName>
-      <gmd:contactInfo>
-        <gmd:CI_Contact id="ip-protocol">
-          <gmd:contactInstructions>
-            <gco:CharacterString>Send carrier pigeon.</gco:CharacterString>
-          </gmd:contactInstructions>
-        </gmd:CI_Contact>
-      </gmd:contactInfo>
-      <gmd:role>
-        <gmd:CI_RoleCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
-                         codeListValue="originator">Originator</gmd:CI_RoleCode>
-      </gmd:role>
-    </gmd:CI_ResponsibleParty>
-  </gmd:citedResponsibleParty>
-  <gmd:citedResponsibleParty>
-    <gmd:CI_ResponsibleParty>
-      <gmd:individualName>
-        <gco:CharacterString>Robin Hood</gco:CharacterString>
-      </gmd:individualName>
-      <gmd:contactInfo xlink:href="#ip-protocol"/>
-      <gmd:role>
-        <gmd:CI_RoleCode codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#CI_RoleCode"
-                         codeListValue="funder">Funder</gmd:CI_RoleCode>
-      </gmd:role>
-    </gmd:CI_ResponsibleParty>
-  </gmd:citedResponsibleParty>
-</gmd:CI_Citation>
+      </cit:date>
+      <cit:dateType>
+        <cit:CI_DateTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#CI_DateTypeCode"
+                             codeListValue="adopted">Adopted</cit:CI_DateTypeCode>
+      </cit:dateType>
+    </cit:CI_Date>
+  </cit:date>
+  <cit:citedResponsibleParty>
+    <cit:CI_Responsibility>
+      <cit:role>
+        <cit:CI_RoleCode codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#CI_RoleCode"
+                         codeListValue="originator">Originator</cit:CI_RoleCode>
+      </cit:role>
+      <cit:party>
+        <cit:CI_Individual>
+          <cit:name>
+            <gco:CharacterString>Maid Marian</gco:CharacterString>
+          </cit:name>
+          <cit:contactInfo>
+            <cit:CI_Contact id="ip-protocol">
+              <cit:contactInstructions>
+                <gco:CharacterString>Send carrier pigeon.</gco:CharacterString>
+              </cit:contactInstructions>
+            </cit:CI_Contact>
+          </cit:contactInfo>
+        </cit:CI_Individual>
+      </cit:party>
+    </cit:CI_Responsibility>
+  </cit:citedResponsibleParty>
+  <cit:citedResponsibleParty>
+    <cit:CI_Responsibility>
+      <cit:role>
+        <cit:CI_RoleCode codeList="http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#CI_RoleCode"
+                         codeListValue="funder">Funder</cit:CI_RoleCode>
+      </cit:role>
+      <cit:party>
+        <cit:CI_Individual>
+          <cit:name>
+            <gco:CharacterString>Robin Hood</gco:CharacterString>
+          </cit:name>
+          <cit:contactInfo xlink:href="#ip-protocol"/>
+        </cit:CI_Individual>
+      </cit:party>
+    </cit:CI_Responsibility>
+  </cit:citedResponsibleParty>
+</cit:CI_Citation>



Mime
View raw message