Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/package-info.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/package-info.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/package-info.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/package-info.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -103,7 +103,7 @@ * </ul> * * <div class="section">How Metadata are marshalled</div> - * The ISO 19139 standard defines how ISO 19115 metadata shall be represented in XML. + * The ISO 19115-3 standard defines how ISO 19115-1 metadata shall be represented in XML. * The SIS library supports XML marshalling and unmarshalling with JAXB annotations. * * <p>Only the implementation classes defined in the {@link org.apache.sis.metadata.iso} packages and sub-packages
Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -27,10 +27,12 @@ import org.opengis.metadata.citation.Cit import org.opengis.metadata.citation.Responsibility; import org.opengis.metadata.citation.PresentationForm; import org.apache.sis.metadata.iso.citation.DefaultCitation; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.jaxb.Schemas; import org.apache.sis.xml.XML; import org.apache.sis.xml.Namespaces; import org.apache.sis.xml.MarshallerPool; +import org.apache.sis.test.DependsOnMethod; import org.apache.sis.test.XMLTestCase; import org.junit.Test; @@ -42,7 +44,7 @@ import static org.apache.sis.test.Assert * * @author Martin Desruisseaux (Geomatys) * @author Guilhem Legal (Geomatys) - * @version 0.5 + * @version 1.0 * * @see <a href="http://jira.geotoolkit.org/browse/GEOTK-121">GEOTK-121</a> * @@ -52,13 +54,14 @@ import static org.apache.sis.test.Assert public final strictfp class CodeListMarshallingTest extends XMLTestCase { /** * Returns a XML string to use for testing purpose. + * Note that responsible party exists only in legacy ISO 19115:2003 model. * * @param baseURL the base URL of XML schemas. */ private static String getResponsiblePartyXML(final String baseURL) { - return "<gmd:CI_ResponsibleParty xmlns:gmd=\"" + Namespaces.GMD + "\">\n" + + return "<gmd:CI_ResponsibleParty xmlns:gmd=\"" + LegacyNamespaces.GMD + "\">\n" + " <gmd:role>\n" + - " <gmd:CI_RoleCode codeList=\"" + baseURL + Schemas.CODELISTS_PATH + "#CI_RoleCode\"" + + " <gmd:CI_RoleCode codeList=\"" + baseURL + Schemas.CODELISTS_PATH_LEGACY + "#CI_RoleCode\"" + " codeListValue=\"principalInvestigator\">" + "Principal investigator</gmd:CI_RoleCode>\n" + " </gmd:role>\n" + "</gmd:CI_ResponsibleParty>"; @@ -67,15 +70,31 @@ public final strictfp class CodeListMars /** * Returns a XML string to use for testing purpose. * - * @param baseURL the base URL of XML schemas. - */ - private static String getCitationXML(final String baseURL, final String language, final String value) { - return "<gmd:CI_Date xmlns:gmd=\"" + Namespaces.GMD + "\">\n" + - " <gmd:dateType>\n" + - " <gmd:CI_DateTypeCode codeList=\"" + baseURL + Schemas.CODELISTS_PATH + "#CI_DateTypeCode\"" + - " codeListValue=\"creation\" codeSpace=\"" + language + "\">" + value + "</gmd:CI_DateTypeCode>\n" + - " </gmd:dateType>\n" + - "</gmd:CI_Date>"; + * @param language three-letter ISO code. + * @param dateType date type code list in the language identified by {@code language}. + * @param legacy {@code true} for ISO 19139:2007 format, {@code false} for ISO 19115-3 format. + */ + private static String getCitationXML(final String language, final String dateType, final boolean legacy) { + final Object[] args = new Object[] { + "cit", // Prefix + Namespaces.CIT, // Namespace + Schemas.METADATA_ROOT, // Base URL of code list path + Schemas.CODELISTS_PATH, // Relative code list path in base URL + language, dateType + }; + if (legacy) { + args[0] = "gmd"; // Prefix + args[1] = LegacyNamespaces.GMD; // Namespace + args[2] = Schemas.METADATA_ROOT_LEGACY; // Base URL of code list path + args[3] = Schemas.CODELISTS_PATH_LEGACY; // Relative code list path in base URL + } + return String.format( + "<%1$s:CI_Date xmlns:%1$s=\"%2$s\">\n" + + " <%1$s:dateType>\n" + + " <%1$s:CI_DateTypeCode codeList=\"%3$s%4$s#CI_DateTypeCode\"" + + " codeListValue=\"creation\" codeSpace=\"%5$s\">%6$s</%1$s:CI_DateTypeCode>\n" + + " </%1$s:dateType>\n" + + "</%1$s:CI_Date>", args); } /** @@ -85,14 +104,14 @@ public final strictfp class CodeListMars */ @Test public void testDefaultURL() throws JAXBException { - final String expected = getResponsiblePartyXML(Schemas.METADATA_ROOT); + final String expected = getResponsiblePartyXML(Schemas.METADATA_ROOT_LEGACY); final Responsibility rp = (Responsibility) XML.unmarshal(expected); assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole()); /* * Use the convenience method in order to avoid the effort of creating * our own MarshallerPool. */ - final String actual = XML.marshal(rp); + final String actual = marshal(rp, VERSION_2007); assertXmlEquals(expected, actual, "xmlns:*"); } @@ -103,14 +122,15 @@ public final strictfp class CodeListMars */ @Test public void testISO_URL() throws JAXBException { - final String expected = getResponsiblePartyXML(Schemas.ISO_19139_ROOT); + final String expected = getResponsiblePartyXML("http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/"); final Responsibility rp = (Responsibility) XML.unmarshal(expected); assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole()); final MarshallerPool pool = getMarshallerPool(); final Marshaller marshaller = pool.acquireMarshaller(); + marshaller.setProperty(XML.METADATA_VERSION, VERSION_2007); marshaller.setProperty(XML.SCHEMAS, Collections.singletonMap("gmd", - "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas")); // Intentionally omit trailing '/'. + "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas")); // Intentionally omit trailing '/'. final String actual = marshal(marshaller, rp); pool.recycle(marshaller); assertXmlEquals(expected, actual, "xmlns:*"); @@ -123,13 +143,36 @@ public final strictfp class CodeListMars */ @Test public void testLocalization() throws JAXBException { + testLocalization(false); + } + + /** + * Tests a code list localization in ISO 19139:2007. + * + * @throws JAXBException if an error occurred while marshaling the XML. + * + * @since 1.0 + */ + @Test + @DependsOnMethod("testLocalization") + public void testLocalizationLegacyXML() throws JAXBException { + testLocalization(true); + } + + /** + * Implementation of {@link #testLocalization()} and {@link #testLocalizationLegacyXML()}. + */ + private void testLocalization(final boolean legacy) throws JAXBException { final MarshallerPool pool = getMarshallerPool(); final Marshaller marshaller = pool.acquireMarshaller(); + if (legacy) { + marshaller.setProperty(XML.METADATA_VERSION, VERSION_2007); + } /* * First, test using the French locale. */ marshaller.setProperty(XML.LOCALE, Locale.FRENCH); - String expected = getCitationXML(Schemas.METADATA_ROOT, "fra", "Création"); + String expected = getCitationXML("fra", "Création", legacy); CitationDate ci = (CitationDate) XML.unmarshal(expected); assertEquals(DateType.CREATION, ci.getDateType()); String actual = marshal(marshaller, ci); @@ -138,7 +181,7 @@ public final strictfp class CodeListMars * Tests again using the English locale. */ marshaller.setProperty(XML.LOCALE, Locale.ENGLISH); - expected = getCitationXML(Schemas.METADATA_ROOT, "eng", "Creation"); + expected = getCitationXML("eng", "Creation", legacy); ci = (CitationDate) XML.unmarshal(expected); assertEquals(DateType.CREATION, ci.getDateType()); actual = marshal(marshaller, ci); @@ -156,21 +199,22 @@ public final strictfp class CodeListMars public void testExtraCodes() throws JAXBException { final DefaultCitation id = new DefaultCitation(); id.setPresentationForms(Arrays.asList( - PresentationForm.valueOf("IMAGE_DIGITAL"), // Existing code with UML id="imageDigital" - PresentationForm.valueOf("test"))); // New code + PresentationForm.valueOf("IMAGE_DIGITAL"), // Existing code with UML id="imageDigital" + PresentationForm.valueOf("test"))); // New code final String xml = marshal(id); - - // "IMAGE_DIGITAL" is marshalled as "imageDigital" because is contains a UML id, which is lower-case. + /* + * "IMAGE_DIGITAL" is marshalled as "imageDigital" because is contains a UML id, which is lower-case. + */ assertXmlEquals( - "<gmd:CI_Citation xmlns:gmd=\"" + Namespaces.GMD + "\">\n" + - " <gmd:presentationForm>\n" + - " <gmd:CI_PresentationFormCode codeListValue=\"imageDigital\">Image digital</gmd:CI_PresentationFormCode>\n" + - " </gmd:presentationForm>\n" + - " <gmd:presentationForm>\n" + - " <gmd:CI_PresentationFormCode codeListValue=\"test\">Test</gmd:CI_PresentationFormCode>\n" + - " </gmd:presentationForm>\n" + - "</gmd:CI_Citation>\n", + "<cit:CI_Citation xmlns:cit=\"" + Namespaces.CIT + "\">\n" + + " <cit:presentationForm>\n" + + " <cit:CI_PresentationFormCode codeListValue=\"imageDigital\">Image digital</cit:CI_PresentationFormCode>\n" + + " </cit:presentationForm>\n" + + " <cit:presentationForm>\n" + + " <cit:CI_PresentationFormCode codeListValue=\"test\">Test</cit:CI_PresentationFormCode>\n" + + " </cit:presentationForm>\n" + + "</cit:CI_Citation>\n", xml, "xmlns:*", "codeList", "codeSpace"); } } Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/EnumMarshallingTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -33,7 +33,8 @@ import static org.apache.sis.test.Assert * Tests the XML marshaling of {@code Enum}. * * @author Martin Desruisseaux (Geomatys) - * @version 0.6 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.5 * @module */ @@ -45,33 +46,33 @@ public final strictfp class EnumMarshall */ @Test public void testTopicCategories() throws JAXBException { - final Collection<TopicCategory> expected = Arrays.asList( + final Collection<TopicCategory> topics = Arrays.asList( TopicCategory.OCEANS, TopicCategory.ENVIRONMENT, TopicCategory.IMAGERY_BASE_MAPS_EARTH_COVER); // We need to test at least one enum with many words. final DefaultDataIdentification id = new DefaultDataIdentification(); - id.setTopicCategories(expected); + id.setTopicCategories(topics); + String expected = + "<mri:MD_DataIdentification xmlns:mri=\"" + Namespaces.MRI + "\">\n" + + " <mri:topicCategory>\n" + + " <mri:MD_TopicCategoryCode>environment</mri:MD_TopicCategoryCode>\n" + + " </mri:topicCategory>\n" + + " <mri:topicCategory>\n" + + " <mri:MD_TopicCategoryCode>imageryBaseMapsEarthCover</mri:MD_TopicCategoryCode>\n" + + " </mri:topicCategory>\n" + + " <mri:topicCategory>\n" + + " <mri:MD_TopicCategoryCode>oceans</mri:MD_TopicCategoryCode>\n" + + " </mri:topicCategory>\n" + + "</mri:MD_DataIdentification>"; - final String xml = marshal(id); - assertXmlEquals( - "<gmd:MD_DataIdentification xmlns:gmd=\"" + Namespaces.GMD + "\">\n" + - " <gmd:topicCategory>\n" + - " <gmd:MD_TopicCategoryCode>environment</gmd:MD_TopicCategoryCode>\n" + - " </gmd:topicCategory>\n" + - " <gmd:topicCategory>\n" + - " <gmd:MD_TopicCategoryCode>imageryBaseMapsEarthCover</gmd:MD_TopicCategoryCode>\n" + - " </gmd:topicCategory>\n" + - " <gmd:topicCategory>\n" + - " <gmd:MD_TopicCategoryCode>oceans</gmd:MD_TopicCategoryCode>\n" + - " </gmd:topicCategory>\n" + - "</gmd:MD_DataIdentification>", - xml, "xmlns:*"); + final String xml = marshal(id, VERSION_2014); + assertXmlEquals(expected, xml, "xmlns:*"); /* * Unmarshall the above XML and verify that we find all the topic categories. */ - final Collection<TopicCategory> unmarshalled = unmarshal(DefaultDataIdentification.class, xml).getTopicCategories(); + final Collection<TopicCategory> unmarshalled = unmarshal(DefaultDataIdentification.class, expected).getTopicCategories(); assertInstanceOf("topicCategory", EnumSet.class, unmarshalled); - assertSetEquals(expected, unmarshalled); + assertSetEquals(topics, unmarshalled); } } Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/PT_LocaleTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/PT_LocaleTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/PT_LocaleTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/PT_LocaleTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -19,9 +19,8 @@ package org.apache.sis.internal.jaxb.cod import java.util.Arrays; import java.util.Locale; import javax.xml.bind.JAXBException; +import org.apache.sis.util.Version; import org.apache.sis.metadata.iso.DefaultMetadata; -import org.apache.sis.internal.jaxb.Schemas; -import org.apache.sis.xml.Namespaces; import org.apache.sis.test.XMLTestCase; import org.junit.Test; @@ -32,28 +31,13 @@ import static org.apache.sis.test.Assert * Tests the XML marshaling of {@link PT_Locale}. * * @author Martin Desruisseaux (Geomatys) - * @version 0.4 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.4 * @module */ public final strictfp class PT_LocaleTest extends XMLTestCase { /** - * The path to the {@code gmxCodelists.xml} path. - */ - private static final String CODELISTS_PATH = Schemas.METADATA_ROOT + Schemas.CODELISTS_PATH; - - /** - * The {@code <gmd:characterEncoding>} element to be repeated for every locale. This element is not - * of interest for this test. In current Apache SIS implementation, it is totally redundant with the - * encoding declared in the XML header. Unfortunately those elements are mandatory according OGC/ISO - * schemas, so we have to carry their weight. - */ - private static final String ENCODING = - " <gmd:characterEncoding>\n" + - " <gmd:MD_CharacterSetCode codeList=\"" + CODELISTS_PATH + "#MD_CharacterSetCode\" codeListValue=\"utf8\">UTF-8</gmd:MD_CharacterSetCode>\n" + - " </gmd:characterEncoding>\n"; - - /** * The locales to use for the tests. For better test coverage we need at least: * * <ul> @@ -66,51 +50,19 @@ public final strictfp class PT_LocaleTes }; /** - * XML representation of the {@link #LOCALES} list. + * Tests marshalling of a few locales using the specified version of metadata schema. + * + * @param filename name of the file containing expected result. + * @param ignoredNodes the fully-qualified names of the nodes to ignore. */ - private static final String XML = - "<gmd:MD_Metadata xmlns:gmd=\"" + Namespaces.GMD + "\">\n" + - " <gmd:language>\n" + - " <gmd:LanguageCode codeList=\"http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#LanguageCode\" codeListValue=\"eng\" codeSpace=\"eng\">English</gmd:LanguageCode>\n" + - " </gmd:language>\n" + - " <gmd:locale>\n" + - " <gmd:PT_Locale>\n" + - " <gmd:languageCode>\n" + - " <gmd:LanguageCode codeList=\"" + CODELISTS_PATH + "#LanguageCode\" codeListValue=\"jpn\" codeSpace=\"eng\">Japanese</gmd:LanguageCode>\n" + - " </gmd:languageCode>\n" + ENCODING + - " </gmd:PT_Locale>\n" + - " </gmd:locale>\n" + - " <gmd:locale>\n" + - " <gmd:PT_Locale>\n" + - " <gmd:languageCode>\n" + - " <gmd:LanguageCode codeList=\"" + CODELISTS_PATH + "#LanguageCode\" codeListValue=\"eng\" codeSpace=\"eng\">English</gmd:LanguageCode>\n" + - " </gmd:languageCode>\n" + - " <gmd:country>\n" + - " <gmd:Country codeList=\"" + CODELISTS_PATH + "#Country\" codeListValue=\"CA\" codeSpace=\"eng\">Canada</gmd:Country>\n" + - " </gmd:country>\n" + ENCODING + - " </gmd:PT_Locale>\n" + - " </gmd:locale>\n" + - " <gmd:locale>\n" + - " <gmd:PT_Locale>\n" + - " <gmd:languageCode>\n" + - " <gmd:LanguageCode codeList=\"" + CODELISTS_PATH + "#LanguageCode\" codeListValue=\"fra\" codeSpace=\"eng\">French</gmd:LanguageCode>\n" + - " </gmd:languageCode>\n" + - " <gmd:country>\n" + - " <gmd:Country codeList=\"" + CODELISTS_PATH + "#Country\" codeListValue=\"FR\" codeSpace=\"eng\">France</gmd:Country>\n" + - " </gmd:country>\n" + ENCODING + - " </gmd:PT_Locale>\n" + - " </gmd:locale>\n" + - " <gmd:locale>\n" + - " <gmd:PT_Locale>\n" + - " <gmd:languageCode>\n" + - " <gmd:LanguageCode codeList=\"" + CODELISTS_PATH + "#LanguageCode\" codeListValue=\"fra\" codeSpace=\"eng\">French</gmd:LanguageCode>\n" + - " </gmd:languageCode>\n" + - " <gmd:country>\n" + - " <gmd:Country codeList=\"" + CODELISTS_PATH + "#Country\" codeListValue=\"CA\" codeSpace=\"eng\">Canada</gmd:Country>\n" + - " </gmd:country>\n" + ENCODING + - " </gmd:PT_Locale>\n" + - " </gmd:locale>\n" + - "</gmd:MD_Metadata>"; + private void marshalAndCompare(final String filename, final Version version, final String... ignoredNodes) + throws JAXBException + { + final DefaultMetadata metadata = new DefaultMetadata(); + metadata.setLanguages(Arrays.asList(LOCALES)); + assertMarshalEqualsFile(filename, metadata, version, STRICT, ignoredNodes, + new String[] {"xmlns:*", "xsi:*"}); + } /** * Tests marshalling of a few locales. @@ -119,9 +71,19 @@ public final strictfp class PT_LocaleTes */ @Test public void testMarshalling() throws JAXBException { - final DefaultMetadata metadata = new DefaultMetadata(); - metadata.setLanguages(Arrays.asList(LOCALES)); - assertXmlEquals(XML, marshal(metadata), "xlmns:*"); + marshalAndCompare("Locales.xml", VERSION_2014, + "mdb:contact", "mdb:dateInfo", "mdb:identificationInfo"); + } + + /** + * Tests marshalling to legacy ISO 19139:2007 schema. + * + * @throws JAXBException if an error occurred during (un)marshalling. + */ + @Test + public void testMarshallingLegacy() throws JAXBException { + marshalAndCompare("Locales (legacy).xml", VERSION_2007, + "gmd:contact", "gmd:dateStamp", "gmd:identificationInfo"); } /** @@ -131,7 +93,18 @@ public final strictfp class PT_LocaleTes */ @Test public void testUnmarshalling() throws JAXBException { - final DefaultMetadata metadata = unmarshal(DefaultMetadata.class, XML); + final DefaultMetadata metadata = unmarshalFile(DefaultMetadata.class, "Locales.xml"); + assertArrayEquals(LOCALES, metadata.getLanguages().toArray()); + } + + /** + * Tests unmarshalling from legacy ISO 19139:2007 schema. + * + * @throws JAXBException if an error occurred during (un)marshalling. + */ + @Test + public void testUnmarshallingLegacy() throws JAXBException { + final DefaultMetadata metadata = unmarshalFile(DefaultMetadata.class, "Locales (legacy).xml"); assertArrayEquals(LOCALES, metadata.getLanguages().toArray()); } } Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -19,8 +19,8 @@ package org.apache.sis.internal.jaxb.met import javax.xml.bind.JAXBException; import org.opengis.util.MemberName; import org.opengis.parameter.ParameterDirection; -import org.apache.sis.util.iso.Names; import org.apache.sis.xml.Namespaces; +import org.apache.sis.util.iso.Names; import org.apache.sis.test.XMLTestCase; import org.junit.Test; @@ -31,7 +31,8 @@ import static org.apache.sis.test.Assert * Tests {@link ServiceParameter}. * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.5 * @module */ @@ -52,6 +53,16 @@ public final strictfp class ServiceParam } /** + * Tests {@link ServiceParameter#getName()}. + */ + @Test + public void testGetName() { + final ServiceParameter param = create(); + assertEquals("name", "Version", String.valueOf(param.getName())); + assertEquals("valueClass", String.class, param.getValueClass()); + } + + /** * Tests {@link ServiceParameter#getValueType()} and {@link ServiceParameter#getValueClass()}. */ @Test @@ -62,27 +73,28 @@ public final strictfp class ServiceParam } /** - * Tests {@link ServiceParameter#getOptionality()} and {@link ServiceParameter#setOptionality(String)}. + * Tests {@link ServiceParameter#getOptionalityLabel()} and {@link ServiceParameter#setOptionalityLabel(String)}. */ @Test public void testOptionalityLabel() { final ServiceParameter param = create(); - assertEquals("Optional", param.getOptionality()); + assertEquals("Optional", param.getOptionalityLabel()); param.optionality = false; - assertEquals("Mandatory", param.getOptionality()); + assertEquals("Mandatory", param.getOptionalityLabel()); - param.setOptionality("Optional"); + param.setOptionalityLabel("Optional"); assertTrue(param.optionality); - param.setOptionality("Mandatory"); + param.setOptionalityLabel("Mandatory"); assertFalse(param.optionality); } /** * Tests marshalling of an almost empty parameter (except for default mandatory values). * The main purpose is to ensure that the XML does not contains spurious elements like - * empty enumeration wrapper. + * empty enumeration wrapper. For testing a complete marshalling, + * see {@link org.apache.sis.metadata.iso.identification.DefaultServiceIdentificationTest}. * * @throws JAXBException if an error occurred during marshalling. */ @@ -93,11 +105,11 @@ public final strictfp class ServiceParam "<srv:SV_Parameter xmlns:srv=\"" + Namespaces.SRV + '"' + " xmlns:gco=\"" + Namespaces.GCO + "\">\n" + " <srv:optionality>\n" + - " <gco:CharacterString>Mandatory</gco:CharacterString>\n" + + " <gco:Boolean>false</gco:Boolean>\n" + " </srv:optionality>\n" + " <srv:repeatability>\n" + " <gco:Boolean>false</gco:Boolean>\n" + " </srv:repeatability>\n" + - "</srv:SV_Parameter>\n", xml, "xlmns:*"); + "</srv:SV_Parameter>\n", xml, "xmlns:*"); } } Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -35,7 +35,7 @@ import static org.apache.sis.metadata.Ke * Unless otherwise specified, all tests use the {@link MetadataStandard#ISO_19115} constant. * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ @@ -65,8 +65,8 @@ public final strictfp class NameMapTest // new SimpleEntry<>("collectiveTitle", "collectiveTitle"), -- deprecated as of ISO 19115:2014 new SimpleEntry<>("ISBN", "ISBN"), new SimpleEntry<>("ISSN", "ISSN"), - new SimpleEntry<>("graphic", "graphics"), - new SimpleEntry<>("onlineResource", "onlineResources") + new SimpleEntry<>("onlineResource", "onlineResources"), + new SimpleEntry<>("graphic", "graphics") }, map.entrySet().toArray()); assertEquals("alternateTitles", map.get("alternateTitle")); Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyAccessorTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -38,7 +38,7 @@ import org.opengis.metadata.constraint.C import org.opengis.metadata.content.AttributeGroup; import org.opengis.metadata.content.CoverageContentType; import org.opengis.metadata.content.CoverageDescription; -import org.opengis.metadata.identification.*; // Really using almost everything. +import org.opengis.metadata.identification.*; // Really using almost everything. import org.opengis.metadata.maintenance.MaintenanceInformation; import org.opengis.metadata.spatial.SpatialRepresentationType; import org.opengis.referencing.IdentifiedObject; @@ -81,7 +81,7 @@ import static org.apache.sis.metadata.Pr * to be updated.</p> * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ @@ -184,8 +184,8 @@ public final strictfp class PropertyAcce // Citation.class, "getCollectiveTitle", "collectiveTitle", "collectiveTitle", "Collective title", InternationalString.class, -- deprecated as of ISO 19115:2014 Citation.class, "getISBN", "ISBN", "ISBN", "ISBN", String.class, Citation.class, "getISSN", "ISSN", "ISSN", "ISSN", String.class, - Citation.class, "getGraphics", "graphics", "graphic", "Graphics", BrowseGraphic[].class, - Citation.class, "getOnlineResources", "onlineResources", "onlineResource", "Online resources", OnlineResource[].class); + Citation.class, "getOnlineResources", "onlineResources", "onlineResource", "Online resources", OnlineResource[].class, + Citation.class, "getGraphics", "graphics", "graphic", "Graphics", BrowseGraphic[].class); } /** @@ -208,24 +208,24 @@ public final strictfp class PropertyAcce Identification.class, "getCredits", "credits", "credit", "Credits", InternationalString[].class, Identification.class, "getStatus", "status", "status", "Status", Progress[].class, Identification.class, "getPointOfContacts", "pointOfContacts", "pointOfContact", "Point of contacts", Responsibility[].class, + Identification.class, "getSpatialRepresentationTypes", "spatialRepresentationTypes", "spatialRepresentationType", "Spatial representation types", SpatialRepresentationType[].class, + Identification.class, "getSpatialResolutions", "spatialResolutions", "spatialResolution", "Spatial resolutions", Resolution[].class, + Identification.class, "getTemporalResolutions", "temporalResolutions", "temporalResolution", "Temporal resolutions", Duration[].class, + Identification.class, "getTopicCategories", "topicCategories", "topicCategory", "Topic categories", TopicCategory[].class, + Identification.class, "getExtents", "extents", "extent", "Extents", Extent[].class, + Identification.class, "getAdditionalDocumentations", "additionalDocumentations", "additionalDocumentation", "Additional documentations", Citation[].class, + Identification.class, "getProcessingLevel", "processingLevel", "processingLevel", "Processing level", Identifier.class, Identification.class, "getResourceMaintenances", "resourceMaintenances", "resourceMaintenance", "Resource maintenances", MaintenanceInformation[].class, Identification.class, "getGraphicOverviews", "graphicOverviews", "graphicOverview", "Graphic overviews", BrowseGraphic[].class, Identification.class, "getResourceFormats", "resourceFormats", "resourceFormat", "Resource formats", Format[].class, Identification.class, "getDescriptiveKeywords", "descriptiveKeywords", "descriptiveKeywords", "Descriptive keywords", Keywords[].class, Identification.class, "getResourceSpecificUsages", "resourceSpecificUsages", "resourceSpecificUsage", "Resource specific usages", Usage[].class, Identification.class, "getResourceConstraints", "resourceConstraints", "resourceConstraints", "Resource constraints", Constraints[].class, - Identification.class, "getSpatialRepresentationTypes", "spatialRepresentationTypes", "spatialRepresentationType", "Spatial representation types", SpatialRepresentationType[].class, - Identification.class, "getSpatialResolutions", "spatialResolutions", "spatialResolution", "Spatial resolutions", Resolution[].class, + Identification.class, "getAssociatedResources", "associatedResources", "associatedResource", "Associated resources", AssociatedResource[].class, DataIdentification.class, "getLanguages", "languages", "language", "Languages", Locale[].class, DataIdentification.class, "getCharacterSets", "characterSets", "characterSet", "Character sets", Charset[].class, - Identification.class, "getTopicCategories", "topicCategories", "topicCategory", "Topic categories", TopicCategory[].class, DataIdentification.class, "getEnvironmentDescription", "environmentDescription", "environmentDescription", "Environment description", InternationalString.class, - Identification.class, "getExtents", "extents", "extent", "Extents", Extent[].class, - DataIdentification.class, "getSupplementalInformation", "supplementalInformation", "supplementalInformation", "Supplemental information", InternationalString.class, - Identification.class, "getAdditionalDocumentations", "additionalDocumentations", "additionalDocumentation", "Additional documentations", Citation[].class, - Identification.class, "getAssociatedResources", "associatedResources", "associatedResource", "Associated resources", AssociatedResource[].class, - Identification.class, "getProcessingLevel", "processingLevel", "processingLevel", "Processing level", Identifier.class, - Identification.class, "getTemporalResolutions", "temporalResolutions", "temporalResolution", "Temporal resolutions", Duration[].class); + DataIdentification.class, "getSupplementalInformation", "supplementalInformation", "supplementalInformation", "Supplemental information", InternationalString.class); } /** Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeNodeTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -188,8 +188,8 @@ public final strictfp class TreeNodeTest private void assertCitationContentEquals(final int offset, final TableColumn<?> column, final Object... expected) { if (valuePolicy == ValueExistencePolicy.COMPACT) { assertEquals(19, expected.length); - System.arraycopy(expected, 11+offset, expected, 10+offset, 8-offset); // Compact the "Individual" element. - System.arraycopy(expected, 7+offset, expected, 6+offset, 11-offset); // Compact the "Organisation" element. + System.arraycopy(expected, 12+offset, expected, 11+offset, 7-offset); // Compact the "Individual" element. + System.arraycopy(expected, 8+offset, expected, 7+offset, 10-offset); // Compact the "Organisation" element. System.arraycopy(expected, 1+offset, expected, offset, 16-offset); // Compact the "Title" element. Arrays.fill(expected, 16, 19, null); } @@ -209,16 +209,16 @@ public final strictfp class TreeNodeTest "Alternate title (2 of 2)", "Edition", "Cited responsible party (1 of 2)", + "Role", "Organisation", // A Party subtype "Name", // In COMPACT mode, this value is associated to "Organisation" node. - "Role", "Cited responsible party (2 of 2)", + "Role", "Individual", // A Party subtype "Name", // In COMPACT mode, this value is associated to "Individual" node. "Contact info", "Address", "Electronic mail address", - "Role", "Presentation form (1 of 2)", "Presentation form (2 of 2)", "Other citation details"); @@ -240,16 +240,16 @@ public final strictfp class TreeNodeTest "alternateTitle", "edition", "citedResponsibleParty", + "role", "party", "name", // In COMPACT mode, this value is associated to "party" node. - "role", "citedResponsibleParty", + "role", "party", "name", // In COMPACT mode, this value is associated to "party" node. "contactInfo", "address", "electronicMailAddress", - "role", "presentationForm", "presentationForm", "otherCitationDetails"); @@ -270,16 +270,16 @@ public final strictfp class TreeNodeTest ONE, // alternateTitle null, // edition ZERO, // citedResponsibleParty + null, // role ZERO, // party (organisation) null, // name — in COMPACT mode, this value is associated to "party" node. - null, // role ONE, // citedResponsibleParty + null, // role ZERO, // party (individual) null, // name — in COMPACT mode, this value is associated to "party" node. ZERO, // contactInfo ZERO, // address ZERO, // electronicMailAddress - null, // role ZERO, // presentationForm ONE, // presentationForm ZERO); // otherCitationDetails @@ -298,16 +298,16 @@ public final strictfp class TreeNodeTest InternationalString.class, InternationalString.class, Responsibility.class, + Role.class, Party.class, // In COMPACT mode, value with be the one of "name" node instead. InternationalString.class, // Name - Role.class, Responsibility.class, + Role.class, Party.class, // In COMPACT mode, value with be the one of "name" node instead. InternationalString.class, // Name Contact.class, Address.class, String.class, - Role.class, PresentationForm.class, PresentationForm.class, InternationalString.class); @@ -326,16 +326,16 @@ public final strictfp class TreeNodeTest "Second alternate title", "Some edition", null, // ResponsibleParty + Role.DISTRIBUTOR, null, // Party (organisation) "Some organisation", - Role.DISTRIBUTOR, null, // ResponsibleParty + Role.POINT_OF_CONTACT, null, // Party (individual) "Some person of contact", null, // Contact null, // Address "Some email", - Role.POINT_OF_CONTACT, PresentationForm.MAP_DIGITAL, PresentationForm.MAP_HARDCOPY, "Some other details"); Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableFormatTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -44,7 +44,7 @@ import static org.apache.sis.test.Assert * Tests the {@link TreeTableFormat} applied to the formatting of metadata tree. * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.3 * @module */ @@ -91,18 +91,18 @@ public final strictfp class TreeTableFor " │ │ └─Alternate title…………………………… ISBN\n" + " │ └─Code space…………………………………………………… ISBN\n"+ " ├─Cited responsible party (1 of 2)\n" + - " │ ├─Individual…………………………………………………… Testsuya Toyoda\n" + - " │ └─Role…………………………………………………………………… Author\n" + + " │ ├─Role…………………………………………………………………… Author\n" + + " │ └─Individual…………………………………………………… Testsuya Toyoda\n" + " ├─Cited responsible party (2 of 2)\n" + - " │ ├─Organisation……………………………………………… Kōdansha\n" + " │ ├─Role…………………………………………………………………… Editor\n" + - " │ └─Extent……………………………………………………………… World\n" + - " │ └─Geographic element\n" + - " │ ├─West bound longitude…… 180°W\n" + - " │ ├─East bound longitude…… 180°E\n" + - " │ ├─South bound latitude…… 90°S\n" + - " │ ├─North bound latitude…… 90°N\n" + - " │ └─Extent type code……………… true\n" + + " │ ├─Extent……………………………………………………………… World\n" + + " │ │ └─Geographic element\n" + + " │ │ ├─West bound longitude…… 180°W\n" + + " │ │ ├─East bound longitude…… 180°E\n" + + " │ │ ├─South bound latitude…… 90°S\n" + + " │ │ ├─North bound latitude…… 90°N\n" + + " │ │ └─Extent type code……………… true\n" + + " │ └─Organisation……………………………………………… Kōdansha\n" + " ├─Presentation form (1 of 2)…………………… Document digital\n" + " ├─Presentation form (2 of 2)…………………… Document hardcopy\n" + " └─ISBN……………………………………………………………………………… 9782505004509\n", text); Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TreeTableViewTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -36,7 +36,7 @@ import static org.apache.sis.test.TestUt * Unless otherwise specified, all tests use the {@link MetadataStandard#ISO_19115} constant. * * @author Martin Desruisseaux (Geomatys) - * @version 0.8 + * @version 1.0 * @since 0.3 * @module */ @@ -59,14 +59,14 @@ public final strictfp class TreeTableVie " ├─Alternate title (2 of 2)…………………………………………… Second alternate title\n" + " ├─Edition………………………………………………………………………………………… Some edition\n" + " ├─Cited responsible party (1 of 2)\n" + - " │ ├─Organisation………………………………………………………………… Some organisation\n" + - " │ └─Role……………………………………………………………………………………… Distributor\n" + + " │ ├─Role……………………………………………………………………………………… Distributor\n" + + " │ └─Organisation………………………………………………………………… Some organisation\n" + " ├─Cited responsible party (2 of 2)\n" + - " │ ├─Individual……………………………………………………………………… Some person of contact\n" + - " │ │ └─Contact info\n" + - " │ │ └─Address\n" + - " │ │ └─Electronic mail address…… Some email\n" + - " │ └─Role……………………………………………………………………………………… Point of contact\n" + + " │ ├─Role……………………………………………………………………………………… Point of contact\n" + + " │ └─Individual……………………………………………………………………… Some person of contact\n" + + " │ └─Contact info\n" + + " │ └─Address\n" + + " │ └─Electronic mail address…… Some email\n" + " ├─Presentation form (1 of 2)……………………………………… Map digital\n" + " ├─Presentation form (2 of 2)……………………………………… Map hardcopy\n" + " └─Other citation details………………………………………………… Some other details\n"; Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/TypeMapTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -47,7 +47,7 @@ import static java.util.AbstractMap.Simp * Unless otherwise specified, all tests use the {@link MetadataStandard#ISO_19115} constant. * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ @@ -77,8 +77,8 @@ public final strictfp class TypeMapTest // new SimpleEntry<>("collectiveTitle", InternationalString.class), -- deprecated as of ISO 19115:2014 new SimpleEntry<>("ISBN", String.class), new SimpleEntry<>("ISSN", String.class), - new SimpleEntry<>("graphic", BrowseGraphic.class), - new SimpleEntry<>("onlineResource", OnlineResource.class) + new SimpleEntry<>("onlineResource", OnlineResource.class), + new SimpleEntry<>("graphic", BrowseGraphic.class) }, map.entrySet().toArray()); assertEquals(InternationalString.class, map.get("alternateTitle")); Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/ValueMapTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -46,7 +46,7 @@ import static org.apache.sis.test.TestUt * Unless otherwise specified, all tests use the {@link MetadataStandard#ISO_19115} constant. * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * * @see MetadataStandardTest#testValueMap() * @@ -174,8 +174,8 @@ public final strictfp class ValueMapTest new SimpleEntry<>("presentationForms", emptySet()), new SimpleEntry<>("otherCitationDetails", emptyList()), new SimpleEntry<>("ISBN", "9782505004509"), - new SimpleEntry<>("graphics", emptyList()), - new SimpleEntry<>("onlineResources", emptyList()) + new SimpleEntry<>("onlineResources", emptyList()), + new SimpleEntry<>("graphics", emptyList()) }, all.entrySet().toArray()); } @@ -205,8 +205,8 @@ public final strictfp class ValueMapTest new SimpleEntry<>("presentationForms", emptySet()), new SimpleEntry<>("otherCitationDetails", emptyList()), new SimpleEntry<>("ISBN", "9782505004509"), - new SimpleEntry<>("graphics", emptyList()), - new SimpleEntry<>("onlineResources", emptyList()) + new SimpleEntry<>("onlineResources", emptyList()), + new SimpleEntry<>("graphics", emptyList()) }, all.entrySet().toArray()); } @@ -238,8 +238,8 @@ public final strictfp class ValueMapTest // new SimpleEntry<>("collectiveTitle", null), -- deprecated as of ISO 19115:2014. new SimpleEntry<>("ISBN", "9782505004509"), new SimpleEntry<>("ISSN", null), - new SimpleEntry<>("graphics", emptyList()), - new SimpleEntry<>("onlineResources", emptyList()) + new SimpleEntry<>("onlineResources", emptyList()), + new SimpleEntry<>("graphics", emptyList()) }, all.entrySet().toArray()); } Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/APIVerifier.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -70,10 +70,10 @@ public final strictfp class APIVerifier @Test public void verifyISO1915() throws IOException, ClassNotFoundException, NoSuchMethodException { final Properties changes = new Properties(); - final InputStream in = APIVerifier.class.getResourceAsStream("api-changes.properties"); - assertNotNull("Missing test resource file.", in); - changes.load(in); - in.close(); + try (InputStream in = APIVerifier.class.getResourceAsStream("api-changes.properties")) { + assertNotNull("Missing test resource file.", in); + changes.load(in); + } try { verifyAPI(MetadataStandard.ISO_19115, changes); } catch (AssertionError e) { Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -16,33 +16,28 @@ */ package org.apache.sis.metadata.iso; -import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import org.opengis.util.ControlledVocabulary; import org.opengis.annotation.UML; -import org.opengis.annotation.Specification; +import org.opengis.util.ControlledVocabulary; import org.apache.sis.internal.jaxb.Context; import org.apache.sis.metadata.MetadataStandard; -import org.apache.sis.metadata.MetadataTestCase; +import org.apache.sis.metadata.PropertyConsistencyCheck; import org.apache.sis.test.LoggingWatcher; import org.apache.sis.test.DependsOn; -import org.apache.sis.xml.Namespaces; import org.junit.Rule; import org.junit.Test; -import static org.junit.Assert.*; - /** * Tests all known {@link ISOMetadata} subclasses for JAXB annotations and getter/setter methods. * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @version 1.0 * @since 0.3 * @module */ @DependsOn(org.apache.sis.metadata.PropertyAccessorTest.class) -public final strictfp class AllMetadataTest extends MetadataTestCase { +public final strictfp class AllMetadataTest extends PropertyConsistencyCheck { /** * A JUnit {@link Rule} for listening to log events. This field is public because JUnit requires us to * do so, but should be considered as an implementation details (it should have been a private field). @@ -212,7 +207,9 @@ public final strictfp class AllMetadataT } /** - * Performs the test documented in the {@link MetadataTestCase} javadoc. + * {@inheritDoc} + * Once the test is completed, this method verifies that the expected warnings have been logged, + * and no unexpected logging occurred. */ @Test @Override @@ -226,87 +223,7 @@ public final strictfp class AllMetadataT } /** - * Returns the name of the XML element for the given UML element. - * This method checks for the special cases which are known to have different UML and XML names. - * - * @return {@inheritDoc} - */ - @Override - protected String getExpectedXmlElementName(final Class<?> enclosing, final UML uml) { - String name = super.getExpectedXmlElementName(enclosing, uml); - switch (name) { - case "MD_Scope": { // ISO 19115:2014 - name = "DQ_Scope"; // ISO 19115:2003 - break; - } - case "distributedComputingPlatform": { - name = "DCP"; - break; - } - case "stepDateTime": { - name = "dateTime"; - break; - } - case "locale": { - if (enclosing == org.opengis.metadata.content.FeatureCatalogueDescription.class) { - name = "language"; - } - break; - } - } - return name; - } - - /** - * Returns the expected namespace for an element defined by the given specification. - * For example the namespace of any type defined by {@link Specification#ISO_19115} - * is {@code "http://www.isotc211.org/2005/gmd"}. - * - * @return {@inheritDoc} - */ - @Override - protected String getExpectedNamespace(final Class<?> impl, final Specification specification) { - if (impl == org.apache.sis.metadata.iso.identification.DefaultCoupledResource.class || - impl == org.apache.sis.metadata.iso.identification.DefaultOperationChainMetadata.class || - impl == org.apache.sis.metadata.iso.identification.DefaultOperationMetadata.class || - impl == org.apache.sis.metadata.iso.identification.DefaultServiceIdentification.class) - { - assertEquals(Specification.ISO_19115, specification); - return Namespaces.SRV; - } - return super.getExpectedNamespace(impl, specification); - } - - /** - * Returns the type of the given element, or {@code null} if the type is not yet - * determined (the later cases could change in a future version). - * - * @return {@inheritDoc} - */ - @Override - protected String getExpectedXmlTypeForElement(final Class<?> type, final Class<?> impl) { - final String rootName = type.getAnnotation(UML.class).identifier(); - switch (rootName) { - // Following prefix was changed in ISO 19115 corrigendum, - // but ISO 19139 still use the old prefix. - case "SV_ServiceIdentification": { - return "MD_ServiceIdentification_Type"; - } - // Following prefix was changed in ISO 19115:2014, - // but ISO 19139 still use the old prefix. - case "MD_Scope": { - return "DQ_Scope_Type"; - } - } - final StringBuilder buffer = new StringBuilder(rootName.length() + 13); - if (impl.getSimpleName().startsWith("Abstract")) { - buffer.append("Abstract"); - } - return buffer.append(rootName).append("_Type").toString(); - } - - /** - * Returns the ISO 19139 wrapper for the given GeoAPI type, + * Returns the ISO 19115-3 wrapper for the given GeoAPI type, * or {@code null} if no adapter is expected for the given type. * * @return {@inheritDoc} @@ -323,28 +240,19 @@ public final strictfp class AllMetadataT return null; } final String classname = "org.apache.sis.internal.jaxb." + - (ControlledVocabulary.class.isAssignableFrom(type) ? "code" : "metadata") + - '.' + type.getAnnotation(UML.class).identifier(); + (ControlledVocabulary.class.isAssignableFrom(type) ? "code" : "metadata") + + '.' + type.getAnnotation(UML.class).identifier(); final Class<?> wrapper = Class.forName(classname); - assertTrue("Expected a final class for " + wrapper.getName(), Modifier.isFinal(wrapper.getModifiers())); - return wrapper; - } - - /** - * Returns {@code true} if the given method is a non-standard extension. - * If {@code true}, then {@code method} does not need to have UML annotation. - * - * @param method the method to verify. - * @return {@code true} if the given method is an extension, or {@code false} otherwise. - * - * @since 0.5 - */ - @Override - protected boolean isExtension(final Method method) { - if (org.opengis.metadata.distribution.StandardOrderProcess.class.isAssignableFrom(method.getDeclaringClass())) { - return method.getName().equals("getCurrency"); + Class<?>[] expectedFinalClasses = wrapper.getClasses(); // "Since2014" internal class. + if (expectedFinalClasses.length == 0) { + expectedFinalClasses = new Class<?>[] {wrapper}; // If no "Since2014", then wrapper itself should be final. + } + for (final Class<?> c : expectedFinalClasses) { + if (!Modifier.isFinal(c.getModifiers())) { + fail("Expected a final class for " + c.getName()); + } } - return super.isExtension(method); + return wrapper; } /** Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultIdentifierTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -17,9 +17,7 @@ package org.apache.sis.metadata.iso; import javax.xml.bind.JAXBException; -import org.opengis.metadata.Identifier; import org.apache.sis.metadata.iso.citation.DefaultCitation; -import org.apache.sis.util.CharSequences; import org.apache.sis.xml.Namespaces; import org.apache.sis.test.XMLTestCase; import org.apache.sis.test.DependsOn; @@ -32,7 +30,8 @@ import static org.apache.sis.test.Metada * Tests {@link DefaultIdentifier}. * * @author Martin Desruisseaux - * @version 0.4 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.4 * @module */ @@ -42,29 +41,23 @@ public final strictfp class DefaultIdent * The expected XML representation for this test. */ private static final String XML = - "<gmd:MD_Identifier xmlns:gmd=\"" + Namespaces.GMD + "\" " + + "<mcc:MD_Identifier xmlns:mcc=\"" + Namespaces.MCC + "\" " + + "xmlns:cit=\"" + Namespaces.CIT + "\" " + "xmlns:gco=\"" + Namespaces.GCO + "\">\n" + - " <gmd:authority>\n" + - " <gmd:CI_Citation>\n" + - " <gmd:title>\n" + + " <mcc:authority>\n" + + " <cit:CI_Citation>\n" + + " <cit:title>\n" + " <gco:CharacterString>EPSG</gco:CharacterString>\n" + - " </gmd:title>\n" + - " </gmd:CI_Citation>\n" + - " </gmd:authority>\n" + - " <gmd:code>\n" + + " </cit:title>\n" + + " </cit:CI_Citation>\n" + + " </mcc:authority>\n" + + " <mcc:code>\n" + " <gco:CharacterString>4326</gco:CharacterString>\n" + - " </gmd:code>\n" + - "</gmd:MD_Identifier>"; + " </mcc:code>\n" + + "</mcc:MD_Identifier>"; /** - * Asserts that XML marshalling of the given object produce the {@link #XML} string. - */ - void testMarshal(final String type, final Identifier identifier) throws JAXBException { - assertXmlEquals(CharSequences.replace(XML, "MD_Identifier", type).toString(), marshal(identifier), "xmlns:*"); - } - - /** - * Test XML marshalling. + * Tests XML marshalling. * * @throws JAXBException if an error occurred during (un)marshalling. */ @@ -73,11 +66,11 @@ public final strictfp class DefaultIdent final DefaultIdentifier identifier = new DefaultIdentifier(); identifier.setAuthority(new DefaultCitation("EPSG")); identifier.setCode("4326"); - testMarshal("MD_Identifier", identifier); + assertXmlEquals(XML, marshal(identifier), "xmlns:*"); } /** - * Test XML unmarshalling. + * Tests XML unmarshalling. * * @throws JAXBException if an error occurred during (un)marshalling. */ Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -53,13 +53,24 @@ import static org.apache.sis.test.TestUt * * @author Cédric Briançon (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @DependsOn(org.apache.sis.internal.metadata.OtherLocalesTest.class) public final strictfp class DefaultMetadataTest extends XMLTestCase implements WarningListener<Object> { /** + * A flag for tracing workarounds for allowing some tests to pass despite regression. + * This boolean should be set to {@code false} and removed after the following issues has been fixed: + * + * <ul> + * <li><a href="https://issues.apache.org/jira/browse/SIS-402">SIS-402</a></li> + * </ul> + */ + public static final boolean REGRESSION = true; + + /** * The resource key for the message of the warning that occurred while unmarshalling a XML fragment, * or {@code null} if none. */ @@ -119,9 +130,9 @@ public final strictfp class DefaultMetad @Test public void testEmptyCollection() throws JAXBException { final DefaultMetadata metadata = unmarshal( - "<gmd:MD_Metadata xmlns:gmd=\"" + Namespaces.GMD + "\">\n" + - " <gmd:contact/>\n" + - "</gmd:MD_Metadata>"); + "<mdb:MD_Metadata xmlns:mdb=\"" + Namespaces.MDB + "\">\n" + + " <mdb:contact/>\n" + + "</mdb:MD_Metadata>"); /* * Verify metadata property. */ Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -24,10 +24,11 @@ import org.apache.sis.metadata.iso.citat import org.apache.sis.metadata.iso.citation.DefaultCitation; import org.apache.sis.util.iso.SimpleInternationalString; import org.apache.sis.internal.simple.SimpleCitation; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.apache.sis.internal.util.Constants; import org.apache.sis.io.wkt.Convention; import org.apache.sis.test.DependsOnMethod; -import org.apache.sis.test.TestCase; +import org.apache.sis.test.XMLTestCase; import org.opengis.test.Validators; import org.apache.sis.test.DependsOn; import org.junit.Test; @@ -40,7 +41,7 @@ import static org.opengis.metadata.Ident * Tests {@link ImmutableIdentifier}. * * @author Martin Desruisseaux (Geomatys) - * @version 0.6 + * @version 1.0 * @since 0.3 * @module */ @@ -48,7 +49,7 @@ import static org.opengis.metadata.Ident DefaultIdentifierTest.class, org.apache.sis.metadata.iso.citation.CitationsTest.class }) -public final strictfp class ImmutableIdentifierTest extends TestCase { +public final strictfp class ImmutableIdentifierTest extends XMLTestCase { /** * Returns the properties map to be used in argument to test methods. */ @@ -171,7 +172,21 @@ public final strictfp class ImmutableIde @Test public void testMarshal() throws JAXBException { final ImmutableIdentifier identifier = new ImmutableIdentifier(new DefaultCitation("EPSG"), null, "4326"); - new DefaultIdentifierTest().testMarshal("RS_Identifier", identifier); + assertXmlEquals( + "<gmd:RS_Identifier xmlns:gmd=\"" + LegacyNamespaces.GMD + "\" " + + "xmlns:gco=\"" + LegacyNamespaces.GCO + "\">\n" + + " <gmd:authority>\n" + + " <gmd:CI_Citation>\n" + + " <gmd:title>\n" + + " <gco:CharacterString>EPSG</gco:CharacterString>\n" + + " </gmd:title>\n" + + " </gmd:CI_Citation>\n" + + " </gmd:authority>\n" + + " <gmd:code>\n" + + " <gco:CharacterString>4326</gco:CharacterString>\n" + + " </gmd:code>\n" + + "</gmd:RS_Identifier>", + marshal(identifier, VERSION_2007), "xmlns:*"); } /** Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultCitationTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -16,6 +16,7 @@ */ package org.apache.sis.metadata.iso.citation; +import java.net.URI; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -29,6 +30,8 @@ import org.opengis.metadata.citation.Dat import org.opengis.metadata.citation.Party; import org.opengis.metadata.citation.Role; import org.opengis.metadata.citation.Responsibility; +import org.opengis.metadata.citation.OnLineFunction; +import org.opengis.metadata.citation.OnlineResource; import org.opengis.metadata.citation.PresentationForm; import org.apache.sis.internal.util.CollectionsExt; import org.apache.sis.xml.IdentifierMap; @@ -37,6 +40,8 @@ import org.apache.sis.metadata.iso.exten import org.apache.sis.metadata.iso.DefaultIdentifier; import org.apache.sis.util.iso.SimpleInternationalString; import org.apache.sis.util.iso.DefaultInternationalString; +import org.apache.sis.util.Version; +import org.apache.sis.test.DependsOnMethod; import org.apache.sis.test.TestUtilities; import org.apache.sis.test.XMLTestCase; import org.junit.Test; @@ -49,7 +54,8 @@ import static org.apache.sis.test.Metada * Tests {@link DefaultCitation}. * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.3 * @module */ @@ -60,6 +66,11 @@ public final strictfp class DefaultCitat private static final String XML_FILE = "Citation.xml"; /** + * An XML file in this package containing a citation in the format of legacy ISO 19139:2007 specification. + */ + private static final String XML_FILE_LEGACY = "Citation (legacy).xml"; + + /** * Creates a citation with an arbitrary title, presentation form and other properties. * * @return an arbitrary citation. @@ -174,6 +185,19 @@ public final strictfp class DefaultCitat } /** + * Tests XML marshalling using the format derived form ISO 19115:2014 model. + * This method also tests usage of {@code gml:id} and {@code xlink:href}. + * + * @throws JAXBException if an error occurred during marshalling. + * + * @since 1.0 + */ + @Test + public void testMarshalling() throws JAXBException { + testMarshalling(XML_FILE, VERSION_2014); + } + + /** * Tests XML marshalling using the format derived form ISO 19115:2003 model. * This method also tests usage of {@code gml:id} and {@code xlink:href}. * @@ -182,8 +206,24 @@ public final strictfp class DefaultCitat * @since 0.7 */ @Test - public void testMarshalling() throws JAXBException { - final DefaultContact contact = new DefaultContact(); + @DependsOnMethod("testMarshalling") + public void testMarshallingLegacy() throws JAXBException { + testMarshalling(XML_FILE_LEGACY, VERSION_2007); + } + + /** + * Tests XML marshalling for the given metadata version. + * + * @param file file containing the expected metadata. + * @param version the metadata version to marshal. + */ + private void testMarshalling(final String file, final Version version) throws JAXBException { + final DefaultOnlineResource rs = new DefaultOnlineResource(URI.create("https://tools.ietf.org/html/rfc1149")); + rs.setName(new SimpleInternationalString("IP over Avian Carriers")); + rs.setDescription(new SimpleInternationalString("High delay, low throughput, and low altitude service.")); + rs.setFunction(OnLineFunction.OFFLINE_ACCESS); + + final DefaultContact contact = new DefaultContact(rs); contact.setContactInstructions(new SimpleInternationalString("Send carrier pigeon.")); contact.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "ip-protocol"); final DefaultCitation c = new DefaultCitation("Fight against poverty"); @@ -192,7 +232,24 @@ public final strictfp class DefaultCitat new DefaultResponsibility(Role.FUNDER, null, new DefaultIndividual("Robin Hood", null, contact)) )); c.getDates().add(new DefaultCitationDate(TestUtilities.date("2015-10-17 00:00:00"), DateType.ADOPTED)); - assertMarshalEqualsFile(XML_FILE, c, "xlmns:*", "xsi:schemaLocation"); + c.getPresentationForms().add(PresentationForm.PHYSICAL_OBJECT); + /* + * Check that XML file built by the marshaller is the same as the example file. + */ + assertMarshalEqualsFile(file, c, version, "xmlns:*", "xsi:schemaLocation"); + } + + /** + * Tests XML unmarshalling using the format derived form ISO 19115:2014 model. + * This method also tests usage of {@code gml:id} and {@code xlink:href}. + * + * @throws JAXBException if an error occurred during unmarshalling. + * + * @since 1.0 + */ + @Test + public void testUnmarshalling() throws JAXBException { + testUnmarshalling(XML_FILE); } /** @@ -204,19 +261,37 @@ public final strictfp class DefaultCitat * @since 0.7 */ @Test - public void testUnmarshalling() throws JAXBException { - final DefaultCitation c = unmarshalFile(DefaultCitation.class, XML_FILE); + @DependsOnMethod("testUnmarshalling") + public void testUnmarshallingLegacy() throws JAXBException { + testUnmarshalling(XML_FILE_LEGACY); + } + + /** + * Tests XML unmarshalling for a metadata version. + * The version is not specified since it should be detected automatically. + * + * @param file file containing the metadata to unmarshal. + */ + private void testUnmarshalling(final String file) throws JAXBException { + final DefaultCitation c = unmarshalFile(DefaultCitation.class, file); assertTitleEquals("title", "Fight against poverty", c); final CitationDate date = getSingleton(c.getDates()); assertEquals("date", date.getDate(), TestUtilities.date("2015-10-17 00:00:00")); - assertEquals("dateType", date.getDateType(), DateType.ADOPTED); + assertEquals("dateType", DateType.ADOPTED, date.getDateType()); + assertEquals("presentationForm", PresentationForm.PHYSICAL_OBJECT, getSingleton(c.getPresentationForms())); final Iterator<Responsibility> it = c.getCitedResponsibleParties().iterator(); final Contact contact = assertResponsibilityEquals(Role.ORIGINATOR, "Maid Marian", it.next()); - assertEquals("Contact instruction", "Send carrier pigeon.", contact.getContactInstructions().toString()); + assertEquals("Contact instruction", "Send carrier pigeon.", String.valueOf(contact.getContactInstructions())); + + final OnlineResource resource = TestUtilities.getSingleton(contact.getOnlineResources()); + assertEquals("Resource name", "IP over Avian Carriers", String.valueOf(resource.getName())); + assertEquals("Resource description", "High delay, low throughput, and low altitude service.", String.valueOf(resource.getDescription())); + assertEquals("Resource linkage", "https://tools.ietf.org/html/rfc1149", String.valueOf(resource.getLinkage())); + assertEquals("Resource function", OnLineFunction.OFFLINE_ACCESS, resource.getFunction()); - // Thanks to xlink:href, the Contact shall be the same instance than above. + // Thanks to xlink:href, the Contact shall be the same instance as above. assertSame("contact", contact, assertResponsibilityEquals(Role.FUNDER, "Robin Hood", it.next())); assertFalse(it.hasNext()); } @@ -227,7 +302,7 @@ public final strictfp class DefaultCitat private static Contact assertResponsibilityEquals(final Role role, final String name, final Responsibility actual) { assertEquals("role", role, actual.getRole()); final Party p = getSingleton(actual.getParties()); - assertEquals("name", name, p.getName().toString()); + assertEquals("name", name, String.valueOf(p.getName())); return getSingleton(p.getContactInfo()); } } Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultContactTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -81,7 +81,7 @@ public final strictfp class DefaultConta * Initializes the test for catching warning messages. */ private void init() { - context = new Context(0, null, null, null, null, null, null, this); + context = new Context(0, null, null, null, null, null, null, null, this); } /** Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java?rev=1825254&r1=1825253&r2=1825254&view=diff ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java [UTF-8] (original) +++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java [UTF-8] Sat Feb 24 16:13:58 2018 @@ -19,7 +19,7 @@ package org.apache.sis.metadata.iso.cita import javax.xml.bind.JAXBException; import org.opengis.metadata.citation.Role; import org.apache.sis.test.XMLTestCase; -import org.apache.sis.xml.Namespaces; +import org.apache.sis.internal.jaxb.LegacyNamespaces; import org.junit.Test; import static java.util.Collections.singleton; @@ -30,7 +30,8 @@ import static org.apache.sis.test.Assert * Tests {@link DefaultResponsibility} and its marshalling as a legacy {@link DefaultResponsibleParty}. * * @author Martin Desruisseaux (Geomatys) - * @version 0.5 + * @author Cullen Rombach (Image Matters) + * @version 1.0 * @since 0.5 * @module */ @@ -46,9 +47,9 @@ public final strictfp class DefaultRespo final DefaultResponsibility r = new DefaultResponsibility(Role.AUTHOR, null, party); final DefaultCitation citation = new DefaultCitation(); citation.setCitedResponsibleParties(singleton(r)); - final String xml = marshal(citation); - assertXmlEquals("<gmd:CI_Citation xmlns:gco=\"" + Namespaces.GCO + '"' + - " xmlns:gmd=\"" + Namespaces.GMD + "\">\n" + + final String xml = marshal(citation, VERSION_2007); + assertXmlEquals("<gmd:CI_Citation xmlns:gco=\"" + LegacyNamespaces.GCO + '"' + + " xmlns:gmd=\"" + LegacyNamespaces.GMD + "\">\n" + " <gmd:citedResponsibleParty>\n" + " <gmd:CI_ResponsibleParty>\n" + " <gmd:individualName>\n" +
