@Test public void testCleanup_EnoughBackupFilesWithVersion() throws IOException { final int startVersion = 1; final int endVersion = startVersion + maxBackupFile * 2; final long baseModifiedTime = System.currentTimeMillis() / 1000 - 100; final long interval = 2; String[] filenames = createBackupFilesWithVersion(accountBackupDir, startVersion, endVersion, baseModifiedTime, interval, false); saveAccountsToFile(Collections.singleton(refAccount), accountBackupDir.resolve(filenames[filenames.length - 1])); createBackupFilesWithVersion(accountBackupDir, startVersion, endVersion, baseModifiedTime, interval, true); createBackupFilesWithoutVersion(accountBackupDir, 10, baseModifiedTime, interval, false); createBackupFilesWithoutVersion(accountBackupDir, 10, baseModifiedTime, interval, true); BackupFileManager backup = new BackupFileManager(accountServiceMetrics, config.backupDir, config.maxBackupFileCount); assertEquals("Number of backup files mismatch", backup.size(), maxBackupFile); File[] remainingFiles = accountBackupDir.toFile().listFiles(); assertEquals("Number of backup files in storage mismatch", remainingFiles.length, maxBackupFile); for (File file : remainingFiles) { assertTrue("Filename " + file.getName() + " should follow version pattern ", BackupFileManager.versionFilenamePattern.matcher(file.getName()).find()); } }
int size() { return backupFileInfos.size(); }
BackupFileManager { int size() { return backupFileInfos.size(); } }
BackupFileManager { int size() { return backupFileInfos.size(); } BackupFileManager(AccountServiceMetrics accountServiceMetrics, String backupDir, int maxBackupFileCount); }
BackupFileManager { int size() { return backupFileInfos.size(); } BackupFileManager(AccountServiceMetrics accountServiceMetrics, String backupDir, int maxBackupFileCount); int getLatestVersion(); }
BackupFileManager { int size() { return backupFileInfos.size(); } BackupFileManager(AccountServiceMetrics accountServiceMetrics, String backupDir, int maxBackupFileCount); int getLatestVersion();  }