Package org.geotools.data

Examples of org.geotools.data.Transaction.commit()


        assertEquals(4, dataStore.getFeatureSource(tname("ft1")).getCount(Query.ALL));
       
        Transaction tx2 = new DefaultTransaction();
        st.setTransaction(tx2);
        st.addFeatures( features );
        tx2.commit();
        tx2.close();
        assertEquals(5, dataStore.getFeatureSource(tname("ft1")).getCount(Query.ALL));
    }
}
View Full Code Here


        SimpleFeatureType type = dataStore.getSchema(tname("guid"));
        SimpleFeature feature = SimpleFeatureBuilder.build(type, new Object[] { uuid3 }, "guid.3");

        SimpleFeatureCollection collection = DataUtilities.collection(feature);
        featureStore.addFeatures(collection);
        transaction.commit();
        assertEquals(featureStore.getCount(Query.ALL),3);
        transaction.close();
    }

    public void testModifyFeatures() throws Exception {
View Full Code Here

        SimpleFeatureStore featureStore = (SimpleFeatureStore) dataStore.getFeatureSource(tname("uuidt"));
        featureStore.setTransaction(transaction);

        featureStore.addFeatures(createFeatureCollection());

        transaction.commit();
        assertEquals(3, featureStore.getCount(Query.ALL));
        transaction.close();
    }

    private SimpleFeatureCollection createFeatureCollection() throws Exception {
View Full Code Here

        System.out.println("t1 commit auto-commit: "+DataUtilities.fidSet(featureStore.getFeatures()) );
        System.out.println("t1 commit          t1: "+DataUtilities.fidSet(featureStore1.getFeatures()) );
        System.out.println("t1 commit          t2: "+DataUtilities.fidSet(featureStore2.getFeatures()) );

        // commit transaction two
        t2.commit();

        System.out.println();
        System.out.println("Step 5 transaction 2 commits the addition of '"+feature.getID()+"'");
        System.out.println("------");
        System.out.println("t2 commit auto-commit: "+DataUtilities.fidSet(featureStore.getFeatures()) );
View Full Code Here

            } finally {
                writer.close();
            }
            System.out.println("commit " + t); // only now are the contents
                                               // removed
            t.commit();
        } catch (Throwable eek) {
            t.rollback();
        } finally {
            t.close();
            store.dispose();
View Full Code Here

        // check the store with the transaction sees the new features, but the other store does not
        assertEquals(4, featureStore.getFeatures().size());
        assertEquals(3, featureStore2.getFeatures().size());
       
        // check that after the commit everybody sees 4
        t.commit();
        assertEquals(4, featureStore.getFeatures().size());
        assertEquals(4, featureStore2.getFeatures().size());
       
        t.close();
    }
View Full Code Here

        assertEquals(4, featureStore.getFeatures().size());
        assertEquals(3, featureStore2.getFeatures().size());
       
        // check that after the commit on the transaction things have not changed,
        // the connection is externally managed
        t.commit();
        assertEquals(4, featureStore.getFeatures().size());
        assertEquals(3, featureStore2.getFeatures().size());

        // commit directly
        conn.commit();
View Full Code Here

        feature.setAttribute(aname("id"), new Integer(100));
        feature.setAttribute(aname("geom_" + type.toLowerCase()), emptyGeometry);
        feature.setAttribute(aname("name"), new String("empty " + type));
        writer.write();
        writer.close();
        tx.commit();
        tx.close();

        SimpleFeatureCollection fc = dataStore.getFeatureSource(tname("empty")).getFeatures();
        assertEquals(1, fc.size());
        SimpleFeatureIterator fi = fc.features();
View Full Code Here

            b.set(aname("intProperty"), new Integer(i));
            b.set(aname("geometry"), new GeometryFactory().createPoint(new Coordinate(i, i)));
            collection.add(b.buildFeature(null));
        }
        featureStore.addFeatures((SimpleFeatureCollection)collection);
        t.commit();
        assertTrue(mockListener.onBorrowCalled);
        assertTrue(mockListener.onReleaseCalled);
        assertTrue(mockListener.onCommitCalled);
        assertFalse(mockListener.onRollbackCalled);
       
View Full Code Here

        assertTrue(coversLax(reader, FINAL));

        // commit t2
        // ---------
        // -ensure that everyone is FINAL at the end of the day
        t2.commit();

        // We now have Number( remove one and add one)
        reader = data.getFeatureReader(new DefaultQuery("road"), Transaction.AUTO_COMMIT);
        reader = data.getFeatureReader(new DefaultQuery("road"), Transaction.AUTO_COMMIT);
        assertTrue(coversLax(reader, FINAL));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.