List of usage examples for org.apache.commons.io FileUtils deleteDirectory
public static void deleteDirectory(File directory) throws IOException
From source file:com.ibm.jaggr.core.util.ZipUtilTest.java
@After public void tearDown() throws Exception { FileUtils.deleteDirectory(tmpdir); }
From source file:com.netflix.genie.client.configs.JobConfigClientIntegrationTest.java
/** * Get rid of the directories created by the system temporarily. * * @throws IOException when unable to delete directory *//*from ww w.java 2 s .c o m*/ @PreDestroy public void cleanup() throws IOException { if (this.jobsDir != null) { FileUtils.deleteDirectory(this.jobsDir); } }
From source file:grakn.core.deduplicator.AttributeDeduplicatorE2E.java
@AfterClass public static void cleanup_cleanupDistribution() throws IOException, InterruptedException, TimeoutException { commandExecutor.command("./grakn", "server", "stop").execute(); assertGraknStopped();// w w w. java 2 s .c o m FileUtils.deleteDirectory(GRAKN_UNZIPPED_DIRECTORY.toFile()); }
From source file:com.gooddata.dataload.processes.ProcessServiceAT.java
@Test(groups = "process", dependsOnGroups = "project") public void createProcess() throws Exception { final File dir = createTempDirectory("sdktest").toFile(); try {/* w ww . j a va2 s. co m*/ copy("sdktest.grf", dir); copy("invalid.grf", dir); copy("workspace.prm", dir); process = gd.getProcessService().createProcess(project, new DataloadProcess(title, ProcessType.GRAPH), dir); } finally { FileUtils.deleteDirectory(dir); } }
From source file:com.xiaomi.linden.file.TestFileChangeWatcher.java
@Test public void testFileChangeWatcher() throws IOException, InterruptedException { final AtomicInteger events = new AtomicInteger(0); final Function<String, Object> callback = new Function<String, Object>() { @Override/*from w ww. j a v a 2 s . c o m*/ public String apply(String absolutePath) { events.incrementAndGet(); return null; } }; File dir = new File("tmp"); if (!dir.exists()) { dir.mkdir(); } File file = new File("tmp/test.txt"); file.createNewFile(); fileChangeWatcher = new FileChangeWatcher(file.getAbsolutePath(), callback, 10); fileChangeWatcher.start(); directoryChangeWatcher = new DirectoryChangeWatcher(dir.getAbsolutePath(), callback, 10); directoryChangeWatcher.start(); Files.write("Hello", file, Charsets.UTF_8); Thread.sleep(10 * 1000); Assert.assertEquals(2, events.get()); FileUtils.deleteQuietly(file); FileUtils.deleteDirectory(dir); }
From source file:com.spectralogic.ds3client.helpers.FileObjectGetter_Test.java
@Test public void testThatNamedPipeThrows() throws IOException, InterruptedException { Assume.assumeFalse(Platform.isWindows()); final String tempPathPrefix = null; final Path tempDirectory = Files.createTempDirectory(Paths.get("."), tempPathPrefix); final String FIFO_NAME = "bFifo"; final AtomicBoolean caughtException = new AtomicBoolean(false); try {//from w w w.ja va 2s .c o m Runtime.getRuntime().exec("mkfifo " + Paths.get(tempDirectory.toString(), FIFO_NAME)).waitFor(); new FileObjectGetter(tempDirectory).buildChannel(FIFO_NAME); } catch (final UnrecoverableIOException e) { assertTrue(e.getMessage().contains(FIFO_NAME)); caughtException.set(true); } finally { FileUtils.deleteDirectory(tempDirectory.toFile()); } assertTrue(caughtException.get()); }
From source file:com.meltmedia.cadmium.deployer.UndeployCommandAction.java
@Override public boolean execute(CommandContext<UndeployRequest> ctx) throws Exception { log.info("Beginning Undeploy Command, started by {}", ctx.getSource()); UndeployRequest request = ctx.getMessage().getBody(); String warName = request.getWarName(); log.debug("Undeploying war {}", warName); if (warName.isEmpty() && !jbossUtil .isCadmiumWar(new File(System.getProperty(JBossUtil.JBOSS_SERVER_HOME_PROP), warName))) { log.info("Invalid undeployment request!"); return false; }//w w w . j a v a 2 s . co m jbossUtil.undeploy(warName); File contentDir = new File(contentRoot, warName); if (contentDir.exists()) { log.info("Deleting content directory: {}", contentDir.getAbsoluteFile().getAbsolutePath()); try { FileUtils.deleteDirectory(contentDir); } catch (IOException ioe) { log.error("Failed to delete content directory for war " + warName, ioe); return false; } } return true; }
From source file:io.druid.storage.azure.AzureTaskLogsTest.java
@Test public void testPushTaskLog() throws Exception { final File tmpDir = Files.createTempDir(); try {//from w ww. j ava2s .co m final File logFile = new File(tmpDir, "log"); azureStorage.uploadBlob(logFile, container, prefix + "/" + taskid + "/log"); expectLastCall(); replayAll(); azureTaskLogs.pushTaskLog(taskid, logFile); verifyAll(); } finally { FileUtils.deleteDirectory(tmpDir); } }
From source file:de.felixschulze.teamcity.xcode.ClangBuildProcess.java
@NotNull public BuildFinishedStatus call() throws Exception { final BuildProgressLogger logger = build.getBuildLogger(); logger.targetStarted("Clang analyze"); final String projectFile = getParameter(XcodeConstants.PARAM_PROJECT, true); final String target = getParameter(XcodeConstants.PARAM_TARGETNAME, false); final String configuration = getParameter(XcodeConstants.PARAM_CONFIGURATION, false); final String sdk = getParameter(XcodeConstants.PARAM_SDK, false); final Boolean clean = Boolean.parseBoolean(getParameter(XcodeConstants.PARAM_CLEAN, false)); if (clean) {/*from w ww . ja va 2 s . c om*/ logger.targetStarted("clean"); File buildDirectory = new File(context.getWorkingDirectory(), "build"); logger.message("Clean dir: " + buildDirectory.getAbsolutePath()); FileUtils.deleteDirectory(buildDirectory); logger.targetFinished("clean"); } final long startTime = System.currentTimeMillis(); if (buildXcodeProjectWithClang(projectFile, target, configuration, sdk)) { final long endTime = System.currentTimeMillis(); logger.message("Analyze finished (took " + ((endTime - startTime) / 1000) + " seconds)"); logger.targetFinished("Clang analyze"); return BuildFinishedStatus.FINISHED_SUCCESS; } else { logger.error("Error during Clang analyze."); return BuildFinishedStatus.FINISHED_FAILED; } }
From source file:com.genericworkflownodes.knime.custom.ZipUtilsTest.java
@Test public void testDecompressTo() throws IOException, UnZipFailureException { File targetDir = createTempDirectory(); ZipUtils.decompressTo(targetDir, getClass().getResourceAsStream("testing.zip")); assertTrue(new File(targetDir, "subir1").exists()); assertTrue(new File(targetDir, "subir1").isDirectory()); assertTrue(new File(new File(targetDir, "subir1"), "tesing_out.tmp").exists()); assertTrue(new File(targetDir, "tesing_in.tmp").exists()); assertTrue(new File(targetDir, "test.png").exists()); FileUtils.deleteDirectory(targetDir); }