List of usage examples for org.apache.commons.io FileUtils deleteDirectory
public static void deleteDirectory(File directory) throws IOException
From source file:io.apiman.manager.test.server.ApiManagerTestPluginRegistry.java
/** * Creates the temp directory to use for the plugin registry. This will put * the temp dir in the target directory so it gets cleaned when a maven * build is done.//from w w w . ja v a 2 s . c om */ private static File getTestPluginDir() { File targetDir = new File("target").getAbsoluteFile(); //$NON-NLS-1$ if (!targetDir.isDirectory()) { throw new RuntimeException("Maven 'target' directory does not exist!"); //$NON-NLS-1$ } File pluginDir = new File(targetDir, "plugintmp"); //$NON-NLS-1$ try { FileUtils.deleteDirectory(pluginDir); pluginDir.mkdirs(); } catch (IOException e) { } return pluginDir; }
From source file:com.netflix.imfutility.itunes.chapters.ChaptersXmlProviderTest.java
@BeforeClass public static void setupAll() throws IOException { // create both working directory and logs folder. FileUtils.deleteDirectory(TemplateParameterContextCreator.getWorkingDir()); File workingDir = TemplateParameterContextCreator.getWorkingDir(); if (!workingDir.mkdir()) { throw new RuntimeException("Could not create a working dir within tmp folder"); }/*from w ww . j a va 2 s . com*/ // set user.dir to working directory userDir = System.getProperty("user.dir"); System.setProperty("user.dir", workingDir.getAbsolutePath()); ChaptersUtils.createChapterFile(1); ChaptersUtils.createChapterFile(2); }
From source file:io.stallion.tests.integration.jobs.JobsTests.java
@BeforeClass public static void setUpClass() throws Exception { startApp("/a_minimal_site"); File tasksDir = new File(Context.getSettings().getDataDirectory() + "/st-jobs-job-status"); if (tasksDir.isDirectory()) { FileUtils.deleteDirectory(tasksDir); }//from www .j a v a 2 s .c om //JobStatusController.selfRegister(); JobCoordinator.initForTesting(); }
From source file:de.uni_hildesheim.sse.easy.ant.modelcopy.ModelCopyTest.java
/** * Copies the QualiMaster model and test precondition. The methods tests whether specific files are copied * correctly. /* w w w . j a va 2 s . c o m*/ */ @BeforeClass public static void setUpBeforeClass() { // Test precondition: Dest folder does not exist, org folder does exist if (DESTINATION_FOLDER.exists()) { try { FileUtils.deleteDirectory(DESTINATION_FOLDER); } catch (IOException e) { Assert.fail("Could not cleanup destination directory \"" + DESTINATION_FOLDER.getAbsolutePath() + "\":" + e.getMessage()); } } Assert.assertFalse("Destination folder \"" + DESTINATION_FOLDER.getAbsolutePath() + "\"exists and could not be deleted.", DESTINATION_FOLDER.exists()); Assert.assertTrue("Original folder \"" + ORIGINAL_FOLDER.getAbsolutePath() + "\"does not exist.", ORIGINAL_FOLDER.exists()); ModelCopy copy = new ModelCopy(ORIGINAL_FOLDER.getAbsolutePath(), DESTINATION_FOLDER.getAbsolutePath(), MAIN_PROJECT); copy.execute(); }
From source file:eu.delving.services.MockServices.java
public static void start() { try {// w w w . j a va2s . c om String root = StarterUtil.getEuropeanaPath(); System.setProperty("launch.properties", MockServices.class.getResource("/mock-launch.properties").getFile()); dropMongoDatabase(); System.setProperty("solr.solr.home", root + "/core/src/test/solr/single-core"); String solrDataDir = root + "/core/target/solrdata/mock_services"; System.setProperty("solr.data.dir", solrDataDir); FileUtils.deleteDirectory(new File(solrDataDir)); server.addHandler(new WebAppContext(root + "/services/src/main/webapp", "/services")); server.addHandler(new WebAppContext(root + "/core/src/test/solr/solr-1.4.1.war", "/solr")); server.start(); } catch (Exception e) { throw new RuntimeException("Couldn't start server", e); } }
From source file:hu.juranyi.zsolt.jauthortagger.util.TestUtils.java
public static void deleteTestDir() { try {// w w w. j a v a 2 s. c om FileUtils.deleteDirectory(TEST_DIR); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.adguard.compiler.FileUtil.java
public static void copyFiles(File source, File dest, Browser browser) throws Exception { if (dest.exists()) { FileUtils.deleteDirectory(dest); }/*ww w. ja va2 s .c om*/ switch (browser) { case CHROMIUM: copyChromiumFiles(source, dest); break; case SAFARI: copySafariFiles(source, dest); break; case FIREFOX: copyFirefoxFiles(source, dest); break; case FIREFOX_LEGACY: copyFirefoxLegacyFiles(source, dest); break; } }
From source file:com.groupon.odo.bmp.Utils.java
/** * Gets a keystore manager for a given hostname * Creates one/key if it does not already exist * @param hostname/*from www . j a v a 2 s .c om*/ * @return * @throws Exception */ public static KeyStoreManager getKeyStoreManager(String hostname) throws Exception { File root = getKeyStoreRoot(hostname); // create entry KeyStoreManager keyStoreManager = new KeyStoreManager(root); // under the hood this will generate the cert if it doesn't exist keyStoreManager.getCertificateByHostname(hostname); // use this since getCertificateByHostname always returns null, but hostname == alias for our purpose X509Certificate cert = keyStoreManager.getCertificateByAlias(hostname); try { cert.checkValidity(); } catch (CertificateExpiredException cee) { // if the cert is expired we should destroy it and recursively call this function keyStoreManager = null; FileUtils.deleteDirectory(root); return getKeyStoreManager(hostname); } return keyStoreManager; }
From source file:net.sf.springderby.DeleteDatabaseAction.java
public void execute(OfflineActionContext context) throws Exception { FileUtils.deleteDirectory(context.getDatabaseLocation()); }
From source file:hu.petabyte.redflags.engine.test.DirectoryScopeTest.java
@AfterClass public static void cleanup() { try {/*from ww w .j av a 2s .c o m*/ FileUtils.deleteDirectory(new File(directory)); } catch (IOException e) { e.printStackTrace(); } }