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

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

Introduction

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

Prototype

public static boolean deleteQuietly(File file) 

Source Link

Document

Deletes a file, never throwing an exception.

Usage

From source file:com.streamsets.datacollector.cluster.TestTarFileCreator.java

@After
public void tearDown() {
    if (tempDir != null) {
        FileUtils.deleteQuietly(tempDir);
    }
}

From source file:com.linkedin.pinot.core.segment.store.SegmentLocalFSDirectoryTest.java

@AfterClass
public void tearDown() throws Exception {
    segmentDirectory.close();
    FileUtils.deleteQuietly(TEST_DIRECTORY);
}

From source file:com.thoughtworks.go.agent.launcher.ServerBinaryDownloaderTest.java

@After
public void tearDown() {
    FileUtils.deleteQuietly(new File(Downloader.AGENT_BINARY));
    FileUtils.deleteQuietly(DownloadableFile.AGENT.getLocalFile());
}

From source file:com.linkedin.gradle.python.tasks.BuildPexTask.java

@TaskAction
public void buildPex() throws Exception {
    Project project = getProject();//from  ww  w.  j a v  a  2  s. c om

    PythonExtension pythonExtension = ExtensionUtils.getPythonExtension(project);
    DeployableExtension deployableExtension = ExtensionUtils.getPythonComponentExtension(project,
            DeployableExtension.class);
    PexExtension pexExtension = ExtensionUtils.getPythonComponentExtension(project, PexExtension.class);

    // Recreate the pex cache if it exists so that we don't mistakenly use an old build's version of the local project.
    if (pexExtension.getPexCache().exists()) {
        FileUtils.deleteQuietly(pexExtension.getPexCache());
        pexExtension.getPexCache().mkdirs();
    }

    project.exec(execSpec -> configureExecution(pythonExtension, execSpec));
    deployableExtension.getDeployableBuildDir().mkdirs();

    if (pexExtension.isFatPex()) {
        new FatPexGenerator(project).buildEntryPoints();
    } else {
        new ThinPexGenerator(project, entryPointTemplate, additionalProperties).buildEntryPoints();
    }
}

From source file:com.unister.semweb.drums.api.DRUMSTest.java

@Before
public void initialise() throws Exception {
    System.gc(); // needed, that files are deletable under windows
    long[] ranges = new long[] { 0, 10, 20, 30 };
    byte[][] bRanges = KeyUtils.toByteArray(ranges);
    String[] filenames = new String[] { "1.db", "2.db", "3.db", "4.db" };
    FileUtils.deleteQuietly(new File(TestUtils.gp.DATABASE_DIRECTORY));
    hashFunction = new RangeHashFunction(bRanges, filenames, "/tmp/hash.hs");
    System.gc();//from  ww w.  ja  va2  s  .co  m
}

From source file:com.linkedin.pinot.controller.validation.StorageQuotaCheckerTest.java

@AfterClass
public void tearDown() {
    FileUtils.deleteQuietly(TEST_DIR);
}

From source file:com.xiaomi.linden.file.TestFileChangeWatcher.java

@Test
public void testFileChangeWatcher() throws IOException, InterruptedException {
    final AtomicInteger events = new AtomicInteger(0);
    final Function<String, Object> callback = new Function<String, Object>() {
        @Override//ww w. j a va2  s .  c  om
        public String apply(String absolutePath) {
            events.incrementAndGet();
            return null;
        }
    };

    File dir = new File("tmp");
    if (!dir.exists()) {
        dir.mkdir();
    }

    File file = new File("tmp/test.txt");
    file.createNewFile();

    fileChangeWatcher = new FileChangeWatcher(file.getAbsolutePath(), callback, 10);
    fileChangeWatcher.start();
    directoryChangeWatcher = new DirectoryChangeWatcher(dir.getAbsolutePath(), callback, 10);
    directoryChangeWatcher.start();

    Files.write("Hello", file, Charsets.UTF_8);
    Thread.sleep(10 * 1000);
    Assert.assertEquals(2, events.get());

    FileUtils.deleteQuietly(file);
    FileUtils.deleteDirectory(dir);
}

From source file:com.splunk.shuttl.archiver.importexport.BucketExportControllerIntegrationTest.java

@AfterMethod
public void tearDown() {
    FileUtils.deleteQuietly(localFileSystemPaths.getArchiverDirectory());
}

From source file:fr.acxio.tools.agia.alfresco.ContentFileDeleteWriterTest.java

@After
public void tearDown() throws Exception {
    Collection<File> aFilesToDelete = FileUtils.listFiles(new File("target"),
            new WildcardFileFilter("content*.pdf"), null);
    for (File aFile : aFilesToDelete) {
        FileUtils.deleteQuietly(aFile);
    }/*from w  w  w. ja  v  a2  s .co m*/
}

From source file:com.thoughtworks.go.util.NestedJarClassLoader.java

NestedJarClassLoader(URL jarURL, ClassLoader parentClassLoader, String... excludes) {
    super(null);//ww  w  .  jav  a2s . c  o  m
    this.jarDir = new File(TEMP_DIR, UUID.randomUUID().toString());
    this.parentClassLoader = parentClassLoader;
    this.jarClassLoader = createLoaderForJar(jarURL);
    this.excludes = excludes;
    Runtime.getRuntime().addShutdownHook(new Thread(() -> FileUtils.deleteQuietly(jarDir)));
}