use of org.opengis.util.InternationalString in project sis by apache.
the class CustomMetadataTest method testSubtypeAttributes.
/**
* Tests that the attributes defined in subtypes are also marshalled.
*
* @throws JAXBException if an error occurred during (un)marshalling.
*
* @see <a href="http://jira.geotoolkit.org/browse/GEOTK-108">GEOTK-108</a>
*/
@Test
public void testSubtypeAttributes() throws JAXBException {
final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
final DataIdentification identification = new DataIdentification() {
@Override
public InternationalString getAbstract() {
Map<Locale, String> names = new HashMap<>();
names.put(Locale.ENGLISH, "Description");
return factory.createInternationalString(names);
}
@Override
public InternationalString getEnvironmentDescription() {
Map<Locale, String> names = new HashMap<>();
names.put(Locale.ENGLISH, "Environment");
return factory.createInternationalString(names);
}
@Override
public InternationalString getSupplementalInformation() {
return null;
}
@Override
public Citation getCitation() {
return null;
}
@Override
public InternationalString getPurpose() {
return null;
}
@Override
public Collection<SpatialRepresentationType> getSpatialRepresentationTypes() {
return null;
}
@Override
public Collection<Resolution> getSpatialResolutions() {
return null;
}
@Override
public Collection<Locale> getLanguages() {
return null;
}
@Override
public Collection<CharacterSet> getCharacterSets() {
return null;
}
@Override
public Collection<TopicCategory> getTopicCategories() {
return null;
}
@Override
public Collection<Extent> getExtents() {
return null;
}
@Override
public Collection<String> getCredits() {
return null;
}
@Override
public Collection<Progress> getStatus() {
return null;
}
@Override
public Collection<ResponsibleParty> getPointOfContacts() {
return null;
}
@Override
public Collection<MaintenanceInformation> getResourceMaintenances() {
return null;
}
@Override
public Collection<BrowseGraphic> getGraphicOverviews() {
return null;
}
@Override
public Collection<Format> getResourceFormats() {
return null;
}
@Override
public Collection<Keywords> getDescriptiveKeywords() {
return null;
}
@Override
public Collection<Usage> getResourceSpecificUsages() {
return null;
}
@Override
public Collection<Constraints> getResourceConstraints() {
return null;
}
@Deprecated
@Override
public Collection<AggregateInformation> getAggregationInfo() {
return null;
}
};
final DefaultMetadata data = new DefaultMetadata();
data.setIdentificationInfo(singleton(identification));
final String xml = XML.marshal(data);
/*
* A few simple checks.
*/
assertTrue("Missing Identification attribute.", xml.contains("Description"));
assertTrue("Missing DataIdentification attribute.", xml.contains("Environment"));
}
use of org.opengis.util.InternationalString in project sis by apache.
the class DefaultGeorectifiedTest method testCheckPointAvailable.
/**
* Tests {@link DefaultGeorectified#isCheckPointAvailable()} and
* {@link DefaultGeorectified#setCheckPointAvailable(boolean)}.
*/
@Test
public void testCheckPointAvailable() {
final DefaultGeorectified metadata = new DefaultGeorectified();
final InternationalString description = new SimpleInternationalString("A check point description.");
assertFalse("checkPointAvailability", metadata.isCheckPointAvailable());
// Setting the description shall set automatically the availability.
metadata.setCheckPointDescription(description);
assertTrue("checkPointAvailability", metadata.isCheckPointAvailable());
loggings.assertNoUnexpectedLog();
// Setting the availability flag shall hide the description and logs a message.
metadata.setCheckPointAvailable(false);
assertNull("checkPointDescription", metadata.getCheckPointDescription());
loggings.assertNextLogContains("checkPointDescription", "checkPointAvailability");
loggings.assertNoUnexpectedLog();
// Setting the availability flag shall bring back the description.
metadata.setCheckPointAvailable(true);
assertSame("checkPointDescription", description, metadata.getCheckPointDescription());
}
use of org.opengis.util.InternationalString in project sis by apache.
the class MetadataAssert method assertTitleEquals.
/**
* Asserts that the English title of the given citation is equals to the expected string.
*
* @param message the message to report in case of test failure.
* @param expected the expected English title.
* @param citation the citation to test.
*
* @since 0.6
*
* @see #assertAnyTitleEquals(String, String, Citation)
*/
public static void assertTitleEquals(final String message, final String expected, final Citation citation) {
assertNotNull(message, citation);
final InternationalString title = citation.getTitle();
assertNotNull(message, title);
assertEquals(message, expected, title.toString(Locale.US));
}
use of org.opengis.util.InternationalString in project sis by apache.
the class MetadataAssert method assertPartyNameEquals.
/**
* Asserts that the given citation has only one responsible party,
* and its English name is equals to the expected string.
*
* @param message the message to report in case of test failure.
* @param expected the expected English responsibly party name.
* @param citation the citation to test.
*
* @since 0.8
*/
public static void assertPartyNameEquals(final String message, final String expected, final DefaultCitation citation) {
assertNotNull(message, citation);
final DefaultResponsibility r = (DefaultResponsibility) TestUtilities.getSingleton(citation.getCitedResponsibleParties());
final InternationalString name = TestUtilities.getSingleton(r.getParties()).getName();
assertNotNull(message, name);
assertEquals(message, expected, name.toString(Locale.US));
}
use of org.opengis.util.InternationalString in project sis by apache.
the class AbstractPositionalAccuracyTest method roundtrip.
/**
* Unmarshals the given file and verify the content.
* Then marshals the object and verify that we get equivalent XML.
*/
private void roundtrip(final String filename, final Version version) throws JAXBException {
final AbstractElement metadata = unmarshalFile(AbstractElement.class, filename);
final InternationalString nameOfMeasure = getSingleton(metadata.getNamesOfMeasure());
/*
* Programmatic verification of the text group.
*/
assertEquals("Quantitative quality measure focusing on the effective class percent " + "regarded to the total surface size", nameOfMeasure.toString(Locale.ENGLISH));
assertEquals("Mesure qualité quantitative de type pourcentage de représentation de la " + "classe par rapport à la surface totale", nameOfMeasure.toString(Locale.FRENCH));
/*
* Opportunist test. While it was not the purpose of this test, the above metadata
* needs to contain a "result" element in order to pass XML validation test.
*/
final Result result = getSingleton(metadata.getResults());
assertInstanceOf("Wrong value for <gmd:result>", DefaultConformanceResult.class, result);
assertEquals("result.pass", Boolean.TRUE, ((DefaultConformanceResult) result).pass());
/*
* Marshalling: ensure that we didn't lost any information.
*/
assertMarshalEqualsFile(filename, metadata, version, "xmlns:*", "xsi:schemaLocation", "xsi:type");
}
Aggregations