List of usage examples for org.apache.commons.io FileUtils deleteDirectory
public static void deleteDirectory(File directory) throws IOException
From source file:edu.northwestern.bioinformatics.studycalendar.osgi.plugininstaller.PluginInstallerTest.java
@Override protected void tearDown() throws Exception { super.tearDown(); for (File path : paths) { FileUtils.deleteDirectory(path); }//from w ww .j a v a 2s.com Thread.sleep(WAIT_FOR_FILEINSTALL); // re-start in case any other tests depend on it startBundle("edu.northwestern.bioinformatics.psc-osgi-layer-host-services"); }
From source file:com.opengamma.engine.cache.BerkeleyDBValueIdentifierMapTest.java
@AfterClass public static void deleteDbDirs() { for (File f : s_dbDirsToDelete) { try {//from w w w . j a va 2 s . c om s_logger.info("Deleting temp directory {}", f); FileUtils.deleteDirectory(f); } catch (IOException ioe) { s_logger.warn("Unable to recursively delete directory {}", f); // Just swallow it. } } s_dbDirsToDelete.clear(); }
From source file:net.sf.infrared.tool.util.FileUtil.java
public void deleteDirectory(File dir) { try {//from w w w. j a v a 2 s.co m FileUtils.deleteDirectory(dir); } catch (IOException ex) { throw new InfraredToolException("Failed to delete directory " + dir, ex); } }
From source file:com.cloudera.dataflow.spark.TransformTranslatorTest.java
@Before public void init() throws IOException { sparkRunner = SparkPipelineRunner.create(); directRunner = DirectPipelineRunner.createForTest(); testDataDirName = Joiner.on(File.separator).join("target", "test-data", name.getMethodName()) + File.separator;//from w ww. j av a2s. c om FileUtils.deleteDirectory(new File(testDataDirName)); new File(testDataDirName).mkdirs(); }
From source file:ml.shifu.shifu.actor.NormalizeDataActorTest.java
@Test public void testActor() throws IOException, InterruptedException { File tmpDir = new File("./tmp"); if (tmpDir.isDirectory()) { FileUtils.deleteDirectory(tmpDir); }/*from www.java 2 s . c o m*/ FileUtils.forceMkdir(tmpDir); ActorRef normalizeRef = actorSystem.actorOf(new Props(new UntypedActorFactory() { private static final long serialVersionUID = 6777309320338075269L; public UntypedActor create() throws IOException { return new NormalizeDataActor(modelConfig, columnConfigList, new AkkaExecStatus(true)); } }), "normalize-calculator"); List<Scanner> scanners = ShifuFileUtils.getDataScanners( "src/test/resources/example/cancer-judgement/DataStore/DataSet1", SourceType.LOCAL); normalizeRef.tell(new AkkaActorInputMessage(scanners), normalizeRef); while (!normalizeRef.isTerminated()) { Thread.sleep(5000); } File outputFile = new File("./tmp/NormalizedData"); Assert.assertTrue(outputFile.exists()); for (Scanner scanner : scanners) { scanner.close(); } }
From source file:com.skynetcomputing.skynetserver.persistence.FileManager.java
protected FileManager(boolean resetFolders) throws IOException, InterruptedException { File jobsDir = new File(JOB_FOLDER_PATH); File jarsDir = new File(JAR_FOLDER_PATH); File tempDir = new File(TEMP_FOLDER_PATH); if (resetFolders) { FileUtils.deleteDirectory(jobsDir); FileUtils.deleteDirectory(jarsDir); FileUtils.deleteDirectory(tempDir); }//from ww w. j a v a 2 s .c o m jobsDir.mkdirs(); jarsDir.mkdirs(); tempDir.mkdirs(); this.watcher = FileSystemWatcher.watch(Paths.get(TEMP_FOLDER_PATH)); }
From source file:dao.NewEntryVideoDaoTest.java
@After public void tearDown() { File file = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook"); try {/* ww w . j a v a2s . c om*/ FileUtils.deleteDirectory(file); } catch (IOException ex) { Logger.getLogger(NewEntryVideoDaoTest.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:is.artefact.flume.source.kafka.KafkaSourceEmbeddedKafka.java
public KafkaSourceEmbeddedKafka(Properties properties) { zookeeper = new KafkaSourceEmbeddedZookeeper(zkPort); dir = new File(System.getProperty("java.io.tmpdir"), "kafka_log-" + UUID.randomUUID()); try {// w w w. j a va2s . c om FileUtils.deleteDirectory(dir); } catch (IOException e) { e.printStackTrace(); } Properties props = new Properties(); props.put("zookeeper.connect", zookeeper.getConnectString()); props.put("broker.id", "1"); props.put("host.name", "localhost"); props.put("port", String.valueOf(serverPort)); props.put("log.dir", dir.getAbsolutePath()); if (properties != null) { props.putAll(properties); } KafkaConfig config = new KafkaConfig(props); kafkaServer = new KafkaServerStartable(config); kafkaServer.startup(); initProducer(); }
From source file:fi.jumi.launcher.daemon.DirBasedStewardTest.java
@Test public void throws_exception_if_cannot_create_daemon_directory() throws IOException { Path parentDir = steward.createDaemonDir(jumiHome).getParent(); FileUtils.deleteDirectory(parentDir.toFile()); Files.createFile(parentDir); // prevents it from creating the daemon directory thrown.expect(RuntimeException.class); thrown.expectMessage("Unable to create daemon directory"); thrown.expectCause(instanceOf(FileAlreadyExistsException.class)); steward.createDaemonDir(jumiHome);/*from ww w.j a v a 2s. c om*/ }
From source file:edu.uci.ics.asterix.test.metadata.MetadataTest.java
private static void deleteTransactionLogs() throws Exception { for (String ncId : AsterixHyracksIntegrationUtil.NC_IDS) { File log = new File(txnProperties.getLogDirectory(ncId)); if (log.exists()) { FileUtils.deleteDirectory(log); }/* ww w .j av a2 s .c om*/ } }