FilesystemStore implements PersistentStore { @Override public synchronized void remove(@Nonnull Key key) throws IOException, SQLException { init(); final Path path = getPrivatePath(key); final int keyHashCode = key.hashCode(); doRemove(path, keyHashCode, true); }  @Override synchronized StoreInfoAndData get(@Nonnull Key key); @Override synchronized StoreInfo getInfo(@Nonnull Key key); @Override synchronized void put(@Nonnull Key key, @Nonnull StoreInfoAndData data); @Nullable @Override byte[] getPublished(@Nonnull Key key); @Override synchronized void remove(@Nonnull Key key); @Override void setPublished(int metadataId, final boolean published); @Override void clear(); void setGeonetworkDataDir(GeonetworkDataDirectory geonetworkDataDir); Path getPrivatePath(Key key); Path getPublicPath(Key key); void setMaxSizeKb(long maxSize); void setMaxSizeMb(int maxSize); void setMaxSizeGb(int maxSize); void setTesting(boolean testing); static final String WITHHELD_MD_DIRNAME; static final String FULL_MD_NAME; static final String QUERY_SETCURRENT_SIZE; static final String QUERY_GETCURRENT_SIZE; }
@Test public void testRemove() throws Exception { StoreInfoAndData data = new StoreInfoAndData("result", 10000, true); Key key = new Key(1, "eng", FormatType.html, "full_view", true, FormatterWidth._100); store.put(key, data); assertNotNull(store.get(key)); assertNotNull(store.getPublished(key)); assertNotNull(store.getInfo(key)); assertEquals(1, countFiles(store.getPrivatePath(key))); assertEquals(1, countFiles(store.getPublicPath(key))); store.remove(key); assertNull(store.getInfo(key)); assertNull(store.getPublished(key)); assertNull(store.get(key)); assertEquals(0, countFiles(store.getPrivatePath(key))); assertEquals(0, countFiles(store.getPublicPath(key))); data = new StoreInfoAndData("result", 10000, false); key = new Key(1, "eng", FormatType.html, "full_view", true, FormatterWidth._100); store.put(key, data); assertEquals(1, countFiles(store.getPrivatePath(key))); assertEquals(0, countFiles(store.getPublicPath(key))); store.remove(key); assertNull(store.getInfo(key)); assertNull(store.getPublished(key)); assertNull(store.get(key)); assertEquals(0, countFiles(store.getPrivatePath(key))); assertEquals(0, countFiles(store.getPublicPath(key))); store.remove(key); }