Package org.syncany.config

Examples of org.syncany.config.Config


  }
 
  @Test
  public void testConfigHelperLoadConfig() throws Exception {
    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
   
    // Run
    Config loadedConfig = ConfigHelper.loadConfig(testConfig.getLocalDir());
   
    // Test
    assertNotNull(loadedConfig);
    assertEquals(testConfig.getAppDir(), loadedConfig.getAppDir());
    assertEquals(testConfig.getCacheDir(), loadedConfig.getCacheDir());
    assertNotNull(loadedConfig.getChunker());
    assertEquals(testConfig.getChunker().toString(), loadedConfig.getChunker().toString());
    assertNotNull(loadedConfig.getCache());
    assertNotNull(loadedConfig.getConnection());
    assertEquals(testConfig.getDatabaseDir(), loadedConfig.getDatabaseDir());   
    assertEquals(testConfig.getDatabaseFile(), loadedConfig.getDatabaseFile());
    assertEquals(testConfig.getDisplayName(), loadedConfig.getDisplayName());
    assertEquals(testConfig.getLocalDir(), loadedConfig.getLocalDir());
    assertEquals(testConfig.getLogDir(), loadedConfig.getLogDir());
    assertEquals(testConfig.getMachineName(), loadedConfig.getMachineName());
    assertEquals(testConfig.getMasterKey(), loadedConfig.getMasterKey());
    assertNotNull(loadedConfig.getMultiChunker());
    assertNotNull(loadedConfig.getRepoId());
    assertNotNull(loadedConfig.getTransformer());

    // Tear down
    TestConfigUtil.deleteTestLocalConfigAndData(testConfig);   
  }
View Full Code Here


  }
 
  @Test
  public void testConfigHelperLoadConfigTO() throws Exception {
    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
   
    // Run
    ConfigTO loadedConfigTO = ConfigHelper.loadConfigTO(testConfig.getLocalDir());
   
    // Test
    assertNotNull(loadedConfigTO);
    assertEquals(testConfig.getDisplayName(), loadedConfigTO.getDisplayName());
    assertEquals(testConfig.getMachineName(), loadedConfigTO.getMachineName());
    assertEquals(testConfig.getMasterKey(), loadedConfigTO.getMasterKey());
   
    // Tear down
    TestConfigUtil.deleteTestLocalConfigAndData(testConfig);   
  }
View Full Code Here

  }
 
  @Test
  public void testConfigHelperLoadRepoTO() throws Exception {   
    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
   
    // Run
    ConfigTO loadedConfigTO = ConfigHelper.loadConfigTO(testConfig.getLocalDir());
    RepoTO repoConfigTO = ConfigHelper.loadRepoTO(testConfig.getLocalDir(), loadedConfigTO);
   
    // Test
    assertNotNull(repoConfigTO);
    assertNotNull(repoConfigTO.getChunkerTO());
    assertNotNull(repoConfigTO.getMultiChunker());
View Full Code Here

public class ApplicationDaoTest {
  @Test
  public void testGetKnownDatabases() throws Exception {
    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
    Connection databaseConnection = testConfig.createDatabaseConnection();

    // Run
    TestSqlUtil.runSqlFromResource(databaseConnection, "test.insert.set3.sql");

    ApplicationSqlDao applicationDao = new ApplicationSqlDao(databaseConnection);
View Full Code Here

  }

  @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[] {
View Full Code Here

  }

  @Test
  public void testShutdown() throws Exception {
    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
    Connection databaseConnection = testConfig.createDatabaseConnection();

    // Prepare
    ApplicationSqlDao applicationDao = new ApplicationSqlDao(databaseConnection);

    List<DatabaseRemoteFile> expectedKnownDatabases = Arrays.asList(new DatabaseRemoteFile[] {
        new DatabaseRemoteFile("database-A-0000000001")
    });

    applicationDao.writeKnownRemoteDatabases(expectedKnownDatabases);

    // Run & Test
    assertTrue(new File(testConfig.getDatabaseFile() + ".lck").exists());
    applicationDao.shutdown();
    assertFalse(new File(testConfig.getDatabaseFile() + ".lck").exists());

    // Tear down
    databaseConnection.close();
    TestConfigUtil.deleteTestLocalConfigAndData(testConfig);
  }
View Full Code Here

public class FileHistoryDaoTest
  @Test
  public void testGetFileHistoriesWithFileVersionByVectorClock() throws Exception {
    // Setup
    Config testConfig = TestConfigUtil.createTestLocalConfig();
    Connection databaseConnection = testConfig.createDatabaseConnection();
       
    // Run
    TestSqlUtil.runSqlFromResource(databaseConnection, "test.insert.set1.sql");

    FileVersionSqlDao fileVersionDao = new FileVersionSqlDao(databaseConnection);
View Full Code Here

public class FileVersionComparatorTest {
  @Test
  public void testCaptureFilePropertiesFromFile() throws Exception {
    // Setup
    Config config = TestConfigUtil.createTestLocalConfig();
    FileVersionComparator versionComparator = new FileVersionComparator(config.getLocalDir(), config.getChunker().getChecksumAlgorithm());

    // Create file
    File somefile = new File(config.getLocalDir()+"/somefile");
    Path somefilePath = Paths.get(somefile.getAbsolutePath());
   
    TestFileUtil.createRandomFile(somefile, 100*1024);   
    somefile.setLastModified(1382196000);   
   
 
View Full Code Here

  }
 
  @Test
  public void testCaptureFilePropertiesFromFileVersion() throws Exception {
    // Setup
    Config config = TestConfigUtil.createTestLocalConfig();
    FileVersionComparator versionComparator = new FileVersionComparator(config.getLocalDir(), config.getChunker().getChecksumAlgorithm());
   
    FileVersion fileVersion = new FileVersion();
    fileVersion.setVersion(3L);

    fileVersion.setChecksum(new FileChecksum(new byte[] { 0x11, 0x22, 0x33 }));
View Full Code Here

 

  @Test
  public void testCompareFileVersionToFile() throws Exception {
    // Setup
    Config config = TestConfigUtil.createTestLocalConfig();
    FileVersionComparator versionComparator = new FileVersionComparator(config.getLocalDir(), config.getChunker().getChecksumAlgorithm());
   
    // Create File
    File somefile = new File(config.getLocalDir()+"/file1");
    Path somefilePath = Paths.get(somefile.getAbsolutePath());
   
    TestFileUtil.createRandomFile(somefile, 130*1024);   
    somefile.setLastModified(1182196000);   
   
 
View Full Code Here

TOP

Related Classes of org.syncany.config.Config

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.