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.splunk.shuttl.archiver.archive.BucketFreezerSystemExitTest.java

@AfterMethod(groups = { "fast-unit" })
public void tearDown() throws IOException {
    FileUtils.deleteDirectory(testDir);
}

From source file:com.xiaomi.linden.server.TestLindenServerWithFacet.java

@BeforeClass
public static void init() {
    try {//from www. j a  va  2 s. c  om
        FileUtils.deleteDirectory(new File("./target/linden_server_facet_data"));
        ZooKeeperService.start();
        startLindenServer();
        index();
        server1.refresh();
        server2.refresh();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:io.Tools.java

/**
 * Create test PDB and Chemcomp folder. Also all PDB files in resources are copied there so all test can use this
 * folder/* w  ww .jav a2s  .  co  m*/
 *
 * @return
 */
public static String createPermanentTestFolder() {

    String d = System.getProperty("user.home");
    String builtTestFolder = d + File.separator + "Documents" + File.separator + testFolderName
            + File.separator;
    final File baseDir = new File(builtTestFolder);

    String builttestPDBFolder = builtTestFolder + File.separator + "pdb";
    baseDir.mkdirs();
    final File pdbDir = new File(builttestPDBFolder);
    if (Files.exists(Paths.get(builttestPDBFolder))) {
        try {
            FileUtils.deleteDirectory(pdbDir);
        } catch (IOException e) {
        }
    }
    pdbDir.mkdir();

    String builttestChemcompFolder = builtTestFolder + File.separator + "chemcomp";
    final File chemcompDir = new File(builttestChemcompFolder);
    if (Files.exists(Paths.get(builttestChemcompFolder))) {
        try {
            FileUtils.deleteDirectory(chemcompDir);
        } catch (IOException e) {
        }
    }

    chemcompDir.mkdirs();

    pdbDir.mkdir();
    testChemcompFolder = builtTestFolder;
    testPDBFolder = builttestPDBFolder;

    String resourcesPDBFolder = null;
    try {
        URL url = BiojavaReaderFromPDBFolderTest.class.getClassLoader().getResource("pdb/1di9.cif.gz");
        File pdb1di9file = new File(url.toURI());
        resourcesPDBFolder = pdb1di9file.getParent();
        Map<String, List<MMcifFileInfos>> indexPDBFileInFolder = IOTools
                .indexPDBFileInFolder(new File(resourcesPDBFolder).toString());
        for (Map.Entry<String, List<MMcifFileInfos>> entry : indexPDBFileInFolder.entrySet()) {
            try {
                FileUtils.copyFileToDirectory(new File(entry.getValue().get(0).getPathToFile().toString()),
                        pdbDir);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    } catch (URISyntaxException e) {
        e.printStackTrace();
    }

    String resourcesChemcompFolder = null;
    try {
        URL url = BiojavaReaderFromPDBFolderTest.class.getClassLoader().getResource("chemcomp/0DY.cif.gz");
        File chemcomp0DY = new File(url.toURI());
        resourcesChemcompFolder = chemcomp0DY.getParent();
        Map<String, List<Path>> indexPDBFileInFolder = IOTools
                .indexChemcompFileInFolder(new File(resourcesChemcompFolder).toString());
        for (Map.Entry<String, List<Path>> entry : indexPDBFileInFolder.entrySet()) {
            try {
                FileUtils.copyFileToDirectory(new File(entry.getValue().get(0).toString()),
                        new File(builttestChemcompFolder));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
    return testChemcompFolder;
}

From source file:com.adaptris.core.runtime.FileLogHandlerJmxTest.java

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

From source file:br.uff.ic.archd.service.mining.AnomalieFileService.java

public void saveAnomalie(ProjectAnomalies projectAnomalies, String projectName, int revisions) {
    String fileStr = path + projectName;
    try {/*  w  ww. ja va  2s  .  c o  m*/
        if (new File(fileStr).exists()) {
            FileUtils.deleteDirectory(new File(fileStr));
        }
        new File(fileStr).mkdirs();
    } catch (Exception e) {
        System.out.println("");
    }

    //setar pacotes
    String fileDir = fileStr + "/packages";
    int type = PACKAGE_TYPE;
    writeAnomalies(type, projectAnomalies, fileDir);

    //setar classes
    fileDir = fileStr + "/classes";
    type = CLASS_TYPE;
    writeAnomalies(type, projectAnomalies, fileDir);

    //setar mtodos
    fileDir = fileStr + "/methods";
    type = METHOD_TYPE;
    writeAnomalies(type, projectAnomalies, fileDir);

    try {
        PrintWriter writer0 = new PrintWriter(fileStr + "/.revisionNumber.txt", "UTF-8");
        writer0.println(revisions);
        writer0.close();
    } catch (Exception e) {
        System.out.println("Erro saveAnomalie:" + e.getMessage());
        e.printStackTrace();
    }

}

From source file:io.vertx.config.git.GitConfigStoreWithGithubTest.java

@Before
public void setUp(TestContext context) throws IOException, GitAPIException {
    vertx = Vertx.vertx();//w w  w  . j  a v a2s . c  o  m
    vertx.exceptionHandler(context.exceptionHandler());

    FileUtils.deleteDirectory(new File("target/junk"));

    git = connect(root);
}

From source file:io.fabric8.agent.download.DownloadManagerTest.java

@Before
public void init() throws Exception {
    karafHomeOld = System.getProperty("karaf.home");
    karafHome = new File("target/karaf");
    FileUtils.deleteDirectory(karafHome);

    karafHome.mkdirs();//from  w ww . j  a  v a 2s  .c o m
    systemRepo = new File(karafHome, "system");
    systemRepo.mkdirs();
    systemRepoUri = systemRepo.getCanonicalFile().toURI().toString() + "@snapshots@id=karaf-default";
    System.setProperty("karaf.home", karafHome.getCanonicalPath());
}

From source file:is.artefact.flume.source.kafka.KafkaSourceEmbeddedZookeeper.java

public void stopZookeeper() throws IOException {
    zookeeper.shutdown();
    factory.shutdown();
    FileUtils.deleteDirectory(dir);
}

From source file:io.wcm.devops.conga.plugins.sling.postprocessor.ProvisioningOsgiConfigPostProcessorTest.java

@Before
public void setUp() throws IOException {
    underTest = new PluginManagerImpl().get(ProvisioningOsgiConfigPostProcessor.NAME,
            PostProcessorPlugin.class);

    // prepare target dirctory
    targetDir = new File("target/postprocessor-test_" + UUID.randomUUID().toString());
    if (targetDir.exists()) {
        FileUtils.deleteDirectory(targetDir);
    }/*from   w  w  w. ja  va 2  s .  c om*/
}

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

@After
public void after() throws Exception {
    cleanupTestMetadata();
    FileUtils.deleteDirectory(new File("../job/meta"));
}