Package org.syncany.plugins.unreliable_local

Examples of org.syncany.plugins.unreliable_local.UnreliableLocalTransferSettings


    return conn;
  }

  public static UnreliableLocalTransferSettings createTestUnreliableLocalConnection(List<String> failingOperationPatterns) throws Exception {
    UnreliableLocalTransferPlugin unreliableLocalPlugin = new UnreliableLocalTransferPlugin();
    UnreliableLocalTransferSettings unreliableLocalConnection = createTestUnreliableLocalConnectionWithoutInit(unreliableLocalPlugin,
        failingOperationPatterns);

    unreliableLocalPlugin.createTransferManager(unreliableLocalConnection, null).init(true);

    return unreliableLocalConnection;
View Full Code Here


    return unreliableLocalConnection;
  }

  public static UnreliableLocalTransferSettings createTestUnreliableLocalConnectionWithoutInit(UnreliableLocalTransferPlugin unreliableLocalPlugin,
      List<String> failingOperationPatterns) throws Exception {
    UnreliableLocalTransferSettings unreliableLocalConnection = unreliableLocalPlugin.createEmptySettings();

    File tempRepoDir = TestFileUtil.createTempDirectoryInSystemTemp(createUniqueName("repo", new Random().nextFloat()));

    unreliableLocalConnection.setPath(tempRepoDir);
    unreliableLocalConnection.setFailingOperationPatterns(failingOperationPatterns);
    return unreliableLocalConnection;
  }
View Full Code Here

  }

  @Test
  public void testCleanupAfterFailedUpOperation() throws Exception {
    // Setup
    UnreliableLocalTransferSettings testConnection = TestConfigUtil.createTestUnreliableLocalConnection(Arrays.asList(new String[] {
        // List of failing operations (regex)
        // Format: abs=<count> rel=<count> op=<connect|init|upload|...> <operation description>

        "rel=[456].+upload.+multichunk" // << 3 retries!
    }));

    TestClient clientA = new TestClient("A", testConnection);
    TestClient clientB = new TestClient("B", testConnection);

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

    UpOperationOptions noCleanupAndForceUpOperationOptions = new UpOperationOptions();
    noCleanupAndForceUpOperationOptions.setForceUploadEnabled(true);
    noCleanupAndForceUpOperationOptions.setStatusOptions(forceChecksumStatusOperationOptions);

    // Run

    // 1. Call A.up(); this fails AFTER the first multichunk
    clientA.createNewFile("A-file1", 5 * 1024 * 1024);
    boolean operationFailed = false;

    try {
      clientA.up();
    }
    catch (Exception e) {
      operationFailed = true; // That is supposed to happen!
    }

    File repoMultiChunkDir = new File(testConnection.getPath() + "/multichunks");
    File repoActionsDir = new File(testConnection.getPath() + "/actions");

    assertTrue(operationFailed);
    // Atomic operation, so multichunk is not yet present at location
    assertEquals(0, repoMultiChunkDir.listFiles().length);
    assertEquals(1, repoActionsDir.listFiles().length);
View Full Code Here

  }

  @Test
  public void testCleanupFailsMidCommit() throws Exception {
    // Setup
    UnreliableLocalTransferSettings testConnection = TestConfigUtil.createTestUnreliableLocalConnection(Arrays.asList(new String[] {
        // List of failing operations (regex)
        // Format: abs=<count> rel=<count> op=<connect|init|upload|...> <operation description>

        "rel=(13|14|15).+move" // << 3 retries!
    }));

    TestClient clientA = new TestClient("A", testConnection);
    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");
    File repoTransactionsDir = new File(testConnection.getPath() + "/transactions");
    File repoTemporaryDir = new File(testConnection.getPath() + "/temporary");

    // Run

    clientA.createNewFile("A-file1", 5 * 1024);
    clientA.up();
 
View Full Code Here

TOP

Related Classes of org.syncany.plugins.unreliable_local.UnreliableLocalTransferSettings

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.