Package org.syncany.operations.cleanup

Examples of org.syncany.operations.cleanup.CleanupOperationOptions


    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);

    CleanupOperationOptions options = new CleanupOperationOptions();
    options.setMergeRemoteFiles(false);
    options.setRemoveOldVersions(true);
    options.setKeepVersionsCount(2);

    // Run

    // A: Create some file versions
    clientA.createNewFile("file.jpg");
View Full Code Here


    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);

    CleanupOperationOptions removeOldCleanupOperationOptions = new CleanupOperationOptions();
    removeOldCleanupOperationOptions.setMergeRemoteFiles(false);
    removeOldCleanupOperationOptions.setRemoveOldVersions(true);
    removeOldCleanupOperationOptions.setKeepVersionsCount(2);

    StatusOperationOptions forceChecksumStatusOperationOptions = new StatusOperationOptions();
    forceChecksumStatusOperationOptions.setForceChecksum(true);

    UpOperationOptions noCleanupAndForceUpOperationOptions = new UpOperationOptions();
View Full Code Here

  public void testCleanupMaxDatabaseFiles() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);

    CleanupOperationOptions options = new CleanupOperationOptions();
    options.setMergeRemoteFiles(true);
    options.setRemoveOldVersions(true);
    options.setKeepVersionsCount(10);
    options.setMaxDatabaseFiles(3);

    // Run

    // A: Create some file versions
    clientA.createNewFile("file.jpg");
View Full Code Here

  public void testQuickDoubleCleanup() throws Exception {
    // Setup
    LocalTransferSettings testConnection = (LocalTransferSettings) TestConfigUtil.createTestLocalConnection();
    TestClient clientA = new TestClient("A", testConnection);

    CleanupOperationOptions options = new CleanupOperationOptions();
    options.setMergeRemoteFiles(true);
    options.setRemoveOldVersions(false);
    options.setMinSecondsBetweenCleanups(40000000);

    // Run

    // A: Create some file versions
    clientA.createNewFile("file.jpg");
    for (int i = 1; i <= 16; i++) {
      clientA.changeFile("file.jpg");
      clientA.upWithForceChecksum();
    }

    // B: Cleanup
    CleanupOperationResult cleanupOperationResult = clientA.cleanup(options);
    assertEquals(CleanupResultCode.OK, cleanupOperationResult.getResultCode());
    assertEquals(16, cleanupOperationResult.getMergedDatabaseFilesCount());
    assertEquals(0, cleanupOperationResult.getRemovedMultiChunks().size());
    assertEquals(0, cleanupOperationResult.getRemovedOldVersionsCount());

    for (int i = 1; i <= 15; i++) {
      clientA.changeFile("file.jpg");
      clientA.upWithForceChecksum();
    }

    // Because of minimum timeout, this cleanup should not do anything
    cleanupOperationResult = clientA.cleanup(options);
    assertEquals(CleanupResultCode.NOK_RECENTLY_CLEANED, cleanupOperationResult.getResultCode());

    // When force is on, the cleanup should go through
    options.setForce(true);

    cleanupOperationResult = clientA.cleanup(options);
    assertEquals(CleanupResultCode.OK, cleanupOperationResult.getResultCode());
    assertEquals(16, cleanupOperationResult.getMergedDatabaseFilesCount());
    assertEquals(0, cleanupOperationResult.getRemovedMultiChunks().size());
View Full Code Here

    java.sql.Connection databaseConnectionA = clientA.getConfig().createDatabaseConnection();

    StatusOperationOptions forceChecksumStatusOperationOptions = new StatusOperationOptions();
    forceChecksumStatusOperationOptions.setForceChecksum(true);

    CleanupOperationOptions options = new CleanupOperationOptions();
    options.setStatusOptions(forceChecksumStatusOperationOptions);
    options.setMergeRemoteFiles(true);
    options.setRemoveOldVersions(true);
    options.setMinSecondsBetweenCleanups(40000000);
    options.setForce(true);

    File repoDir = testConnection.getPath();
    File repoMultiChunkDir = new File(testConnection.getPath() + "/multichunks");
    File repoActionsDir = new File(testConnection.getPath() + "/actions");
    File repoDatabasesDir = new File(testConnection.getPath() + "/databases");
View Full Code Here

    clientDzHome.upWithForceChecksum();

    // work
    clientUxWork.down();

    CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
    cleanupOptions.setKeepVersionsCount(2);
   
    clientUxWork.cleanup(cleanupOptions);
       
    // home
    clientDzHome.down();
View Full Code Here

   
    // 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);
View Full Code Here

    clientA.up();

    clientA.changeFile("file");
    clientA.upWithForceChecksum();

    CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
    cleanupOptions.setKeepVersionsCount(1);
    boolean cleanupFailed = false;
    try {
      clientA.cleanup(cleanupOptions);
    }
    catch (StorageException e) {
View Full Code Here

    clientA.up();

    clientA.changeFile("file");
    clientA.upWithForceChecksum();

    CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
    cleanupOptions.setMaxDatabaseFiles(1);
    boolean cleanupFailed = false;
    try {
      clientA.cleanup(cleanupOptions);
    }
    catch (StorageException e) {
View Full Code Here

    clientA.up();

    clientA.changeFile("file");
    clientA.upWithForceChecksum();

    CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
    cleanupOptions.setMaxDatabaseFiles(1);
    boolean cleanupFailed = false;
    try {
      clientA.cleanup(cleanupOptions);
    }
    catch (StorageException e) {
View Full Code Here

TOP

Related Classes of org.syncany.operations.cleanup.CleanupOperationOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.