org.apache.commons.io.FileUtils.deleteDirectory() - java examples

Here are the examples of the java api org.apache.commons.io.FileUtils.deleteDirectory() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : BloomFilterCreatorTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(TEMP_DIR);
}

19 View Complete Implementation : DerivedColumnTransformationTest.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanUp() throws IOException {
    File f = new File(outputPath);
    FileUtils.deleteDirectory(f);
}

19 View Complete Implementation : TestHdfsManifestToResourcesPlugin.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanUp() throws IOException {
    File tmpDir = new File(tmpPath);
    FileUtils.deleteDirectory(tmpDir);
}

19 View Complete Implementation : StartZookeeperCommand.java
Copyright Apache License 2.0
Author : apache
@Override
public void cleanup() {
    if (_tmpdir != null) {
        try {
            FileUtils.deleteDirectory(_tmpdir);
        } catch (IOException e) {
        // Nothing to do right now.
        }
    }
}

19 View Complete Implementation : FSConfigConverterTestCommons.java
Copyright Apache License 2.0
Author : apache
public void setUp() throws IOException {
    File d = new File(TEST_DIR, "conversion-output");
    if (d.exists()) {
        FileUtils.deleteDirectory(d);
    }
    boolean success = d.mkdirs();
    replacedertTrue("Can't create directory: " + d.getAbsolutePath(), success);
}

19 View Complete Implementation : TestGpuResourceHandlerImpl.java
Copyright Apache License 2.0
Author : apache
public void createTestDataDirectory() throws IOException {
    String testDirectoryPath = getTestParentDirectory();
    testDataDirectory = new File(testDirectoryPath);
    FileUtils.deleteDirectory(testDataDirectory);
    testDataDirectory.mkdirs();
}

19 View Complete Implementation : SegmentPurgerTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(TEMP_DIR);
}

19 View Complete Implementation : TestServiceMonitor.java
Copyright Apache License 2.0
Author : apache
@After
public void tearDown() throws IOException {
    if (basedir != null) {
        FileUtils.deleteDirectory(basedir);
    }
    if (zkCluster != null) {
        zkCluster.stop();
    }
}

19 View Complete Implementation : PinotLLCRealtimeSegmentManagerTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws IOException {
    FileUtils.deleteDirectory(TEMP_DIR);
}

19 View Complete Implementation : TestAMSimulator.java
Copyright Apache License 2.0
Author : apache
private void deleteMetricOutputDir() {
    try {
        FileUtils.deleteDirectory(metricOutputDir.toFile());
    } catch (IOException e) {
        replacedert.fail(e.toString());
    }
}

19 View Complete Implementation : ControllerPeriodicTasksIntegrationTests.java
Copyright Apache License 2.0
Author : apache
/**
 * Tear down the cluster after tests
 * @throws Exception
 */
@AfterClreplaced
public void tearDown() throws Exception {
    stopServer();
    stopBroker();
    stopController();
    stopKafka();
    stopZk();
    FileUtils.deleteDirectory(_tempDir);
}

19 View Complete Implementation : TestAppLogAggregatorImpl.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanUp() throws IOException {
    FileUtils.deleteDirectory(LOCAL_LOG_DIR);
    FileUtils.deleteQuietly(REMOTE_LOG_FILE);
}

19 View Complete Implementation : TestMRAppMaster.java
Copyright Apache License 2.0
Author : apache
@Before
public void prepare() throws IOException {
    File dir = new File(stagingDir);
    if (dir.exists()) {
        FileUtils.deleteDirectory(dir);
    }
    dir.mkdirs();
}

19 View Complete Implementation : BaseStarTreeV2Test.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws IOException {
    _indexSegment.destroy();
    FileUtils.deleteDirectory(TEMP_DIR);
}

19 View Complete Implementation : TestCsiClient.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public static void tearDown() throws IOException {
    if (testRoot != null) {
        FileUtils.deleteDirectory(testRoot);
    }
}

19 View Complete Implementation : HybridClusterIntegrationTest.java
Copyright Apache License 2.0
Author : apache
/**
 * Can be overridden to preserve segments.
 *
 * @throws Exception
 */
protected void cleanup() throws Exception {
    FileUtils.deleteDirectory(_tempDir);
}

19 View Complete Implementation : TestRuncContainerRuntime.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanUp() throws IOException {
    File tmpDir = new File(tmpPath);
    FileUtils.deleteDirectory(tmpDir);
}

19 View Complete Implementation : TopkPhaseTest.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanUp() throws IOException {
    File f = new File(outputPath);
    FileUtils.deleteDirectory(f);
}

19 View Complete Implementation : TestProvidedImpl.java
Copyright Apache License 2.0
Author : apache
private static void createStorageDirs(DataStorage storage, Configuration conf, int numDirs, int numProvidedDirs) throws IOException {
    List<Storage.StorageDirectory> dirs = new ArrayList<Storage.StorageDirectory>();
    List<String> dirStrings = new ArrayList<String>();
    FileUtils.deleteDirectory(new File(BASE_DIR));
    for (int i = 0; i < numDirs; i++) {
        File loc = new File(BASE_DIR, "data" + i);
        dirStrings.add(new Path(loc.toString()).toUri().toString());
        loc.mkdirs();
        dirs.add(createLocalStorageDirectory(loc, conf));
        when(storage.getStorageDir(i)).thenReturn(dirs.get(i));
    }
    for (int i = numDirs; i < numDirs + numProvidedDirs; i++) {
        File loc = new File(BASE_DIR, "data" + i);
        providedBasePath = loc.getAbsolutePath();
        loc.mkdirs();
        String dirString = "[PROVIDED]" + new Path(loc.toString()).toUri().toString();
        dirStrings.add(dirString);
        dirs.add(createProvidedStorageDirectory(dirString, conf));
        when(storage.getStorageDir(i)).thenReturn(dirs.get(i));
    }
    String dataDir = StringUtils.join(",", dirStrings);
    conf.set(DFSConfigKeys.DFS_DATANODE_DATA_DIR_KEY, dataDir);
    when(storage.dirIterator()).thenReturn(dirs.iterator());
    when(storage.getNumStorageDirs()).thenReturn(numDirs + numProvidedDirs);
}

19 View Complete Implementation : NullValueVectorCreatorTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(TEMP_DIR);
}

19 View Complete Implementation : TestVEDeviceDiscoverer.java
Copyright Apache License 2.0
Author : apache
@After
public void teardown() throws IOException {
    if (testFolder != null) {
        File f = new File(testFolder);
        FileUtils.deleteDirectory(f);
    }
}

19 View Complete Implementation : TestServiceAM.java
Copyright Apache License 2.0
Author : apache
@After
public void tearDown() throws IOException {
    if (basedir != null) {
        FileUtils.deleteDirectory(basedir);
    }
    if (zkCluster != null) {
        zkCluster.stop();
    }
}

19 View Complete Implementation : TestNonAggregatingLogHandler.java
Copyright Apache License 2.0
Author : apache
@Test
public void testDelayedDelete() throws IOException {
    File[] localLogDirs = getLocalLogDirFiles(this.getClreplaced().getName(), 2);
    String localLogDirsString = localLogDirs[0].getAbsolutePath() + "," + localLogDirs[1].getAbsolutePath();
    conf.set(YarnConfiguration.NM_LOG_DIRS, localLogDirsString);
    conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, false);
    conf.setLong(YarnConfiguration.NM_LOG_RETAIN_SECONDS, YarnConfiguration.DEFAULT_NM_LOG_RETAIN_SECONDS);
    dirsHandler.init(conf);
    NonAggregatingLogHandler logHandler = new NonAggregatingLogHandlerWithMockExecutor(dispatcher, mockDelService, dirsHandler);
    logHandler.init(conf);
    logHandler.start();
    logHandler.handle(new LogHandlerAppStartedEvent(appId, user, null, null));
    logHandler.handle(new LogHandlerContainerFinishedEvent(container11, ContainerType.APPLICATION_MASTER, 0));
    logHandler.handle(new LogHandlerAppFinishedEvent(appId));
    Path[] localAppLogDirs = new Path[2];
    localAppLogDirs[0] = new Path(localLogDirs[0].getAbsolutePath(), appId.toString());
    localAppLogDirs[1] = new Path(localLogDirs[1].getAbsolutePath(), appId.toString());
    ScheduledThreadPoolExecutor mockSched = ((NonAggregatingLogHandlerWithMockExecutor) logHandler).mockSched;
    verify(mockSched).schedule(any(Runnable.clreplaced), eq(10800l), eq(TimeUnit.SECONDS));
    logHandler.close();
    for (int i = 0; i < localLogDirs.length; i++) {
        FileUtils.deleteDirectory(localLogDirs[i]);
    }
}

19 View Complete Implementation : TestBuildExternalComponents.java
Copyright Apache License 2.0
Author : apache
@After
public void tearDown() throws IOException {
    if (basedir != null) {
        FileUtils.deleteDirectory(basedir);
    }
}

19 View Complete Implementation : TestLevelDbMockAliasMapClient.java
Copyright Apache License 2.0
Author : apache
@After
public void tearDown() throws IOException {
    levelDBAliasMapServer.close();
    inMemoryLevelDBAliasMapClient.close();
    FileUtils.deleteDirectory(tempDir);
}

19 View Complete Implementation : TestStagingCommitter.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanup() {
    try {
        if (tmpDir != null) {
            FileUtils.deleteDirectory(tmpDir);
        }
    } catch (IOException ignored) {
    }
}

19 View Complete Implementation : ITestInMemoryAliasMap.java
Copyright Apache License 2.0
Author : apache
@After
public void tearDown() throws Exception {
    aliasMap.close();
    FileUtils.deleteDirectory(tempDirectory);
}

19 View Complete Implementation : TestContainerLocalizer.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanUp() throws IOException {
    FileUtils.deleteDirectory(new File(basedir.toUri().getRawPath()));
}

19 View Complete Implementation : HadoopSegmentBuildPushOfflineClusterIntegrationTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws Exception {
    stopServer();
    stopBroker();
    stopController();
    stopZk();
    _mrCluster.stop();
    FileUtils.deleteDirectory(_mrCluster.getTestWorkDir());
    FileUtils.deleteDirectory(_tempDir);
}

19 View Complete Implementation : TestMRAppMaster.java
Copyright Apache License 2.0
Author : apache
@Test
public void testMRAppMasterMissingStaging() throws IOException, InterruptedException {
    String applicationAttemptIdStr = "appattempt_1317529182569_0004_000002";
    String containerIdStr = "container_1317529182569_0004_000002_1";
    String userName = "TestAppMasterUser";
    JobConf conf = new JobConf();
    conf.set(MRJobConfig.MR_AM_STAGING_DIR, stagingDir);
    ApplicationAttemptId applicationAttemptId = ApplicationAttemptId.fromString(applicationAttemptIdStr);
    // Delete the staging directory
    File dir = new File(stagingDir);
    if (dir.exists()) {
        FileUtils.deleteDirectory(dir);
    }
    ContainerId containerId = ContainerId.fromString(containerIdStr);
    MRAppMaster appMaster = new MRAppMasterTest(applicationAttemptId, containerId, "host", -1, -1, System.currentTimeMillis(), false, false);
    boolean caught = false;
    try {
        MRAppMaster.initAndStartAppMaster(appMaster, conf, userName);
    } catch (IOException e) {
        // The IO Exception is expected
        LOG.info("Caught expected Exception", e);
        caught = true;
    }
    replacedertTrue(caught);
    replacedertTrue(appMaster.errorHappenedShutDown);
    // Copying the history file is disabled, but it is not really visible from
    // here
    replacedertEquals(JobStateInternal.ERROR, appMaster.forcedState);
    appMaster.stop();
}

19 View Complete Implementation : LoaderUtilsTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws IOException {
    FileUtils.deleteDirectory(TEST_DIR);
}

19 View Complete Implementation : TestTimelineReaderWebServices.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public static void tearDown() throws Exception {
    FileUtils.deleteDirectory(new File(ROOT_DIR));
}

19 View Complete Implementation : AggregationPhaseTest.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanUp() throws IOException {
    File f = new File(outputPath);
    FileUtils.deleteDirectory(f);
}

19 View Complete Implementation : TestServiceAM.java
Copyright Apache License 2.0
Author : apache
@Before
public void setup() throws Exception {
    basedir = new File("target", "apps");
    if (basedir.exists()) {
        FileUtils.deleteDirectory(basedir);
    } else {
        basedir.mkdirs();
    }
    zkCluster = new TestingCluster(1);
    zkCluster.start();
    conf.set(KEY_REGISTRY_ZK_QUORUM, zkCluster.getConnectString());
    LOG.info("ZK cluster: {}", zkCluster.getConnectString());
}

19 View Complete Implementation : PurgeTaskExecutorTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(TEMP_DIR);
}

19 View Complete Implementation : TestFSSchedulerConfigurationStore.java
Copyright Apache License 2.0
Author : apache
@After
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(testSchedulerConfigurationDir);
}

19 View Complete Implementation : SegmentConverterTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws Exception {
    FileUtils.deleteDirectory(WORKING_DIR);
}

19 View Complete Implementation : TestInMemoryLevelDBAliasMapClient.java
Copyright Apache License 2.0
Author : apache
@After
public void tearDown() throws IOException {
    levelDBAliasMapServer.close();
    inMemoryLevelDBAliasMapClient.close();
    FileUtils.deleteDirectory(tempDir);
}

19 View Complete Implementation : OfflineClusterIntegrationTest.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public void tearDown() throws Exception {
    // Test instance decommission before tearing down
    testInstanceDecommission();
    // Brokers and servers has been stopped
    stopController();
    stopZk();
    FileUtils.deleteDirectory(_tempDir);
}

19 View Complete Implementation : TemporarySocketDirectory.java
Copyright Apache License 2.0
Author : apache
@Override
public void close() throws IOException {
    if (dir != null) {
        FileUtils.deleteDirectory(dir);
        dir = null;
    }
}

19 View Complete Implementation : EmbeddedZooKeeper.java
Copyright Apache License 2.0
Author : apache
@Override
public void close() throws IOException {
    zookeeper.shutdown();
    factory.shutdown();
    FileUtils.deleteDirectory(tmpDir);
}

19 View Complete Implementation : TestCGroupsResourceCalculator.java
Copyright Apache License 2.0
Author : apache
@Test(expected = YarnException.clreplaced)
public void testNoMemoryCGgroupMount() throws Exception {
    File procfs = new File(basePath + "/1234");
    replacedert.replacedertTrue("Setup error", procfs.mkdirs());
    try {
        FileUtils.writeStringToFile(new File(procfs, CGroupsResourceCalculator.CGROUP), "7:devices:/yarn/container_1\n" + "6:cpuacct,cpu:/yarn/container_1\n" + "5:pids:/yarn/container_1\n", StandardCharsets.UTF_8);
        CGroupsResourceCalculator calculator = new CGroupsResourceCalculator("1234", basePath, cGroupsHandler, clock, 10);
        calculator.setCGroupFilePaths();
        replacedert.replacedertEquals("Expected exception", null, calculator);
    } finally {
        FileUtils.deleteDirectory(new File(basePath));
    }
}

19 View Complete Implementation : BitmapInvertedIndexCreatorTest.java
Copyright Apache License 2.0
Author : apache
@AfterMethod
public void tearDown() throws IOException {
    FileUtils.deleteDirectory(ON_HEAP_INDEX_DIR);
    FileUtils.deleteDirectory(OFF_HEAP_INDEX_DIR);
}

19 View Complete Implementation : TestNECVEPlugin.java
Copyright Apache License 2.0
Author : apache
@After
public void teardown() throws IOException {
    if (testFolder != null) {
        File f = new File(testFolder);
        FileUtils.deleteDirectory(f);
    }
}

19 View Complete Implementation : TestTimelineServiceClientIntegration.java
Copyright Apache License 2.0
Author : apache
@AfterClreplaced
public static void tearDownClreplaced() throws Exception {
    if (auxService != null) {
        auxService.stop();
    }
    FileUtils.deleteDirectory(new File(ROOT_DIR));
}

19 View Complete Implementation : TestNECVEPlugin.java
Copyright Apache License 2.0
Author : apache
private void setupTestDirectory(String postFix) throws IOException {
    String path = "target/temp/" + TestNECVEPlugin.clreplaced.getName() + (postFix == null ? "" : postFix);
    testFolder = new File(path).getAbsolutePath();
    File f = new File(testFolder);
    FileUtils.deleteDirectory(f);
    if (!f.mkdirs()) {
        throw new RuntimeException("Could not create directory: " + f.getAbsolutePath());
    }
    defaultSearchDirs = new String[] { testFolder };
}

19 View Complete Implementation : TestCGroupsResourceCalculator.java
Copyright Apache License 2.0
Author : apache
@Test
public void testCGgroupNotFound() throws Exception {
    File procfs = new File(basePath + "/1234");
    replacedert.replacedertTrue("Setup error", procfs.mkdirs());
    try {
        FileUtils.writeStringToFile(new File(procfs, CGroupsResourceCalculator.CGROUP), "7:devices:/yarn/container_1\n" + "6:cpuacct,cpu:/yarn/container_1\n" + "5:pids:/yarn/container_1\n" + "4:memory:/yarn/container_1\n", StandardCharsets.UTF_8);
        CGroupsResourceCalculator calculator = new CGroupsResourceCalculator("1234", basePath, cGroupsHandler, clock, 10);
        calculator.setCGroupFilePaths();
        calculator.updateProcessTree();
        replacedert.replacedertEquals("cgroups should be missing", (long) ResourceCalculatorProcessTree.UNAVAILABLE, calculator.getRssMemorySize(0));
    } finally {
        FileUtils.deleteDirectory(new File(basePath));
    }
}

19 View Complete Implementation : EmbeddedSolrServerFactory.java
Copyright Apache License 2.0
Author : apache
/**
 * @param solrHome
 *          the Solr home directory to use
 * @param configSetHome
 *          the directory containing config sets
 * @param coreName
 *          the name of the core, must have a matching directory in configHome
 * @param cleanSolrHome
 *          if true the directory for solrHome will be deleted and re-created
 *          if it already exists
 *
 * @return an EmbeddedSolrServer with a core created for the given coreName
 * @throws IOException
 */
public static SolrClient create(final String solrHome, final String configSetHome, final String coreName, final boolean cleanSolrHome) throws IOException, SolrServerException {
    final File solrHomeDir = new File(solrHome);
    if (solrHomeDir.exists()) {
        FileUtils.deleteDirectory(solrHomeDir);
        solrHomeDir.mkdirs();
    } else {
        solrHomeDir.mkdirs();
    }
    final SolrResourceLoader loader = new SolrResourceLoader(solrHomeDir.toPath());
    final Path configSetPath = Paths.get(configSetHome).toAbsolutePath();
    final NodeConfig config = new NodeConfig.NodeConfigBuilder("embeddedSolrServerNode", loader).setConfigSetBaseDirectory(configSetPath.toString()).build();
    final EmbeddedSolrServer embeddedSolrServer = new EmbeddedSolrServer(config, coreName);
    final CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create();
    createRequest.setCoreName(coreName);
    createRequest.setConfigSet(coreName);
    embeddedSolrServer.request(createRequest);
    return embeddedSolrServer;
}

19 View Complete Implementation : TestVEDeviceDiscoverer.java
Copyright Apache License 2.0
Author : apache
private void setupTestDirectory() throws IOException {
    String path = "target/temp/" + TestVEDeviceDiscoverer.clreplaced.getName();
    testFolder = new File(path).getAbsolutePath();
    File f = new File(testFolder);
    FileUtils.deleteDirectory(f);
    if (!f.mkdirs()) {
        throw new RuntimeException("Could not create directory: " + f.getAbsolutePath());
    }
}

19 View Complete Implementation : TestGpuResourceHandlerImpl.java
Copyright Apache License 2.0
Author : apache
@After
public void cleanupTestFiles() throws IOException {
    FileUtils.deleteDirectory(testDataDirectory);
    nvidiaBinaryHelper = new NvidiaBinaryHelper();
}