From fd26ba0d409af8d9b4804ca7cabff5ec242e393c Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 30 Oct 2012 02:54:01 -0700 Subject: [PATCH] Simplify FilesystemAsyncBlobStoreTest.tearDown We should not swallow an IOException and resourcesToBeDeleted only ever has one file. --- .../FilesystemAsyncBlobStoreTest.java | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java index ce8095deba..5d84b6d127 100644 --- a/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java +++ b/apis/filesystem/src/test/java/org/jclouds/filesystem/FilesystemAsyncBlobStoreTest.java @@ -91,7 +91,6 @@ public class FilesystemAsyncBlobStoreTest { private BlobStoreContext context = null; private BlobStore blobStore = null; - private Set resourcesToBeDeleted = new HashSet(); @BeforeMethod protected void setUp() throws Exception { @@ -101,25 +100,13 @@ public class FilesystemAsyncBlobStoreTest { context = ContextBuilder.newBuilder(PROVIDER).overrides(prop).build(BlobStoreContext.class); // create a container in the default location blobStore = context.getBlobStore(); - - resourcesToBeDeleted.add(new File(TestUtils.TARGET_BASE_DIR)); + new File(TestUtils.TARGET_BASE_DIR).mkdir(); } @AfterMethod - protected void tearDown() { + protected void tearDown() throws IOException { context.close(); - context = null; - // freeing filesystem resources used for tests - Iterator resourceToDelete = resourcesToBeDeleted.iterator(); - while (resourceToDelete.hasNext()) { - File fileToDelete = resourceToDelete.next(); - try { - FileUtils.forceDelete(fileToDelete); - } catch (IOException ex) { - System.err.println("Error deleting folder [" + fileToDelete.getName() + "]."); - } - resourceToDelete.remove(); - } + FileUtils.forceDelete(new File(TestUtils.TARGET_BASE_DIR)); } /** @@ -515,9 +502,6 @@ public class FilesystemAsyncBlobStoreTest { result = blobStore.containerExists(CONTAINER_NAME2); assertTrue(result, "Container doesn't exist"); TestUtils.directoryExists(TestUtils.TARGET_BASE_DIR + CONTAINER_NAME2, true); - - // clean the environment - FileUtils.forceDelete(new File(TARGET_CONTAINER_NAME2)); } /**