private void testLargeFile(long size) throws Exception {
// Setup
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
Logging.disableLogging();
logln("NOTE: This test can take several minutes!");
logln("Disabling console logging for this test; Too much output/overhead.");
logln("");
// A
logln("Creating large file for scenario ("+((long) size/1024L/1024L)+" MB) ...");
clientA.createNewFile("A-large-file.zip", size);
logln("Done creating large file. Now creating checksum ...");
String checksumFileA = StringUtil.toHex(TestFileUtil.createChecksum(clientA.getLocalFile("A-large-file.zip")));
logln("Done. Checksum is: "+checksumFileA);
logln("clientA.up() started.");
clientA.up();
logln("clientA.up() completed.");
logln("Freeing up space, deleting file at client A ...");
clientA.deleteFile("A-large-file.zip");
logln("Deleting done.");
// B
logln("clientB.down(); started.");
clientB.down();
logln("clientB.down(); completed.");
String checksumFileB = StringUtil.toHex(TestFileUtil.createChecksum(clientB.getLocalFile("A-large-file.zip")));
logln("Done. Checksum is: "+checksumFileB);
logln("Freeing up space, deleting file at client B ...");
clientB.deleteFile("A-large-file.zip");
logln("Deleting done.");
try {
assertEquals("File checksum should be equal. ", checksumFileA, checksumFileB);
assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
}
finally {
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
}
}