We often see failures of FileUtils.deleteDirectory in SystemTestData.tearDown in builds.
These failures are hard to reproduce locally, but running org.geoserver.wfs.v2_0.GetFeatureJoinTest in Eclipse reveals files like src/wfs/target/default7740998516718894422data/foo.2.log.db that are not cleaned. This indicates that data stores (in this case H2) are still writing to the data directory location and have not been disposed. Adding a breakpoint shows that CatalogImpl.dispose is never hit. Furthermore GeoServerImpl.dispose() is never called. The fix is to add a call to GeoServer.dispose() in GeoServerSystemTestSupport.destroyGeoServer() to ensure that all data stores are disposed before the data directory is removed. This change prevents the stale H2 cruft foo.2.log.db from being left behind when running org.geoserver.wfs.v2_0.GetFeatureJoinTest in Eclipse. It also causes new GWCIntegrationTest and GWCDataSecurityTest failures, under investigation.