clientA.createNewFile("file"+i, 1);
clientA.up();
}
for (int i=1; i<=15; i++) {
DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
File expectedDatabaseFile = new File(testConnection.getPath()+"/databases/"+expectedDatabaseRemoteFile.getName());
assertTrue("Database file SHOULD exist: "+expectedDatabaseFile, expectedDatabaseFile.exists());
}
// ROUND 2: 1x sync up (cleanup expected!)
clientA.createNewFile("file16", 1);
clientA.up();
clientA.cleanup(); // Force cleanup
for (int i=1; i<=15; i++) {
DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
File expectedDatabaseFile = new File(testConnection.getPath()+"/databases/"+expectedDatabaseRemoteFile.getName());
assertTrue("Database file should NOT exist: "+expectedDatabaseFile, !expectedDatabaseFile.exists());
}
for (int i=16; i<=16; i++) {
DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
File expectedDatabaseFile = new File(testConnection.getPath()+"/databases/"+expectedDatabaseRemoteFile.getName());
assertTrue("Database file SHOULD exist: "+expectedDatabaseFile, expectedDatabaseFile.exists());
}
// ROUND 3: many sync up (no cleanup expected here)
for (int i=17; i<=30; i++) {
clientA.createNewFile("file"+i, 1);
clientA.up();
}
for (int i=1; i<=15; i++) {
DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
File expectedDatabaseFile = new File(testConnection.getPath()+"/databases/"+expectedDatabaseRemoteFile.getName());
assertTrue("Database file should NOT exist: "+expectedDatabaseFile, !expectedDatabaseFile.exists());
}
for (int i=16; i<=30; i++) {
DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
File expectedDatabaseFile = new File(testConnection.getPath()+"/databases/"+expectedDatabaseRemoteFile.getName());
assertTrue("Database file SHOULD exist: "+expectedDatabaseFile, expectedDatabaseFile.exists());
}
// ROUND 4: 1x sync up (cleanup expected!)
clientA.createNewFile("file31", 1);
clientA.up();
CleanupOperationOptions options = new CleanupOperationOptions();
options.setForce(true);
clientA.cleanup(options); // Force cleanup
for (int i=1; i<=30; i++) {
DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
File expectedDatabaseFile = new File(testConnection.getPath()+"/databases/"+expectedDatabaseRemoteFile.getName());
assertTrue("Database file should NOT exist: "+expectedDatabaseFile, !expectedDatabaseFile.exists());
}
for (int i=31; i<=31; i++) {
DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
File expectedDatabaseFile = new File(testConnection.getPath()+"/databases/"+expectedDatabaseRemoteFile.getName());
assertTrue("Database file SHOULD exist: "+expectedDatabaseFile, expectedDatabaseFile.exists());
}
// Tear down