@Test void resolveFile() throws IOException { AruPatch aruPatch1 = new AruPatch().patchId("99999").version(SOME_VERSION); PatchFile p1 = new PatchFile(aruPatch1, null,null); assertThrows(FileNotFoundException.class, () -> p1.resolve(cacheStore)); AruPatch aruPatch2 = new AruPatch().patchId(BUGNUMBER).version(SOME_VERSION); PatchFile patch2 = new PatchFile(aruPatch2, null,null); String expected = cacheStore.getValueFromCache(BUGNUMBER + "_" + SOME_VERSION); assertEquals(expected, patch2.resolve(cacheStore), "failed to resolve patch in cache"); }
@Override public String resolve(CacheStore cacheStore) throws IOException { String cacheKey = getKey(); logger.entering(cacheKey); String filePath; boolean fileExists; filePath = cacheStore.getValueFromCache(cacheKey); fileExists = isFileOnDisk(filePath); if (fileExists) { logger.info("IMG-0017", getKey(), filePath); } else { logger.info("IMG-0061", getKey(), aruPatch.patchId()); if (offlineMode()) { throw new FileNotFoundException(Utils.getMessage("IMG-0056", getKey())); } filePath = downloadPatch(cacheStore); } logger.exiting(filePath); return filePath; }
PatchFile extends CachedFile { @Override public String resolve(CacheStore cacheStore) throws IOException { String cacheKey = getKey(); logger.entering(cacheKey); String filePath; boolean fileExists; filePath = cacheStore.getValueFromCache(cacheKey); fileExists = isFileOnDisk(filePath); if (fileExists) { logger.info("IMG-0017", getKey(), filePath); } else { logger.info("IMG-0061", getKey(), aruPatch.patchId()); if (offlineMode()) { throw new FileNotFoundException(Utils.getMessage("IMG-0056", getKey())); } filePath = downloadPatch(cacheStore); } logger.exiting(filePath); return filePath; } }
PatchFile extends CachedFile { @Override public String resolve(CacheStore cacheStore) throws IOException { String cacheKey = getKey(); logger.entering(cacheKey); String filePath; boolean fileExists; filePath = cacheStore.getValueFromCache(cacheKey); fileExists = isFileOnDisk(filePath); if (fileExists) { logger.info("IMG-0017", getKey(), filePath); } else { logger.info("IMG-0061", getKey(), aruPatch.patchId()); if (offlineMode()) { throw new FileNotFoundException(Utils.getMessage("IMG-0056", getKey())); } filePath = downloadPatch(cacheStore); } logger.exiting(filePath); return filePath; } PatchFile(AruPatch aruPatch, String userId, String password); }
PatchFile extends CachedFile { @Override public String resolve(CacheStore cacheStore) throws IOException { String cacheKey = getKey(); logger.entering(cacheKey); String filePath; boolean fileExists; filePath = cacheStore.getValueFromCache(cacheKey); fileExists = isFileOnDisk(filePath); if (fileExists) { logger.info("IMG-0017", getKey(), filePath); } else { logger.info("IMG-0061", getKey(), aruPatch.patchId()); if (offlineMode()) { throw new FileNotFoundException(Utils.getMessage("IMG-0056", getKey())); } filePath = downloadPatch(cacheStore); } logger.exiting(filePath); return filePath; } PatchFile(AruPatch aruPatch, String userId, String password); @Override String getVersion(); @Override String resolve(CacheStore cacheStore); @Override String toString(); }
PatchFile extends CachedFile { @Override public String resolve(CacheStore cacheStore) throws IOException { String cacheKey = getKey(); logger.entering(cacheKey); String filePath; boolean fileExists; filePath = cacheStore.getValueFromCache(cacheKey); fileExists = isFileOnDisk(filePath); if (fileExists) { logger.info("IMG-0017", getKey(), filePath); } else { logger.info("IMG-0061", getKey(), aruPatch.patchId()); if (offlineMode()) { throw new FileNotFoundException(Utils.getMessage("IMG-0056", getKey())); } filePath = downloadPatch(cacheStore); } logger.exiting(filePath); return filePath; } PatchFile(AruPatch aruPatch, String userId, String password); @Override String getVersion(); @Override String resolve(CacheStore cacheStore); @Override String toString();  }