FilesystemStore implements PersistentStore { @Override public synchronized StoreInfoAndData get(@Nonnull Key key) throws IOException, SQLException { init(); StoreInfo info = getInfo(key); if (info == null) { return null; } byte[] data = Files.readAllBytes(getPrivatePath(key)); return new StoreInfoAndData(info, data); }  @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 testGet() throws Exception { StoreInfoAndData data = new StoreInfoAndData("result", 10000, false); final Key key = new Key(1, "eng", FormatType.html, "full_view", true, FormatterWidth._100); store.put(key, data); final StoreInfoAndData loaded = store.get(key); assertEquals(data.getDataAsString(), loaded.getDataAsString()); assertEquals(data.getChangeDate(), loaded.getChangeDate()); assertEquals(data.isPublished(), loaded.isPublished()); assertTrue(0 < countFiles(geonetworkDataDirectory.getHtmlCacheDir())); }