use of org.syncany.operations.cleanup.CleanupOperationOptions.TimeUnit in project syncany by syncany.
the class CleanupOperationTest method testFullyDeletingDeletedFiles.
@Test
public void testFullyDeletingDeletedFiles() throws Exception {
// Setup
LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
java.sql.Connection databaseConnectionA = clientA.getConfig().createDatabaseConnection();
CleanupOperationOptions options = new CleanupOperationOptions();
options.setRemoveOldVersions(true);
options.setMinSecondsBetweenCleanups(0);
options.setPurgeFileVersionSettings(new TreeMap<Long, TimeUnit>());
options.setMinKeepSeconds(2);
clientA.createNewFile("file.jpg");
clientA.up();
clientA.deleteFile("file.jpg");
clientA.up();
clientA.cleanup(options);
assertEquals("2", TestSqlUtil.runSqlSelect("select count(*) from fileversion", databaseConnectionA));
Thread.sleep(3000);
clientA.cleanup(options);
assertEquals("0", TestSqlUtil.runSqlSelect("select count(*) from fileversion", databaseConnectionA));
// Tear down
clientA.deleteTestData();
}
Aggregations