use of org.syncany.config.Config in project syncany by syncany.
the class ApplicationDaoTest method testPersistAndGetKnownDatabases.
@Test
public void testPersistAndGetKnownDatabases() throws Exception {
// Setup
Config testConfig = TestConfigUtil.createTestLocalConfig();
Connection databaseConnection = testConfig.createDatabaseConnection();
// Run
ApplicationSqlDao applicationDao = new ApplicationSqlDao(databaseConnection);
List<DatabaseRemoteFile> expectedKnownDatabases = Arrays.asList(new DatabaseRemoteFile[] { new DatabaseRemoteFile("database-A-0000000001"), new DatabaseRemoteFile("database-V-0000000001"), new DatabaseRemoteFile("database-B-0000000001"), new DatabaseRemoteFile("database-A-0000000002") });
applicationDao.writeKnownRemoteDatabases(expectedKnownDatabases);
List<DatabaseRemoteFile> actualKnownDatabases = applicationDao.getKnownDatabases();
// Test
assertTrue(CollectionUtil.containsExactly(expectedKnownDatabases, actualKnownDatabases));
// Tear down
databaseConnection.close();
TestConfigUtil.deleteTestLocalConfigAndData(testConfig);
}
use of org.syncany.config.Config in project syncany by syncany.
the class ConfigHelperTest method testConfigHelperFindLocalDirInPath.
@Test
public void testConfigHelperFindLocalDirInPath() throws Exception {
// Setup
Config testConfig = TestConfigUtil.createTestLocalConfig();
File startingPath = testConfig.getLocalDir();
// Run
File actualLocalDir = ConfigHelper.findLocalDirInPath(startingPath);
// Test
assertNotNull(actualLocalDir);
assertEquals(testConfig.getLocalDir(), actualLocalDir.getCanonicalFile());
// Tear down
TestConfigUtil.deleteTestLocalConfigAndData(testConfig);
}
use of org.syncany.config.Config in project syncany by syncany.
the class ConfigTest method testConfigMultiChunkerNull.
@Test
public void testConfigMultiChunkerNull() throws Exception {
// Setup
File localDir = new File("/some/folder");
ConfigTO configTO = new ConfigTO();
RepoTO repoTO = new RepoTO();
// <<< valid
configTO.setMachineName("somevalidmachinename");
// <<< valid
repoTO.setChunkerTO(TestConfigUtil.createFixedChunkerTO());
// <<< valid
repoTO.setRepoId(new byte[] { 0x01, 0x02 });
// <<< valid
repoTO.setTransformers(null);
// <<< INVALID !!
repoTO.setMultiChunker(null);
// Run!
try {
new Config(localDir, configTO, repoTO);
fail("Config should not been have initialized.");
} catch (ConfigException e) {
TestAssertUtil.assertErrorStackTraceContains("No multichunker", e);
}
}
use of org.syncany.config.Config in project syncany by syncany.
the class ConfigTest method testConfigMachineNameInvalidChars.
@Test
public void testConfigMachineNameInvalidChars() throws Exception {
File localDir = new File("/some/folder");
ConfigTO configTO = new ConfigTO();
RepoTO repoTO = new RepoTO();
configTO.setMachineName("invalid machine name");
// Run!
try {
new Config(localDir, configTO, repoTO);
fail("Machine name should not have been accepted.");
} catch (ConfigException e) {
TestAssertUtil.assertErrorStackTraceContains("Machine name", e);
}
}
use of org.syncany.config.Config in project syncany by syncany.
the class ConfigTest method testConfigInitLocalDirNull.
@Test(expected = ConfigException.class)
public void testConfigInitLocalDirNull() throws Exception {
File localDir = null;
ConfigTO configTO = new ConfigTO();
RepoTO repoTO = new RepoTO();
new Config(localDir, configTO, repoTO);
}
Aggregations