Search in sources :

Example 21 with Session

use of org.geotoolkit.storage.feature.session.Session in project geotoolkit by Geomatys.

the class ShapefileQuadTreeReadWriteTest method doubleWrite.

private void doubleWrite(final FeatureType type, final FeatureCollection one, final File tmp, final ShapefileProvider maker, final boolean memorymapped) throws IOException, MalformedURLException, DataStoreException, URISyntaxException {
    FeatureStore s;
    s = createDataStore(maker, tmp.toURI().toURL(), memorymapped);
    s.createFeatureType(type);
    Session session = s.createSession(true);
    session.addFeatures(type.getName().toString(), one);
    session.addFeatures(type.getName().toString(), one);
    session.commit();
    s = createDataStore(maker, tmp.toURI().toURL(), true);
    assertEquals(one.size() * 2, s.getCount(new Query(s.getNames().iterator().next())));
}
Also used : Query(org.geotoolkit.storage.feature.query.Query) FeatureStore(org.geotoolkit.storage.feature.FeatureStore) Session(org.geotoolkit.storage.feature.session.Session)

Aggregations

Session (org.geotoolkit.storage.feature.session.Session)21 Query (org.geotoolkit.storage.feature.query.Query)20 FeatureType (org.opengis.feature.FeatureType)14 Test (org.junit.Test)13 Feature (org.opengis.feature.Feature)13 FeatureCollection (org.geotoolkit.storage.feature.FeatureCollection)12 FeatureIterator (org.geotoolkit.storage.feature.FeatureIterator)10 ResourceId (org.opengis.filter.ResourceId)9 GenericName (org.opengis.util.GenericName)7 Date (java.util.Date)5 FeatureStore (org.geotoolkit.storage.feature.FeatureStore)5 Coordinate (org.locationtech.jts.geom.Coordinate)5 Point (org.locationtech.jts.geom.Point)4 ArrayList (java.util.ArrayList)3 FeatureTypeBuilder (org.apache.sis.feature.builder.FeatureTypeBuilder)3 SQLQuery (org.geotoolkit.storage.feature.query.SQLQuery)3 Version (org.geotoolkit.version.Version)3 GeometryCollection (org.locationtech.jts.geom.GeometryCollection)3 GeometryFactory (org.locationtech.jts.geom.GeometryFactory)3 File (java.io.File)2