System.err.println("****************");
// First, read using the slow, built-in mechanisms
String[] propertyNames = safePropertyNames(ft);
final String typeName = testData.getTempTableName();
Query allQuery = new Query(typeName, Filter.INCLUDE, propertyNames);
System.err.println("Performing slow read...");
long startTime = System.currentTimeMillis();
FeatureReader<SimpleFeatureType, SimpleFeature> fr = this.dataStore.getFeatureReader(
allQuery, Transaction.AUTO_COMMIT);
FilteringFeatureReader<SimpleFeatureType, SimpleFeature> ffr = new FilteringFeatureReader<SimpleFeatureType, SimpleFeature>(
fr, filter);
ArrayList<SimpleFeature> slowResults = new ArrayList<SimpleFeature>();
collectResults(ffr, slowResults);
ffr.close();
long endTime = System.currentTimeMillis();
System.err.println("Slow read took " + (endTime - startTime) + " milliseconds.");
// Now read using DataStore's mechanisms.
System.err.println("Performing fast read...");
startTime = System.currentTimeMillis();
Query filteringQuery = new Query(testData.getTempTableName(), filter, safePropertyNames(ft));
fr = this.dataStore.getFeatureReader(filteringQuery, Transaction.AUTO_COMMIT);
ArrayList<SimpleFeature> fastResults = new ArrayList<SimpleFeature>();
collectResults(fr, fastResults);
fr.close();