-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace
java.util.Date
(from Java 1) by `java.time.temporal.Tempora…
…l` (from Java 8) in two properties that were introduced by the ISO 19157 upgrade (GitHub issue #44). This change should be done on all properties, but this commit starts with properties that did not existed before #44 for making the transition smother in implementations. #79 #44
- Loading branch information
1 parent
de5cc61
commit c816d67
Showing
6 changed files
with
256 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
geoapi/src/test/java/org/opengis/metadata/quality/ElementImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* GeoAPI - Java interfaces for OGC/ISO standards | ||
* http://www.geoapi.org | ||
* | ||
* Copyright (C) 2022 Open Geospatial Consortium, Inc. | ||
* All Rights Reserved. http://www.opengeospatial.org/ogc/legal | ||
* | ||
* Permission to use, copy, and modify this software and its documentation, with | ||
* or without modification, for any purpose and without fee or royalty is hereby | ||
* granted, provided that you include the following on ALL copies of the software | ||
* and documentation or portions thereof, including modifications, that you make: | ||
* | ||
* 1. The full text of this NOTICE in a location viewable to users of the | ||
* redistributed or derivative work. | ||
* 2. Notice of any changes or modifications to the OGC files, including the | ||
* date changes were made. | ||
* | ||
* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE | ||
* NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT | ||
* THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY | ||
* PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. | ||
* | ||
* COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR | ||
* CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. | ||
* | ||
* The name and trademarks of copyright holders may NOT be used in advertising or | ||
* publicity pertaining to the software without specific, written prior permission. | ||
* Title to copyright in this software and any associated documentation will at all | ||
* times remain with copyright holders. | ||
*/ | ||
package org.opengis.metadata.quality; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
|
||
/** | ||
* A simple implementation of {@link Element} for testing purposes. | ||
* | ||
* @author Martin Desruisseaux (Geomatys) | ||
* @version 3.1 | ||
* @since 3.1 | ||
*/ | ||
final class ElementImpl implements Element { | ||
/** | ||
* Information about the evaluation method, or {@code null} if none. | ||
*/ | ||
private final EvaluationMethod method; | ||
|
||
/** | ||
* Creates a new element. | ||
* | ||
* @param method information about the evaluation method, or {@code null} if none. | ||
*/ | ||
ElementImpl(final EvaluationMethod method) { | ||
this.method = method; | ||
} | ||
|
||
/** | ||
* Returns the evaluation information. | ||
*/ | ||
@Override | ||
public EvaluationMethod getEvaluationMethod() { | ||
return method; | ||
} | ||
|
||
/** | ||
* No yet implemented. | ||
*/ | ||
@Override | ||
public Collection<? extends Result> getResults() { | ||
return Collections.emptyList(); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
geoapi/src/test/java/org/opengis/metadata/quality/ElementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* GeoAPI - Java interfaces for OGC/ISO standards | ||
* http://www.geoapi.org | ||
* | ||
* Copyright (C) 2022 Open Geospatial Consortium, Inc. | ||
* All Rights Reserved. http://www.opengeospatial.org/ogc/legal | ||
* | ||
* Permission to use, copy, and modify this software and its documentation, with | ||
* or without modification, for any purpose and without fee or royalty is hereby | ||
* granted, provided that you include the following on ALL copies of the software | ||
* and documentation or portions thereof, including modifications, that you make: | ||
* | ||
* 1. The full text of this NOTICE in a location viewable to users of the | ||
* redistributed or derivative work. | ||
* 2. Notice of any changes or modifications to the OGC files, including the | ||
* date changes were made. | ||
* | ||
* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE | ||
* NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT | ||
* THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY | ||
* PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. | ||
* | ||
* COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR | ||
* CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. | ||
* | ||
* The name and trademarks of copyright holders may NOT be used in advertising or | ||
* publicity pertaining to the software without specific, written prior permission. | ||
* Title to copyright in this software and any associated documentation will at all | ||
* times remain with copyright holders. | ||
*/ | ||
package org.opengis.metadata.quality; | ||
|
||
import java.time.Instant; | ||
import java.util.Collection; | ||
import java.util.Iterator; | ||
import java.util.Date; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
|
||
/** | ||
* Tests {@link Element}. | ||
* | ||
* @author Martin Desruisseaux (Geomatys) | ||
* @version 3.1 | ||
* @since 3.1 | ||
*/ | ||
public final class ElementTest { | ||
/** | ||
* Tests {@link Element#getDates()}. | ||
*/ | ||
@Test | ||
public void testGetDates() { | ||
final Instant startTime = Instant.parse("2009-05-08T14:10:00Z"); | ||
final Instant endTime = Instant.parse("2009-05-12T21:45:00Z"); | ||
final ElementImpl element = new ElementImpl(new EvaluationMethodImpl(startTime, endTime)); | ||
|
||
@SuppressWarnings("deprecation") | ||
final Collection<? extends Date> dates = element.getDates(); | ||
assertEquals(2, dates.size()); | ||
final Iterator<? extends Date> it = dates.iterator(); | ||
assertEquals(startTime, it.next().toInstant()); | ||
assertEquals(endTime, it.next().toInstant()); | ||
assertFalse (it.hasNext()); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
geoapi/src/test/java/org/opengis/metadata/quality/EvaluationMethodImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* GeoAPI - Java interfaces for OGC/ISO standards | ||
* http://www.geoapi.org | ||
* | ||
* Copyright (C) 2022 Open Geospatial Consortium, Inc. | ||
* All Rights Reserved. http://www.opengeospatial.org/ogc/legal | ||
* | ||
* Permission to use, copy, and modify this software and its documentation, with | ||
* or without modification, for any purpose and without fee or royalty is hereby | ||
* granted, provided that you include the following on ALL copies of the software | ||
* and documentation or portions thereof, including modifications, that you make: | ||
* | ||
* 1. The full text of this NOTICE in a location viewable to users of the | ||
* redistributed or derivative work. | ||
* 2. Notice of any changes or modifications to the OGC files, including the | ||
* date changes were made. | ||
* | ||
* THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE | ||
* NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | ||
* TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT | ||
* THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY | ||
* PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. | ||
* | ||
* COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR | ||
* CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. | ||
* | ||
* The name and trademarks of copyright holders may NOT be used in advertising or | ||
* publicity pertaining to the software without specific, written prior permission. | ||
* Title to copyright in this software and any associated documentation will at all | ||
* times remain with copyright holders. | ||
*/ | ||
package org.opengis.metadata.quality; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.time.temporal.Temporal; | ||
|
||
|
||
/** | ||
* A simple implementation of {@link EvaluationMethod} for testing purposes. | ||
* | ||
* @author Martin Desruisseaux (Geomatys) | ||
* @version 3.1 | ||
* @since 3.1 | ||
*/ | ||
final class EvaluationMethodImpl implements EvaluationMethod { | ||
/** | ||
* Range of dates on which a data quality measure was applied. | ||
*/ | ||
private final Temporal startTime, endTime; | ||
|
||
/** | ||
* Creates a new evaluation method. | ||
* | ||
* @param startTime start time on which a data quality measure was applied. | ||
* @param endTime end time on which a data quality measure was applied. | ||
*/ | ||
EvaluationMethodImpl(final Temporal startTime, final Temporal endTime) { | ||
this.startTime = startTime; | ||
this.endTime = endTime; | ||
} | ||
|
||
/** | ||
* Returns the range of dates on which a data quality measure was applied. | ||
*/ | ||
@Override | ||
public Collection<Temporal> getDates() { | ||
return Arrays.asList(startTime, endTime); | ||
} | ||
} |