Examples of CommandLineClient


Examples of org.syncany.cli.CommandLineClient

  @Test
  public void testCliSyncUpWithoutCleanup() throws Exception {
    Map<String, String> connectionSettings = TestConfigUtil.createTestLocalConnectionSettings();
    Map<String, String> clientA = TestCliUtil.createLocalTestEnvAndInit("A", connectionSettings);

    new CommandLineClient(new String[] {
       "--localdir", clientA.get("localdir"),
       "up"
    }).start();

    for (int i=1; i<=20; i++) {
      new File(clientA.get("localdir")+"/somefolder"+i).mkdir();

      new CommandLineClient(new String[] {
        "--localdir", clientA.get("localdir"),
        "up"
      }).start();
    }
   
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

  public void testCliSyncUpWithCleanup() throws Exception {
    Map<String, String> connectionSettings = TestConfigUtil.createTestLocalConnectionSettings();
    Map<String, String> clientA = TestCliUtil.createLocalTestEnvAndInit("A", connectionSettings);
    Map<String, String> clientB = TestCliUtil.createLocalTestEnvAndConnect("B", connectionSettings);

    new CommandLineClient(new String[] {
       "--localdir", clientA.get("localdir"),
       "up"
    }).start();

    for (int i=1; i<=20; i++) {
      new File(clientA.get("localdir")+"/somefolder"+i).mkdir();

      new CommandLineClient(new String[] {
        "--localdir", clientA.get("localdir"),
        "up"
      }).start();
    }
   
    // Delete something so that cleanup actually does something
    new File(clientA.get("localdir")+"/somefolder1").delete();
   
    new CommandLineClient(new String[] {
       "--localdir", clientA.get("localdir"),
       "up"
    }).start();

    // Apply all changes at B
    new CommandLineClient(new String[] {
       "--localdir", clientB.get("localdir"),
       "down"
    }).start();
   
    // Now cleanup
    String[] cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] {
       "--localdir", clientA.get("localdir"),
       "cleanup"
    }));
   
    assertEquals(7, cliOut.length);
    assertTrue(cliOut[4].contains("22 database files merged"));
    assertTrue(cliOut[5].contains("1 file histories shortened"));
    assertTrue(cliOut[6].contains("Cleanup successful"));

    for (int i=1; i<=21; i++) {
      DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
      File databaseFileInRepo = new File(connectionSettings.get("path")+"/databases/"+expectedDatabaseRemoteFile.getName());

      assertFalse("Database file SHOULD NOT exist: "+databaseFileInRepo, databaseFileInRepo.exists());
    }
   
    for (int i=22; i<=22; i++) {
      DatabaseRemoteFile expectedDatabaseRemoteFile = new DatabaseRemoteFile("A", i);
      File databaseFileInRepo = new File(connectionSettings.get("path")+"/databases/"+expectedDatabaseRemoteFile.getName());

      assertTrue("Database file SHOULD exist: "+databaseFileInRepo, databaseFileInRepo.exists());
    }
   
    cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] {
      "--localdir", clientB.get("localdir"),
      "down"
    }));
   
    assertEquals(6, cliOut.length);
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

    Map<String, String> clientA = TestCliUtil.createLocalTestEnvAndInit("A", connectionSettings);
    Map<String, String> clientB = TestCliUtil.createLocalTestEnvAndConnect("B", connectionSettings);

    TestFileUtil.createRandomFilesInDirectory(new File(clientA.get("localdir")), 20*1024, 10);
       
    new CommandLineClient(new String[] {
       "--localdir", clientA.get("localdir"),
       "up"
    }).start();

    new CommandLineClient(new String[] {
       "--localdir", clientB.get("localdir"),
       "down"
    }).start();
   
    assertFileListEqualsExcludeLockedAndNoRead(new File(clientA.get("localdir")), new File(clientB.get("localdir")));
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

        "--no-encryption",
        "--no-compression"
    };

    logger.log(Level.INFO, "Running syncany with argument: " + StringUtil.join(initArgs, " "));
    new CommandLineClient(initArgs).start();

    assertTrue("Repo file in repository should exist.", new File(clientA.get("repopath") + "/syncany").exists());
    assertTrue("Repo file in local client should exist.", new File(clientA.get("localdir") + "/" + Config.DIR_APPLICATION + "/"
        + Config.FILE_REPO).exists());
    assertTrue("Config file in local client should exist.", new File(clientA.get("localdir") + "/" + Config.DIR_APPLICATION + "/"
        + Config.FILE_CONFIG).exists());

    // Connect
    String[] connectArgs = new String[] {
        "connect",
        "--localdir", clientB.get("localdir"),
        "--plugin", "local",
        "--plugin-option", "path=" + clientB.get("repopath")
    };

    logger.log(Level.INFO, "Running syncany with argument: " + StringUtil.join(connectArgs, " "));
    new CommandLineClient(connectArgs).start();

    assertTrue("Repo file in local client should exist.", new File(clientB.get("localdir") + "/" + Config.DIR_APPLICATION + "/"
        + Config.FILE_REPO).exists());
    assertTrue("Config file in local client should exist.", new File(clientB.get("localdir") + "/" + Config.DIR_APPLICATION + "/"
        + Config.FILE_CONFIG).exists());
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

    Map<String, String> clientA = TestCliUtil.createLocalTestEnvAndInit("A", connectionSettings);

    // Run!
    new File(clientA.get("localdir") + "/somefolder").mkdir();

    String[] cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] {
        "--localdir", clientA.get("localdir"),
        "up"
    }));

    // Test folder existence
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

    Thread clientThreadA = new Thread(new Runnable() {
      @Override
      public void run() {
        try {
          new CommandLineClient(new String[] {
              "--localdir", clientA.get("localdir"),
              "watch",
              "--interval", "1"
          }).start();
        }
        catch (Exception e) {
          System.out.println("Interrupted.");
        }
      }
    });

    // Client A: Start 'watch'
    clientThreadA.start();

    // Client B: New file and up
    TestFileUtil.createRandomFile(new File(clientB.get("localdir") + "/file1"), 20 * 1024);

    new CommandLineClient(new String[] {
        "--localdir", clientB.get("localdir"),
        "up"
    }).start();

    // Client A: Wait for client A to sync it
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

        "local",
        clientB.get("repopath"),
        "somesuperlongpassword"
    }, "\n") + "\n");

    String[] cliOutputA = TestCliUtil.runAndCaptureOutput(new CommandLineClient(connectArgs));
    String cliOutputSingleLineA = StringUtil.join(cliOutputA, " ");

    assertTrue(localDirB.exists());
    assertTrue(new File(localDirB + "/.syncany").exists());
    assertTrue(new File(localDirB + "/.syncany/syncany").exists());
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

    systemInMock.provideText(StringUtil.join(new String[] {
        // No path or params, not needed because link provided
        initializedRepoPassword
    }, "\n") + "\n");

    String[] cliOutputA = TestCliUtil.runAndCaptureOutput(new CommandLineClient(connectArgs));
    String cliOutputSingleLineA = StringUtil.join(cliOutputA, " ");

    assertTrue(localDirB.exists());
    assertTrue(new File(localDirB + "/.syncany").exists());
    assertTrue(new File(localDirB + "/.syncany/syncany").exists());
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

        initializedRepoFolder.getAbsolutePath(),
        initializedRepoPassword,
        initializedRepoPassword
    }, "\n") + "\n");

    String[] cliOutputA = TestCliUtil.runAndCaptureOutput(new CommandLineClient(initArgs));
    String cliOutputSingleLineA = StringUtil.join(cliOutputA, " ");

    assertTrue(new File(initializedRepoFolder + "/syncany").exists());
    assertTrue(new File(initializedRepoFolder + "/master").exists());
    assertTrue(new File(initializedRepoFolder + "/databases").exists());
View Full Code Here

Examples of org.syncany.cli.CommandLineClient

    // Setup
    Map<String, String> connectionSettings = TestConfigUtil.createTestLocalConnectionSettings();
    Map<String, String> clientA = TestCliUtil.createLocalTestEnvAndInit("A", connectionSettings);
    File clientLocalDirB = TestFileUtil.createTempDirectoryInSystemTemp();

    String[] cliOutA = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] {
        "--localdir", clientA.get("localdir"),
        "genlink",
        "--machine-readable"
    }));

    assertEquals("Different number of output lines expected.", 1, cliOutA.length);
    String createdLink = cliOutA[0];

    String[] cliOutB = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] {
        "--localdir", clientLocalDirB.getAbsolutePath(),
        "connect",
        createdLink
    }));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.