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:de.uzk.hki.da.convert.PublishPDFConversionStrategyTests.java

@After
public void tearDown() throws IOException {
    FileUtils.deleteQuietly(dipPath.toFile());
}

From source file:com.ning.metrics.collector.processing.db.CollectorMysqlTestingHelper.java

public void stopMysql() {
    mysqldResource.shutdown();
    FileUtils.deleteQuietly(dbDir);
}

From source file:com.shopzilla.hadoop.testing.MiniCluster.java

@PreDestroy
public void stop() {
    if (jobTracker != null) {
        jobTracker.stop();/* w w w .  j ava2 s.  co  m*/
    }
    if (dfsCluster != null) {
        dfsCluster.stop();
    }
    FileUtils.deleteQuietly(logDirectory);
    FileUtils.deleteQuietly(configurationFile);
}

From source file:mx.itesm.mexadl.MexAdlAnalyzer.java

/**
 * Analyze an xADL architecture in order to generate the following MexADL
 * artifacts:/*  w w  w .j av  a  2 s  .  co  m*/
 * <ul>
 * <li>AspectJ architecture description aspect (XPI)</li>
 * <li>AspectJ metrics data aspect</li>
 * </ul>
 * 
 * @param xArch
 *            xADL architecture definition.
 * @param xArchFilePath
 *            Path to the file containing the xADL architecture definition.
 * @throws Exception
 */
public static void analyzeXArch(final String xArch, final String xArchFilePath) throws Exception {
    Document document;

    try {
        // Clean output
        FileUtils.deleteQuietly(Util.getOutputDir(xArchFilePath));

        // If there are any processors configured, execute them with the
        // current xADL architecture
        if ((MexAdlAnalyzer.processors != null) && (!MexAdlAnalyzer.processors.isEmpty())) {
            document = MexAdlAnalyzer.saxBuilder.build(new ByteArrayInputStream(xArch.getBytes()));
            for (MexAdlProcessor processor : processors) {
                try {
                    processor.processDocument(document, xArchFilePath);
                } catch (Exception e) {
                    MexAdlAnalyzer.logger.log(Level.WARNING, "An error ocurred while executing " + processor,
                            e);
                    throw e;
                }
            }
        } else {
            MexAdlAnalyzer.logger.log(Level.WARNING,
                    "No MexAdlProcessors found to analyze the xADL architecture");
        }
    } catch (Exception e) {
        MexAdlAnalyzer.logger.log(Level.WARNING, "Error analyzing xArch: ", e);
        throw e;
    }
}

From source file:com.linkedin.pinot.core.indexsegment.mutable.MutableSegmentImplTest.java

@BeforeClass
public void setUp() throws Exception {
    FileUtils.deleteQuietly(TEMP_DIR);

    URL resourceUrl = MutableSegmentImplTest.class.getClassLoader().getResource(AVRO_FILE);
    Assert.assertNotNull(resourceUrl);/*  w ww .j a va  2 s . c  o m*/
    File avroFile = new File(resourceUrl.getFile());

    SegmentGeneratorConfig config = SegmentTestUtils.getSegmentGeneratorConfigWithoutTimeColumn(avroFile,
            TEMP_DIR, "testTable");
    SegmentIndexCreationDriver driver = new SegmentIndexCreationDriverImpl();
    driver.init(config);
    driver.build();
    _immutableSegment = ImmutableSegmentLoader.load(new File(TEMP_DIR, driver.getSegmentName()), ReadMode.mmap);

    _schema = config.getSchema();
    _mutableSegmentImpl = MutableSegmentImplTestUtils.createMutableSegmentImpl(_schema, Collections.emptySet(),
            Collections.emptySet(), false);
    try (RecordReader recordReader = new AvroRecordReader(avroFile, _schema)) {
        GenericRow reuse = new GenericRow();
        while (recordReader.hasNext()) {
            _mutableSegmentImpl.index(recordReader.next(reuse));
        }
    }
}

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

@AfterClass
public void tearDownClass() {
    FileUtils.deleteQuietly(TEST_DIRECTORY);
}

From source file:de.cosmocode.solr.SolrJServerTest.java

/**
 * Stops the Solr server after all tests are run.
 *//*from w w  w.  java 2 s  . c  o m*/
@AfterClass
public static void stopServer() {
    LOG.debug("Stopping Solr Server...");
    core.close();
    LOG.debug("Stopped Solr Server");

    // cleanup temporary data directory
    final boolean tmpDeleted = FileUtils.deleteQuietly(tmpData);
    if (tmpDeleted) {
        LOG.debug("Temporary data directory deleted");
    } else {
        LOG.warn("Could not delete temporary data directory");
    }
}

From source file:it.geosolutions.jaiext.JAIEXTInitializationTest.java

@AfterClass
public static void fileDisposal() {
    FileUtils.deleteQuietly(newJAIFile);
    FileUtils.deleteQuietly(newJAIFile.getParentFile());
}

From source file:com.creactiviti.piper.plugin.ffmpeg.Ffprobe.java

@Override
public Map<String, Object> handle(Task aTask) throws Exception {
    CommandLine cmd = new CommandLine("ffprobe");
    cmd.addArgument("-v").addArgument("quiet").addArgument("-print_format").addArgument("json")
            .addArgument("-show_error").addArgument("-show_format").addArgument("-show_streams")
            .addArgument(aTask.getRequiredString("input"));
    log.debug("{}", cmd);
    DefaultExecutor exec = new DefaultExecutor();
    File tempFile = File.createTempFile("log", null);
    try (PrintStream stream = new PrintStream(tempFile);) {
        exec.setStreamHandler(new PumpStreamHandler(stream));
        exec.execute(cmd);//  w w  w .  j a  v a2s  .c  o  m
        return parse(FileUtils.readFileToString(tempFile));
    } catch (ExecuteException e) {
        throw new ExecuteException(e.getMessage(), e.getExitValue(),
                new RuntimeException(FileUtils.readFileToString(tempFile)));
    } finally {
        FileUtils.deleteQuietly(tempFile);
    }
}

From source file:com.thoughtworks.go.service.ConfigRepositoryTest.java

@After
public void tearDown() {
    FileUtils.deleteQuietly(env.getConfigRepoDir());
}