FileBasedObjectStore implements PersistenceObjectStore { static boolean isMementoDirExistButEmpty(String dir) { return isMementoDirExistButEmpty(new File(dir)); } FileBasedObjectStore(File basedir); @Override String getSummaryName(); File getBaseDir(); @Override synchronized void prepareForMasterUse(); @Override void createSubPath(String subPath); @Override StoreObjectAccessor newAccessor(String path); @Override List<String> listContentsWithSubPath(final String parentSubPath); @Override void close(); @Override String toString(); @Override void injectManagementContext(ManagementContext mgmt); @Override void prepareForSharedUse(@Nullable PersistMode persistMode, HighAvailabilityMode haMode); @Override void deleteCompletely(); static void deleteCompletely(File d);  }
@Test public void testIsMementoDirExistsButEmpty() throws Exception { basedir = new File(parentdir, "testIsMementoDirExistsButEmpty"); assertFalse(FileBasedObjectStore.isMementoDirExistButEmpty(basedir)); assertFalse(FileBasedObjectStore.isMementoDirExistButEmpty(basedir.getAbsolutePath())); basedir.mkdir(); assertTrue(FileBasedObjectStore.isMementoDirExistButEmpty(basedir)); assertTrue(FileBasedObjectStore.isMementoDirExistButEmpty(basedir.getAbsolutePath())); new File(basedir, "entities").mkdir(); new File(basedir, "locations").mkdir(); assertTrue(FileBasedObjectStore.isMementoDirExistButEmpty(basedir)); assertTrue(FileBasedObjectStore.isMementoDirExistButEmpty(basedir.getAbsolutePath())); new File(new File(basedir, "locations"), "afile").createNewFile(); assertFalse(FileBasedObjectStore.isMementoDirExistButEmpty(basedir)); assertFalse(FileBasedObjectStore.isMementoDirExistButEmpty(basedir.getAbsolutePath())); }