// is as expected.
assertEquals(8, origional.getCount(Query.ALL));
final SortedSet<String> allFids = new TreeSet<String>();
SimpleFeatureCollection collection = origional.getFeatures();
TestProgressListener progress = new TestProgressListener();
collection.accepts(new FeatureVisitor() {
public void visit(Feature feature) {
allFids.add(feature.getIdentifier().getID());
}
}, progress);
assertTrue("visitor completed", progress.completed);
assertEquals("visitor 100%", 100f, progress.progress);
assertNull("visitor no problems", progress.exception);
// we are going to use this transaction to modify and commit
DefaultTransaction t1 = new DefaultTransaction("Transaction 1");
SimpleFeatureStore featureStore1 = (SimpleFeatureStore) dataStore
.getFeatureSource(typeName);
featureStore1.setTransaction(t1);
TestFeatureListener listener1 = new TestFeatureListener();
featureStore1.addFeatureListener(listener1);
// we are going to use this transaction to modify and rollback
DefaultTransaction t2 = new DefaultTransaction("Transaction 2");
SimpleFeatureStore featureStore2 = (SimpleFeatureStore) dataStore
.getFeatureSource(typeName);
featureStore2.setTransaction(t2);
TestFeatureListener listener2 = new TestFeatureListener();
featureStore2.addFeatureListener(listener2);
// verify they are all working
assertEquals(8, origional.getCount(Query.ALL));
assertEquals(8, featureStore1.getCount(Query.ALL));
assertEquals(8, featureStore2.getCount(Query.ALL));
Query queryOneFeature = new Query();
queryOneFeature.setTypeName(typeName);
queryOneFeature.setFilter(Filter.INCLUDE);
queryOneFeature.setMaxFeatures(1);
queryOneFeature.setPropertyNames(Query.ALL_NAMES);
collection = featureStore1.getFeatures(queryOneFeature);
progress.reset();
final SortedSet<String> fids = new TreeSet<String>();
collection.accepts(new FeatureVisitor() {
public void visit(Feature feature) {
fids.add(feature.getIdentifier().getID());
}
}, progress);
assertTrue("visitor completed", progress.completed);