List of usage examples for org.apache.commons.io FileUtils deleteDirectory
public static void deleteDirectory(File directory) throws IOException
From source file:com.google.caliper.runner.ParsedOptionsTest.java
@Override protected void tearDown() throws IOException { if (tempDir != null) { FileUtils.deleteDirectory(tempDir); } }
From source file:com.serli.open.data.poitiers.jobs.importer.ImportAllDataJobTest.java
public static void createDevNode() { LOGGER.info("Creating dev ES node ..."); Path localDevDataDirectory = Paths.get(ES_LOCAL_DATA); try {/* w w w.j a v a 2 s . c om*/ FileUtils.deleteDirectory(localDevDataDirectory.toFile()); } catch (IOException e) { throw new RuntimeException(e); } Settings settings = ImmutableSettings.builder().put("http.port", "9200").put("network.host", "localhost") .put("path.data", ES_LOCAL_DATA).build(); Node node = NodeBuilder.nodeBuilder().local(true).data(true) .clusterName("elasticSearch" + UUID.randomUUID()).settings(settings).build(); node.start(); // loading settings run(ReloadDefaultSettings.class); ImportAllDataJob.elasticType = "test-ES"; ImportAllDataJob.filename = "conf/test-ES.properties"; run(ImportAllDataJob.class); }
From source file:io.pravega.segmentstore.storage.impl.bookkeeper.ZooKeeperServiceRunner.java
@Override public void close() throws Exception { if (this.server.get() != null) { this.server.get().shutdown(); }// ww w . j a v a 2 s .c o m if (this.tmpDir != null) { log.info("Cleaning up " + this.tmpDir); FileUtils.deleteDirectory(this.tmpDir); } }
From source file:com.gs.obevo.db.impl.platforms.hsql.HsqlRevengTest.java
@Test @Override/*from www. j a v a2 s . c om*/ public void testReverseEngineeringFromFile() throws Exception { AquaRevengArgs args = new AquaRevengArgs(); args.setDbSchema("MYSCHEMA01"); args.setGenerateBaseline(false); args.setJdbcUrl("jdbc:hsqldb:mem:hsqldbreveng"); args.setUsername("myuser"); args.setPassword("mypass"); File outputDir = new File("./target/outputReveng"); FileUtils.deleteDirectory(outputDir); args.setOutputPath(outputDir); args.setInputPath(new File("./src/test/resources/reveng/hsql/input.sql")); new HsqlDbPlatform().getDdlReveng().reveng(args); DirectoryAssert.assertDirectoriesEqual(new File("./src/test/resources/reveng/hsql/expected"), new File(outputDir, "final")); // Ensure that we can still build the schema that was reverse engineered DbEnvironment prod = DbEnvironmentFactory.getInstance() .readOneFromSourcePath(new File(outputDir, "final").getAbsolutePath(), "prod"); prod.setCleanBuildAllowed(true); prod.buildAppContext("sa", "").setupEnvInfra().cleanEnvironment().deploy(); }
From source file:ezbake.frack.common.utils.PollingDirectoryWatcherTest.java
@Test public void testPoll_NoFiles() throws IOException, InterruptedException { File directory = new File("test_dir"); directory.mkdir();/*from w ww. ja v a 2 s. com*/ try { final PollingDirectoryWatcher watcher = new PollingDirectoryWatcher(2000, directory); Optional<File[]> result = watcher.poll(); assertFalse("No files retrieved", result.isPresent()); } finally { FileUtils.deleteDirectory(directory); } }
From source file:gndata.app.ui.main.MenuCtrlTest.java
@After public void tearDown() throws Exception { if (Files.exists(tmpPath)) { FileUtils.deleteDirectory(tmpPath.toFile()); }/*from www . j av a2s .c om*/ if (Files.exists(tmpConf)) { Files.delete(tmpConf); } }
From source file:com.splunk.shuttl.archiver.model.BucketTest.java
@AfterMethod(groups = { "fast-unit" }) public void tearDown() throws IOException { if (rootTestDirectory != null) FileUtils.deleteDirectory(rootTestDirectory); }
From source file:jetbrick.tools.chm.Application.java
private static void clean() throws IOException { File f = new File(Config.apiLocation, "htmlhelp.hhp"); if (f.exists()) f.delete();// w w w . ja va 2 s .com f = new File(Config.apiLocation, "htmlhelp.hhc"); if (f.exists()) f.delete(); f = new File(Config.apiLocation, "htmlhelp.hhk"); if (f.exists()) f.delete(); f = new File(Config.apiLocation, "build.bat"); if (f.exists()) f.delete(); f = new File(Config.apiLocation, "hhc.exe"); if (f.exists()) f.delete(); f = new File(Config.apiLocation, "hha.dll"); if (f.exists()) f.delete(); f = new File(Config.apiLocation, "redirs/"); if (f.exists()) FileUtils.deleteDirectory(f); }
From source file:gobblin.writer.AvroToParquetHdfsTimePartitionedWriterTest.java
@BeforeClass public static void setUp() throws IOException { File stagingDir = new File(STAGING_DIR); File outputDir = new File(OUTPUT_DIR); if (!stagingDir.exists()) { stagingDir.mkdirs();/* ww w . java 2s . c om*/ } else { FileUtils.deleteDirectory(stagingDir); } if (!outputDir.exists()) { outputDir.mkdirs(); } else { FileUtils.deleteDirectory(outputDir); } schema = new Schema.Parser().parse(AVRO_SCHEMA); State properties = new State(); properties.setProp(ConfigurationKeys.WRITER_PARTITION_COLUMN_NAME, PARTITION_COLUMN_NAME); properties.setProp(ConfigurationKeys.WRITER_BUFFER_SIZE, ConfigurationKeys.DEFAULT_BUFFER_SIZE); properties.setProp(ConfigurationKeys.WRITER_FILE_SYSTEM_URI, ConfigurationKeys.LOCAL_FS_URI); properties.setProp(ConfigurationKeys.WRITER_STAGING_DIR, STAGING_DIR); properties.setProp(ConfigurationKeys.WRITER_OUTPUT_DIR, OUTPUT_DIR); properties.setProp(ConfigurationKeys.WRITER_FILE_PATH, BASE_FILE_PATH); properties.setProp(ConfigurationKeys.WRITER_FILE_NAME, FILE_NAME); // Build a writer to write test records writer = new AvroToParquetTimePartitionedWriterBuilder() .writeTo(Destination.of(Destination.DestinationType.HDFS, properties)) .writeInFormat(WriterOutputFormat.PARQUET).withWriterId(WRITER_ID).withSchema(schema) .withBranches(1).forBranch(0).build(); }
From source file:com.linkedin.pinot.filesystem.LocalPinotFS.java
@Override public boolean delete(URI segmentUri) throws IOException { File file = new File(segmentUri); if (file.isDirectory()) { // Throws an IOException if it is unable to delete FileUtils.deleteDirectory(file); } else {//from w w w.ja v a 2 s . c om // Returns false if delete fails return FileUtils.deleteQuietly(file); } return true; }