GeoToolsLayer extends FeatureSourceRetriever implements VectorLayer { @Override @Transactional(rollbackFor = { Throwable.class }) public void delete(String featureId) throws LayerException { SimpleFeatureSource source = getFeatureSource(); if (source instanceof SimpleFeatureStore) { SimpleFeatureStore store = (SimpleFeatureStore) source; Filter filter = filterService.createFidFilter(new String[] { featureId }); transactionSynchronization.synchTransaction(store); try { store.removeFeatures(filter); if (log.isDebugEnabled()) { log.debug("Deleted feature {} in {}", featureId, getFeatureSourceName()); } } catch (IOException ioe) { featureModelUsable = false; throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION); } } else { log.error("Don't know how to delete from " + getFeatureSourceName() + ", class " + source.getClass().getName() + " does not implement SimpleFeatureStore"); throw new LayerException(ExceptionCode.DELETE_NOT_IMPLEMENTED, getFeatureSourceName(), source.getClass() .getName()); } }  @Override String getId(); @Api void setId(String id); @Api void setUrl(String url); @Api void setDbtype(String dbtype); @Api DataSource getDataSource(); @Api void setDataSource(DataSource dataSource); @Api void setParameters(List<Parameter> parameters); @Api void setCooldownTimeBetweenInitializationRetries(long cooldownTimeBetweenInitializationRetries); @Override CoordinateReferenceSystem getCrs(); @Api void setLayerInfo(VectorLayerInfo layerInfo); @Override VectorLayerInfo getLayerInfo(); @Override boolean isCreateCapable(); @Override boolean isUpdateCapable(); @Override boolean isDeleteCapable(); @Override @Deprecated void setDataStore(DataStore dataStore); @Override @Transactional(rollbackFor = { Throwable.class }) Object create(Object feature); @Override @Transactional(rollbackFor = { Throwable.class }) void delete(String featureId); @Override @Transactional(rollbackFor = { Throwable.class }) Object saveOrUpdate(Object feature); @Override Object read(String featureId); @Override Envelope getBounds(); @Override Envelope getBounds(Filter filter); @Transactional(readOnly = true) Iterator<?> getElements(Filter filter, int offset, int maxResultSize); @Override FeatureModel getFeatureModel(); @Override DataStore getDataStore(); @Override SimpleFeatureSource getFeatureSource();  }
@Test public void testDelete() throws Exception { SimpleFeature f = (SimpleFeature) layer.read(LAYER_NAME + ".4"); Assert.assertNotNull(f); layer.delete(LAYER_NAME + ".4"); Assert.assertTrue(true); }