MemoryFeatureCollection collection = new MemoryFeatureCollection(featureType1);
Coordinate insideCoord = new Coordinate(5.2, 7.5);
Point myPoint = geomfac.createPoint(insideCoord);
SimpleFeature feat = new SimpleFeatureImpl(Arrays.asList(new Object[]{myPoint, "mypoint", "pics/x.jpg", "pics/y.jpg"}), featureType1, new FeatureIdImpl("myid") );
collection.add(feat);
Transaction transaction = new DefaultTransaction();
store.setTransaction(transaction);
List<FeatureId> fids = store.addFeatures((SimpleFeatureCollection) collection);
assertEquals(1, fids.size());
Filter filterRemove = filterfac.id(filterfac.featureId("poi.2"));
store.removeFeatures(filterRemove);
Filter filterUpdate = filterfac.id(filterfac.featureId("poi.3"));
store.modifyFeatures("NAME", "blah", filterUpdate);
transaction.commit();
ContentFeatureCollection coll = store.getFeatures();
FeatureIterator it= coll.features();
while (it.hasNext()) {
System.err.println(it.next());
}
assertEquals(3, coll.size());
coll = store.getFeatures( new Query(simpleTypeName1.getLocalPart(), filterfac.equals(filterfac.property("NAME"), filterfac.literal("mypoint"))) );
it= coll.features();
while (it.hasNext()) {
System.err.println(it.next());
}
assertEquals(1, coll.size());
SimpleFeature feature = coll.features().next();
assertEquals(feat.getAttributes(), feature.getAttributes());
coll = store.getFeatures( new Query(simpleTypeName1.getLocalPart(), filterRemove) );
assertEquals(0, coll.size());
coll = store.getFeatures( new Query(simpleTypeName1.getLocalPart(), filterUpdate) );