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:dcll.grp3.morphoQuizz.AppTest.java

@Override
public void tearDown() throws Exception {
    super.tearDown();
    // System.out.println("TearDown");

    // suppression des fichiers de tests
    FileUtils.deleteDirectory(testFolder);
}

From source file:com.yahoo.labs.samoa.streams.fs.LocalFileStreamSourceTest.java

@After
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(new File(BASE_DIR));
}

From source file:com.switchfly.compress.cli.CompressCLITest.java

@After
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(_outputLocation);
    FileUtils.deleteQuietly(_outputFile);
}

From source file:com.kylinolap.job.hadoop.cube.NewBaseCuboidMapperTest.java

@Before
public void setUp() throws Exception {
    createTestMetadata();//  w  w  w  . j av  a2  s. c o  m

    // hack for distributed cache
    FileUtils.deleteDirectory(new File("../job/meta"));
    FileUtils.copyDirectory(new File(this.getTestConfig().getMetadataUrl()), new File("../job/meta"));

    NewBaseCuboidMapper<Text> mapper = new NewBaseCuboidMapper<Text>();
    mapDriver = MapDriver.newMapDriver(mapper);
}

From source file:com.kylinolap.job.hadoop.cube.BaseCuboidMapperTest.java

@Before
public void setUp() throws Exception {
    createTestMetadata();/*w ww  . j av a  2  s.  c  o  m*/

    // hack for distributed cache
    FileUtils.deleteDirectory(new File("../job/meta"));
    FileUtils.copyDirectory(new File(this.getTestConfig().getMetadataUrl()), new File("../job/meta"));

    BaseCuboidMapper<Text> mapper = new BaseCuboidMapper<Text>();
    mapDriver = MapDriver.newMapDriver(mapper);
}

From source file:com.linkedin.pinot.core.startree.hll.HllStarTreeIndexTest.java

@AfterSuite
void tearDown() throws IOException {
    FileUtils.deleteDirectory(new File(SEGMENT_DIR_NAME));
}

From source file:io.v.rx.syncbase.SgHostUtilLocalTest.java

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

From source file:com.googlecode.t7mp.RunMojoTest.java

@After
public void tearDown() throws IOException {
    FileUtils.deleteDirectory(catalinaBaseDir);
}

From source file:cascading.hive.RCFileTest.java

@AfterClass
public static void tearDown() throws IOException {
    // Comment out the below line if you want to inspect the output of these tests.
    FileUtils.deleteDirectory(new File("output"));
}

From source file:com.uber.stream.kafka.mirrormaker.controller.core.GitBackUpHandler.java

public void writeToFile(String fileName, String data) throws Exception {
    Repository backupRepo = null;/*www. ja  v a2  s . com*/
    BufferedWriter output = null;
    Git git = null;
    Git result = null;
    try {
        try {
            FileUtils.deleteDirectory(new File(localPath));
        } catch (IOException e) {
            LOGGER.error("Error deleting exisiting backup directory");
            throw e;
        }

        try {
            result = Git.cloneRepository().setURI(remotePath).setDirectory(new File(localPath)).call();
        } catch (Exception e) {
            LOGGER.error("Error cloning backup git repo");
            throw e;
        }

        try {
            backupRepo = new FileRepository(localPath + "/.git");
        } catch (IOException e) {
            throw e;
        }

        git = new Git(backupRepo);
        File myfile = new File(localPath + "/" + fileName);

        try {
            output = new BufferedWriter(new FileWriter(myfile));
            output.write(data);
            output.flush();
        } catch (IOException e) {
            LOGGER.error("Error writing backup to the file with name " + fileName);
            throw e;
        }

        try {
            git.add().addFilepattern(".").call();
        } catch (GitAPIException e) {
            LOGGER.error("Error adding files to git");
            throw e;
        }

        try {
            git.commit().setMessage("Taking backup on " + new Date()).call();

        } catch (GitAPIException e) {
            LOGGER.error("Error commiting files to git");
            throw e;
        }

        try {
            git.push().call();
        } catch (GitAPIException e) {
            LOGGER.error("Error pushing files to git");
            throw e;
        }
    } catch (Exception e) {
        throw e;
    } finally {
        output.close();
        git.close();
        if (result != null)
            result.getRepository().close();
        backupRepo.close();
    }
}