Search in sources :

Example 26 with CleanupOperationOptions

use of org.syncany.operations.cleanup.CleanupOperationOptions in project syncany by syncany.

the class CleanupMergeDatabaseFilesScenarioTest method testIssue58_3.

@Test
public void testIssue58_3() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);
    TestClient clientC = new TestClient("C", testConnection);
    CleanupOperationOptions cleanupOptionsKeep1 = new CleanupOperationOptions();
    cleanupOptionsKeep1.setRemoveOldVersions(true);
    StatusOperationOptions statusOptionsForceChecksum = new StatusOperationOptions();
    statusOptionsForceChecksum.setForceChecksum(true);
    UpOperationOptions upNoCleanupForceChecksum = new UpOperationOptions();
    upNoCleanupForceChecksum.setStatusOptions(statusOptionsForceChecksum);
    UpOperationOptions upWithCleanupKeep1ForceChecksum = new UpOperationOptions();
    upWithCleanupKeep1ForceChecksum.setStatusOptions(statusOptionsForceChecksum);
    clientA.createNewFile("fileA");
    clientB.createNewFile("fileB");
    clientA.up(upNoCleanupForceChecksum);
    clientB.down();
    TestFileUtil.copyFile(clientA.getLocalFile("fileA"), clientB.getLocalFile("fileB"));
    String problemChecksum = StringUtil.toHex(FileUtil.createChecksum(clientA.getLocalFile("fileA"), "SHA1"));
    clientB.up(upNoCleanupForceChecksum);
    for (int i = 0; i < 20; i++) {
        clientA.down();
        clientA.changeFile("fileA");
        clientA.up(upNoCleanupForceChecksum);
        clientB.down();
        clientB.changeFile("fileB");
        clientB.up(upNoCleanupForceChecksum);
    }
    System.out.println("Problem checksum: " + problemChecksum);
    clientB.cleanup();
    clientA.down();
    clientA.cleanup();
    clientA.down();
    clientC.down();
    // Tear down
    clientA.deleteTestData();
    clientB.deleteTestData();
    clientC.deleteTestData();
}
Also used : LocalTransferSettings(org.syncany.plugins.local.LocalTransferSettings) TestClient(org.syncany.tests.util.TestClient) CleanupOperationOptions(org.syncany.operations.cleanup.CleanupOperationOptions) UpOperationOptions(org.syncany.operations.up.UpOperationOptions) StatusOperationOptions(org.syncany.operations.status.StatusOperationOptions) Test(org.junit.Test)

Example 27 with CleanupOperationOptions

use of org.syncany.operations.cleanup.CleanupOperationOptions in project syncany by syncany.

the class CleanupMergeDatabaseFilesScenarioTest method testIssue58_5.

@Test
public void testIssue58_5() throws Exception {
    // Test for https://github.com/syncany/syncany/issues/58#issuecomment-43472118
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);
    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.setRemoveOldVersions(true);
    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.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"));
    // If this doesn't crash that's a win!
    clientC.down();
    for (int i = 0; i < 30; i++) {
        clientB.down();
        clientB.changeFile("fileA");
        clientB.up(upNoCleanupForceChecksum);
    }
    // Second cleanup
    FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath() + "_3_before_cleanup"));
    FileUtils.copyDirectory(clientB.getConfig().getDatabaseDir(), new File(clientB.getConfig().getAppDir(), "3_before_cleanup"));
    clientB.cleanup(cleanupMergeAndRemoveOldFiles);
    FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath() + "_4_after_cleanup"));
    FileUtils.copyDirectory(clientB.getConfig().getDatabaseDir(), new File(clientB.getConfig().getAppDir(), "4_after_cleanup"));
    // If this doesn't crash that's a win!
    clientD.down();
    for (int i = 0; i < 30; i++) {
        clientB.down();
        clientB.changeFile("fileA");
        clientB.up(upNoCleanupForceChecksum);
    }
    // < Remove original checksum from first DBV
    clientB.deleteFile("fileAcopy");
    clientB.up(upNoCleanupForceChecksum);
    // Third cleanup
    FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath() + "_5_before_cleanup"));
    FileUtils.copyDirectory(clientB.getConfig().getDatabaseDir(), new File(clientB.getConfig().getAppDir(), "5_before_cleanup"));
    clientB.cleanup(cleanupMergeAndRemoveOldFiles);
    FileUtils.copyDirectory(testConnection.getPath(), new File(testConnection.getPath() + "_6_after_cleanup"));
    FileUtils.copyDirectory(clientB.getConfig().getDatabaseDir(), new File(clientB.getConfig().getAppDir(), "6_after_cleanup"));
    // If this doesn't crash that's a win!
    clientE.down();
    // Tear down
    clientA.deleteTestData();
    clientB.deleteTestData();
    clientC.deleteTestData();
    clientD.deleteTestData();
    clientE.deleteTestData();
    FileUtils.deleteDirectory(new File(testConnection.getPath() + "_1_before_cleanup"));
    FileUtils.deleteDirectory(new File(clientA.getConfig().getAppDir(), "1_before_cleanup"));
    FileUtils.deleteDirectory(new File(testConnection.getPath() + "_2_after_cleanup"));
    FileUtils.deleteDirectory(new File(clientA.getConfig().getAppDir(), "2_after_cleanup"));
    FileUtils.deleteDirectory(new File(testConnection.getPath() + "_3_before_cleanup"));
    FileUtils.deleteDirectory(new File(clientB.getConfig().getAppDir(), "3_before_cleanup"));
    FileUtils.deleteDirectory(new File(testConnection.getPath() + "_4_after_cleanup"));
    FileUtils.deleteDirectory(new File(clientB.getConfig().getAppDir(), "4_after_cleanup"));
    FileUtils.deleteDirectory(new File(testConnection.getPath() + "_5_before_cleanup"));
    FileUtils.deleteDirectory(new File(clientB.getConfig().getAppDir(), "5_before_cleanup"));
    FileUtils.deleteDirectory(new File(testConnection.getPath() + "_6_after_cleanup"));
    FileUtils.deleteDirectory(new File(clientB.getConfig().getAppDir(), "6_after_cleanup"));
}
Also used : LocalTransferSettings(org.syncany.plugins.local.LocalTransferSettings) TestClient(org.syncany.tests.util.TestClient) CleanupOperationOptions(org.syncany.operations.cleanup.CleanupOperationOptions) UpOperationOptions(org.syncany.operations.up.UpOperationOptions) StatusOperationOptions(org.syncany.operations.status.StatusOperationOptions) File(java.io.File) Test(org.junit.Test)

Example 28 with CleanupOperationOptions

use of org.syncany.operations.cleanup.CleanupOperationOptions in project syncany by syncany.

the class CleanupMergeDatabaseFilesScenarioTest method testCleanupMergeDatabaseFilesScenario1.

@Test
public void testCleanupMergeDatabaseFilesScenario1() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);
    TestClient clientC = new TestClient("C", testConnection);
    CleanupOperationOptions cleanupOptionsOnlyMergeDatabases = new CleanupOperationOptions();
    cleanupOptionsOnlyMergeDatabases.setRemoveOldVersions(false);
    UpOperationOptions upOperationOptionsNoCleanup = new UpOperationOptions();
    upOperationOptionsNoCleanup.setForceUploadEnabled(true);
    // Run preparations
    int[] clientUpSequence = new int[] { // 16x "1", merge happens after 15!
    1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
    for (int i = 0; i < clientUpSequence.length; i++) {
        if (clientUpSequence[i] == 1) {
            clientA.down();
            clientA.createNewFile("A-file" + i + ".jpg", i);
            clientA.up(upOperationOptionsNoCleanup);
        } else {
            clientB.down();
            clientB.createNewFile("B-file" + i + ".jpg", i);
            clientB.up(upOperationOptionsNoCleanup);
        }
    }
    clientA.cleanup();
    clientA.down();
    clientB.down();
    assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
    // Make sure the "merge" process actually happened
    assertFalse(new File(testConnection.getPath(), "databases/database-A-0000000001").exists());
    assertFalse(new File(testConnection.getPath(), "databases/database-A-0000000005").exists());
    assertFalse(new File(testConnection.getPath(), "databases/database-A-0000000010").exists());
    assertFalse(new File(testConnection.getPath(), "databases/database-A-0000000030").exists());
    assertFalse(new File(testConnection.getPath(), "databases/database-A-0000000031").exists());
    assertTrue(new File(testConnection.getPath(), "databases/database-A-0000000032").exists());
    // Run
    // <<< Here is/was the issue: Client C failed when downloading
    clientC.down();
    assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientC.getDatabaseFile());
    // Tear down
    clientA.deleteTestData();
    clientB.deleteTestData();
    clientC.deleteTestData();
}
Also used : LocalTransferSettings(org.syncany.plugins.local.LocalTransferSettings) TestClient(org.syncany.tests.util.TestClient) CleanupOperationOptions(org.syncany.operations.cleanup.CleanupOperationOptions) UpOperationOptions(org.syncany.operations.up.UpOperationOptions) File(java.io.File) Test(org.junit.Test)

Example 29 with CleanupOperationOptions

use of org.syncany.operations.cleanup.CleanupOperationOptions in project syncany by syncany.

the class DirtyDatabaseScenarioTest method testDirtyCleanupDirty.

@Test
public void testDirtyCleanupDirty() throws Exception {
    // Setup
    TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);
    TestClient clientC = new TestClient("C", testConnection);
    TestClient clientD = new TestClient("D", testConnection);
    StatusOperationOptions statusOptions = new StatusOperationOptions();
    statusOptions.setForceChecksum(true);
    UpOperationOptions upOptionsForceEnabled = new UpOperationOptions();
    upOptionsForceEnabled.setStatusOptions(statusOptions);
    upOptionsForceEnabled.setForceUploadEnabled(true);
    CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
    cleanupOptions.setMinSecondsBetweenCleanups(0);
    cleanupOptions.setForce(true);
    // Run
    //// 1. CREATE FIRST DIRTY VERSION
    clientA.createNewFile("A-file1.jpg", 50 * 1024);
    // (A1)
    clientA.up(upOptionsForceEnabled);
    clientB.down();
    clientB.changeFile("A-file1.jpg");
    // (A1,B1)
    clientB.up(upOptionsForceEnabled);
    clientA.down();
    // conflict (winner)
    clientA.changeFile("A-file1.jpg");
    // (A2,B1)
    clientA.up(upOptionsForceEnabled);
    // conflict (loser)
    clientB.changeFile("A-file1.jpg");
    clientB.up(upOptionsForceEnabled);
    // don't care about the conflict, just continue
    clientA.createNewFolder("new folder at A");
    // (A3,B1)
    clientA.up(upOptionsForceEnabled);
    // don't care about the conflict, just continue
    clientB.createNewFolder("new folder at B");
    clientB.up(upOptionsForceEnabled);
    // resolve conflict (wins, no DIRTY)
    clientA.down();
    java.sql.Connection databaseConnectionA = DatabaseConnectionFactory.createConnection(clientA.getDatabaseFile(), false);
    assertEquals("0", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status='DIRTY'", databaseConnectionA));
    // resolve conflict (loses, creates DIRTY version)
    clientB.down();
    java.sql.Connection databaseConnectionB = DatabaseConnectionFactory.createConnection(clientB.getDatabaseFile(), false);
    assertEquals("2", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status='DIRTY'", databaseConnectionB));
    assertEquals("(A1,B2)\n(A1,B3)", TestSqlUtil.runSqlSelect("select vectorclock_serialized from databaseversion where status='DIRTY' order by id", databaseConnectionB));
    assertEquals("(A1)\n(A1,B1)\n(A2,B1)\n(A3,B1)", TestSqlUtil.runSqlSelect("select vectorclock_serialized from databaseversion where status<>'DIRTY' order by id", databaseConnectionB));
    StatusOperationResult statusResultBAfterDirty = clientB.status();
    assertNotNull(statusResultBAfterDirty);
    ChangeSet changeSetBAfterDirty = statusResultBAfterDirty.getChangeSet();
    assertEquals(2, changeSetBAfterDirty.getNewFiles().size());
    TestAssertUtil.assertConflictingFileExists("A-file1.jpg", clientB.getLocalFiles());
    // (A3,B2)
    clientB.up(upOptionsForceEnabled);
    assertEquals("0", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status='DIRTY'", databaseConnectionB));
    // (A1), (A1,B1), (A2,B1), (A3,B1)
    assertEquals("4", TestSqlUtil.runSqlSelect("select count(*) from databaseversion", databaseConnectionA));
    assertEquals("(A1)\n(A1,B1)\n(A2,B1)\n(A3,B1)", TestSqlUtil.runSqlSelect("select vectorclock_serialized from databaseversion order by id", databaseConnectionA));
    assertEquals("5", TestSqlUtil.runSqlSelect("select count(*) from databaseversion", databaseConnectionB));
    assertEquals("(A1)\n(A1,B1)\n(A2,B1)\n(A3,B1)\n(A3,B4)", TestSqlUtil.runSqlSelect("select vectorclock_serialized from databaseversion order by id", databaseConnectionB));
    //// 2. NOW THAT CLIENT B RESOLVED IT, A GETS DIRTY
    // No 'down'! This version will become DIRTY
    clientA.changeFile("A-file1.jpg");
    clientA.createNewFile("dirty1");
    clientA.up(upOptionsForceEnabled);
    // No 'down'! This version will become DIRTY
    clientA.changeFile("A-file1.jpg");
    clientA.createNewFile("dirty2");
    clientA.up(upOptionsForceEnabled);
    // No 'down'! This version will become DIRTY
    clientA.changeFile("A-file1.jpg");
    clientA.createNewFile("dirty3");
    clientA.up(upOptionsForceEnabled);
    // No 'down'! This version will become DIRTY
    clientA.changeFile("A-file1.jpg");
    clientA.createNewFile("dirty4");
    clientA.up(upOptionsForceEnabled);
    // No 'down'! This version will become DIRTY
    clientA.changeFile("A-file1.jpg");
    clientA.createNewFile("dirty5");
    clientA.up(upOptionsForceEnabled);
    // No 'down'! This version will become DIRTY
    clientA.changeFile("A-file1.jpg");
    clientA.createNewFile("dirty6");
    clientA.up(upOptionsForceEnabled);
    // No 'down'! This version will become DIRTY
    clientA.changeFile("A-file1.jpg");
    clientA.createNewFile("dirty7");
    clientA.up(upOptionsForceEnabled);
    assertEquals("11", TestSqlUtil.runSqlSelect("select count(*) from databaseversion", databaseConnectionA));
    clientA.down();
    assertEquals("12", TestSqlUtil.runSqlSelect("select count(*) from databaseversion", databaseConnectionA));
    assertEquals("7", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status='DIRTY'", databaseConnectionA));
    assertEquals("5", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status<>'DIRTY'", databaseConnectionA));
    assertEquals("(A1)\n(A1,B1)\n(A2,B1)\n(A3,B1)\n(A3,B4)", TestSqlUtil.runSqlSelect("select vectorclock_serialized from databaseversion where status<>'DIRTY' order by id", databaseConnectionA));
    // Does nothing; A versions lose against (A3,B2) // same as above!
    clientB.down();
    assertEquals("5", TestSqlUtil.runSqlSelect("select count(*) from databaseversion", databaseConnectionB));
    assertEquals("(A1)\n(A1,B1)\n(A2,B1)\n(A3,B1)\n(A3,B4)", TestSqlUtil.runSqlSelect("select vectorclock_serialized from databaseversion order by id", databaseConnectionB));
    //// 3. NEW CLIENT JOINS
    clientC.down();
    TestAssertUtil.assertSqlDatabaseEquals(clientB.getDatabaseFile(), clientC.getDatabaseFile());
    //// 4. FORCE MERGE DATABASES ON CLIENT A
    clientA.deleteFile("dirty1");
    clientA.deleteFile("dirty2");
    // upload DIRTY version
    clientA.up(upOptionsForceEnabled);
    assertEquals("6", TestSqlUtil.runSqlSelect("select count(*) from databaseversion", databaseConnectionA));
    assertEquals("0", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status='DIRTY'", databaseConnectionA));
    assertEquals("6", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status<>'DIRTY'", databaseConnectionA));
    clientA.createNewFile("A-file2.jpg");
    // For every X up's call 'cleanup' ("X" is larger than the max. length of file versions in a history)
    int cleanupEveryXUps = 7;
    for (int i = 1; i <= 21; i++) {
        clientA.changeFile("A-file2.jpg");
        clientA.up(upOptionsForceEnabled);
        if (i % cleanupEveryXUps == 0) {
            clientA.cleanup(cleanupOptions);
        }
    }
    clientA.cleanup(cleanupOptions);
    clientB.down();
    clientC.down();
    clientD.down();
    TestAssertUtil.assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
    TestAssertUtil.assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientC.getDatabaseFile());
    TestAssertUtil.assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientD.getDatabaseFile());
    // Tear down
    clientA.deleteTestData();
    clientB.deleteTestData();
    clientC.deleteTestData();
    clientD.deleteTestData();
}
Also used : TestClient(org.syncany.tests.util.TestClient) CleanupOperationOptions(org.syncany.operations.cleanup.CleanupOperationOptions) TransferSettings(org.syncany.plugins.transfer.TransferSettings) UpOperationOptions(org.syncany.operations.up.UpOperationOptions) StatusOperationOptions(org.syncany.operations.status.StatusOperationOptions) ChangeSet(org.syncany.operations.ChangeSet) StatusOperationResult(org.syncany.operations.status.StatusOperationResult) Test(org.junit.Test)

Example 30 with CleanupOperationOptions

use of org.syncany.operations.cleanup.CleanupOperationOptions in project syncany by syncany.

the class FileVanishedScenarioTest method testCallUpWhileDeletingFiles.

// TODO [low] If a file has vanished, are its chunks and multichunks still added to the database, and then uploaded? If so, fix this!
@Test
public void testCallUpWhileDeletingFiles() throws Exception {
    // Setup
    final TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
    final TestClient clientA = new TestClient("A", testConnection);
    final TestClient clientB = new TestClient("B", testConnection);
    final int numFiles = 100;
    final int numFilesVanished = 50;
    final int numFilesRemaining = numFiles - numFilesVanished;
    final int sizeFiles = 500 * 1024;
    CleanupOperationOptions options = new CleanupOperationOptions();
    options.setMinKeepSeconds(0);
    // Prepare by creating test files
    logger.log(Level.INFO, "Creating test files ...");
    for (int i = 0; i <= numFiles; i++) {
        clientA.createNewFile("A-original" + i, sizeFiles);
    }
    // Prepare threads (delete & run up)
    Thread deleteFilesThread = new Thread(new Runnable() {

        @Override
        public void run() {
            for (int i = numFiles; i >= numFilesVanished; i--) {
                boolean deleteSuccess = clientA.deleteFile("A-original" + i);
                if (deleteSuccess) {
                    logger.log(Level.SEVERE, "Deleted " + clientA.getLocalFile("A-original" + i));
                } else {
                    logger.log(Level.SEVERE, "FAILED TO DELETE FILE " + clientA.getLocalFile("A-original" + i));
                }
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    logger.log(Level.FINE, "Thread interrupted", e);
                }
            }
        }
    }, "A-delete");
    Thread runUpThread = new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                Thread.sleep(40);
                clientA.up();
            } catch (Exception e) {
                e.printStackTrace();
                fail(e.getMessage());
            }
        }
    }, "A-up");
    // Before we start: init database (this takes a while)
    clientA.status();
    clientB.status();
    // Delete files and run up simultaneously
    // --> This will hopefully lead to a couple of 'vanished' files
    logger.log(Level.INFO, "Starting 'up' thread ...");
    runUpThread.start();
    logger.log(Level.INFO, "Starting 'delete' thread ...");
    deleteFilesThread.start();
    runUpThread.join();
    deleteFilesThread.join();
    // Test 1: There should be between 50 and 100 file histories in the database
    SqlDatabase databaseClientA = clientA.loadLocalDatabase();
    assertTrue("There should be less file histories than originally added files.", databaseClientA.getFileHistoriesWithFileVersions().size() < numFiles);
    assertTrue("There should be more (or equal size) file histories than files there are.", databaseClientA.getFileHistoriesWithFileVersions().size() >= numFilesRemaining);
    // Test 2: Now up the rest, there should be exactly 50 files in the database
    clientA.up();
    clientA.cleanup(options);
    databaseClientA = clientA.loadLocalDatabase();
    assertEquals("There should be EXACTLY " + numFilesRemaining + " file histories in the database.", numFilesRemaining, databaseClientA.getFileHistoriesWithFileVersions().size());
    // Test 3: After that, the sync between the clients should of course still work
    clientB.down();
    assertFileListEquals("Files of both clients should be identical.", clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
    assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
    // Tear down
    clientA.deleteTestData();
    clientB.deleteTestData();
}
Also used : TestClient(org.syncany.tests.util.TestClient) CleanupOperationOptions(org.syncany.operations.cleanup.CleanupOperationOptions) SqlDatabase(org.syncany.database.SqlDatabase) TransferSettings(org.syncany.plugins.transfer.TransferSettings) Test(org.junit.Test)

Aggregations

CleanupOperationOptions (org.syncany.operations.cleanup.CleanupOperationOptions)34 Test (org.junit.Test)31 TestClient (org.syncany.tests.util.TestClient)31 LocalTransferSettings (org.syncany.plugins.local.LocalTransferSettings)21 UnreliableLocalTransferSettings (org.syncany.plugins.unreliable_local.UnreliableLocalTransferSettings)18 CleanupOperationResult (org.syncany.operations.cleanup.CleanupOperationResult)14 File (java.io.File)11 StatusOperationOptions (org.syncany.operations.status.StatusOperationOptions)8 UpOperationOptions (org.syncany.operations.up.UpOperationOptions)8 FilenameFilter (java.io.FilenameFilter)5 TimeUnit (org.syncany.operations.cleanup.CleanupOperationOptions.TimeUnit)5 DatabaseRemoteFile (org.syncany.plugins.transfer.files.DatabaseRemoteFile)5 ActionRemoteFile (org.syncany.plugins.transfer.files.ActionRemoteFile)4 MultichunkRemoteFile (org.syncany.plugins.transfer.files.MultichunkRemoteFile)4 RemoteFile (org.syncany.plugins.transfer.files.RemoteFile)4 TempRemoteFile (org.syncany.plugins.transfer.files.TempRemoteFile)4 TransactionRemoteFile (org.syncany.plugins.transfer.files.TransactionRemoteFile)4 StorageException (org.syncany.plugins.transfer.StorageException)3 TransferManager (org.syncany.plugins.transfer.TransferManager)3 TransferSettings (org.syncany.plugins.transfer.TransferSettings)3