Iterator<FeatureBean> iterator =
(Iterator<FeatureBean>) beanLayer.getElements(filterService.createTrueFilter(), 0, 0);
int count = 0;
int check = 0;
while (iterator.hasNext()) {
FeatureBean featureBean = iterator.next();
count++;
check |= 1 << (featureBean.getId() - 1);
}
Assert.assertEquals(4, count);
Assert.assertEquals(15, check);
// now delete again
Filter filter = filterService.createFidFilter(new String[]{"4"});
oldFeatures = layerService.getFeatures(LAYER_ID,
crs, filter, null, VectorLayerService.FEATURE_INCLUDE_ATTRIBUTES);
Assert.assertEquals(1, oldFeatures.size());
newFeatures = new ArrayList<InternalFeature>();
layerService.saveOrUpdate(LAYER_ID, crs, oldFeatures, newFeatures);
iterator = (Iterator<FeatureBean>) beanLayer.getElements(filterService.createTrueFilter(), 0, 0);
count = 0;
check = 0;
while (iterator.hasNext()) {
FeatureBean featureBean = iterator.next();
count++;
check |= 1 << (featureBean.getId() - 1);
}
Assert.assertEquals(3, count);
Assert.assertEquals(7, check);
}