@Test public void should_store_external_binary() throws Exception { final ExternalBinary externalBinary = new ExternalBinary("1.0.0.Final", "https: final String releasesId = "4968399"; gitHubLastUpdateCache.store(externalBinary, releasesId, ZonedDateTime.now()); assertThat(tmpFolder.listFiles()).containsOnly(new File(tmpFolder.getAbsolutePath() + "/gh.cache.4968399.json")); }
public <T> void store(T asset, String uniqueKey, ZonedDateTime dateTime) { final File cachedFilePath = createCachedFilePath(uniqueKey).toFile(); final JsonObject jsonObject = combineAsJson(asset, dateTime); try (FileOutputStream fileOutputStream = new FileOutputStream(cachedFilePath, false)) { fileOutputStream.write(jsonObject.toString().getBytes()); } catch (IOException e) { throw new RuntimeException("Unable to store " + jsonObject + "%n as [" + cachedFilePath + "]", e); } }
GitHubLastUpdateCache { public <T> void store(T asset, String uniqueKey, ZonedDateTime dateTime) { final File cachedFilePath = createCachedFilePath(uniqueKey).toFile(); final JsonObject jsonObject = combineAsJson(asset, dateTime); try (FileOutputStream fileOutputStream = new FileOutputStream(cachedFilePath, false)) { fileOutputStream.write(jsonObject.toString().getBytes()); } catch (IOException e) { throw new RuntimeException("Unable to store " + jsonObject + "%n as [" + cachedFilePath + "]", e); } } }
GitHubLastUpdateCache { public <T> void store(T asset, String uniqueKey, ZonedDateTime dateTime) { final File cachedFilePath = createCachedFilePath(uniqueKey).toFile(); final JsonObject jsonObject = combineAsJson(asset, dateTime); try (FileOutputStream fileOutputStream = new FileOutputStream(cachedFilePath, false)) { fileOutputStream.write(jsonObject.toString().getBytes()); } catch (IOException e) { throw new RuntimeException("Unable to store " + jsonObject + "%n as [" + cachedFilePath + "]", e); } } GitHubLastUpdateCache(final Path cacheDirectory);  GitHubLastUpdateCache(final File cacheDirectory);  GitHubLastUpdateCache(); }
GitHubLastUpdateCache { public <T> void store(T asset, String uniqueKey, ZonedDateTime dateTime) { final File cachedFilePath = createCachedFilePath(uniqueKey).toFile(); final JsonObject jsonObject = combineAsJson(asset, dateTime); try (FileOutputStream fileOutputStream = new FileOutputStream(cachedFilePath, false)) { fileOutputStream.write(jsonObject.toString().getBytes()); } catch (IOException e) { throw new RuntimeException("Unable to store " + jsonObject + "%n as [" + cachedFilePath + "]", e); } } GitHubLastUpdateCache(final Path cacheDirectory);  GitHubLastUpdateCache(final File cacheDirectory);  GitHubLastUpdateCache(); ZonedDateTime lastModificationOf(String uniqueKey); T load(String uniqueKey, Class<T> type); boolean cacheFileExists(String uniqueKey); void store(T asset, String uniqueKey, ZonedDateTime dateTime); }
GitHubLastUpdateCache { public <T> void store(T asset, String uniqueKey, ZonedDateTime dateTime) { final File cachedFilePath = createCachedFilePath(uniqueKey).toFile(); final JsonObject jsonObject = combineAsJson(asset, dateTime); try (FileOutputStream fileOutputStream = new FileOutputStream(cachedFilePath, false)) { fileOutputStream.write(jsonObject.toString().getBytes()); } catch (IOException e) { throw new RuntimeException("Unable to store " + jsonObject + "%n as [" + cachedFilePath + "]", e); } } GitHubLastUpdateCache(final Path cacheDirectory);  GitHubLastUpdateCache(final File cacheDirectory);  GitHubLastUpdateCache(); ZonedDateTime lastModificationOf(String uniqueKey); T load(String uniqueKey, Class<T> type); boolean cacheFileExists(String uniqueKey); void store(T asset, String uniqueKey, ZonedDateTime dateTime);  }