TestClient clientB = new TestClient("B", testConnection);
TestClient clientC = new TestClient("C", testConnection);
TestClient clientD = new TestClient("D", testConnection);
TestClient clientE = new TestClient("E", testConnection);
CleanupOperationOptions cleanupOptionsKeep1 = new CleanupOperationOptions();
cleanupOptionsKeep1.setMergeRemoteFiles(true);
cleanupOptionsKeep1.setRemoveOldVersions(true);
cleanupOptionsKeep1.setKeepVersionsCount(1);
StatusOperationOptions statusOptionsForceChecksum = new StatusOperationOptions();
statusOptionsForceChecksum.setForceChecksum(true);
UpOperationOptions upNoCleanupForceChecksum = new UpOperationOptions();
upNoCleanupForceChecksum.setStatusOptions(statusOptionsForceChecksum);
UpOperationOptions upWithCleanupKeep1ForceChecksum = new UpOperationOptions();
upWithCleanupKeep1ForceChecksum.setStatusOptions(statusOptionsForceChecksum);
// First round
clientB.createNewFile("fileA");
clientB.up(upNoCleanupForceChecksum);
clientA.down();
TestFileUtil.copyFile(clientA.getLocalFile("fileA"), clientA.getLocalFile("fileAcopy"));
clientA.up(upNoCleanupForceChecksum);
clientA.down();
for (int i = 0; i < 30; i++) {
clientA.down();
clientA.changeFile("fileA");
clientA.up(upNoCleanupForceChecksum);
}
// First cleanup
FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath() + "_1_before_cleanup"));
FileUtils.copyDirectory(clientA.getConfig().getDatabaseDir(), new File(clientA.getConfig().getAppDir(), "1_before_cleanup"));
CleanupOperationOptions cleanupMergeAndRemoveOldFiles = new CleanupOperationOptions();
cleanupMergeAndRemoveOldFiles.setMergeRemoteFiles(true);
cleanupMergeAndRemoveOldFiles.setRemoveOldVersions(true);
clientA.cleanup(cleanupMergeAndRemoveOldFiles);
FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath() + "_2_after_cleanup"));
FileUtils.copyDirectory(clientA.getConfig().getDatabaseDir(), new File(clientA.getConfig().getAppDir(), "2_after_cleanup"));