List of usage examples for org.apache.commons.io FileUtils deleteDirectory
public static void deleteDirectory(File directory) throws IOException
From source file:com.adaptris.fs.StandardWorkerTest.java
@After public void tearDown() { try { FileUtils.deleteDirectory(baseDir); } catch (IOException e) { } }
From source file:ml.shifu.shifu.util.ModelSpecLoaderUtilsTest.java
@Test public void testFindModels() throws IOException { ModelConfig modelConfig = CommonUtils.loadModelConfig( "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ModelConfig.json", SourceType.LOCAL);// w ww . ja v a 2 s . c om File srcModels = new File("src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models"); File dstModels = new File("models"); FileUtils.copyDirectory(srcModels, dstModels); List<FileStatus> modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, null, SourceType.LOCAL); Assert.assertEquals(5, modelFiles.size()); EvalConfig evalConfig = modelConfig.getEvalConfigByName("EvalA"); evalConfig.setCustomPaths(new HashMap<String, String>()); evalConfig.getCustomPaths().put(Constants.KEY_MODELS_PATH, null); modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, evalConfig, SourceType.LOCAL); Assert.assertEquals(5, modelFiles.size()); evalConfig.getCustomPaths().put(Constants.KEY_MODELS_PATH, " "); modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, evalConfig, SourceType.LOCAL); Assert.assertEquals(5, modelFiles.size()); FileUtils.deleteDirectory(dstModels); evalConfig.getCustomPaths().put(Constants.KEY_MODELS_PATH, "./src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models"); modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, evalConfig, SourceType.LOCAL); Assert.assertEquals(5, modelFiles.size()); evalConfig.getCustomPaths().put(Constants.KEY_MODELS_PATH, "./src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models/model0.nn"); modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, evalConfig, SourceType.LOCAL); Assert.assertEquals(1, modelFiles.size()); evalConfig.getCustomPaths().put(Constants.KEY_MODELS_PATH, "not-exists"); modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, evalConfig, SourceType.LOCAL); Assert.assertEquals(0, modelFiles.size()); evalConfig.getCustomPaths().put(Constants.KEY_MODELS_PATH, "./src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models/*.nn"); modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, evalConfig, SourceType.LOCAL); Assert.assertEquals(5, modelFiles.size()); evalConfig.getCustomPaths().put(Constants.KEY_MODELS_PATH, "./src/test/resources/example/cancer-judgement/ModelStore/ModelSet{0,1,9}/*/*.nn"); modelFiles = ModelSpecLoaderUtils.findModels(modelConfig, evalConfig, SourceType.LOCAL); Assert.assertEquals(5, modelFiles.size()); }
From source file:azkaban.execapp.FlowRunnerTest.java
@Before public void setUp() throws Exception { System.out.println("Create temp dir"); synchronized (this) { workingDir = new File("_AzkabanTestDir_" + System.currentTimeMillis()); if (workingDir.exists()) { FileUtils.deleteDirectory(workingDir); }/*from w w w . ja v a 2 s . c o m*/ workingDir.mkdirs(); } jobtypeManager = new JobTypeManager(null, null, this.getClass().getClassLoader()); JobTypePluginSet pluginSet = jobtypeManager.getJobTypePluginSet(); pluginSet.addPluginClass("java", JavaJob.class); pluginSet.addPluginClass("test", InteractiveTestJob.class); fakeProjectLoader = new MockProjectLoader(workingDir); InteractiveTestJob.clearTestJobs(); }
From source file:it.sonarlint.cli.LanguageTest.java
@Test public void testRunTwice() throws IOException { Path project = sonarlint.deployProject("java-sample"); int code = sonarlint.run(project); assertThat(code).isEqualTo(0);/*from w ww . jav a 2s . c o m*/ assertThat(sonarlint.getOut()).contains("11 issues"); assertThat(sonarlint.getOut()).contains("1 critical"); assertThat(sonarlint.getOut()).contains("5 major"); assertThat(sonarlint.getOut()).contains("5 minor"); assertThat(sonarlint.getOut()).contains("2 files analyzed"); FileUtils.deleteDirectory(project.resolve(".sonarlint").toFile()); code = sonarlint.run(project); assertThat(code).isEqualTo(0); assertThat(sonarlint.getOut()).contains("11 issues"); assertThat(sonarlint.getOut()).contains("1 critical"); assertThat(sonarlint.getOut()).contains("5 major"); assertThat(sonarlint.getOut()).contains("5 minor"); assertThat(sonarlint.getOut()).contains("2 files analyzed"); }
From source file:com.tripod.solr.util.EmbeddedSolrServerFactory.java
/** * @param solrHome the Solr home directory to use * @param configSetHome the directory containing config sets * @param coreName the name of the core, must have a matching directory in configHome * @param cleanSolrHome if true the directory for solrHome will be deleted and re-created if it already exists * @return an EmbeddedSolrServer with a core created for the given coreName *///from w w w. j a va 2s . c o m public static SolrClient create(final String solrHome, final String configSetHome, final String coreName, final boolean cleanSolrHome) throws IOException, SolrServerException { final File solrHomeDir = new File(solrHome); if (solrHomeDir.exists()) { FileUtils.deleteDirectory(solrHomeDir); solrHomeDir.mkdirs(); } else { solrHomeDir.mkdirs(); } final SolrResourceLoader loader = new SolrResourceLoader(solrHomeDir.toPath()); final Path configSetPath = Paths.get(configSetHome).toAbsolutePath(); final NodeConfig config = new NodeConfig.NodeConfigBuilder("embeddedSolrServerNode", loader) .setConfigSetBaseDirectory(configSetPath.toString()).build(); final EmbeddedSolrServer embeddedSolrServer = new EmbeddedSolrServer(config, coreName); final CoreAdminRequest.Create createRequest = new CoreAdminRequest.Create(); createRequest.setCoreName(coreName); createRequest.setConfigSet(coreName); embeddedSolrServer.request(createRequest); return embeddedSolrServer; }
From source file:cosmos.results.integration.CosmosIntegrationTest.java
@AfterClass public static void stopAccumuloCluster() throws Exception { mac.stop(); FileUtils.deleteDirectory(macDir); }
From source file:azkaban.execapp.event.LocalFlowWatcherTest.java
public File setupDirectory() throws IOException { System.out.println("Create temp dir"); File workingDir = new File("_AzkabanTestDir_" + dirVal); if (workingDir.exists()) { FileUtils.deleteDirectory(workingDir); }//ww w . ja va 2 s . co m workingDir.mkdirs(); dirVal++; return workingDir; }
From source file:com.linuxbox.enkive.docstore.mongo.FileDocStoreServiceTest.java
@AfterClass public static void tearDownClass() throws Exception { docStoreService.shutdown();/*from w w w .j a v a 2 s .c o m*/ // Clean up after ourselves Dropper.dropCollection(TestingConstants.MONGODB_TEST_DATABASE, FILE_COLLECTION); FileUtils.deleteDirectory(new File(TestingConstants.MONGODB_TEST_FILEBASE)); }
From source file:io.druid.cli.convert.ConvertPropertiesTest.java
@After public void tearDown() throws IOException { FileUtils.deleteDirectory(tmpFolder.getRoot()); }
From source file:azkaban.utils.FileIOUtilsTest.java
@After public void tearDown() throws Exception { temp.delete();/*from ww w.jav a 2s . co m*/ FileUtils.deleteDirectory(baseDir); FileUtils.deleteDirectory(sourceDir); FileUtils.deleteDirectory(destDir); }