Search in sources :

Example 1 with ImageDescription

use of org.opengis.metadata.content.ImageDescription in project sis by apache.

the class MergerTest method testDeepMerge.

/**
 * Tests a merge operation that merge also the collection elements. Such deep merge is a
 * little bit aggressive; it may be desired in some occasions, but may also be dangerous.
 */
@Test
public void testDeepMerge() {
    final DefaultMetadata source = createSample1();
    final DefaultMetadata target = createSample2();
    final Merger merger = new Merger(null);
    merger.copy(source, target);
    assertSetEquals(Arrays.asList(Locale.JAPANESE, Locale.FRENCH), target.getLanguages());
    assertSetEquals(Collections.singleton(StandardCharsets.UTF_16), target.getCharacterSets());
    final Iterator<ContentInformation> it = target.getContentInfo().iterator();
    final ImageDescription image = (ImageDescription) it.next();
    final FeatureCatalogueDescription features = (FeatureCatalogueDescription) it.next();
    final DefaultCoverageDescription coverage = (DefaultCoverageDescription) it.next();
    assertFalse(it.hasNext());
    assertEquals("imagingCondition", ImagingCondition.CLOUD, image.getImagingCondition());
    assertEquals("cloudCoverPercentage", Double.valueOf(0.8), image.getCloudCoverPercentage());
    assertEquals("processingLevelCode", "Level 2", image.getProcessingLevelCode().getCode());
    assertEquals("processingLevelCode", "Level 1", coverage.getProcessingLevelCode().getCode());
    assertEquals("includedWithDataset", Boolean.TRUE, features.isIncludedWithDataset());
    final Iterator<? extends Citation> ci = features.getFeatureCatalogueCitations().iterator();
    assertEquals("GPX file", ci.next().getTitle().toString());
    assertEquals("Shapefile", ci.next().getTitle().toString());
    assertFalse(ci.hasNext());
}
Also used : FeatureCatalogueDescription(org.opengis.metadata.content.FeatureCatalogueDescription) DefaultFeatureCatalogueDescription(org.apache.sis.metadata.iso.content.DefaultFeatureCatalogueDescription) DefaultMetadata(org.apache.sis.metadata.iso.DefaultMetadata) ContentInformation(org.opengis.metadata.content.ContentInformation) DefaultCoverageDescription(org.apache.sis.metadata.iso.content.DefaultCoverageDescription) ImageDescription(org.opengis.metadata.content.ImageDescription) DefaultImageDescription(org.apache.sis.metadata.iso.content.DefaultImageDescription) Test(org.junit.Test)

Aggregations

DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)1 DefaultCoverageDescription (org.apache.sis.metadata.iso.content.DefaultCoverageDescription)1 DefaultFeatureCatalogueDescription (org.apache.sis.metadata.iso.content.DefaultFeatureCatalogueDescription)1 DefaultImageDescription (org.apache.sis.metadata.iso.content.DefaultImageDescription)1 Test (org.junit.Test)1 ContentInformation (org.opengis.metadata.content.ContentInformation)1 FeatureCatalogueDescription (org.opengis.metadata.content.FeatureCatalogueDescription)1 ImageDescription (org.opengis.metadata.content.ImageDescription)1