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:com.gs.obevo.db.impl.platforms.mssql.MsSqlRevengTest.java

@Test
@Override//from  w w w  .ja va  2  s  .  c  om
public void testReverseEngineeringFromFile() throws Exception {
    AquaRevengArgs args = new AquaRevengArgs();
    args.setDbSchema("myschema01");
    args.setGenerateBaseline(false);
    args.setDbHost("myhost.me.com");
    args.setDbPort(1234);
    args.setDbServer("myserver");
    args.setUsername("myuser");
    args.setPassword("mypass");

    File outputDir = new File("./target/outputReveng");
    FileUtils.deleteDirectory(outputDir);
    args.setOutputPath(outputDir);

    args.setInputPath(new File("./src/test/resources/reveng/input"));

    new MsSqlDbPlatform().getDdlReveng().reveng(args);

    DirectoryAssert.assertDirectoriesEqual(new File("./src/test/resources/reveng/expected"),
            new File(outputDir, "final"));
}

From source file:com.gs.obevo.db.impl.platforms.mysql.MySqlRevengTest.java

@Test
@Override/*ww  w  .ja  v  a 2  s . c  om*/
public void testReverseEngineeringFromFile() throws Exception {
    AquaRevengArgs args = new AquaRevengArgs();
    args.setDbSchema("myschema01");
    args.setGenerateBaseline(false);
    args.setDbHost("myhost.me.com");
    args.setDbPort(1234);
    args.setDbServer("myserver");
    args.setUsername("myuser");
    args.setPassword("mypass");

    File outputDir = new File("./target/outputReveng");
    FileUtils.deleteDirectory(outputDir);
    args.setOutputPath(outputDir);

    args.setInputPath(new File("./src/test/resources/reveng/pgdump/input/input.sql"));

    new MySqlDbPlatform().getDdlReveng().reveng(args);

    DirectoryAssert.assertDirectoriesEqual(new File("./src/test/resources/reveng/pgdump/expected"),
            new File(outputDir, "final"));
}

From source file:ca.sfu.federation.utils.DirectoryFilterTest.java

@Override
protected void tearDown() throws Exception {
    super.tearDown();
    FileUtils.deleteDirectory(testdir);
}

From source file:io.druid.segment.writeout.TmpFileSegmentWriteOutMedium.java

TmpFileSegmentWriteOutMedium(File outDir) throws IOException {
    File tmpOutputFilesDir = new File(outDir, "tmpOutputFiles");
    FileUtils.forceMkdir(tmpOutputFilesDir);
    closer.register(() -> FileUtils.deleteDirectory(tmpOutputFilesDir));
    this.dir = tmpOutputFilesDir;
}

From source file:gov.redhawk.sca.efs.ScaFileSystemPlugin.java

private void cleanOldFiles() {
    // TODO  In future be smart about clearing this
    try {//www.ja v  a 2 s .  c  om
        FileUtils.deleteDirectory(getTempDirectory());
    } catch (IOException e) {
        // PASS
    }
}

From source file:com.gs.obevo.db.impl.platforms.postgresql.PostgreSqlRevengTest.java

@Test
@Override/*from  w  w w .  ja v a  2 s . co m*/
public void testReverseEngineeringFromFile() throws Exception {
    AquaRevengArgs args = new AquaRevengArgs();
    args.setDbSchema("myschema01");
    args.setGenerateBaseline(false);
    args.setDbHost("myhost.me.com");
    args.setDbPort(1234);
    args.setDbServer("myserver");
    args.setUsername("myuser");
    args.setPassword("mypass");

    File outputDir = new File("./target/outputReveng");
    FileUtils.deleteDirectory(outputDir);
    args.setOutputPath(outputDir);

    args.setInputPath(new File("./src/test/resources/reveng/pgdump/input/input.sql"));

    new PostgreSqlDbPlatform().getDdlReveng().reveng(args);

    DirectoryAssert.assertDirectoriesEqual(new File("./src/test/resources/reveng/pgdump/expected"),
            new File(outputDir, "final"));
}

From source file:dao.FilesDaoTest.java

@AfterClass
public static void tearDownClass() {
    try {//from   w  w w . j av  a  2s .  c om
        File testFolder = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook");
        FileUtils.deleteDirectory(testFolder);
    } catch (IOException ex) {
        Logger.getLogger(FilesDaoTest.class.getName()).log(Level.SEVERE, null, ex);
    }
}

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

/**
 * Expands the zip files and imports the terms therein.
 * //w  w  w  . ja  v  a 2s .  c o m
 * @param dir
 */
public static void processZipDir(String dir) {
    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()) {
        try {
            FileUtils.deleteDirectory(outputDir);
        } catch (IOException e) {
            throw new RuntimeException(e); // I hate checked exceptions
        }
    }
    outputDir.mkdir();

    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)));
        }
    }

    // InstanceImporter.runImport(outputDir, (String)null, new
    // DefaultConflictResolver());

    importXmlFiles(outputDir);

    // Versioning.main(new String[]{outputDir.getAbsolutePath()});
}

From source file:edu.snu.dolphin.bsp.examples.ml.algorithms.classification.LogisticRegTest.java

/**
 * Set up the test environment./*ww  w . j a  v a2 s .  co  m*/
 */
@Before
public void setUp() throws Exception {
    FileUtils.deleteDirectory(new File(OUTPUT_PATH));
}

From source file:de.huxhorn.lilith.swing.callables.CleanObsoleteCallable.java

public Long call() throws Exception {
    Long result = 0L;// w w  w.  j  a v a2s  . c  om

    if (parentDirectory.isDirectory()) {
        setNumberOfSteps(1);
        result = 1L;
        FileUtils.deleteDirectory(parentDirectory);
        if (logger.isInfoEnabled()) {
            boolean deleted = !parentDirectory.exists();
            if (deleted) {
                logger.info("Deleted obsolete directory '{}'.", parentDirectory);
            } else {
                if (logger.isWarnEnabled()) {
                    logger.warn("Failed to delete obsolete directory '{}'!", parentDirectory);
                }
            }
        }
        setCurrentStep(1);
    }

    return result;
}