Package org.syncany.operations.daemon.messages.api

Examples of org.syncany.operations.daemon.messages.api.Response


      request.setId(i);
      request.setRoot(clientA.getConfig().getLocalDir().getAbsolutePath());
      request.setOptions(lsOperationOption);
      eventBus.post(request);
     
      Response response = waitForResponse(i);
     
      assertTrue(response instanceof LsFolderResponse);
      LsFolderResponse treeResponse = (LsFolderResponse) response;
     
      files = treeResponse.getResult().getFileTree().values().toArray(new FileVersion[]{});
     
      if (files.length == 2) {
        break;
      }
     
      if (i == 19) {
        assertEquals(2, files.length);
      }
      else {
        Thread.sleep(1000);
      }
    }
   
    if (files[0].getName().equals("folder")) {
      files = new FileVersion[]{files[1], files[0]};
    }

    assertEquals(clientA.getLocalFile("file-1").getName(), files[0].getName());
    assertEquals(clientA.getLocalFile("file-1").length(), (long) files[0].getSize());

    assertEquals(clientA.getLocalFile("folder").getName(), files[1].getName());
    assertTrue(clientA.getLocalFile("folder").isDirectory());
    assertEquals(files[1].getType(), FileVersion.FileType.FOLDER);

    // Create GetFileHistoryRequest for the first returned file
    GetFileHistoryFolderRequest request = new GetFileHistoryFolderRequest();
    request.setId(21);
    request.setRoot(clientA.getConfig().getLocalDir().getAbsolutePath());
    request.setFileHistoryId(files[0].getFileHistoryId().toString());
   
    eventBus.post(request);
   
    Response response = waitForResponse(21);
    assertTrue(response instanceof GetFileHistoryFolderResponse);
    GetFileHistoryFolderResponse fileHistoryResponse = (GetFileHistoryFolderResponse) response;
    assertEquals(1, fileHistoryResponse.getFiles().size());
    assertEquals(files[0], fileHistoryResponse.getFiles().get(0));
   
View Full Code Here


      try {
        if (!watchOperation.isSyncRunning() && !watchOperation.isSyncRequested()) {
          watchOperation.pause();
         
          FolderRequestHandler handler = FolderRequestHandler.createFolderRequestHandler(folderRequest, config);
          Response response = handler.handleRequest(folderRequest);
         
          if (response != null) {
            eventBus.post(response);
          }
         
View Full Code Here

    Thread.sleep(3000); // Settlement in Watcher!
   
    localEventBus.post(cliStatusRequest);
   
    // Then, let's hope the response is "no, no, no!"
    Response response = waitForResponse(2586);
   
    assertTrue(response instanceof StatusFolderResponse);
    StatusFolderResponse cliResponse = (StatusFolderResponse) response;
   
    //assertEquals("Cannot run CLI commands while sync is running or requested.\n", cliResponse.getOutput());
View Full Code Here

    logger.log(Level.FINE, "Received HttpResponse: " + httpResponse);

    String responseStr = IOUtils.toString(httpResponse.getEntity().getContent());
    logger.log(Level.FINE, "Responding to message with responseString: " + responseStr);

    Response response = MessageFactory.toResponse(responseStr);

    if (response instanceof FolderResponse) {
      FolderResponse folderResponse = (FolderResponse) response;
      command.printResults(folderResponse.getResult());

      return 0;
    }
    else if (response instanceof AlreadySyncingResponse) {
      out.println("Daemon is already syncing, please retry later.");
      return 1;
    }
    else if (response instanceof BadRequestResponse) {
      out.println(response.getMessage());
      return 1;
    }

    return 1;
  }
View Full Code Here

TOP

Related Classes of org.syncany.operations.daemon.messages.api.Response

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.