List of usage examples for org.apache.commons.io FileUtils deleteQuietly
public static boolean deleteQuietly(File file)
From source file:ml.shifu.shifu.actor.PostTrainActorTest.java
public void testActor() throws IOException, InterruptedException { File tmpModels = new File("models"); File tmpCommon = new File("common"); File models = new File("src/test/resources/example/cancer-judgement/ModelStore/ModelSet1/models"); FileUtils.copyDirectory(models, tmpModels); ActorRef postTrainRef = actorSystem.actorOf(new Props(new UntypedActorFactory() { private static final long serialVersionUID = 6777309320338075269L; public UntypedActor create() { return new PostTrainActor(modelConfig, columnConfigList, new AkkaExecStatus(true)); }/*www . j a v a 2 s . c o m*/ }), "post-trainer"); List<Scanner> scanners = ShifuFileUtils.getDataScanners( "src/test/resources/example/cancer-judgement/DataStore/DataSet1", SourceType.LOCAL); postTrainRef.tell(new AkkaActorInputMessage(scanners), postTrainRef); while (!postTrainRef.isTerminated()) { Thread.sleep(5000); } File file = new File("./ColumnConfig.json"); Assert.assertTrue(file.exists()); FileUtils.deleteQuietly(file); FileUtils.deleteDirectory(tmpModels); FileUtils.deleteDirectory(tmpCommon); }
From source file:ml.shifu.shifu.container.obj.ColumnConfigTest.java
@Test public void testEmptyCategory() throws IOException { List<ColumnConfig> columnConfigList = new ArrayList<ColumnConfig>(); ColumnConfig columnConfig = new ColumnConfig(); columnConfig.setColumnNum(1);// ww w. j a v a 2s .c o m columnConfig.setColumnName("TestColumn"); columnConfig.setColumnStats(new ColumnStats()); columnConfig.setColumnBinning(new ColumnBinning()); List<String> binCategoryList = new ArrayList<String>(); binCategoryList.add(""); binCategoryList.add("Hello\nWorld"); binCategoryList.add("For\tTest"); binCategoryList.add(";"); binCategoryList.add(null); columnConfig.setBinCategory(binCategoryList); columnConfigList.add(columnConfig); File columnConfigFile = new File("ColumnConfig.json"); jsonMapper.writerWithDefaultPrettyPrinter().writeValue(columnConfigFile, columnConfigList); Assert.assertTrue(columnConfigFile.exists()); FileUtils.deleteQuietly(columnConfigFile); }
From source file:com.jaspersoft.studio.dnd.DataAdapterDragSourceListener.java
@Override public void dragFinished(DragSourceEvent event) { for (String daFileLocation : dataAdapterFilesLocations) { FileUtils.deleteQuietly(new File(daFileLocation)); }//from www. j a va2s .com }
From source file:com.streamsets.pipeline.stage.destination.hdfs.TestHdfsTarget.java
@After public void after() { FileUtils.deleteQuietly(new File(testDir)); }
From source file:edu.cornell.med.icb.goby.counts.CountsArchiveWriter.java
/** * Initialize with a basename. Count information will be written to a file basename+"."+countArchiveModifier * * @param basename Basename for the alignment/counts. * @param countArchiveModifier the extension to write the archive. * @throws IOException If an error occurs preparing the packaged counts. */// w w w . j a v a 2s .c om public CountsArchiveWriter(final String basename, final String countArchiveModifier) throws IOException { final String physicalFilename = basename + "." + countArchiveModifier; final File tobedeleted = new File(physicalFilename); // delete before writing since the compound file writer supports appending. FileUtils.deleteQuietly(tobedeleted); compoundWriter = new CompoundFileWriter(physicalFilename); }
From source file:com.splunk.shuttl.archiver.usecases.ImportCsvFunctionalTest.java
@AfterMethod public void tearDown() { FileUtils.deleteQuietly(thawDirectory); FileUtils.deleteQuietly(archiverData); }
From source file:com.linkedin.pinot.core.data.readers.ThriftRecordReaderTest.java
@AfterClass public void tearDown() throws IOException { FileUtils.deleteQuietly(_tempFile); }
From source file:com.linkedin.pinot.core.segment.creator.impl.inv.OnHeapBitmapInvertedIndexCreator.java
@Override public void seal() throws IOException { try (DataOutputStream out = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(_invertedIndexFile)))) { // Write all offsets int offset = (_bitmaps.length + 1) * V1Constants.Numbers.INTEGER_SIZE; out.writeInt(offset);//from ww w.j av a2 s .c o m for (MutableRoaringBitmap bitmap : _bitmaps) { offset += bitmap.serializedSizeInBytes(); // Check for int overflow Preconditions.checkState(offset > 0, "Inverted index file exceeds 2GB limit for column: %s", _columnName); out.writeInt(offset); } // Write bitmap data for (MutableRoaringBitmap bitmap : _bitmaps) { bitmap.serialize(out); } } catch (Exception e) { FileUtils.deleteQuietly(_invertedIndexFile); throw e; } }
From source file:com.xiaomi.linden.hadoop.indexing.LindenMapredTest.java
@Test public void TestMapper() throws IOException { try {/* ww w . jav a 2 s . c o m*/ String propertiesFilePath = LindenMapredTest.class.getClassLoader().getResource("linden.properties") .getFile(); Files.copy(new File(propertiesFilePath).toPath(), Paths.get("lindenProperties"), StandardCopyOption.REPLACE_EXISTING); String schemaFilePath = LindenMapredTest.class.getClassLoader().getResource("schema.xml").getFile(); Files.copy(new File(schemaFilePath).toPath(), Paths.get("lindenSchema"), StandardCopyOption.REPLACE_EXISTING); String json = "{\"id\":0,\"groupid\":\"0\",\"tags\":\"hybrid,leather,moon-roof,reliable\",\"category\":\"compact\",\"mileage\":14900,\"price\":7500,\"contents\":\"yellow compact hybrid leather moon-roof reliable u.s.a. florida tampa asian acura 1.6el \",\"color\":\"yellow\",\"year\":1994,\"makemodel\":\"asian/acura/1.6el\",\"city\":\"u.s.a./florida/tampa\"}"; mDriver.withInput(new LongWritable(1L), new Text(json.getBytes())); mDriver.run(); } catch (Exception e) { e.printStackTrace(); Assert.assertTrue(false); } finally { FileUtils.deleteQuietly(Paths.get("lindenProperties").toFile()); FileUtils.deleteQuietly(Paths.get("lindenSchema").toFile()); } }
From source file:com.fizzed.blaze.ssh.SshBaseTest.java
public void contextWithEmptyUserDir() throws IOException { Path emptyUserDir = context.userDir().resolve("empty"); FileUtils.deleteQuietly(emptyUserDir.toFile()); Files.createDirectories(emptyUserDir); context.userDir(emptyUserDir);// w w w. jav a 2s . c om }