You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/06/28 23:23:24 UTC
svn commit: r1497930 - in
/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis:
test/suite/MetadataTestSuite.java xml/ImageryMarshallingTest.java
Author: desruisseaux
Date: Fri Jun 28 21:23:23 2013
New Revision: 1497930
URL: http://svn.apache.org/r1497930
Log:
One more test.
Added:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/ImageryMarshallingTest.java (with props)
Modified:
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.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=1497930&r1=1497929&r2=1497930&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] Fri Jun 28 21:23:23 2013
@@ -64,6 +64,7 @@ import org.junit.BeforeClass;
org.apache.sis.xml.AnchorMarshallingTest.class,
org.apache.sis.xml.ObjectReferenceMarshallingTest.class,
org.apache.sis.xml.CustomMetadataTest.class,
+ org.apache.sis.xml.ImageryMarshallingTest.class,
org.apache.sis.xml.MetadataMarshallingTest.class
})
public final strictfp class MetadataTestSuite extends TestSuite {
Added: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/ImageryMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/ImageryMarshallingTest.java?rev=1497930&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/ImageryMarshallingTest.java (added)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/ImageryMarshallingTest.java [UTF-8] Fri Jun 28 21:23:23 2013
@@ -0,0 +1,91 @@
+/*
+ * 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.xml;
+
+import java.util.Arrays;
+import javax.xml.bind.JAXBException;
+import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.metadata.iso.DefaultIdentifier;
+import org.apache.sis.metadata.iso.lineage.DefaultSource;
+import org.apache.sis.metadata.iso.lineage.DefaultLineage;
+import org.apache.sis.test.XMLTestCase;
+import org.junit.Test;
+
+import static org.apache.sis.test.Assert.*;
+
+
+/**
+ * Tests the XML marshalling of objects in the {@code "gmi"} namespace that
+ * GeoAPI merged with the object of same name in the {@code "gmd"} namespace.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @since 0.3 (derived from geotk-3.17)
+ * @version 0.3
+ * @module
+ */
+public final strictfp class ImageryMarshallingTest extends XMLTestCase {
+ /**
+ * Tests the marshalling of an {@code "gmd:LI_Source"} element, which shall become
+ * {@code "gmi:LE_Source"} when some ISO 19115-2 properties are defined.
+ *
+ * @throws JAXBException If an error occurred while marshalling the XML.
+ */
+ @Test
+ public void testSource() throws JAXBException {
+ final DefaultLineage lineage = new DefaultLineage();
+ final DefaultSource source = new DefaultSource();
+ source.setDescription(new SimpleInternationalString("Description of source data level."));
+ lineage.setSources(Arrays.asList(source));
+ /*
+ * If this simpler case, only ISO 19115 elements are defined (no ISO 19115-2).
+ * Consequently the XML name shall be "gmd:LI_Source".
+ */
+ String actual = XML.marshal(lineage);
+ assertXmlEquals(
+ "<gmd:LI_Lineage xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
+ " <gmd:source>\n" +
+ " <gmd:LI_Source>\n" +
+ " <gmd:description>\n" +
+ " <gco:CharacterString>Description of source data level.</gco:CharacterString>\n" +
+ " </gmd:description>\n" +
+ " </gmd:LI_Source>\n" +
+ " </gmd:source>\n" +
+ "</gmd:LI_Lineage>", actual, "xmlns:*");
+ /*
+ * Now add a ISO 19115-2 specific property. The XML name shall become "gmi:LE_Source".
+ */
+ source.setProcessedLevel(new DefaultIdentifier("DummyLevel"));
+ actual = XML.marshal(lineage);
+ assertXmlEquals(
+ "<gmd:LI_Lineage xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
+ " <gmd:source>\n" +
+ " <gmi:LE_Source>\n" +
+ " <gmd:description>\n" +
+ " <gco:CharacterString>Description of source data level.</gco:CharacterString>\n" +
+ " </gmd:description>\n" +
+ " <gmi:processedLevel>\n" +
+ " <gmd:MD_Identifier>\n" +
+ " <gmd:code>\n" +
+ " <gco:CharacterString>DummyLevel</gco:CharacterString>\n" +
+ " </gmd:code>\n" +
+ " </gmd:MD_Identifier>\n" +
+ " </gmi:processedLevel>\n" +
+ " </gmi:LE_Source>\n" +
+ " </gmd:source>\n" +
+ "</gmd:LI_Lineage>", actual, "xmlns:*");
+ }
+}
Propchange: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/ImageryMarshallingTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/xml/ImageryMarshallingTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain;charset=UTF-8