use of org.syncany.cli.CommandLineClient in project syncany by syncany.
the class LsRemoteCommandTest method testLsRemoteCommand.
@Test
public void testLsRemoteCommand() throws Exception {
Map<String, String> connectionSettings = TestConfigUtil.createTestLocalConnectionSettings();
Map<String, String> clientA = TestCliUtil.createLocalTestEnvAndInit("A", connectionSettings);
Map<String, String> clientB = TestCliUtil.createLocalTestEnvAndConnect("B", connectionSettings);
// Round 1: No changes / remote databases expected
String[] cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] { "--localdir", clientA.get("localdir"), "ls-remote" }));
assertEquals("Different number of output lines expected.", 3, cliOut.length);
// Round 2: One new database expected
TestFileUtil.createRandomFile(new File(clientB.get("localdir") + "/file1"), 20 * 1024);
TestFileUtil.createRandomFile(new File(clientB.get("localdir") + "/file2"), 20 * 1024);
new CommandLineClient(new String[] { "--localdir", clientB.get("localdir"), "up" }).start();
cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] { "--localdir", clientA.get("localdir"), "ls-remote" }));
assertEquals("Different number of output lines expected.", 3, cliOut.length);
assertEquals("? database-B-0000000001", cliOut[2]);
TestCliUtil.deleteTestLocalConfigAndData(clientA);
TestCliUtil.deleteTestLocalConfigAndData(clientB);
}
use of org.syncany.cli.CommandLineClient in project syncany by syncany.
the class PluginCommandTest method testPluginListLocalOnly.
@Test
public void testPluginListLocalOnly() throws Exception {
String[] cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] { "plugin", "list", "--local-only" }));
assertTrue(cliOut.length >= 3);
TestAssertUtil.assertRegexInLines("\\| Name", cliOut);
TestAssertUtil.assertRegexInLines("local\\s+\\|\\s+Local", cliOut);
}
use of org.syncany.cli.CommandLineClient in project syncany by syncany.
the class StatusCommandTest method testStatusCommandWithLogFile.
@Test
public void testStatusCommandWithLogFile() throws Exception {
// Setup
Map<String, String> connectionSettings = TestConfigUtil.createTestLocalConnectionSettings();
Map<String, String> clientA = TestCliUtil.createLocalTestEnvAndInit("A", connectionSettings);
File tempLogFile = new File(clientA.get("localdir") + "/" + Config.DIR_APPLICATION + "/" + Config.DIR_LOG + "/templogfile");
// Run!
new File(clientA.get("localdir") + "/somefolder1").mkdir();
new File(clientA.get("localdir") + "/somefolder2").mkdir();
String[] cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] { "--log", tempLogFile.getAbsolutePath(), "--localdir", clientA.get("localdir"), "status" }));
// Test
assertTrue("Log file should exist.", new File(tempLogFile.getAbsolutePath() + ".0").exists());
assertEquals(5, cliOut.length);
assertEquals("? .syignore", cliOut[2]);
assertEquals("? somefolder1", cliOut[3]);
assertEquals("? somefolder2", cliOut[4]);
// Cleanup
TestCliUtil.deleteTestLocalConfigAndData(clientA);
}
use of org.syncany.cli.CommandLineClient in project syncany by syncany.
the class UpdateCommandTest method testUpdateCheckOutdated.
@Test
public void testUpdateCheckOutdated() throws Exception {
Properties originalAppProperties = (Properties) Client.getApplicationProperties().clone();
Client.getApplicationProperties().setProperty("applicationVersion", "0.0.1");
Client.getApplicationProperties().setProperty("applicationVersionFull", "0.0.1-alpha+SNAPSHOT.UNITTESTS");
String[] cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] { "update", "check" }));
assertEquals(4, cliOut.length);
assertTrue(cliOut[2].contains("new version is available"));
assertTrue(cliOut[3].contains("ownload"));
Client.getApplicationProperties().setProperty("applicationVersion", originalAppProperties.getProperty("applicationVersion"));
Client.getApplicationProperties().setProperty("applicationVersionFull", originalAppProperties.getProperty("applicationVersionFull"));
}
use of org.syncany.cli.CommandLineClient in project syncany by syncany.
the class UpdateCommandTest method testUpdateCheckUpToDate.
@Test
public void testUpdateCheckUpToDate() throws Exception {
Properties originalAppProperties = (Properties) Client.getApplicationProperties().clone();
Client.getApplicationProperties().setProperty("applicationVersion", "13.3.7-alpha");
Client.getApplicationProperties().setProperty("applicationVersionFull", "13.3.7-alpha+SNAPSHOT.UNITTESTS");
String[] cliOut = TestCliUtil.runAndCaptureOutput(new CommandLineClient(new String[] { "update", "check" }));
assertEquals(3, cliOut.length);
assertTrue(cliOut[2].contains("Up to date"));
Client.getApplicationProperties().setProperty("applicationVersion", originalAppProperties.getProperty("applicationVersion"));
Client.getApplicationProperties().setProperty("applicationVersionFull", originalAppProperties.getProperty("applicationVersionFull"));
}
Aggregations