Package org.syncany.operations.init

Examples of org.syncany.operations.init.ConnectOperationResult


    connectOperationOptionsB.setConfigTO(connectionConfigToB);
    connectOperationOptionsB.setPassword(initOperationOptionsA.getPassword());
    connectOperationOptionsB.setLocalDir(localDirB);

    ConnectOperation connectOperationB = new ConnectOperation(connectOperationOptionsB, null);
    ConnectOperationResult connectOperationResultB = connectOperationB.execute();

    assertEquals(ConnectResultCode.OK, connectOperationResultB.getResultCode());
    assertTrue(new File(localConnectDirB, Config.DIR_DATABASE).exists());
    assertTrue(new File(localConnectDirB, Config.DIR_CACHE).exists());
    assertTrue(new File(localConnectDirB, Config.FILE_CONFIG).exists());
    assertTrue(new File(localConnectDirB, Config.DIR_LOG).exists());
    assertTrue(new File(localConnectDirB, Config.FILE_REPO).exists());
View Full Code Here


    connectOperationOptionsB.setConfigTO(connectionConfigToB);
    connectOperationOptionsB.setPassword(initOperationOptionsA.getPassword());
    connectOperationOptionsB.setLocalDir(localDirB);

    ConnectOperation connectOperationB = new ConnectOperation(connectOperationOptionsB, null);
    ConnectOperationResult connectOperationResultB = connectOperationB.execute();

    assertEquals(ConnectResultCode.NOK_TEST_FAILED, connectOperationResultB.getResultCode());
    assertFalse(new File(localConnectDirB, Config.DIR_DATABASE).exists());
    assertFalse(new File(localConnectDirB, Config.DIR_CACHE).exists());
    assertFalse(new File(localConnectDirB, Config.FILE_CONFIG).exists());
    assertFalse(new File(localConnectDirB, Config.DIR_LOG).exists());
    assertFalse(new File(localConnectDirB, Config.FILE_REPO).exists());
View Full Code Here

    boolean performOperation = true;

    ConnectOperationOptions operationOptions = parseOptions(operationArgs);

    while (retryNeeded && performOperation) {
      ConnectOperationResult operationResult = client.connect(operationOptions, this);
      printResults(operationResult);

      retryNeeded = operationResult.getResultCode() != ConnectResultCode.OK
          && operationResult.getResultCode() != ConnectResultCode.NOK_DECRYPT_ERROR;

      if (retryNeeded) {
        performOperation = isInteractive && askRetryConnection();

        if (performOperation) {
View Full Code Here

      return null; // Will be set in callback!
    }
  }
  @Override
  public void printResults(OperationResult operationResult) {
    ConnectOperationResult concreteOperationResult = (ConnectOperationResult) operationResult;

    if (concreteOperationResult.getResultCode() == ConnectResultCode.OK) {
      out.println();
      out.println("Repository connected, and local folder initialized.");
      out.println("You can now use the 'syncany' command to sync your files.");
      out.println();

      if (concreteOperationResult.isAddedToDaemon()) {
        out.println("To automatically sync this folder, simply restart the daemon with 'sy daemon restart'.");
        out.println();
      }
    }
    else if (concreteOperationResult.getResultCode() == ConnectResultCode.NOK_TEST_FAILED) {
      StorageTestResult testResult = concreteOperationResult.getTestResult();
      out.println();

      if (!testResult.isTargetCanConnect()) {
        out.println("ERROR: Cannot connect to the repository, because the connection to the storage backend failed.");
        out.println("       Possible reasons for this could be connectivity issues (are you connect to the Internet?),");
        out.println("       or invalid user credentials (are username/password valid?).");
      }
      else if (!testResult.isTargetExists()) {
        out.println("ERROR: Cannot connect to the repository, because the target does not exist.");
        out.println("       Please check if it really exists and if you can read from it / write to it.");
      }
      else if (!testResult.isTargetCanWrite()) {
        out.println("ERROR: Cannot connect to the repository, because the target is not writable. This is probably");
        out.println("       a permission issue (does the user have write permissions to the target?).");
      }
      else if (!testResult.isRepoFileExists()) {
        out.println("ERROR: Cannot connect to the repository, because no repo file was found ('syncany' file).");
        out.println("       Are you sure that this is a valid Syncany repository? Use 'sy init' to create a new one.");
      }
      else {
        out.println("ERROR: Cannot connect to the repository.");
      }

      out.println();
      printTestResult(testResult);
    }
    else if (concreteOperationResult.getResultCode() == ConnectResultCode.NOK_DECRYPT_ERROR) {
      out.println();
      out.println("ERROR: Invalid password or corrupt ciphertext.");
      out.println();
      out.println("The reason for this might be an invalid password, or that the");
      out.println("link/files have been tampered with.");
View Full Code Here

TOP

Related Classes of org.syncany.operations.init.ConnectOperationResult

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.