DataStoreCacheUpgradeUtils { public static void upgrade(File homeDir, File path, boolean moveCache, boolean deleteMap) { movePendingUploadsToStaging(homeDir, path, deleteMap); if (moveCache) { moveDownloadCache(path); } }  static void moveDownloadCache(final File path); static void movePendingUploadsToStaging(File homeDir, File path, boolean deleteMap); static void upgrade(File homeDir, File path, boolean moveCache, boolean deleteMap);  }
@Test public void upgradeNoDownloads() throws Exception { setupUploads("1111110", "2222220", "3333330"); DataStoreCacheUpgradeUtils.upgrade(homeDir, path, true, true); assertFiles(UPLOAD_STAGING_DIR, "1111110", "2222220", "3333330"); assertFalse(pendingUploads.exists()); }
@Test public void upgradeNoDownloadsDelPendingFileFalse() throws Exception { setupUploads("1111110", "2222220", "3333330"); DataStoreCacheUpgradeUtils.upgrade(homeDir, path, true, false); assertFiles(UPLOAD_STAGING_DIR, "1111110", "2222220", "3333330"); assertTrue(pendingUploads.exists()); }
@Test public void upgradeMoveDownloadsFalse() throws Exception { setupUploads("1111110", "2222220", "3333330"); setupDownloads("4444440", "5555550", "6666660"); DataStoreCacheUpgradeUtils.upgrade(homeDir, path, false, true); assertFiles(UPLOAD_STAGING_DIR, "1111110", "2222220", "3333330"); assertFalse(pendingUploads.exists()); assertFilesNoMove(DOWNLOAD_DIR, "4444440", "5555550", "6666660"); }
@Test public void upgradeNoUploads() throws Exception { setupDownloads("1111110", "2222220", "3333330"); DataStoreCacheUpgradeUtils.upgrade(homeDir, path, true, true); assertFiles(DOWNLOAD_DIR, "1111110", "2222220", "3333330"); }
@Test public void upgradeNoUploadMap() throws Exception { setupUploads("1111110", "2222220", "3333330"); FileUtils.deleteQuietly(pendingUploads); DataStoreCacheUpgradeUtils.upgrade(homeDir, path, true, true); assertFiles(DOWNLOAD_DIR, "1111110", "2222220", "3333330"); assertFalse(pendingUploads.exists()); }
@Test public void upgrade() throws Exception { upgrade(true); }
@Test public void upgradeDelPendingFileFalse() throws Exception { upgrade(false); }