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

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

Introduction

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

Prototype

public static void cleanDirectory(File directory) throws IOException 

Source Link

Document

Cleans a directory without deleting it.

Usage

From source file:org.apache.drill.exec.expr.fn.FunctionImplementationRegistry.java

/**
 * If {@link #deleteTmpDir} is set to true, deletes generated temporary directory.
 * Otherwise cleans up {@link #localUdfDir}.
 *///from w ww .j  a  va  2s. com
@Override
public void close() {
    if (deleteTmpDir) {
        FileUtils.deleteQuietly(tmpDir);
    } else {
        try {
            FileUtils.cleanDirectory(new File(localUdfDir.toUri().getPath()));
        } catch (IOException e) {
            logger.warn("Problems during local udf directory clean up", e);
        }
    }
}

From source file:org.apache.drill.exec.udf.dynamic.TestDynamicUDFSupport.java

@After
public void cleanup() throws Exception {
    closeClient();
    FileUtils.cleanDirectory(udfDir);
    dirTestWatcher.clear();
}

From source file:org.apache.drill.jdbc.test.TestViews.java

@BeforeClass
public static void generateHive() throws Exception {
    new HiveTestDataGenerator().generateTestData();

    // delete tmp workspace directory
    File f = new File("/tmp/drilltest");
    if (f.exists()) {
        FileUtils.cleanDirectory(f);
        FileUtils.forceDelete(f);//from  w  ww  .  j  a  v  a  2s.  c o  m
    }
}

From source file:org.apache.drill.test.BaseDirTestWatcher.java

/**
 * Clear contents of cluster directories
 *///from   w ww  .j a  v  a 2 s.  co  m
public void clear() {
    try {
        FileUtils.cleanDirectory(rootDir);
        FileUtils.cleanDirectory(tmpDir);
        FileUtils.cleanDirectory(storeDir);
        FileUtils.cleanDirectory(dfsTestTmpDir);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.apache.flink.runtime.jobmanager.JobManagerSubmittedJobGraphsRecoveryITCase.java

@Before
public void cleanUp() throws Exception {
    if (FileStateBackendBasePath != null) {
        FileUtils.cleanDirectory(FileStateBackendBasePath);
    }/*  ww  w .j av  a  2 s .  c  o m*/

    ZooKeeper.deleteAll();
}

From source file:org.apache.flink.test.recovery.AbstractJobManagerProcessFailureRecoveryITCase.java

@Before
public void cleanUp() throws Exception {
    ZooKeeper.deleteAll();

    FileUtils.cleanDirectory(FileStateBackendBasePath);
}

From source file:org.apache.flink.test.recovery.JobManagerCheckpointRecoveryITCase.java

@Before
public void cleanUp() throws Exception {
    if (FileStateBackendBasePath != null && FileStateBackendBasePath.exists()) {
        FileUtils.cleanDirectory(FileStateBackendBasePath);
    }// w ww  . jav a  2s  .c  om

    ZooKeeper.deleteAll();
}

From source file:org.apache.geode.management.internal.configuration.ClusterConfigurationServiceEndToEndDUnitTest.java

private void shutdownAll() throws IOException {
    VM locatorAndMgr = getHost(0).getVM(3);
    locatorAndMgr.invoke(new SerializableCallable() {
        @Override/*from  w w w . j  a v  a2 s . co  m*/
        public Object call() throws Exception {
            GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
            ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
            return null;
        }
    });

    locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);

    // Clean up the directories
    if (!serverNames.isEmpty()) {
        for (String serverName : serverNames) {
            final File serverDir = new File(serverName);
            FileUtils.cleanDirectory(serverDir);
            FileUtils.deleteDirectory(serverDir);
        }
    }
    serverNames.clear();
}

From source file:org.apache.geode.management.internal.configuration.SharedConfigurationEndToEndDUnitTest.java

private void shutdownAll() throws IOException {
    VM locatorAndMgr = getHost(0).getVM(3);
    locatorAndMgr.invoke(new SerializableCallable() {
        @Override/*w w w . j  a  v  a 2 s .c om*/
        public Object call() throws Exception {
            GemFireCacheImpl cache = (GemFireCacheImpl) CacheFactory.getAnyInstance();
            ShutdownAllRequest.send(cache.getDistributedSystem().getDistributionManager(), -1);
            return null;
        }
    });

    locatorAndMgr.invoke(SharedConfigurationTestUtils.cleanupLocator);

    //Clean up the directories
    if (!serverNames.isEmpty()) {
        for (String serverName : serverNames) {
            final File serverDir = new File(serverName);
            FileUtils.cleanDirectory(serverDir);
            FileUtils.deleteDirectory(serverDir);
        }
    }
    serverNames.clear();
}

From source file:org.apache.gobblin.GobblinLocalJobLauncherUtils.java

public static void cleanDir() throws IOException {
    FileUtils.forceMkdir(new File(RESOURCE_DIR + STATE_STORE));
    FileUtils.forceMkdir(new File(RESOURCE_DIR + WRITER_STAGING));
    FileUtils.forceMkdir(new File(RESOURCE_DIR + WRITER_OUTPUT));
    FileUtils.forceMkdir(new File(RESOURCE_DIR + TMP));
    FileUtils.forceMkdir(new File(RESOURCE_DIR + METRICS));
    FileUtils.forceMkdir(new File(RESOURCE_DIR + SAMPLE_DIR));
    FileUtils.forceMkdir(new File(RESOURCE_DIR + FINAL_DIR));

    FileUtils.cleanDirectory(new File(RESOURCE_DIR + STATE_STORE));
    FileUtils.cleanDirectory(new File(RESOURCE_DIR + WRITER_STAGING));
    FileUtils.cleanDirectory(new File(RESOURCE_DIR + WRITER_OUTPUT));
    FileUtils.cleanDirectory(new File(RESOURCE_DIR + TMP));
    FileUtils.cleanDirectory(new File(RESOURCE_DIR + METRICS));
    FileUtils.cleanDirectory(new File(RESOURCE_DIR + SAMPLE_DIR));
    FileUtils.cleanDirectory(new File(RESOURCE_DIR + FINAL_DIR));
}