public void deleteDirectory(String container, String directory) { // create complete dir path String fullDirPath = buildPathStartingFromBaseDir(container, directory); try { Utils.deleteRecursively(new File(fullDirPath)); } catch (IOException ex) { logger.error("An error occurred removing directory %s.", fullDirPath); Throwables.propagate(ex); } }
@Override public void clearContainer(String container, ListContainerOptions options) { filesystemContainerNameValidator.validate(container); if (options.getDir() != null) { container += denormalize("/" + options.getDir()); } try { File containerFile = openFolder(container); File[] children = containerFile.listFiles(); if (null != children) { for (File child : children) if (options.isRecursive() || child.isFile()) { Utils.deleteRecursively(child); } } } catch (IOException e) { logger.error(e, "An error occurred while clearing container %s", container); Throwables.propagate(e); } }
@AfterMethod protected void tearDown() throws IOException { context.close(); Utils.deleteRecursively(new File(TestUtils.TARGET_BASE_DIR)); }