This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/sis.git
commit 763417be3bf18c4c9f5d08bbfb9dbc6c577e9501 Merge: 47053a8ff3 11dcc51787 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Sat Dec 30 14:45:43 2023 +0100 Merge branch 'geoapi-3.1'. .../org/apache/sis/console/CommandRunnerTest.java | 15 +- .../sis/coverage/grid/GridCoverageBuilder.java | 2 +- .../apache/sis/coverage/grid/GridExtentTest.java | 23 +- .../main/org/apache/sis/xml/MarshalContext.java | 34 +- .../main/org/apache/sis/xml/MarshallerPool.java | 47 ++- .../main/org/apache/sis/xml/Pooled.java | 71 +++- .../main/org/apache/sis/xml/PooledMarshaller.java | 53 +-- .../main/org/apache/sis/xml/PooledTemplate.java | 6 +- .../org/apache/sis/xml/PooledUnmarshaller.java | 175 ++++++--- .../main/org/apache/sis/xml/ReferenceResolver.java | 228 ++++++++++-- .../main/org/apache/sis/xml/XLink.java | 13 +- .../main/org/apache/sis/xml/XML.java | 7 +- .../main/org/apache/sis/xml/bind/Context.java | 341 +++++++++++++---- .../org/apache/sis/xml/bind/ScopedIdentifier.java | 145 ++++++++ .../apache/sis/xml/util/ExternalLinkHandler.java | 290 +++++++++++++++ .../main/org/apache/sis/xml/util/URISource.java | 120 ++++++ .../main/org/apache/sis/xml/util/XmlUtilities.java | 41 ++ .../metadata/iso/citation/DefaultCitationTest.java | 15 +- .../metadata/iso/citation/DefaultContactTest.java | 2 +- .../sis/metadata/xml/2016/UsingExternalXLink.xml | 51 +++ .../org/apache/sis/xml/ReferenceResolverMock.java | 2 +- .../org/apache/sis/xml/ReferenceResolverTest.java | 66 ++++ .../org/apache/sis/xml/XLinkMarshallingTest.java | 10 +- .../test/org/apache/sis/xml/XLinkTest.java | 25 +- .../apache/sis/xml/bind/gco/StringAdapterTest.java | 2 +- .../apache/sis/xml/bind/gml/TimePeriodTest.java | 2 +- .../test/org/apache/sis/xml/test/TestCase.java | 46 ++- .../apache/sis/xml/test/TestReferenceResolver.java | 56 +++ .../org/apache/sis/xml/util/XmlUtilitiesTest.java | 7 +- .../main/org/apache/sis/io/wkt/AbstractParser.java | 23 +- .../org/apache/sis/io/wkt/FormattableObject.java | 17 +- .../apache/sis/io/wkt/GeodeticObjectParser.java | 11 +- .../org/apache/sis/io/wkt/MathTransformParser.java | 20 +- .../main/org/apache/sis/io/wkt/Parser.java | 4 +- .../main/org/apache/sis/io/wkt/WKTFormat.java | 129 ++++--- .../main/org/apache/sis/io/wkt/Warnings.java | 2 + .../sis/parameter/AbstractParameterDescriptor.java | 13 +- .../sis/parameter/DefaultParameterDescriptor.java | 15 +- .../parameter/DefaultParameterDescriptorGroup.java | 15 +- .../sis/parameter/DefaultParameterValue.java | 172 +++++++-- .../main/org/apache/sis/parameter/Parameters.java | 28 ++ .../sis/parameter/UnmodifiableParameterValue.java | 10 + .../org/apache/sis/parameter/package-info.java | 2 +- .../sis/referencing/AbstractIdentifiedObject.java | 9 +- .../main/org/apache/sis/referencing/CRS.java | 53 ++- .../referencing/factory/GeodeticObjectFactory.java | 8 +- .../referencing/factory/sql/EPSGDataAccess.java | 4 +- .../CompressedGrid.java} | 20 +- .../referencing/operation/gridded/GridFile.java | 299 +++++++++++++++ .../GridGroup.java} | 43 ++- .../referencing/operation/gridded/GridLoader.java | 143 +++++++ .../LoadedGrid.java} | 184 ++++----- .../{provider => gridded}/package-info.java | 10 +- .../operation/provider/AbstractProvider.java | 2 +- .../operation/provider/DatumShiftGridLoader.java | 248 ------------ .../provider/FranceGeocentricInterpolation.java | 59 ++- .../sis/referencing/operation/provider/NADCON.java | 48 +-- .../sis/referencing/operation/provider/NTv2.java | 69 ++-- .../operation/provider/package-info.java | 5 +- .../operation/transform/ContextualParameters.java | 2 +- .../transform/DefaultMathTransformFactory.java | 8 +- .../transform/SpecializableTransform.java | 2 +- .../util/j2d/ImmutableAffineTransform.java | 2 +- .../org/apache/sis/referencing/util/j2d/Tile.java | 4 +- .../referencing/CC_GeneralOperationParameter.java | 1 + .../xml/bind/referencing/CC_OperationMethod.java | 7 +- .../org/apache/sis/xml/bind/referencing/Code.java | 28 +- .../test/org/apache/sis/io/wkt/ColorsTest.java | 14 +- .../org/apache/sis/io/wkt/ComparisonWithEPSG.java | 6 +- .../test/org/apache/sis/io/wkt/ConventionTest.java | 2 +- .../test/org/apache/sis/io/wkt/ElementTest.java | 144 +++---- .../sis/io/wkt/GeodeticObjectParserTest.java | 336 ++++++++--------- .../apache/sis/io/wkt/MathTransformParserTest.java | 20 +- .../test/org/apache/sis/io/wkt/SymbolsTest.java | 39 +- .../org/apache/sis/io/wkt/TransliteratorTest.java | 20 +- .../org/apache/sis/io/wkt/WKTDictionaryTest.java | 109 +++--- .../test/org/apache/sis/io/wkt/WKTFormatTest.java | 60 ++- .../sis/parameter/DefaultParameterValueTest.java | 414 +++++++++------------ .../sis/parameter/ParameterMarshallingTest.java | 81 ++-- .../referencing/AbstractIdentifiedObjectTest.java | 2 +- .../operation/SingleOperationMarshallingTest.java | 148 +++++--- .../sis/referencing/operation/Transformation.xml | 4 +- .../CompressedGridTest.java} | 12 +- .../LoadedGridTest.java} | 22 +- .../operation/provider/DatumShiftTestCase.java | 5 +- .../FranceGeocentricInterpolationTest.java | 31 +- .../referencing/operation/provider/NADCONTest.java | 23 +- .../referencing/operation/provider/NTv2Test.java | 36 +- .../transform/MathTransformFactoryMock.java | 31 ++ .../operation/transform/PoleRotationTest.java | 2 +- .../sis/test/integration/DatumShiftTest.java | 5 +- .../apache/sis/storage/netcdf/base/Variable.java | 4 +- .../org/apache/sis/storage/base/PRJDataStore.java | 21 +- .../sis/io/stream/ChannelDataOutputTest.java | 20 +- .../org/apache/sis/storage/FeatureQueryTest.java | 5 +- .../apache/sis/storage/StorageConnectorTest.java | 49 ++- .../main/org/apache/sis/system/DataDirectory.java | 33 +- .../main/org/apache/sis/util/Utilities.java | 2 +- .../main/org/apache/sis/util/collection/Cache.java | 2 +- .../apache/sis/util/internal/CheckedArrayList.java | 2 +- .../apache/sis/util/internal/DefinitionURI.java | 22 +- .../sis/util/resources/IndexedResourceBundle.java | 2 +- .../org/apache/sis/util/resources/Messages.java | 4 +- .../apache/sis/util/resources/Messages.properties | 2 +- .../sis/util/resources/Messages_fr.properties | 2 +- .../org/apache/sis/measure/UnitFormatTest.java | 36 +- .../test/org/apache/sis/test/Assertions.java | 84 +++-- .../org/apache/sis/util/ArgumentChecksTest.java | 44 +-- .../sis/util/internal/DefinitionURITest.java | 10 + parent/pom.xml | 9 +- 110 files changed, 3709 insertions(+), 1824 deletions(-) diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java index 32b60ad8f0,e2a883b057..6c3806ea64 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java @@@ -52,8 -53,9 +53,8 @@@ import org.apache.sis.test.TestUtilitie import static org.apache.sis.test.TestUtilities.getSingleton; import static org.apache.sis.metadata.Assertions.assertTitleEquals; - // Specific to the main and geoapi-3.1 branches: -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.metadata.citation.Party; -import org.opengis.metadata.citation.Responsibility; ++// Specific to the main branch: +import org.opengis.metadata.citation.ResponsibleParty; /** @@@ -305,10 -315,10 +314,10 @@@ public final class DefaultCitationTest final CitationDate date = getSingleton(c.getDates()); assertEquals("date", date.getDate(), TestUtilities.date("2015-10-17 00:00:00")); - assertEquals("dateType", DateType.ADOPTED, date.getDateType()); - assertEquals("presentationForm", PresentationForm.PHYSICAL_OBJECT, getSingleton(c.getPresentationForms())); + assertEquals("dateType", DateType.valueOf("adopted"), date.getDateType()); + assertEquals("presentationForm", PresentationForm.valueOf("physicalObject"), getSingleton(c.getPresentationForms())); - final Iterator<ResponsibleParty> it = c.getCitedResponsibleParties().iterator(); - final Iterator<? extends Responsibility> it = c.getCitedResponsibleParties().iterator(); ++ final Iterator<? extends ResponsibleParty> it = c.getCitedResponsibleParties().iterator(); final Contact contact = assertResponsibilityEquals(Role.ORIGINATOR, "Maid Marian", it.next()); assertEquals("Contact instruction", "Send carrier pigeon.", String.valueOf(contact.getContactInstructions())); diff --cc endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/ReferenceResolverTest.java index 0000000000,141eef9d9a..3110ad2fa9 mode 000000,100644..100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/ReferenceResolverTest.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/ReferenceResolverTest.java @@@ -1,0 -1,66 +1,66 @@@ + /* + * 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.io.IOException; + import jakarta.xml.bind.JAXBException; + import org.opengis.metadata.citation.Citation; + import org.opengis.metadata.identification.DataIdentification; + + // Test dependencies + import org.junit.Test; + import static org.junit.jupiter.api.Assertions.*; + import org.apache.sis.metadata.xml.TestUsingFile; + import org.apache.sis.metadata.iso.citation.DefaultCitationTest; + import static org.apache.sis.test.TestUtilities.getSingleton; + + + /** + * Tests {@link ReferenceResolver}. + * + * @author Martin Desruisseaux (Geomatys) + */ + public final class ReferenceResolverTest extends TestUsingFile { + /** + * Creates a new test case. + */ + public ReferenceResolverTest() { + } + + /** + * Tests loading a document with a {@code xlink:href} to an external document. + * + * @throws IOException if an error occurred while opening the test file. + * @throws JAXBException if an error occurred while parsing the test file. + */ + @Test + public void testUsingExternalXLink() throws IOException, JAXBException { + final var data = (DataIdentification) XML.unmarshal(Format.XML2016.getURL("UsingExternalXLink.xml")); + assertEquals("Test the use of XLink to an external document.", data.getAbstract().toString()); + final Citation citation = data.getCitation(); + DefaultCitationTest.verifyUnmarshalledCitation(citation); + /* + * The fragment should reference the exact same object than the one in the citation. + */ - final var parent = getSingleton(citation.getCitedResponsibleParties().iterator().next().getParties()); - final var reusing = getSingleton(getSingleton(data.getPointOfContacts()).getParties()); - assertEquals("Little John", reusing.getName().toString()); - assertSame(getSingleton(parent .getContactInfo()), - getSingleton(reusing.getContactInfo())); ++ final var parent = citation.getCitedResponsibleParties().iterator().next(); ++ final var reusing = getSingleton(data.getPointOfContacts()); ++ assertEquals("Little John", reusing.getIndividualName()); ++ assertSame(parent .getContactInfo(), ++ reusing.getContactInfo()); + + } + } diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/AbstractParameterDescriptor.java index 2463d88486,9f89555788..c5b316461c --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/AbstractParameterDescriptor.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/AbstractParameterDescriptor.java @@@ -63,9 -66,8 +62,8 @@@ import static org.apache.sis.xml.bind.r * <td class="sep">{@code Abstract}</td> * <td class="sep">{@code description}</td> * <td class="sep">Also known as “definition”.</td> - * </tr> - * <tr> + * </tr><tr> - * <td>{@link #getDirection()}</td> + * <td>{@code getDirection()}</td> * <td class="sep"></td> * <td class="sep"></td> * <td class="sep">{@code direction}</td> diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/DefaultParameterDescriptor.java index b46c8fd9c3,17ae032cbb..96e507147e --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/DefaultParameterDescriptor.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/DefaultParameterDescriptor.java @@@ -137,28 -137,23 +137,23 @@@ public class DefaultParameterDescriptor * <th>Property name</th> * <th>Value type</th> * <th>Returned by</th> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td> - * <td>{@link org.opengis.metadata.Identifier} or {@link String}</td> + * <td>{@link org.opengis.referencing.ReferenceIdentifier} or {@link String}</td> * <td>{@link #getName()}</td> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td> * <td>{@link org.opengis.util.GenericName} or {@link CharSequence} (optionally as array)</td> * <td>{@link #getAlias()}</td> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td> - * <td>{@link org.opengis.metadata.Identifier} (optionally as array)</td> + * <td>{@link org.opengis.referencing.ReferenceIdentifier} (optionally as array)</td> * <td>{@link #getIdentifiers()}</td> - * </tr> - * <tr> + * </tr><tr> - * <td>{@value org.opengis.metadata.Identifier#DESCRIPTION_KEY}</td> + * <td>"description"</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getDescription()}</td> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getRemarks()}</td> diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java index 472c74d2ea,472656654e..824c2ebb29 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java @@@ -119,28 -122,23 +119,23 @@@ public class DefaultParameterDescriptor * <th>Property name</th> * <th>Value type</th> * <th>Returned by</th> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#NAME_KEY}</td> - * <td>{@link org.opengis.metadata.Identifier} or {@link String}</td> + * <td>{@link org.opengis.referencing.ReferenceIdentifier} or {@link String}</td> * <td>{@link #getName()}</td> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#ALIAS_KEY}</td> * <td>{@link org.opengis.util.GenericName} or {@link CharSequence} (optionally as array)</td> * <td>{@link #getAlias()}</td> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#IDENTIFIERS_KEY}</td> - * <td>{@link org.opengis.metadata.Identifier} (optionally as array)</td> + * <td>{@link org.opengis.referencing.ReferenceIdentifier} (optionally as array)</td> * <td>{@link #getIdentifiers()}</td> - * </tr> - * <tr> + * </tr><tr> - * <td>{@value org.opengis.metadata.Identifier#DESCRIPTION_KEY}</td> + * <td>"description"</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getDescription()}</td> - * </tr> - * <tr> + * </tr><tr> * <td>{@value org.opengis.referencing.IdentifiedObject#REMARKS_KEY}</td> * <td>{@link org.opengis.util.InternationalString} or {@link String}</td> * <td>{@link #getRemarks()}</td> diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/WKTDictionaryTest.java index 61b035720f,3825c1730e..0d9c3f79f0 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/WKTDictionaryTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/io/wkt/WKTDictionaryTest.java @@@ -44,10 -44,11 +44,11 @@@ import org.apache.sis.test.TestUtilitie import org.apache.sis.test.DependsOn; import org.apache.sis.test.TestCase; import static org.apache.sis.test.Assertions.assertSetEquals; + import static org.apache.sis.test.Assertions.assertMessageContains; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.metadata.Identifier; -import static org.opengis.test.Assert.assertAxisDirectionsEqual; +// Specific to the main branch: +import org.opengis.referencing.ReferenceIdentifier; +import static org.apache.sis.test.GeoapiAssert.assertAxisDirectionsEqual; /** diff --cc endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/NTv2Test.java index 423338a0a0,d6ac4eb852..e0043f1a5e --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/NTv2Test.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/operation/provider/NTv2Test.java @@@ -42,9 -46,10 +46,10 @@@ import static org.junit.Assume.assumeTr import static org.junit.Assert.*; import static org.opengis.test.Assert.assertInstanceOf; import org.apache.sis.test.DependsOn; + import org.apache.sis.referencing.operation.gridded.LoadedGridTest; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import static org.opengis.test.Assert.assertMatrixEquals; +// Specific to the main branch: +import static org.apache.sis.test.GeoapiAssert.assertMatrixEquals; /** @@@ -53,9 -58,10 +58,9 @@@ * * @author Martin Desruisseaux (Geomatys) * - * @see GeocentricTranslationTest#testFranceGeocentricInterpolationPoint() * @see org.apache.sis.referencing.operation.transform.MolodenskyTransformTest#testFranceGeocentricInterpolationPoint() */ - @DependsOn(DatumShiftGridFileTest.class) + @DependsOn(LoadedGridTest.class) public final class NTv2Test extends DatumShiftTestCase { /** * Name of the file containing a small extract of the "{@code NTF_R93.gsb}" file. diff --cc endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/FeatureQueryTest.java index dc8957c9e8,5569206dc2..04faaae94d --- a/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/FeatureQueryTest.java +++ b/endorsed/src/org.apache.sis.storage/test/org/apache/sis/storage/FeatureQueryTest.java @@@ -33,14 -33,21 +33,15 @@@ import org.junit.Test import static org.junit.Assert.*; import org.apache.sis.test.TestUtilities; import org.apache.sis.test.TestCase; + import static org.apache.sis.test.Assertions.assertMessageContains; -// Specific to the geoapi-3.1 and geoapi-4.0 branches: -import org.opengis.feature.Feature; -import org.opengis.feature.FeatureType; -import org.opengis.feature.PropertyType; -import org.opengis.feature.AttributeType; -import org.opengis.feature.IdentifiedType; -import org.opengis.feature.Operation; -import org.opengis.filter.Expression; -import org.opengis.filter.Filter; -import org.opengis.filter.FilterFactory; -import org.opengis.filter.MatchAction; -import org.opengis.filter.SortOrder; -import org.opengis.filter.SortProperty; +// Specific to the main branch: +import org.apache.sis.feature.AbstractFeature; +import org.apache.sis.feature.DefaultFeatureType; +import org.apache.sis.feature.DefaultAttributeType; +import org.apache.sis.feature.AbstractIdentifiedType; +import org.apache.sis.feature.AbstractOperation; +import org.apache.sis.filter.Expression; /** diff --cc endorsed/src/org.apache.sis.util/main/org/apache/sis/util/resources/IndexedResourceBundle.java index dd83f6f277,cbffab180b..de5544fbfc --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/resources/IndexedResourceBundle.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/util/resources/IndexedResourceBundle.java @@@ -405,11 -408,11 +405,11 @@@ public abstract class IndexedResourceBu } replacement = CharSequences.shortSentence(text, MAX_STRING_LENGTH); } else if (element instanceof URI) { - replacement = ((URI) element).getPath(); // For decoding encoded characters. + replacement = ((URI) element).getSchemeSpecificPart(); // For decoding encoded characters. } else if (element instanceof Class<?>) { replacement = Classes.getShortName(getPublicType((Class<?>) element)); - } else if (element instanceof ControlledVocabulary) { - replacement = MetadataServices.getInstance().getCodeTitle((ControlledVocabulary) element, getLocale()); + } else if (element instanceof CodeList<?>) { + replacement = MetadataServices.getInstance().getCodeTitle((CodeList<?>) element, getLocale()); } else if (element instanceof Range<?>) { final Range<?> range = (Range<?>) element; replacement = new RangeFormat(getLocale(), range.getElementType()).format(range);