Skip to content
Browse files

Fix up a few gt-shapefile tests

  • Loading branch information...
1 parent 758bbfb commit 88656efd849570e594d3fb94ad47e21c97522e76 @jodygarnett jodygarnett committed Oct 30, 2012
View
7 ...es/plugin/shapefile/src/test/java/org/geotools/data/shapefile/ShapefileDataStoreTest.java
@@ -47,6 +47,7 @@
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureSource;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.FeatureTypes;
import org.geotools.feature.simple.SimpleFeatureBuilder;
@@ -520,7 +521,7 @@ private SimpleFeatureCollection createFeatureCollection() throws Exception {
SimpleFeatureType featureType = createExampleSchema();
SimpleFeatureBuilder build = new SimpleFeatureBuilder(featureType);
- SimpleFeatureCollection features = FeatureCollections.newCollection();
+ DefaultFeatureCollection features = new DefaultFeatureCollection();
for (int i = 0, ii = 20; i < ii; i++) {
build.add(new GeometryFactory().createPoint(new Coordinate(1, -1)));
@@ -581,7 +582,7 @@ public void testWriteReadBigNumbers() throws Exception {
// create feature type
SimpleFeatureType type = DataUtilities.createType("junk",
"a:Point,b:java.math.BigDecimal,c:java.math.BigInteger");
- SimpleFeatureCollection features = FeatureCollections.newCollection();
+ DefaultFeatureCollection features = new DefaultFeatureCollection();
BigInteger bigInteger = new BigInteger("1234567890123456789");
BigDecimal bigDecimal = new BigDecimal(bigInteger, 2);
@@ -671,7 +672,7 @@ private void runWriteReadTest(Geometry geom, boolean d3) throws Exception {
ftb.add("a", geom.getClass());
SimpleFeatureType type = ftb.buildFeatureType();
- SimpleFeatureCollection features = FeatureCollections.newCollection();
+ DefaultFeatureCollection features = new DefaultFeatureCollection();
SimpleFeatureBuilder build = new SimpleFeatureBuilder(type);
for (int i = 0, ii = 20; i < ii; i++) {
build.set(0, (Geometry) geom.clone());
View
3 modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/FidQueryTest.java
@@ -30,6 +30,7 @@
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureStore;
import org.geotools.factory.CommonFactoryFinder;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.opengis.feature.simple.SimpleFeature;
@@ -110,7 +111,7 @@ public void testAddFeature() throws Exception {
build.add(new Long(0));
build.add("Hey");
SimpleFeature newFeature = build.buildFeature(null);
- SimpleFeatureCollection collection = FeatureCollections.newCollection();
+ DefaultFeatureCollection collection = new DefaultFeatureCollection();
collection.add(newFeature);
List<FeatureId> newFids = featureStore.addFeatures(collection);
View
22 ...file/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java
@@ -38,11 +38,10 @@
import org.geotools.TestData;
import org.geotools.data.DataStore;
import org.geotools.data.DataUtilities;
-import org.geotools.data.DefaultQuery;
+import org.geotools.data.Query;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.FeatureReader;
import org.geotools.data.FeatureWriter;
-import org.geotools.data.Query;
import org.geotools.data.Transaction;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.shapefile.ShpFileType;
@@ -53,6 +52,7 @@
import org.geotools.data.simple.SimpleFeatureStore;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.factory.FactoryRegistryException;
+import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
@@ -115,7 +115,7 @@ protected void tearDown() throws Exception {
protected SimpleFeatureCollection loadFeatures(String resource, Query q)
throws Exception {
if (q == null) {
- q = new DefaultQuery();
+ q = new Query();
}
File shpFile = copyShapefiles(resource);
@@ -131,7 +131,7 @@ protected SimpleFeatureCollection loadFeatures(String resource, Query q)
protected SimpleFeatureCollection loadFeatures(String resource, Charset charset,
Query q) throws Exception {
if (q == null)
- q = new DefaultQuery();
+ q = new Query();
File shpFile = copyShapefiles(resource);
URL url = shpFile.toURI().toURL();
s = new IndexedShapefileDataStore(url, null, false,
@@ -340,7 +340,7 @@ public void testSelectionQuery() throws Exception {
IndexType.NONE);
SimpleFeatureSource featureSource = ds.getFeatureSource();
SimpleFeatureType schema = featureSource.getSchema();
- DefaultQuery query = new DefaultQuery( schema.getTypeName() );
+ Query query = new Query( schema.getTypeName() );
query.setPropertyNames(new String[0]);
SimpleFeatureCollection features = featureSource.getFeatures( query );
@@ -377,7 +377,7 @@ public void testQueryBboxNonGeomAttributes() throws Exception {
// build a query that extracts no geom but uses a bbox filter
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
- DefaultQuery q = new DefaultQuery();
+ Query q = new Query();
q.setPropertyNames(new String[] {"STATE_NAME", "PERSONS"});
ReferencedEnvelope queryBounds = new ReferencedEnvelope(-75.102613, -72.361859, 40.212597,
41.512517, null);
@@ -703,7 +703,7 @@ private SimpleFeatureCollection createFeatureCollection() throws Exception {
SimpleFeatureType featureType = createExampleSchema();
SimpleFeatureBuilder build = new SimpleFeatureBuilder(featureType);
- SimpleFeatureCollection features = FeatureCollections.newCollection();
+ DefaultFeatureCollection features = new DefaultFeatureCollection();
for (int i = 0, ii = 20; i < ii; i++) {
build.add(new GeometryFactory().createPoint(new Coordinate(1, -1)));
@@ -791,7 +791,7 @@ private void runWriteReadTest(Geometry geom, boolean d3) throws Exception {
ftb.add("a", geom.getClass());
SimpleFeatureType type = ftb.buildFeatureType();
- SimpleFeatureCollection features = FeatureCollections.newCollection();
+ DefaultFeatureCollection features = new DefaultFeatureCollection();
for (int i = 0, ii = 20; i < ii; i++) {
SimpleFeature feature = SimpleFeatureBuilder.build(type,
@@ -937,12 +937,12 @@ public void testCountTransaction() throws Exception {
String typeName = store.getSchema().getTypeName();
Id id = ff.id(Collections.singleton(ff.featureId(fid)));
- assertEquals(-1, store.getCount(new DefaultQuery(typeName, id)));
+ assertEquals(-1, store.getCount(new Query(typeName, id)));
assertEquals(1, count(ds, typeName, id, t));
store.removeFeatures(id);
- assertEquals(-1, store.getCount(new DefaultQuery(store.getSchema().getTypeName(), id)));
+ assertEquals(-1, store.getCount(new Query(store.getSchema().getTypeName(), id)));
assertEquals(initialCount - 1, count(ds, typeName, Filter.INCLUDE, t));
assertEquals(0, count(ds, typeName, id, t));
ds.dispose();
@@ -954,7 +954,7 @@ private int count(DataStore ds, String typeName, Filter filter) throws Exception
private int count(DataStore ds, String typeName, Filter filter, Transaction t) throws Exception {
FeatureReader<SimpleFeatureType, SimpleFeature> reader;
- reader = ds.getFeatureReader(new DefaultQuery(typeName, filter), t);
+ reader = ds.getFeatureReader(new Query(typeName, filter), t);
int count = 0;
try {
while (reader.hasNext()) {

0 comments on commit 88656ef

Please sign in to comment.
Something went wrong with that request. Please try again.