use of org.opengis.metadata.content.ContentInformation 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());
}
Aggregations