List of usage examples for org.apache.commons.io FileUtils deleteQuietly
public static boolean deleteQuietly(File file)
From source file:de.hybris.platform.licence.sap.HybrisAdminTest.java
@Test public void shouldInstallLicenseFromFile() throws Exception { // given/*from ww w . j ava 2 s.c o m*/ final String licenseFileLocation = getLicenseFileLocation(); writeStandardLicenseFile(licenseFileLocation); final String[] args = new String[] { "-i", licenseFileLocation }; assertThat(validator.validateLicense("CPS_HDB").isValid()).isFalse(); // when HybrisAdmin.main(args); // then assertThat(validator.validateLicense("CPS_HDB").isValid()).isTrue(); FileUtils.deleteQuietly(new File(licenseFileLocation)); }
From source file:com.netflix.suro.client.async.TestAsyncSuroClientWithNonExistentFilePath.java
@After public void tearDown() throws Exception { FileUtils.deleteDirectory(new File(NON_EXISTENT_PATH)); FileUtils.deleteQuietly(new File(TEMP_FILE)); TestConnectionPool.shutdownServers(servers); injector.getInstance(LifecycleManager.class).close(); assertFalse(String.format("The directory %s should be deleted", NON_EXISTENT_PATH), new File(NON_EXISTENT_PATH).exists()); }
From source file:com.adaptris.core.fs.TraversingFsConsumerTest.java
public void testConsume() throws Exception { String subDir = new GuidGenerator().safeUUID(); MockMessageListener stub = new MockMessageListener(10); FsConsumer fs = createConsumer(subDir); fs.setReacquireLockBetweenMessages(true); fs.setPoller(new FixedIntervalPoller(new TimeInterval(300L, TimeUnit.MILLISECONDS))); StandaloneConsumer sc = new StandaloneConsumer(fs); sc.registerAdaptrisMessageListener(stub); int count = 10; File parentDir = FsHelper//from w ww . jav a2 s. co m .createFileReference(FsHelper.createUrlFromString(PROPERTIES.getProperty(BASE_KEY), true)); try { File baseDir = new File(parentDir, subDir); start(sc); createFiles(baseDir, ".xml", count); waitForMessages(stub, count); assertMessages(stub.getMessages(), count); } finally { stop(sc); FileUtils.deleteQuietly(new File(parentDir, subDir)); } }
From source file:com.seagate.kinetic.SimulatorTestTarget.java
private void deleteJavaServerAuxilaryData(SimulatorConfiguration simulatorConfiguration) { String kineticHome = System.getProperty("user.home") + File.separator + "kinetic"; if (simulatorConfiguration.getProperty(SimulatorConfiguration.KINETIC_HOME) != null) { kineticHome = simulatorConfiguration.getProperty(SimulatorConfiguration.KINETIC_HOME); }//from w w w .ja v a2s . c o m FileUtils.deleteQuietly(new File(kineticHome)); String defaultHome = System.getProperty("user.home") + File.separator + "leafcutter"; String leafcutterHome = simulatorConfiguration.getProperty(SimulatorConfiguration.KINETIC_HOME, defaultHome); FileUtils.deleteQuietly(new File(leafcutterHome)); }
From source file:com.openkm.jcr.SecurityTest.java
@Override protected void tearDown() { log.debug("tearDown()"); log.debug("Delete repository: {}", TestConfig.REPOSITORY_HOME); FileUtils.deleteQuietly(new File(TestConfig.REPOSITORY_HOME)); }
From source file:ddf.content.plugin.video.TestVideoThumbnailPlugin.java
@After public void tearDown() { videoThumbnailPlugin.destroy();//from w w w. jav a 2 s . com final File binaryFolder = new File(binaryPath); if (binaryFolder.exists() && !FileUtils.deleteQuietly(binaryFolder)) { binaryFolder.deleteOnExit(); } }
From source file:io.treefarm.plugins.haxe.CompileHxcppMojo.java
@Override public void execute() throws MojoExecutionException, MojoFailureException { super.execute(); File projectFile;/* w w w. j a v a2 s . co m*/ if (cacheFiles != null) { File cacheFile; for (String cacheFileName : cacheFiles) { getLog().info("Deleting cache '" + cacheFileName + "'."); cacheFile = new File(cacheFileName); FileUtils.deleteQuietly(cacheFile); } } if (hxcppProjectFile != null) { projectFile = new File(hxcppProjectFile); if (projectFile.exists()) { getLog().info("Building Hxcpp project '" + projectFile.getName() + "'."); try { hxcppCompiler.initialize(debug); hxcppCompiler.compile(project, projectFile, projectFile.getParentFile(), compilerFlags); } catch (Exception e) { throw new MojoFailureException("Hxcpp build failed ", e); } if (relocateFiles != null && relocateFiles.containsKey("source") && relocateFiles.containsKey("destination")) { try { File source = new File(relocateFiles.get("source")); File destination = new File(relocateFiles.get("destination")); if (source.exists()) { getLog().info("Relocating '" + source.getAbsolutePath() + "' to '" + destination.getAbsolutePath() + "'"); source.renameTo(destination); } else { getLog().error("Hxcpp relocate cannot move '" + source.getAbsolutePath() + "' as it appears not to exist!"); } } catch (Exception e) { throw new MojoFailureException("Hxcpp relocate failed ", e); } } } else { throw new MojoFailureException( "Hxcpp project file '" + projectFile.getName() + "' does not exist!"); } } }
From source file:ml.shifu.shifu.core.LogisticRegressionTest.java
@AfterClass public void tearDown() throws IOException { FileUtils.deleteDirectory(new File("./models/")); FileUtils.deleteDirectory(new File("./modelsTmp/")); FileUtils.deleteQuietly(new File("ModelConfig.json")); FileUtils.deleteDirectory(new File("test")); }
From source file:com.yata.core.FileManager.java
public static void deleteDirectoryContent(String filePath) { System.out.println("deleteFile@" + className + " : File to Delete :-> " + filePath); File file = new File(filePath); for (File childFile : file.listFiles()) { FileUtils.deleteQuietly(childFile); }/*from w w w . ja va2s .c om*/ }
From source file:de.tudarmstadt.ukp.dkpro.tc.fstore.simple.SparseFeatureStoreTest.java
@Test public void testSerializeJSON() throws Exception { Gson gson = new Gson(); File tmpFile = File.createTempFile("tempFeatureStore", ".json"); FileUtils.writeStringToFile(tmpFile, gson.toJson(featureStore)); // make sure we have correctly filled instance testValuesOfDefaultFeatureStoreInstance(featureStore); FeatureStore fs = gson.fromJson(FileUtils.readFileToString(tmpFile), SparseFeatureStore.class); // test deserialized values testValuesOfDefaultFeatureStoreInstance(fs); FileUtils.deleteQuietly(tmpFile); }