use of org.opengis.metadata.constraint.Constraints 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.metadata.constraint.Constraints in project sis by apache.
the class FrenchProfileTest method testConstraintsToAFNOR.
/**
* Tests {@link FrenchProfile#toAFNOR(Object)} with {@link Constraints},
* {@link LegalConstraints} and {@link SecurityConstraints} objects.
*/
@Test
public void testConstraintsToAFNOR() {
Constraints std, fra;
std = new DefaultConstraints("Some constraints.");
fra = (Constraints) FrenchProfile.toAFNOR(std);
assertNotSame("Expected a copy.", std, fra);
assertSame("Already an AFNOR instance.", fra, FrenchProfile.toAFNOR(fra));
assertEquals("Some constraints.", getSingleton(fra.getUseLimitations()).toString());
std = new DefaultLegalConstraints("Some legal constraints.");
fra = (LegalConstraints) FrenchProfile.toAFNOR(std);
assertNotSame("Expected a copy.", std, fra);
assertSame("Already an AFNOR instance.", fra, FrenchProfile.toAFNOR(fra));
assertEquals("Some legal constraints.", getSingleton(fra.getUseLimitations()).toString());
std = new DefaultSecurityConstraints("Some security constraints.");
fra = (SecurityConstraints) FrenchProfile.toAFNOR(std);
assertNotSame("Expected a copy.", std, fra);
assertSame("Already an AFNOR instance.", fra, FrenchProfile.toAFNOR(fra));
assertEquals("Some security constraints.", getSingleton(fra.getUseLimitations()).toString());
}
Aggregations