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:de.thomasbolz.renamer.RenamerTest.java

@Before
public void setUp() throws Exception {
    source = Paths.get(new File(".").getCanonicalPath(), "source");
    target = Paths.get(new File(".").getCanonicalPath(), "target");
    if (!target.toFile().exists() || target.toFile().listFiles().length <= 5) {
        FileUtils.deleteDirectory(target.toFile());
        Files.createDirectories(target);
    }//from  ww  w.  j  a va 2  s .  co  m
    log.debug(source);
    log.debug(target);

}

From source file:de.zib.gndms.neomodel.gorfx.tests.NeoTest.java

@BeforeSuite
public void killDatabase() throws IOException {
    FileUtils.deleteDirectory(dbDir);
}

From source file:com.eviware.soapui.impl.wsdl.WsdlProjectLoadAndSaveTest.java

@AfterClass
public static void teardown() throws IOException {
    FileUtils.deleteDirectory(TEMPORARY_FOLDER);
}

From source file:com.artglorin.web.utils.ResourcesHelperTest.java

@AfterClass(enabled = true)
public void deleteTestFolder() throws IOException {
    FileUtils.deleteDirectory(testFolder.toFile());
}

From source file:com.consol.citrus.admin.util.FileHelperImplTest.java

@AfterTest
public void cleanup() throws Exception {
    FileUtils.deleteDirectory(tmpDir);
    tmpDir.delete();
}

From source file:com.igitras.codegen.axon.CommandGenTest.java

@Before
public void setUp() throws Exception {
    File file = new File("/Volumes/BACKUP/Mac/SCM/CodeGen/axon-generator/target/TestProject/");

    if (file.exists()) {
        FileUtils.deleteDirectory(file);
    }/*from   ww  w .j a  v a 2 s .c  om*/

    projectGen = ProjectGen.getInstance().withName("TestProject").withType(JavaProjectType.JAR)
            .withBasePackage("org.personal.mason").withDescription("Test Project").withVersion("1.0.1")
            .withBaseDirectory("/Volumes/BACKUP/Mac/SCM/CodeGen/axon-generator/target");

    CommandGen commandGen = CommandGen.getInstance();

    JavaFieldPart fieldPart = new JavaFieldPart(VisitPrivilege.PRIVATE, IsStatic.DEFAULT, IsFinal.FINAL,
            String.class.getName(), "field1", new JavaInitialPart());
    JavaFieldPart fieldPart2 = new JavaFieldPart(VisitPrivilege.PRIVATE, IsStatic.DEFAULT, IsFinal.FINAL,
            String.class.getName(), "field2", new JavaInitialPart());
    commandGen.withName("Hello").withAbstract(IsAbstract.ABSTRACT).withVisitPrivilege(VisitPrivilege.PUBLIC)
            .withComment("//Hello Command").withFieldPart(fieldPart).withFieldPart(fieldPart2)
            .withBasePackage("org.personal.mason");

    Project project = projectGen.build();
    commandGen.withinProject(project);
    commandGen.generate();
    project.generate();
}

From source file:co.indexia.antiquity.graph.TitanTxLongVersionedGraphTest.java

@Override
protected ActiveVersionedGraph<?, Long> generateGraph() {
    File f = new File("/tmp/testgraph");
    if (f.exists()) {
        if (f.isDirectory()) {
            try {
                FileUtils.deleteDirectory(f);
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }/*from   w  w  w . j  a v  a  2  s.  c om*/
        } else {
            f.delete();
        }

    }

    Configuration c = new BaseConfiguration();
    c.addProperty("storage.directory", "/tmp/testgraph");
    TitanGraph g = TitanFactory.open(c);

    return new ActiveVersionedGraph.ActiveVersionedTransactionalGraphBuilder<TitanGraph, Long>(g,
            new LongGraphIdentifierBehavior()).init(true).conf(null).build();
}

From source file:io.druid.segment.loading.MMappedQueryableIndexFactory.java

@Override
public QueryableIndex factorize(File parentDir) throws SegmentLoadingException {
    try {//  w  ww. j a  v a  2s  . c om
        return IndexIO.loadIndex(parentDir);
    } catch (IOException e) {
        log.warn(e, "Got exception!!!! Going to delete parentDir[%s]", parentDir);
        try {
            FileUtils.deleteDirectory(parentDir);
        } catch (IOException e2) {
            log.error(e, "Problem deleting parentDir[%s]", parentDir);
        }
        throw new SegmentLoadingException(e, "%s", e.getMessage());
    }
}

From source file:com.tasktop.c2c.server.scm.service.GitServiceTestBase.java

public static void ensureDirExistsAndIsEmpty(String dir) throws IOException {
    File file = new File(dir);
    if (!file.exists()) {
        file.mkdirs();//from w w w . j av  a 2 s . c  o  m
    } else {
        FileUtils.deleteDirectory(file);
    }
}

From source file:com.ngdata.hbaseindexer.impl.IndexerModelImplTest.java

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    ZK_DIR = new File(System.getProperty("java.io.tmpdir") + File.separator + "hbaseindexer.zklocktest");
    FileUtils.deleteDirectory(ZK_DIR);
    ZK_CLIENT_PORT = getFreePort();//from  w  ww . j  a  v  a 2 s.c  om

    ZK_CLUSTER = new MiniZooKeeperCluster();
    ZK_CLUSTER.setDefaultClientPort(ZK_CLIENT_PORT);
    ZK_CLUSTER.startup(ZK_DIR);
}