Package org.syncany.operations.status

Examples of org.syncany.operations.status.StatusOperationResult


    FileUtil.createSymlink("/etc/hosts", symlinkFile);

    assertTrue("Symlink should exist at " + symlinkFile, symlinkFile.exists());

    UpOperationResult upResult = clientA.up();
    StatusOperationResult statusResult = upResult.getStatusResult();

    // Test 1: Check result sets for inconsistencies
    assertTrue("Status should return changes.", statusResult.getChangeSet().hasChanges());
    assertTrue("File should be uploaded.", upResult.getChangeSet().hasChanges());

    // Test 2: Check database for inconsistencies
    SqlDatabase database = clientA.loadLocalDatabase();
View Full Code Here


    java.sql.Connection databaseConnectionB = DatabaseConnectionFactory.createConnection(clientB.getDatabaseFile());
    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());
   
    clientB.up(upOptionsForceEnabled); // (A3,B2)
    assertEquals("0", TestSqlUtil.runSqlSelect("select count(*) from databaseversion where status='DIRTY'", databaseConnectionB));
View Full Code Here

    }
    else if (EnvironmentUtil.isUnixLikeOperatingSystem()) {
      Files.setPosixFilePermissions(bFilePath, PosixFilePermissions.fromString("rwxrwxrwx"));
    }   
   
    StatusOperationResult statusResult = clientB.status();
    assertNotNull(statusResult);
   
    ChangeSet changes = statusResult.getChangeSet();
   
    assertTrue("Status-Operation should return changes.", changes.hasChanges());
    UpOperationResult upResult = clientB.up();
    StatusOperationResult statusResultFromUp = upResult.getStatusResult();
   
    // Test 1: Check result sets for inconsistencies
    assertTrue("Status should return changes.", statusResultFromUp.getChangeSet().hasChanges());
    assertTrue("File should be uploaded.", upResult.getChangeSet().hasChanges());
   
    // Test 2: Check database for inconsistencies
    SqlDatabase database = clientB.loadLocalDatabase();
View Full Code Here

  }

  private boolean checkPreconditions() throws Exception {
    // Find local changes
    StatusOperation statusOperation = new StatusOperation(config, options.getStatusOptions());
    StatusOperationResult statusOperationResult = statusOperation.execute();
    ChangeSet localChanges = statusOperationResult.getChangeSet();

    result.getStatusResult().setChangeSet(localChanges);

    if (!localChanges.hasChanges()) {
      logger.log(Level.INFO, "Local database is up-to-date (change set). NOTHING TO DO!");
View Full Code Here

    return CleanupResultCode.OK;
  }

  private boolean hasLocalChanges() throws Exception {
    StatusOperationResult statusOperationResult = new StatusOperation(config, options.getStatusOptions()).execute();
    return statusOperationResult.getChangeSet().hasChanges();
  }
View Full Code Here

  public Response handleRequest(FolderRequest request) {
    StatusFolderRequest concreteRequest = (StatusFolderRequest) request;

    try {
      StatusOperation operation = new StatusOperation(config, concreteRequest.getOptions());
      StatusOperationResult operationResult = operation.execute();
      StatusFolderResponse statusFolderResponse = new StatusFolderResponse(operationResult, request.getId());
   
      return statusFolderResponse;
    }
    catch (Exception e) {
View Full Code Here

    Thread.sleep(50);

    logger.log(Level.SEVERE, "Started clientA.up()");
    UpOperationResult upResult = clientA.up();
    StatusOperationResult statusResult = upResult.getStatusResult();
    logger.log(Level.SEVERE, "Ended clientA.up()");

    writeFileThread.join();

    // Test 1: Check result sets for inconsistencies
    assertTrue("Status command expected to return changes.", statusResult.getChangeSet().hasChanges());
    assertFalse("File should NOT be uploaded while still writing (no half-file upload).", upResult.getChangeSet().hasChanges());

    // Test 2: Check database for inconsistencies
    SqlDatabase database = clientA.loadLocalDatabase();
View Full Code Here

  }
 
  @Override
  public int execute(String[] operationArgs) throws Exception {
    StatusOperationOptions operationOptions = parseOptions(operationArgs);
    StatusOperationResult operationResult = client.status(operationOptions);
   
    printResults(operationResult);
   
    return 0;
  }
View Full Code Here

    return operationOptions;
 

  @Override
  public void printResults(OperationResult operationResult) {
    StatusOperationResult concreteOperationResult = (StatusOperationResult) operationResult;
   
    if (concreteOperationResult.getChangeSet().hasChanges()) {
      for (String newFile : concreteOperationResult.getChangeSet().getNewFiles()) {
        out.println("? "+newFile);
      }

      for (String changedFile : concreteOperationResult.getChangeSet().getChangedFiles()) {
        out.println("M "+changedFile);
      }
     
      for (String deletedFile : concreteOperationResult.getChangeSet().getDeletedFiles()) {
        out.println("D "+deletedFile);
      }           
    }
    else {
      out.println("No local changes.");
View Full Code Here

    clientA.deleteTestData();
  }

  private void runUpAndTestForConsistentDatabase(TransferSettings connection, TestClient client) throws Exception {
    UpOperationResult upResult = client.up();
    StatusOperationResult statusResult = upResult.getStatusResult();

    // Test 1: Check result sets for inconsistencies
    assertTrue("Status command expected to return changes.", statusResult.getChangeSet().hasChanges());
    assertTrue("File should be uploaded while it is read-only.", upResult.getChangeSet().hasChanges());

    // Test 2: Check database for inconsistencies
    SqlDatabase database = client.loadLocalDatabase();
    assertNotNull("There should be a new database version, because files should have been added.", database.getLastDatabaseVersionHeader());
View Full Code Here

TOP

Related Classes of org.syncany.operations.status.StatusOperationResult

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.