sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1611177 - in /sis/branches/JDK7: ./ core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
Date Wed, 16 Jul 2014 20:20:43 GMT
Author: desruisseaux
Date: Wed Jul 16 20:20:42 2014
New Revision: 1611177

URL: http://svn.apache.org/r1611177
Log:
Merge from the JDK8 branch.

Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK8:r1611105-1611175

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java?rev=1611177&r1=1611176&r2=1611177&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
[UTF-8] Wed Jul 16 20:20:42 2014
@@ -17,8 +17,10 @@
 package org.apache.sis.test.integration;
 
 import java.net.URI;
+import java.net.URL;
 import java.util.Arrays;
 import java.util.Locale;
+import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 import javax.measure.unit.SI;
 
@@ -48,6 +50,7 @@ import org.apache.sis.internal.jaxb.gmx.
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.xml.MarshallerPool;
 import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
@@ -82,6 +85,10 @@ public strictfp class DefaultMetadataTes
      * @param endTime   The end time in the {@code "yyy-mm-dd"} format.
      */
     protected void setTemporalBounds(final DefaultTemporalExtent extent, final String startTime,
final String endTime) {
+        /*
+         * Note: if this DefaultMetadataTest class is made final and this method removed,
+         *       then testUnmarshalling() can be simplified.
+         */
     }
 
     /**
@@ -302,6 +309,13 @@ public strictfp class DefaultMetadataTes
     }
 
     /**
+     * Returns the URL to the {@code "Metadata.xml"} file to use for this test.
+     */
+    private URL getResource() {
+        return DefaultMetadataTest.class.getResource("Metadata.xml");
+    }
+
+    /**
      * Tests marshalling of a XML document.
      *
      * @throws JAXBException If an error occurred during marshalling.
@@ -310,7 +324,7 @@ public strictfp class DefaultMetadataTes
     @Ignore("Need to investigate why anchors are lost at marshalling time.")
     public void testMarshalling() throws JAXBException {
         final String xml = marshal(createHardCoded());
-        assertXmlEquals(DefaultMetadataTest.class.getResource("Metadata.xml"), xml, "xmlns:*",
"xsi:schemaLocation");
+        assertXmlEquals(getResource(), xml, "xmlns:*", "xsi:schemaLocation");
     }
 
     /**
@@ -320,7 +334,14 @@ public strictfp class DefaultMetadataTes
      */
     @Test
     public void testUnmarshalling() throws JAXBException {
-        final DefaultMetadata metadata = unmarshalFile(DefaultMetadata.class, "Metadata.xml");
+        /*
+         * Note: if this DefaultMetadataTest class is made final, then all following lines
+         * until pool.recycle(…) can be replaced by a call to unmarshallFile("Metadata.xml").
+         */
+        final MarshallerPool pool = getMarshallerPool();
+        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+        final DefaultMetadata metadata = (DefaultMetadata) unmarshaller.unmarshal(getResource());
+        pool.recycle(unmarshaller);
         final DefaultMetadata expected = createHardCoded();
         assertTrue(metadata.equals(expected, ComparisonMode.DEBUG));
     }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java?rev=1611177&r1=1611176&r2=1611177&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultRecord.java
[UTF-8] Wed Jul 16 20:20:42 2014
@@ -41,7 +41,7 @@ import java.util.Objects;
  * By definition, all record members have a [1 … 1] cardinality
  * (for a more flexible construct, see {@linkplain org.apache.sis.feature features}).
  * Since all members are expected to be assigned a value, the initial values on {@code DefaultRecord}
- * instantiation are undetermined. Some may be null, or some may be zero.
+ * instantiation are unspecified. Some may be null, or some may be zero.
  *
  * {@section Limitations}
  * <ul>
@@ -80,7 +80,7 @@ public class DefaultRecord implements Re
 
     /**
      * Creates a new record for the given record type.
-     * The initial values are undetermined - they may be null or zero.
+     * The initial values are unspecified - they may be null or zero.
      * Callers can assign values by a call to {@link #setAll(Object[])}.
      *
      * @param type The type definition of the new record.



Mime
View raw message