use of org.syncany.plugins.local.LocalTransferSettings in project syncany by syncany.
the class CleanupOperationTest method testCleanupManyUpsAfterCleanup.
@Test
public void testCleanupManyUpsAfterCleanup() throws Exception {
// Setup
LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
CleanupOperationOptions options = new CleanupOperationOptions();
options.setRemoveOldVersions(true);
options.setMinKeepSeconds(0);
// Run
// A: Create some file versions
clientA.createNewFile("file.jpg");
for (int i = 1; i <= 4; i++) {
clientA.changeFile("file.jpg");
clientA.upWithForceChecksum();
}
// B: Sync down
clientB.down();
// A: Cleanup
CleanupOperationResult cleanupOperationResult = clientA.cleanup(options);
assertEquals(CleanupResultCode.OK, cleanupOperationResult.getResultCode());
assertEquals(4, cleanupOperationResult.getMergedDatabaseFilesCount());
assertEquals(3, cleanupOperationResult.getRemovedMultiChunksCount());
assertEquals(1, cleanupOperationResult.getRemovedOldVersionsCount());
// A: Continue to upload stuff ! <<<<<<<<<<<<<<<<<<<<<
for (int i = 1; i <= 4; i++) {
clientA.changeFile("file.jpg");
clientA.upWithForceChecksum();
}
clientA.createNewFile("file2.jpg");
for (int i = 1; i <= 4; i++) {
clientA.changeFile("file2.jpg");
clientA.upWithForceChecksum();
}
// B: Sync down
clientB.down();
TestAssertUtil.assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
}
Aggregations