protected void tearDown() throws Exception { if (foo != null) { fileUtil.deleteTree(foo); } if (defaultDir != null) { fileUtil.deleteTree(defaultDir); } }
/** * Depth First traversal of the directory. Attempts to delete every file in * the structure. * * @return true if the file passed in is successfully deleted */ public boolean deleteTree(File file) { if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteTree(files[i]); } } return file.delete(); }
/** * Depth First traversal of the directory. Attempts to delete every file in * the structure. * * @return true if the file passed in is successfully deleted */ public boolean deleteTree(File file) { if (file.isDirectory()) { File[] files = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteTree(files[i]); } } return file.delete(); }
public boolean cleanTestDir() { return deleteTree(testDir()); }
public boolean cleanTestDir() { return deleteTree(testDir()); }
public void testCreateDbFiles() { new Files().deleteTree(dataDir); File dbDataDir = new File(dataDir, "mysql"); File host_frm = new File(dbDataDir, "host.frm"); assertEquals(false, host_frm.exists()); assertEquals(false, dataDir.exists()); mysqldResource.ensureEssentialFilesExist(); assertTrue(host_frm.exists()); }
public void testDeleteTree() throws FileNotFoundException { foo = new File(fileUtil.testDir(), "foo"); File bar = new File(foo, "bar"); bar.mkdirs(); assertEquals(true, bar.exists()); File baz = new File(foo, "baz"); writeToFile(baz, "baz"); assertEquals(true, baz.exists()); assertEquals(3, baz.length()); assertEquals(true, fileUtil.deleteTree(foo)); assertEquals(false, foo.exists()); }
@Override public void ensureEssentialFilesExist() { try { if(bNewMySqldWasCopiedToWorkArea) { utils.files().deleteTree(new File(baseDir + File.separator + "share")); } String sSourceDir = binDir(); JarInputStream dataIn = new JarInputStream(new FileInputStream(sSourceDir + File.separator + "data_dir.jar")); utils.streams().expandEachEntry(dataDir, dataIn); JarInputStream shareIn = new JarInputStream(new FileInputStream(sSourceDir + File.separator + "share_dir.jar")); utils.streams().expandEachEntry(baseDir, shareIn); } catch (IOException e) { e.printStackTrace(); } }
protected void tearDown() { try { if (bean != null) { try { bean.invoke(SimpleMysqldDynamicMBean.STOP_METHOD, null, null); } catch (Exception e) { e.printStackTrace(); } threads.pause(50); } if (agent != null) { agent.shutdown(); } new Files().deleteTree(dataDir); } finally { System.setProperty(Files.USE_TEST_DIR, orig); super.tearDown(); } }
public void testCreateUser() throws Exception { fileUtil.deleteTree(baseDir3); mysqld = new MysqldResource(baseDir3); baseDir3.mkdirs();
public void testInitializeUser() throws Exception { File baseDir4 = new File(tmpDir, "mxj-init-user-test"); fileUtil.deleteTree(baseDir4); mysqld = new MysqldResource(baseDir4); mysqld.setKillDelay(testUtil.testKillDelay()); mysqld.shutdown(); assertEquals(false, mysqld.isRunning()); fileUtil.deleteTree(baseDir4);
protected void tearDown() { super.tearDown(); // un-quiet so we can see errors. try { File baseDir = new Files().tmp(MysqldResource.MYSQL_C_MXJ); ServerLauncherSocketFactory.shutdown(baseDir, dataDir, testUtil .testKillDelay()); } catch (MysqldResourceNotFoundException e) { warn(e); } finally { if (orig != null) { System.setProperty(Files.USE_TEST_DIR, orig); } else { // System.clearProperty(Files.USE_TEST_DIR); System.setProperty(Files.USE_TEST_DIR, ""); } new Files().cleanTestDir(); if (dataDir != null) { new Files().deleteTree(dataDir); } } }