Search in sources :

Example 1 with Lineage

use of org.opengis.metadata.lineage.Lineage in project sis by apache.

the class ConcatenatedFeatureSetTest method testSameType.

/**
 * Tests the concatenation of two feature sets having the same feature type.
 *
 * @throws DataStoreException if an error occurred while concatenating the feature sets.
 */
@Test
public void testSameType() throws DataStoreException {
    final FeatureTypeBuilder builder = new FeatureTypeBuilder();
    builder.setName("City");
    builder.addAttribute(String.class).setName("name");
    builder.addAttribute(Integer.class).setName("population");
    final DefaultFeatureType ft = builder.build();
    final FeatureSet cfs = ConcatenatedFeatureSet.create(new MemoryFeatureSet(null, ft, Arrays.asList(ft.newInstance(), ft.newInstance())), new MemoryFeatureSet(null, ft, Arrays.asList(ft.newInstance())));
    assertSame("getType()", ft, cfs.getType());
    assertEquals("features.count()", 3, cfs.features(false).count());
    final Metadata md = cfs.getMetadata();
    assertNotNull("getMetadata()", md);
    assertContentInfoEquals("City", 3, (FeatureCatalogueDescription) getSingleton(md.getContentInfo()));
    final Lineage lineage = getSingleton(((DefaultMetadata) md).getResourceLineages());
    assertFeatureSourceEquals("City", new String[] { "City" }, getSingleton(lineage.getSources()));
}
Also used : FeatureTypeBuilder(org.apache.sis.feature.builder.FeatureTypeBuilder) DefaultFeatureType(org.apache.sis.feature.DefaultFeatureType) DefaultMetadata(org.apache.sis.metadata.iso.DefaultMetadata) Metadata(org.opengis.metadata.Metadata) Lineage(org.opengis.metadata.lineage.Lineage) FeatureSet(org.apache.sis.storage.FeatureSet) Test(org.junit.Test)

Aggregations

DefaultFeatureType (org.apache.sis.feature.DefaultFeatureType)1 FeatureTypeBuilder (org.apache.sis.feature.builder.FeatureTypeBuilder)1 DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)1 FeatureSet (org.apache.sis.storage.FeatureSet)1 Test (org.junit.Test)1 Metadata (org.opengis.metadata.Metadata)1 Lineage (org.opengis.metadata.lineage.Lineage)1