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 2016/09/02 09:25:40 UTC
svn commit: r1758915 - in /sis/trunk: ./
core/sis-feature/src/test/java/org/apache/sis/feature/
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/
core/sis-referencing/src/main...
Author: desruisseaux
Date: Fri Sep 2 09:25:39 2016
New Revision: 1758915
URL: http://svn.apache.org/viewvc?rev=1758915&view=rev
Log:
Merge from the JDK6 branch.
Modified:
sis/trunk/ (props changed)
sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java
sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java
sis/trunk/ide-project/NetBeans/build.xml
sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 2 09:25:39 2016
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
-/sis/branches/JDK6:1394364-1758410
-/sis/branches/JDK7:1394913-1758397
-/sis/branches/JDK8:1584960-1758394
+/sis/branches/JDK6:1394364-1758914
+/sis/branches/JDK7:1394913-1758913
+/sis/branches/JDK8:1584960-1758905
Modified: sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-feature/src/test/java/org/apache/sis/feature/DefaultFeatureTypeTest.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -29,8 +29,8 @@ import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
-import static java.util.Collections.singletonMap;
import static org.apache.sis.test.TestUtilities.getSingleton;
+import static java.util.Collections.singletonMap;
/**
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -27,7 +27,6 @@ import java.util.Collections;
import java.util.Locale;
import java.util.Date;
import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import java.text.FieldPosition;
import java.lang.reflect.Array;
@@ -104,7 +103,7 @@ import org.apache.sis.internal.jdk7.JDK7
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4
- * @version 0.7
+ * @version 0.8
* @module
*
* @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
@@ -124,12 +123,6 @@ public class Formatter implements Locali
private static final int VERTICAL_ACCURACY = 9;
/**
- * The time span threshold for switching between the {@code "yyyy-MM-dd'T'HH:mm:ss.SX"}
- * and {@code "yyyy-MM-dd"} date pattern when formatting a temporal extent.
- */
- private static final long TEMPORAL_THRESHOLD = 24 * 60 * 60 * 1000L;
-
- /**
* The value of {@code X364.FOREGROUND_DEFAULT.sequence()}, hard-coded for avoiding
* {@link org.apache.sis.internal.util.X364} class loading.
*/
@@ -918,13 +911,12 @@ public class Formatter implements Locali
}
/**
- * Appends the given temporal extents, if non-null.
- * This method uses a simplified format if the time span is large enough.
+ * Appends the given temporal extent, if non-null.
* Examples:
*
* <ul>
- * <li>\u201c{@code TemporalExtent[1980-04-12, 1980-04-18]}\u201d (\u0394t = 6 days)</li>
- * <li>\u201c{@code TemporalExtent[1980-04-12T18:00:00.0Z, 1980-04-12T21:00:00.0Z]}\u201d (\u0394t = 3 hours)</li>
+ * <li>\u201c{@code TemporalExtent[1980-04-12, 1980-04-18]}\u201d</li>
+ * <li>\u201c{@code TemporalExtent[1980-04-12T18:00:00.0Z, 1980-04-12T21:00:00.0Z]}\u201d</li>
* </ul>
*/
private void appendTemporalExtent(final Range<Date> range) {
@@ -932,26 +924,10 @@ public class Formatter implements Locali
final Date min = range.getMinValue();
final Date max = range.getMaxValue();
if (min != null && max != null) {
- String pattern = null;
- if (dateFormat instanceof SimpleDateFormat && (max.getTime() - min.getTime()) >= TEMPORAL_THRESHOLD) {
- final String p = ((SimpleDateFormat) dateFormat).toPattern();
- if (p.length() > StandardDateFormat.SHORT_PATTERN.length() &&
- p.startsWith(StandardDateFormat.SHORT_PATTERN))
- {
- pattern = p;
- ((SimpleDateFormat) dateFormat).applyPattern(StandardDateFormat.SHORT_PATTERN);
- }
- }
openElement(true, WKTKeywords.TimeExtent);
setColor(ElementKind.EXTENT);
- try {
- append(min);
- append(max);
- } finally {
- if (pattern != null) {
- ((SimpleDateFormat) dateFormat).applyPattern(pattern);
- }
- }
+ append(min);
+ append(max);
resetColor();
closeElement(true);
}
Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultConstraints.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -127,7 +127,7 @@ public class DefaultConstraints extends
* This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the
* given object are not recursively copied.
*
- * @param object The metadata to copy values from, or {@code null} if none.
+ * @param object the metadata to copy values from, or {@code null} if none.
*
* @see #castOrCopy(Constraints)
*/
@@ -165,8 +165,8 @@ public class DefaultConstraints extends
* metadata contained in the given object are not recursively copied.</li>
* </ul>
*
- * @param object The object to get as a SIS implementation, or {@code null} if none.
- * @return A SIS implementation containing the values of the given object (may be the
+ * @param object the object to get as a SIS implementation, or {@code null} if none.
+ * @return a SIS implementation containing the values of the given object (may be the
* given object itself), or {@code null} if the argument was null.
*/
public static DefaultConstraints castOrCopy(final Constraints object) {
@@ -187,7 +187,7 @@ public class DefaultConstraints extends
* Returns the limitation affecting the fitness for use of the resource.
* Example: <cite>"not to be used for navigation"</cite>.
*
- * @return Limitation affecting the fitness for use of the resource.
+ * @return limitation affecting the fitness for use of the resource.
*/
@Override
@XmlElement(name = "useLimitation")
@@ -199,7 +199,7 @@ public class DefaultConstraints extends
* Sets the limitation affecting the fitness for use of the resource.
* Example: <cite>"not to be used for navigation"</cite>.
*
- * @param newValues The new use limitations.
+ * @param newValues the new use limitations.
*/
public void setUseLimitations(final Collection<? extends InternationalString> newValues) {
useLimitations = writeCollection(newValues, useLimitations, InternationalString.class);
@@ -209,7 +209,7 @@ public class DefaultConstraints extends
* Returns the spatial and / or temporal extents and or levels of the application
* of the constraints restrictions.
*
- * @return Spatial and / or temporal extents.
+ * @return spatial and / or temporal extents.
*
* @since 0.5
*/
@@ -222,7 +222,7 @@ public class DefaultConstraints extends
/**
* Sets the spatial and / or temporal extents and or levels of the application of the constraints restrictions.
*
- * @param newValue The new spatial and / or temporal extents.
+ * @param newValue the new spatial and / or temporal extents.
*
* @since 0.5
*/
@@ -234,7 +234,7 @@ public class DefaultConstraints extends
/**
* Returns the graphics / symbols indicating the constraint.
*
- * @return The graphics / symbols indicating the constraint.
+ * @return the graphics / symbols indicating the constraint.
*
* @since 0.5
*/
@@ -247,7 +247,7 @@ public class DefaultConstraints extends
/**
* Sets the new graphics / symbols indicating the constraint.
*
- * @param newValues the new graphics / symbols indicating the constraint.
+ * @param newValues the new graphics / symbols indicating the constraint.
*
* @since 0.5
*/
@@ -259,7 +259,7 @@ public class DefaultConstraints extends
* Returns citations for the limitation of constraint.
* Example: "copyright statement, license agreement, etc."
*
- * @return Citations for the limitation of constraint.
+ * @return citations for the limitation of constraint.
*
* @since 0.5
*/
@@ -272,7 +272,7 @@ public class DefaultConstraints extends
/**
* Sets the citations for the limitation of constraint.
*
- * @param newValues The new citation for the limitation of constraint.
+ * @param newValues the new citation for the limitation of constraint.
*
* @since 0.5
*/
@@ -306,7 +306,7 @@ public class DefaultConstraints extends
* when GeoAPI will provide it (tentatively in GeoAPI 3.1).
* </div>
*
- * @param newValue the new information concerning the parties to whom the resource can or cannot be released.
+ * @param newValue the new information concerning the parties to whom the resource can or cannot be released.
*
* @since 0.5
*/
@@ -323,7 +323,7 @@ public class DefaultConstraints extends
* when GeoAPI will provide it (tentatively in GeoAPI 3.1).
* </div>
*
- * @return Parties responsible for the resource constraints.
+ * @return parties responsible for the resource constraints.
*
* @since 0.5
*/
@@ -341,7 +341,7 @@ public class DefaultConstraints extends
* when GeoAPI will provide it (tentatively in GeoAPI 3.1).
* </div>
*
- * @param newValues The new parties responsible for the resource constraints.
+ * @param newValues the new parties responsible for the resource constraints.
*
* @since 0.5
*/
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -79,6 +79,7 @@ import org.apache.sis.measure.Units;
import static java.util.Collections.singletonMap;
import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
+import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
// Branch-dependent imports
import org.apache.sis.internal.jdk8.JDK8;
@@ -1336,14 +1337,14 @@ public enum CommonCRS {
/**
* Time measured as days since January 1st, 4713 BC at 12:00 UTC.
*/
- JULIAN(Vocabulary.Keys.Julian, -2440588 * (24*60*60*1000L) + (12*60*60*1000L)),
+ JULIAN(Vocabulary.Keys.Julian, -2440588L * MILLISECONDS_PER_DAY + MILLISECONDS_PER_DAY/2),
/**
* Time measured as days since November 17, 1858 at 00:00 UTC.
* A <cite>Modified Julian day</cite> (MJD) is defined relative to
* <cite>Julian day</cite> (JD) as {@code MJD = JD \u2212 2400000.5}.
*/
- MODIFIED_JULIAN(Vocabulary.Keys.ModifiedJulian, -40587 * (24*60*60*1000L)),
+ MODIFIED_JULIAN(Vocabulary.Keys.ModifiedJulian, -40587L * MILLISECONDS_PER_DAY),
/**
* Time measured as days since May 24, 1968 at 00:00 UTC.
@@ -1351,14 +1352,14 @@ public enum CommonCRS {
* A <cite>Truncated Julian day</cite> (TJD) is defined relative to
* <cite>Julian day</cite> (JD) as {@code TJD = JD \u2212 2440000.5}.
*/
- TRUNCATED_JULIAN(Vocabulary.Keys.TruncatedJulian, -587 * (24*60*60*1000L)),
+ TRUNCATED_JULIAN(Vocabulary.Keys.TruncatedJulian, -587L * MILLISECONDS_PER_DAY),
/**
* Time measured as days since December 31, 1899 at 12:00 UTC.
* A <cite>Dublin Julian day</cite> (DJD) is defined relative to
* <cite>Julian day</cite> (JD) as {@code DJD = JD \u2212 2415020}.
*/
- DUBLIN_JULIAN(Vocabulary.Keys.DublinJulian, -25568 * (24*60*60*1000L) + (12*60*60*1000L)),
+ DUBLIN_JULIAN(Vocabulary.Keys.DublinJulian, -25568L * MILLISECONDS_PER_DAY + MILLISECONDS_PER_DAY/2),
/**
* Time measured as seconds since January 1st, 1970 at 00:00 UTC.
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -50,6 +50,7 @@ import org.junit.Test;
import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
+import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
// Branch-specific imports
import org.opengis.util.Factory;
@@ -1040,7 +1041,7 @@ public final strictfp class GeodeticObje
final TemporalDatum timeDatum = timeCRS.getDatum();
assertNameAndIdentifierEqual("Time", 0, timeCRS);
assertNameAndIdentifierEqual("Modified Julian", 0, timeDatum);
- assertEquals("epoch", new Date(-40587 * (24*60*60*1000L)), timeDatum.getOrigin());
+ assertEquals("epoch", new Date(-40587L * MILLISECONDS_PER_DAY), timeDatum.getOrigin());
// No more CRS.
assertFalse(components.hasNext());
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -28,6 +28,7 @@ import org.junit.Test;
import static org.apache.sis.test.ReferencingAssert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
+import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
/**
@@ -47,7 +48,7 @@ public final strictfp class DefaultTempo
/**
* November 17, 1858 at 00:00 UTC as a Java timestamp.
*/
- private static final long ORIGIN = -40587 * (24*60*60*1000L);
+ private static final long ORIGIN = -40587L * MILLISECONDS_PER_DAY;
/**
* Creates the temporal datum to use for testing purpose.
Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -28,6 +28,7 @@ import org.apache.sis.internal.metadata.
import org.apache.sis.metadata.iso.citation.HardCodedCitations;
import static org.opengis.referencing.datum.Datum.*;
+import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
/**
@@ -151,7 +152,7 @@ public final strictfp class HardCodedDat
*/
public static final DefaultTemporalDatum MODIFIED_JULIAN = new DefaultTemporalDatum(
properties("Modified Julian", null, null),
- new Date(-40587 * (24*60*60*1000L)));
+ new Date(-40587L * MILLISECONDS_PER_DAY));
/**
* Image with {@link PixelInCell#CELL_CENTER}.
Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -26,12 +26,20 @@ import java.text.SimpleDateFormat;
/**
- * A date format used for parsing date in the {@code "yyyy-MM-dd'T'HH:mm:ss.SSSX"} pattern, but in which
- * the time is optional. The "Apache SIS for JDK8" branch can use the {@link java.time.format} package,
- * while other branches use {@link java.text.SimpleDateFormat}.
+ * A date format used for parsing dates in the {@code "yyyy-MM-dd'T'HH:mm:ss.SSSX"} pattern, but in which
+ * the time is optional. For this class, "Standard" is interpreted as "close to ISO 19162 requirements",
+ * which is not necessarily identical to other ISO standards.
*
- * <p>External users should use nothing else than the parsing and formating methods. The methods for
- * configuring the {@code DateFormat} may not be available between different SIS branches.</p>
+ * <p>This class is implemented in two different way depending on the Apache SIS branch:</p>
+ * <ul>
+ * <li>Branches for JDK8 and more use {@link java.time.format.DateTimeFormatter}.</li>
+ * <li>Branches for older JDKs use {@link java.text.SimpleDateFormat} together with some hacks
+ * for allowing some fields to be optional (for example adding ":00" is seconds are missing).</li>
+ * </ul>
+ *
+ * External users should use nothing else than the parsing and formating methods.
+ * The methods for configuring the {@code DateFormat} instances may or may not work
+ * depending on the branch.
*
* <p>The main usage for this class is Well Known Text (WKT) parsing and formatting.
* ISO 19162 uses ISO 8601:2004 for the dates. Any precision is allowed: the date could have only the year,
@@ -47,6 +55,7 @@ import java.text.SimpleDateFormat;
public final class StandardDateFormat extends SimpleDateFormat {
/**
* For cross-version compatibility.
+ * This number must be different between the JDK8 branch and pre-JDK8 branches.
*/
private static final long serialVersionUID = 1552761359761440473L;
@@ -88,6 +97,11 @@ public final class StandardDateFormat ex
public static final String PATTERN = SHORT_PATTERN + "'T'" + TIME_PATTERN;
/**
+ * The length of a day in number of milliseconds.
+ */
+ public static final int MILLISECONDS_PER_DAY = 24*60*60*1000;
+
+ /**
* {@code true} if the user has invoked {@link #applyPattern(String)} or {@link #applyLocalizedPattern(String)}.
*/
private boolean isUserSpecifiedPattern;
@@ -145,22 +159,22 @@ public final class StandardDateFormat ex
* Formats the given date. If hours, minutes, seconds and milliseconds are zero and the timezone is UTC,
* then this method omits the clock part (unless the user has overridden the pattern).
*
- * @param date the date to format.
- * @param buffer where to format the date.
- * @param pos where to store information about a date field.
+ * @param date the date to format.
+ * @param toAppendTo where to format the date.
+ * @param pos ignored.
* @return the given buffer, for method calls chaining.
*/
@Override
- public StringBuffer format(final Date date, final StringBuffer buffer, final FieldPosition pos) {
- if (!isUserSpecifiedPattern && (date.getTime() % (24*60*60*1000)) == 0 && UTC.equals(getTimeZone().getID())) {
+ public StringBuffer format(final Date date, final StringBuffer toAppendTo, final FieldPosition pos) {
+ if (!isUserSpecifiedPattern && (date.getTime() % MILLISECONDS_PER_DAY) == 0 && UTC.equals(getTimeZone().getID())) {
try {
super.applyPattern(SHORT_PATTERN);
- return super.format(date, buffer, pos);
+ return super.format(date, toAppendTo, pos);
} finally {
super.applyPattern(PATTERN);
}
}
- return super.format(date, buffer, pos);
+ return super.format(date, toAppendTo, pos);
}
/**
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -58,6 +58,8 @@ public final strictfp class StandardDate
/**
* Tests parsing a date.
+ * Since the implementation is completely different in JDK8 branch than in previous branch,
+ * a key purpose of this test is to ensure that the parsing is consistent between the branches.
*
* @throws ParseException if an error occurred while parsing the date.
*/
Modified: sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/test/java/org/apache/sis/util/collection/RangeSetTest.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -34,6 +34,7 @@ import org.apache.sis.test.TestUtilities
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
/**
@@ -69,10 +70,10 @@ public final strictfp class RangeSetTest
/**
* Verifies the value of {@link RangeSet#contains(Range, boolean)}.
*
- * @param ranges The range set to test.
- * @param range The range to check for inclusion.
- * @param exact The expected value in exact mode.
- * @param included The expected value in non-exact mode.
+ * @param ranges the range set to test.
+ * @param range the range to check for inclusion.
+ * @param exact the expected value in exact mode.
+ * @param included the expected value in non-exact mode.
*/
private static <E extends Comparable<? super E>> void checkContains(final RangeSet<E> ranges,
final Range<E> range, final boolean exact, final boolean included)
@@ -151,17 +152,16 @@ public final strictfp class RangeSetTest
/*
* Add a singleton range.
*/
- final long day = 24*60*60*1000L;
final Date now = new Date();
- final Date yesterday = new Date(now.getTime() - day);
+ final Date yesterday = new Date(now.getTime() - MILLISECONDS_PER_DAY);
assertTrue(ranges.add(yesterday, now));
assertEquals(1, ranges.size());
checkContains(ranges, new Range<Date>(Date.class, yesterday, true, now, false), true, true);
/*
* Add a disjoint range.
*/
- final Date lastWeek = new Date(now.getTime() - 7*day);
- final Date other = new Date(lastWeek.getTime() + 2*day);
+ final Date lastWeek = new Date(now.getTime() - 7*MILLISECONDS_PER_DAY);
+ final Date other = new Date(lastWeek.getTime() + 2*MILLISECONDS_PER_DAY);
assertTrue(ranges.add(new Range<Date>(Date.class, lastWeek, true, other, false)));
assertEquals(2, ranges.size());
/*
@@ -324,8 +324,8 @@ public final strictfp class RangeSetTest
assertTrue(ranges.remove(-15, -5));
assertEquals("size", 1, ranges.size());
Range<Integer> r = ranges.first();
- assertEquals(-20, (int) r.getMinValue());
- assertEquals(-15, (int) r.getMaxValue());
+ assertEquals(-20, r.getMinValue().intValue());
+ assertEquals(-15, r.getMaxValue().intValue());
/*
* A B
* Range : [-------------]
@@ -339,8 +339,8 @@ public final strictfp class RangeSetTest
assertTrue(ranges.remove(-25, -15));
assertEquals("size", 1, ranges.size());
r = ranges.first();
- assertEquals(-15, (int) r.getMinValue());
- assertEquals(-10, (int) r.getMaxValue());
+ assertEquals(-15, r.getMinValue().intValue());
+ assertEquals(-10, r.getMaxValue().intValue());
/*
* A B
* Range : [-----------------------]
@@ -354,14 +354,14 @@ public final strictfp class RangeSetTest
assertTrue(ranges.remove(-17, -13));
assertEquals("size", 2, ranges.size());
r = ranges.getRange(0);
- assertEquals(-20, (int) r.getMinValue());
- assertEquals(-17, (int) r.getMaxValue());
+ assertEquals(-20, r.getMinValue().intValue());
+ assertEquals(-17, r.getMaxValue().intValue());
r = ranges.getRange(1);
- assertEquals(-17, (int) r.getMinValue());
- assertEquals(-13, (int) r.getMaxValue());
+ assertEquals(-17, r.getMinValue().intValue());
+ assertEquals(-13, r.getMaxValue().intValue());
r = ranges.getRange(2);
- assertEquals(-13, (int) r.getMinValue());
- assertEquals(-10, (int) r.getMaxValue());
+ assertEquals(-13, r.getMinValue().intValue());
+ assertEquals(-10, r.getMaxValue().intValue());
/*
* A B
* Range : [----------------]
@@ -541,7 +541,7 @@ public final strictfp class RangeSetTest
* in normal SIS build. We run this test only when the {@link RangeSet} implementation
* changed, and we want to test the impact of that change on the performance.
*
- * @throws InterruptedException If the test has been interrupted.
+ * @throws InterruptedException if the test has been interrupted.
*/
@Performance
public void stress() throws InterruptedException {
Modified: sis/trunk/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/build.xml?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/build.xml (original)
+++ sis/trunk/ide-project/NetBeans/build.xml Fri Sep 2 09:25:39 2016
@@ -124,7 +124,6 @@
<concat destfile="${build.classes.dir}/META-INF/services/org.opengis.referencing.operation.OperationMethod" encoding="UTF-8" fixlastline="yes">
<fileset dir="${project.root}">
<include name="*/*/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod"/>
- <include name="*/*/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod"/>
</fileset>
</concat>
@@ -204,5 +203,12 @@
<include name="**/*.xml"/>
</fileset>
</copy>
+
+ <!-- OperationMethod implementations to be loaded by ServiceLoader. -->
+ <concat destfile="${build.test.classes.dir}/META-INF/services/org.opengis.referencing.operation.OperationMethod" encoding="UTF-8" fixlastline="yes">
+ <fileset dir="${project.root}">
+ <include name="*/*/src/test/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod"/>
+ </fileset>
+ </concat>
</target>
</project>
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java?rev=1758915&r1=1758914&r2=1758915&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] Fri Sep 2 09:25:39 2016
@@ -45,6 +45,8 @@ import org.apache.sis.util.CharSequences
import org.apache.sis.util.Utilities;
import org.apache.sis.util.iso.Types;
+import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
+
// Branch-dependent imports
import org.apache.sis.internal.jdk7.JDK7;
import org.apache.sis.internal.jdk8.LocalDate;
@@ -647,16 +649,16 @@ parse: for (int i = 0; i < length;)
}
final DefaultCitation c = new DefaultCitation(notice);
if (year != 0) {
- final Date date = new Date(LocalDate.of(year, 1, 1).toEpochDay() * (24*60*60*1000L));
+ final Date date = new Date(LocalDate.of(year, 1, 1).toEpochDay() * MILLISECONDS_PER_DAY);
c.setDates(Collections.singleton(new DefaultCitationDate(date, DateType.valueOf("IN_FORCE"))));
}
if (i != 0) {
buffer.setLength(i);
// Same limitation than MetadataBuilder.party().
final AbstractParty party = new AbstractParty(buffer, null);
- final DefaultResponsibleParty p = new DefaultResponsibleParty(Role.OWNER);
- p.setParties(Collections.singleton(party));
- c.setCitedResponsibleParties(Collections.singleton(p));
+ final DefaultResponsibleParty r = new DefaultResponsibleParty(Role.OWNER);
+ r.setParties(Collections.singleton(party));
+ c.setCitedResponsibleParties(Collections.singleton(r));
}
constraints.getReferences().add(c);
}