Example usage for org.apache.commons.io FileUtils deleteDirectory

List of usage examples for org.apache.commons.io FileUtils deleteDirectory

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils deleteDirectory.

Prototype

public static void deleteDirectory(File directory) throws IOException 

Source Link

Document

Deletes a directory recursively.

Usage

From source file:ch.sbb.releasetrain.git.GitRepoTest.java

@Test
public void isCloned() throws IOException {
    File dir = temporaryFolder.newFolder("cloned2");
    new File(dir, ".git").mkdir();
    assertTrue(new GitRepoImpl("", "", "", "", dir).isCloned());
    FileUtils.deleteDirectory(dir);
}

From source file:com.netflix.imfutility.inputparameters.InputParametersTest.java

@BeforeClass
public static void setupAll() throws IOException {
    // create both working directory and logs folder.
    FileUtils.deleteDirectory(TemplateParameterContextCreator.getWorkingDir());
    File workingDir = TemplateParameterContextCreator.getWorkingDir();
    if (!workingDir.mkdir()) {
        throw new RuntimeException("Could not create a working dir within tmp folder");
    }// w  w w.j ava  2s. c  o m
    new File(workingDir, "config.xml");
}

From source file:com.netflix.imfutility.ImfUtilityTest.java

@AfterClass
public static void teardownAll() throws IOException {
    FileUtils.deleteDirectory(TemplateParameterContextCreator.getWorkingDir());
}

From source file:com.streamsets.datacollector.execution.runner.common.TestProductionSourceOffsetCommitterOffsetTracker.java

@BeforeClass
public static void beforeClass() throws IOException {
    System.setProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR, "./target/var");
    File f = new File(System.getProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR));
    FileUtils.deleteDirectory(f);
}

From source file:com.redhat.red.offliner.PomArtifactListReaderTest.java

@BeforeClass
public static void prepare() throws IOException {
    File tempDir = new File(TEMP_POM_DIR);
    if (tempDir.exists()) {
        FileUtils.deleteDirectory(tempDir);
    }/*w ww . ja v  a 2 s.com*/
    tempDir.mkdirs();

    List<String> resources = new ArrayList<String>(2);
    resources.add("repo.pom");
    resources.add("settings.xml");

    for (String resource : resources) {
        InputStream is = PomArtifactListReaderTest.class.getClassLoader().getResourceAsStream(resource);
        File target = new File(TEMP_POM_DIR, resource);
        OutputStream os = new FileOutputStream(target);
        try {
            IOUtils.copy(is, os);
        } finally {
            IOUtils.closeQuietly(is);
            IOUtils.closeQuietly(os);
        }
    }
}

From source file:io.stallion.slowTests.AsyncTaskSlowTests.java

@BeforeClass
public static void setUpClass() throws Exception {
    startApp("/a_minimal_site", true);
    AsyncCoordinator.shutDownForTests();
    File tasksDir = new File(Context.getSettings().getDataDirectory() + "/async-tasks");
    if (tasksDir.isDirectory()) {
        FileUtils.deleteDirectory(tasksDir);
    }/*w w  w.  j a v a2s .c o m*/
    FileSystemWatcherService.start();
    AsyncCoordinator.initAndStart();
    AsyncCoordinator.instance().registerClassLoader(AsyncTaskSlowTests.class.getClassLoader());
}

From source file:com.streamsets.datacollector.runner.production.TestProductionSourceOffsetTracker.java

@BeforeClass
public static void beforeClass() throws IOException {
    System.setProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR, "./target/var");
    File f = new File(System.getProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR));
    try {// w  w w . j  a v  a 2 s  . c  o m
        FileUtils.deleteDirectory(f);
    } catch (Exception ex) {
        LOG.info(Utils.format("Got exception while deleting directory: {}", f.getAbsolutePath()), ex);
    }

}

From source file:com.gs.obevo.db.impl.platforms.oracle.OracleAquaRevengTest.java

@Test
public void testReveng2() throws Exception {
    File outputDir = new File("./target/reveng/oracle1");
    FileUtils.deleteDirectory(outputDir);

    AquaRevengArgs args = new AquaRevengArgs();
    args.setDbSchema("MYSCHEMA01");
    args.setInputPath(new File("./src/test/resources/reveng/oracle/aquaexample1"));
    args.setGenerateBaseline(false);//w w  w  . j  av  a2 s. com
    args.setOutputPath(outputDir);
    new OracleAquaReveng().reveng(args);

    // TODO need to add Oracle reverse engineering examples
    DirectoryAssert.assertDirectoriesEqual(new File("./src/test/resources/reveng/oracle/aqua/expected"),
            outputDir);
}

From source file:com.runwaysdk.dataaccess.io.instance.VersioningUnzipper.java

/**
 * Expands the zip files and imports the terms therein.
 * //from   ww w  . j av a2s  .  c  o m
 * @param dir
 */
public static void processZipDir(String dir) {
    try {
        File directory = new File(dir);

        if (!directory.exists()) {
            logger.error("Directory [" + directory.getAbsolutePath() + "] does not exist, aborting import.");

            return;
        }

        final File outputDir = new File(dir + TEMP_DIR);

        if (outputDir.exists()) {
            FileUtils.deleteDirectory(outputDir);
        }

        outputDir.mkdir();

        try {

            for (File zip : directory.listFiles()) {
                if (zip.getName().endsWith(".gz")) {
                    logger.info("Unzipping " + zip.getAbsolutePath() + " to " + outputDir + ".");

                    FileIO.gunzip(zip,
                            new File(outputDir, zip.getName().substring(0, zip.getName().length() - 3)));
                }
            }

            DatabaseVersioning.main(new String[] { outputDir.getAbsolutePath() });
        } finally {
            FileUtils.deleteDirectory(outputDir);
        }
    } catch (IOException e) {
        throw new ProgrammingErrorException(e);
    }
}

From source file:com.seitenbau.jenkins.plugins.dynamicparameter.ScriptParameterBaseDescriptorTests.java

/**
 * Static clean up method.//from ww  w.  j  a  v  a 2 s . c o m
 * @throws IOException
 */
@AfterClass
public static void afterClass() throws IOException {
    FileUtils.deleteDirectory(new File(CLASSPATH));
}