List of usage examples for org.apache.commons.io FileUtils deleteQuietly
public static boolean deleteQuietly(File file)
From source file:ml.shifu.shifu.actor.CalculateStatsActorTest.java
@AfterClass public void delete() throws IOException { File file = new File("./ColumnConfig.json"); if (file.exists()) { FileUtils.deleteQuietly(file); }/* w w w . j av a 2s . com*/ }
From source file:io.fluo.quickstart.MiniHelper.java
@Override public void close() throws Exception { miniFluo.stop(); cluster.stop(); FileUtils.deleteQuietly(dir); }
From source file:ml.shifu.shifu.core.pmml.PMMLTranslatorTest.java
@Test public void testAllNumericVariablePmmlCase() throws Exception { // Step 1. Eval the scores using SHIFU File originModel = new File( "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ModelConfig.json"); File tmpModel = new File("ModelConfig.json"); File originColumn = new File( "src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/ColumnConfig.json"); File tmpColumn = new File("ColumnConfig.json"); File modelsDir = new File("src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models"); File tmpModelsDir = new File("models"); FileUtils.copyFile(originModel, tmpModel); FileUtils.copyFile(originColumn, tmpColumn); FileUtils.copyDirectory(modelsDir, tmpModelsDir); // run evaluation set ShifuCLI.runEvalScore("EvalA"); File evalScore = new File("evals/EvalA/EvalScore"); ShifuCLI.exportModel(null);/*from www .j a v a 2 s. c om*/ // Step 2. Eval the scores using PMML and compare it with SHIFU output String DataPath = "./src/test/resources/example/cancer-judgement/DataStore/Full_data/data.dat"; String OutPath = "./pmml_out.dat"; for (int index = 0; index < 5; index++) { String num = Integer.toString(index); String pmmlPath = "pmmls/cancer-judgement" + num + ".pmml"; evalPmml(pmmlPath, DataPath, OutPath, "\\|", "model" + num); compareScore(evalScore, new File(OutPath), "model" + num, "\\|", 1.0); FileUtils.deleteQuietly(new File(OutPath)); } FileUtils.deleteQuietly(tmpModel); FileUtils.deleteQuietly(tmpColumn); FileUtils.deleteDirectory(tmpModelsDir); FileUtils.deleteQuietly(new File("./pmmls")); FileUtils.deleteQuietly(new File("evals")); }
From source file:com.linkedin.pinot.core.segment.index.loader.LoaderTest.java
@BeforeClass public void setUp() throws Exception { FileUtils.deleteQuietly(INDEX_DIR); URL resourceUrl = getClass().getClassLoader().getResource(AVRO_DATA); Assert.assertNotNull(resourceUrl);//from www . j av a 2s .c o m _avroFile = new File(resourceUrl.getFile()); _v1IndexLoadingConfig = new IndexLoadingConfig(); _v1IndexLoadingConfig.setReadMode(ReadMode.mmap); _v1IndexLoadingConfig.setSegmentVersion(SegmentVersion.v1); _v3IndexLoadingConfig = new IndexLoadingConfig(); _v3IndexLoadingConfig.setReadMode(ReadMode.mmap); _v3IndexLoadingConfig.setSegmentVersion(SegmentVersion.v3); }
From source file:com.adguard.compiler.LocaleUtils.java
public static void convertFromChromeToFirefoxLocales(File chromeLocalesDir) throws IOException { for (File file : chromeLocalesDir.listFiles()) { File chromeLocaleFile = new File(file, "messages.json"); if (!SupportedLocales.supported(file.getName())) { FileUtils.deleteQuietly(file); continue; }/*www . jav a 2 s. com*/ String firefoxLocale = StringUtils.replace(file.getName(), "_", "-"); File appLocaleFile = new File(chromeLocalesDir, firefoxLocale + ".properties"); byte[] content = FileUtils.readFileToByteArray(chromeLocaleFile); Map map = objectMapper.readValue(content, Map.class); StringBuilder sb = new StringBuilder(); for (Object key : map.keySet()) { String message = (String) ((Map) map.get(key)).get("message"); message = message.replaceAll("\n", "\\\\n"); sb.append(key).append("=").append(message); sb.append(System.lineSeparator()); } FileUtils.writeStringToFile(appLocaleFile, sb.toString(), "utf-8"); FileUtils.deleteQuietly(file); } }
From source file:com.github.wesjd.overcastmappacker.xml.module.impl.XMLTest.java
@org.junit.Test public void testXML() { final File tempDir = new File(System.getProperty("java.io.tmpdir")); tempDir.mkdirs();//w w w . ja v a2s . com final File xmlTest = new File(tempDir, "mappackerxmltest.xml"); final DocumentHandler handler = DocumentHandler.createNewXMLFile(xmlTest); handler.set(null, NameModule.class, "A Test Map"); handler.set(null, NameModule.class, "HI I CHANGED PROPERLY"); handler.set(null, VersionModule.class, "1.0.0"); handler.set(null, ObjectiveModule.class, "A description."); handler.set(ContributorsParentModule.class, ContributorModule.class, "A contributor.", ContinuingMap.from("contribution", "Helping.").add("uuid", "a-u-u-i-d")); handler.saveDocument(); Assert.assertTrue("Check name module", handler.getLoadedDocument().getElementsByTagName("name").item(0) .getTextContent().equals("HI I CHANGED PROPERLY")); Assert.assertTrue("Check contributors parent", handler.getLoadedDocument().getElementsByTagName("contributors").item(0) != null); Assert.assertTrue("Check contributor", handler.getLoadedDocument().getElementsByTagName("contributor").getLength() > 0); FileUtils.deleteQuietly(xmlTest); }
From source file:com.splunk.shuttl.archiver.retry.ColdToFrozenRetrierTest.java
@AfterMethod public void tearDown() { FileUtils.deleteQuietly(safeBucketDirectory); }
From source file:com.linkedin.pinot.core.startree.TestStarTreeMetadata.java
private void setupSegment(File segmentDir) throws Exception { final String filePath = TestUtils .getFileFromResourceUrl(getClass().getClassLoader().getResource(AVRO_DATA)); if (segmentDir.exists()) { FileUtils.deleteQuietly(segmentDir); }//www. ja v a 2 s.c o m final SegmentGeneratorConfig config = SegmentTestUtils.getSegmentGenSpecWithSchemAndProjectedColumns( new File(filePath), segmentDir, "time_day", TimeUnit.DAYS, TABLE_NAME); config.setTableName(TABLE_NAME); config.setSegmentName(SEGMENT_NAME); StarTreeIndexSpec starTreeIndexSpec = new StarTreeIndexSpec(); starTreeIndexSpec.setDimensionsSplitOrder(DIMENSIONS_SPLIT_ORDER); starTreeIndexSpec.setMaxLeafRecords(MAX_LEAF_RECORDS); starTreeIndexSpec.setSkipMaterializationCardinalityThreshold(SKIP_CARDINALITY_THRESHOLD); starTreeIndexSpec.setSkipStarNodeCreationForDimensions(SKIP_STAR_NODE_CREATION_DIMENSTIONS); starTreeIndexSpec.setSkipMaterializationForDimensions(SKIP_MATERIALIZATION_DIMENSIONS); config.setEnableStarTreeIndex(true); config.setStarTreeIndexSpec(starTreeIndexSpec); final SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null); driver.init(config); driver.build(); }
From source file:com.liferay.server.manager.internal.executor.PluginExecutor.java
@Override public void executeCreate(HttpServletRequest request, JSONObject responseJSONObject, Queue<String> arguments) throws Exception { AutoDeploymentContext autoDeploymentContext = new AutoDeploymentContext(); String context = arguments.poll(); autoDeploymentContext.setContext(context); File tempFile = getTempFile(request, responseJSONObject); if (tempFile == null) { return;/*from ww w . j a va 2 s . co m*/ } autoDeploymentContext.setFile(tempFile); DeployManagerUtil.deploy(autoDeploymentContext); boolean success = FileUtils.deleteQuietly(tempFile.getParentFile()); if (success) { return; } String message = "Unable to remove temp directory " + tempFile.getParentFile(); _log.error(message); responseJSONObject.put(JSONKeys.ERROR, message); success = FileUtils.deleteQuietly(tempFile); if (success) { return; } message = "Unable to remove temp file " + tempFile; _log.error(message); responseJSONObject.put(JSONKeys.ERROR, message); }
From source file:com.splunk.shuttl.archiver.metastore.MetadataStoreReadIntegrationTest.java
@BeforeMethod public void setUp() { ArchiveConfiguration config = TUtilsFunctional.getLocalFileSystemConfiguration(); localFileSystem = ArchiveFileSystemFactory.getWithConfiguration(config); pathResolver = new PathResolver(config); localFileSystemPaths = new LocalFileSystemPaths(createDirectory()); flatFileStorage = new FlatFileStorage(localFileSystemPaths); metadataStore = new MetadataStore(pathResolver, flatFileStorage, localFileSystem, new TransactionExecuter(), localFileSystemPaths);// ww w. j ava 2 s . com remoteBucket = TUtilsBucket.createRemoteBucket(); expectedData = "data"; fileName = "FileNameOfMetadataFile.file"; localMetadata = flatFileStorage.getFlatFile(remoteBucket, fileName); String metadataPath = pathResolver.resolvePathForBucketMetadata(remoteBucket, localMetadata); remoteMetadata = new File(metadataPath); FileUtils.deleteQuietly(remoteMetadata); FileUtils.deleteQuietly(localMetadata); }