@Test void psuInvolvedNoVersionSuppliedHasPsuVersions() throws Exception { String patchId = "1110003"; List<AruPatch> aruPatches = AruUtil.rest().getPatches(patchId, null, null); AruPatch aruPatch = AruPatch.selectPatch(aruPatches, null, "12.2.1.3.181016", "12.2.1.3.0"); assertNotNull(aruPatch); PatchFile patchFile = new PatchFile(aruPatch, "x", "x"); String filePath = patchFile.resolve(cacheStore); assertNotNull(filePath, "Patch resolve() failed to get file path from XML"); String filePathFromCache = cacheStore.getValueFromCache(patchId + "_12.2.1.3.181016"); assertNotNull(filePathFromCache, "Could not find new patch in cache"); assertEquals(filePath, filePathFromCache, "Patch in cache does not match"); }
@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();  }