Package org.syncany.operations.status

Examples of org.syncany.operations.status.StatusOperation$StatusFileVisitor


    eventBus.post(new UpEndSyncExternalEvent(config.getLocalDir().getAbsolutePath(), result.getResultCode(), result.getChangeSet()));
  }

  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()) {
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 StatusOperationResult status() throws Exception {
    return status(new StatusOperationOptions());
  }

  public StatusOperationResult status(StatusOperationOptions options) throws Exception {
    return new StatusOperation(config, options).execute();
  }
View Full Code Here

  @Override
  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

   
    // Add new files
    List<File> originalFiles = TestFileUtil.createRandomFilesInDirectory(config.getLocalDir(), 500*1024, 3);
    
    // Status
    ChangeSet changeSet = (new StatusOperation(config).execute()).getChangeSet();       
   
    assertEquals(changeSet.getNewFiles().size(), originalFiles.size());
    assertEquals(changeSet.getChangedFiles().size(), 0);
    assertEquals(changeSet.getDeletedFiles().size(), 0);
       
    // Up
    new UpOperation(config).execute();   
       
    // Status
    changeSet = (new StatusOperation(config).execute()).getChangeSet();   
   
    assertEquals(changeSet.getNewFiles().size(), 0);
    assertEquals(changeSet.getChangedFiles().size(), 0);
    assertEquals(changeSet.getDeletedFiles().size(), 0);

    // Change all files, run 'status'
    Thread.sleep(2000); // TODO [low] StatusOperation relies on file modified time and size, any other methods?

    for (File file : originalFiles) {
      TestFileUtil.changeRandomPartOfBinaryFile(file);
    }   
   
    changeSet = (new StatusOperation(config).execute()).getChangeSet();
   
    assertEquals(changeSet.getNewFiles().size(), 0);
    assertEquals(changeSet.getChangedFiles().size(), originalFiles.size());
    assertEquals(changeSet.getDeletedFiles().size(), 0);
   
    // Up
    new UpOperation(config).execute();
       
    // Delete all files, run 'status' again
    for (File file : originalFiles) {
      TestFileUtil.deleteFile(file);
    }
       
    changeSet = (new StatusOperation(config).execute()).getChangeSet();
   
    assertEquals(changeSet.getNewFiles().size(), 0);
    assertEquals(changeSet.getChangedFiles().size(), 0);
    assertEquals(changeSet.getDeletedFiles().size(), originalFiles.size());
       
View Full Code Here

    // IMPORTANT: Do NOT sleep to enforce checksum-based comparison in 'status'
    new UpOperation(config, syncUpOptions).execute();   
    TestFileUtil.changeRandomPartOfBinaryFile(testFile);
   
    // Run 'status', this should run a checksum-based file comparison
    ChangeSet changeSet = (new StatusOperation(config, statusOptions).execute()).getChangeSet();           
    assertEquals(changeSet.getChangedFiles().size(), 1);
       
    // Cleanup
    TestConfigUtil.deleteTestLocalConfigAndData(config);
  }
View Full Code Here

    new UpOperation(config).execute();       
    Thread.sleep(2000);
    TestFileUtil.changeRandomPartOfBinaryFile(testFile);
   
    // Run 'status', this should NOT run a checksum-based file comparison
    ChangeSet changeSet = (new StatusOperation(config).execute()).getChangeSet();           
    assertEquals(changeSet.getChangedFiles().size(), 1);
       
    // Cleanup
    TestConfigUtil.deleteTestLocalConfigAndData(config);
  }
View Full Code Here

    // Setup
    Config config = TestConfigUtil.createTestLocalConfig();
    new File(config.getLocalDir()+"/somefolder").mkdir();
       
    // Run 'status', this SHOULD list the folder
    ChangeSet changeSet = (new StatusOperation(config).execute()).getChangeSet();           
    assertEquals(changeSet.getNewFiles().size(), 1);
    assertEquals(changeSet.getChangedFiles().size(), 0);
    assertEquals(changeSet.getDeletedFiles().size(), 0);
    assertEquals(changeSet.getUnchangedFiles().size(), 0)
   
    // Run 'up' to check in the folder
    new UpOperation(config).execute();
   
    // Run 'status', this SHOULD NOT list the folder in the changed/new files
    changeSet = (new StatusOperation(config).execute()).getChangeSet();           
    assertEquals(changeSet.getNewFiles().size(), 0);
    assertEquals(changeSet.getChangedFiles().size(), 0);
    assertEquals(changeSet.getDeletedFiles().size(), 0);
    assertEquals(changeSet.getUnchangedFiles().size(), 1);   
       
View Full Code Here

TOP

Related Classes of org.syncany.operations.status.StatusOperation$StatusFileVisitor

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.