/** * Delete the file or directory at the supplied path. This method works on a directory that is not empty, unlike the * {@link File#delete()} method. * * @param path the path to the file or directory that is to be deleted * @return true if the file or directory at the supplied path existed and was successfully deleted, or false otherwise */ public static boolean delete( String path ) { if (path == null || path.trim().length() == 0) return false; return delete(new File(path)); }
/** * Delete the file or directory at the supplied path. This method works on a directory that is not empty, unlike the * {@link File#delete()} method. * * @param path the path to the file or directory that is to be deleted * @return true if the file or directory at the supplied path existed and was successfully deleted, or false otherwise */ public static boolean delete( String path ) { if (path == null || path.trim().length() == 0) return false; return delete(new File(path)); }
@Override public boolean removeDocument( String id ) { File file = fileFor(id); checkFileNotExcluded(id, file); // Remove the extra properties at the old location ... extraPropertiesStore().removeProperties(id); // Now remove the file (if it is there) ... if (!file.exists()) return false; FileUtil.delete(file); // recursive delete return true; }
private void prepareExternalDirectory( String dirpath ) throws IOException { FileUtil.delete(dirpath); new File(dirpath).mkdir(); File file = new File(dirpath + "/file.txt"); IoUtil.write(JcrRepositoryStartupTest.class.getClassLoader().getResourceAsStream("io/file1.txt"), new FileOutputStream(file)); }
@Override public void initialize() throws IOException { if (directory.exists()) FileUtil.delete(directory); directory.mkdirs(); // Make some content ... addFile("large-file1.png", "data/large-file1.png"); }
@Override public boolean removeDocument( String id ) { File file = fileFor(id); checkFileNotExcluded(id, file); // Remove the extra properties at the old location ... extraPropertiesStore().removeProperties(id); // Now remove the file (if it is there) ... if (!file.exists()) return false; FileUtil.delete(file); // recursive delete return true; }
@Before public void before() throws Exception { FileUtil.delete("target/files"); File fileConnectorTestDir = new File("target/files"); fileConnectorTestDir.mkdir(); File testFile = new File(fileConnectorTestDir, "testFile"); IoUtil.write(getClass().getClassLoader().getResourceAsStream("data/simple.json"), new FileOutputStream(testFile)); }
@Before public void setUp() throws Exception { testDirectory = new File("target/backupArea/writerTests"); testDirectory.mkdirs(); FileUtil.delete(testDirectory); testDirectory.mkdirs(); problems = new SimpleProblems(); }
@AfterClass public static void tearDownClass() { esNode.close(); FileUtil.delete("target/data"); }
@Before public void beforeClass() { directory = new File("target/fsbs/"); FileUtil.delete(directory); directory.mkdirs(); trash = new File(directory, FileSystemBinaryStore.TRASH_DIRECTORY_NAME); store = new FileSystemBinaryStore(directory, trash); store.setMinimumBinarySizeInBytes(MIN_BINARY_SIZE); store.setMimeTypeDetector(DEFAULT_DETECTOR); print = false; }
private ClusteredJournal startNewJournal( String fileLocation, int clusterServiceIdx, int maxReconciliationWaitTimeMinutes) throws Exception { FileUtil.delete(fileLocation); LocalJournal localJournal = new LocalJournal(fileLocation); ClusteredJournal clusteredJournal = new ClusteredJournal(localJournal, clusteringServices.get(clusterServiceIdx), maxReconciliationWaitTimeMinutes); clusteredJournal.start(); return clusteredJournal; } }
@BeforeClass public static void beforeEach() { store = TransientBinaryStore.get(); directory = TransientBinaryStore.TRANSIENT_STORE_DIRECTORY; FileUtil.delete(directory); directory.mkdirs(); trash = new File(directory, FileSystemBinaryStore.TRASH_DIRECTORY_NAME); store.setMinimumBinarySizeInBytes(MIN_BINARY_SIZE); store.setMimeTypeDetector(DEFAULT_DETECTOR); print = false; } }
@After @Override public void afterEach() throws Exception { super.afterEach(); FileUtil.delete(storageDir()); }
@AfterClass public static void tearDownClass() { index.shutdown(true); esNode.close(); FileUtil.delete("target/data"); }
@Test @FixFor("MODE-2670") public void shouldRollbackAndCommitTransactionsFromDifferentThreadsForDBProvider() throws Exception { FileUtil.delete("target/txn"); // Start the repository using the JBoss Transactions transaction manager ... startRepositoryWithConfigurationFrom("config/repo-config-db-txn.json"); testCommitAndRollbackOffSeparateThreads(); }
@Test @FixFor( "MODE-2387" ) public void shouldStartRepositoryWithCustomSettingsForLocalIndexProvider() throws Exception { shutdownDefaultRepository(); FileUtil.delete("target/local_index_custom_settings_test_repository"); repository = TestingUtil.startRepositoryWithConfig("config/local-index-provider-with-custom-settings.json"); repository.start(); }
@Before public void beforeEach() throws Exception { FileUtil.delete("target/concurrent_load_non_clustered"); print = false; config = RepositoryConfiguration.read("load/concurrent-load-repo-config.json").with(new TestingEnvironment()); engine = new ModeShapeEngine(); }
@Before @Override public void beforeEach() throws Exception { FileUtil.delete("target/files"); // Now start the repository ... startRepositoryWithConfigurationFrom("config/repo-config-federation-changes.json"); printMessage("Started repository..."); changeBus = repository().changeBus(); }
@Override @Before public void beforeEach() throws Exception { super.beforeEach(); FileUtil.delete("target/obs_journal"); startRepositoryWithConfigurationFrom("config/repo-config-observation.json"); session = login(WORKSPACE); this.testRootNode = this.session.getRootNode().addNode("testroot", UNSTRUCTURED); save(); }