List of usage examples for org.apache.hadoop.fs FileUtil fullyDelete
public static boolean fullyDelete(final File dir)
From source file:org.apache.nutch.indexer.TestIndexSorter.java
License:Apache License
protected void tearDown() throws Exception { FileUtil.fullyDelete(testDir); }
From source file:org.apache.oozie.tools.TestOozieDBCLI.java
License:Apache License
@BeforeClass protected void setUp() throws Exception { SECURITY_MANAGER = System.getSecurityManager(); new LauncherSecurityManager(); // remove an old variant FileUtil.fullyDelete(new File("target/test-data/oozietests/org.apache.oozie.tools.TestOozieDBCLI/data.db")); this.oozieConfig = System.getProperty("oozie.test.config.file"); File oozieConfig = new File("src/test/resources/hsqldb-oozie-site.xml"); System.setProperty("oozie.test.config.file", oozieConfig.getAbsolutePath()); Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); Connection conn = DriverManager.getConnection(url, "sa", ""); conn.close();//from w ww. j a va2 s.c o m super.setUp(false); }
From source file:org.apache.pig.piggybank.test.storage.TestAllLoader.java
License:Apache License
@Before public void setUp() throws Exception { Configuration hadoopConf = new Configuration(); FileSystem.setDefaultUri(hadoopConf, LocalFileSystem.getDefaultUri(hadoopConf)); if (baseDir == null) { configuration = new Properties(); configuration.setProperty(LoadFuncHelper.FILE_EXTENSION_LOADERS, extensionLoaders); baseDir = new File("build/test/testAllLoader"); if (baseDir.exists()) { FileUtil.fullyDelete(baseDir); }/*from ww w. j av a 2 s . c o m*/ assertTrue(baseDir.mkdirs()); createSimpleDir(); createDatePartitionDir(); createLogicPartitionDir(); createTaggedLogicPartitionDir(); createFileByContentDir(); server = new PigServer(ExecType.LOCAL, configuration); server.setBatchOn(); } }
From source file:org.apache.pig.piggybank.test.storage.TestAllLoader.java
License:Apache License
@After public void tearDown() throws Exception { server.shutdown(); FileUtil.fullyDelete(baseDir); baseDir = null; }
From source file:org.apache.pig.piggybank.test.storage.TestLoadFuncHelper.java
License:Apache License
@Before public void setUp() throws Exception { if (baseDir == null) { // we need this here for some strange reason while running ant test // the FileSystem.get call in the LoadFuncHelper will try and // connect to localhost?? PigServer pig = new PigServer(ExecType.LOCAL); configuration = new Configuration(false); configuration.set(LoadFuncHelper.FILE_EXTENSION_LOADERS, extensionLoaders); helper = new LoadFuncHelper(configuration); baseDir = new File("build/test/testLoadFuncHelper"); if (baseDir.exists()) { FileUtil.fullyDelete(baseDir); }//from w w w . ja v a 2s. c o m assertTrue(baseDir.mkdirs()); testFile = new File(baseDir, "testFile.txt"); FileWriter writer = new FileWriter(testFile); try { for (int i = 0; i < 100; i++) { writer.append("test test\n"); } } finally { writer.close(); } } }
From source file:org.apache.pig.piggybank.test.storage.TestLoadFuncHelper.java
License:Apache License
@Override protected void tearDown() throws Exception { FileUtil.fullyDelete(baseDir); baseDir = null; }
From source file:org.apache.pig.test.TestLOLoadDeterminedSchema.java
License:Apache License
@Before public void setUp() throws Exception { FileLocalizer.deleteTempFiles();//from ww w . jav a 2 s .co m server = new PigServer(ExecType.LOCAL, new Properties()); baseDir = new File("build/testLoLoadDeterminedSchema"); if (baseDir.exists()) { FileUtil.fullyDelete(baseDir); } assertTrue(baseDir.mkdirs()); inputFile = new File(baseDir, "testInput.txt"); inputFile.createNewFile(); // write a short input FileWriter writer = new FileWriter(inputFile); try { writer.write("a\tb\tc"); } finally { writer.close(); } }
From source file:org.apache.pig.test.TestLOLoadDeterminedSchema.java
License:Apache License
@After public void tearDown() throws Exception { if (baseDir.exists()) FileUtil.fullyDelete(baseDir); server.shutdown(); }
From source file:org.apache.slider.core.zk.MiniZooKeeperCluster.java
License:Apache License
private void recreateDir(File dir) throws IOException { if (dir.exists()) { if (!FileUtil.fullyDelete(dir)) { throw new IOException("Could not delete zk base directory: " + dir); }//from w w w. ja v a 2 s . com } try { dir.mkdirs(); } catch (SecurityException e) { throw new IOException("creating dir: " + dir, e); } }
From source file:org.apache.storm.hdfs.bolt.AvroGenericRecordBoltTest.java
License:Apache License
@Before public void setup() throws Exception { MockitoAnnotations.initMocks(this); Configuration conf = new Configuration(); conf.set("fs.trash.interval", "10"); conf.setBoolean("dfs.permissions", true); File baseDir = new File("./target/hdfs/").getAbsoluteFile(); FileUtil.fullyDelete(baseDir); conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, baseDir.getAbsolutePath()); MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(conf); hdfsCluster = builder.build();/* www . java 2 s .c om*/ fs = hdfsCluster.getFileSystem(); hdfsURI = fs.getUri() + "/"; }