Package org.syncany.database

Examples of org.syncany.database.SqlDatabase


   
    clientB.createNewFile("B-file2", 0);
    clientB.moveFile("A-file1.jpg", "B-file1-moved");
    clientB.up();
   
    SqlDatabase database = clientB.loadLocalDatabase();
    DatabaseVersionHeader lastDatabaseVersionHeaderBeforeUp = database.getLastDatabaseVersionHeader();
   
    clientB.up(); // double-up, has caused problems
    DatabaseVersionHeader lastDatabaseVersionHeaderAfterUp = database.getLastDatabaseVersionHeader();

    assertEquals("Nothing changed. Local database file should not change.", lastDatabaseVersionHeaderBeforeUp, lastDatabaseVersionHeaderAfterUp);
   
    clientA.down();
    assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
View Full Code Here


    dDAO.load(remoteDatabase, remoteDatabaseFile, null, null, DatabaseReadType.FULL, DatabaseVersionType.DEFAULT, null);

    DatabaseVersion remoteDatabaseVersion = remoteDatabase.getLastDatabaseVersion();

    // - Sql Database
    SqlDatabase localDatabase = new SqlDatabase(testConfig);
    Map<FileHistoryId, PartialFileHistory> localFileHistories = localDatabase.getFileHistoriesWithFileVersions();

    // Compare!
    assertEquals(localDatabase.getLastDatabaseVersionHeader(), remoteDatabaseVersion.getHeader());

    assertEquals(localFileHistories.size(), fileAmount);
    assertEquals(localDatabase.getFileHistoriesWithFileVersions().size(), remoteDatabaseVersion.getFileHistories().size());

    Collection<PartialFileHistory> remoteFileHistories = remoteDatabaseVersion.getFileHistories();

    List<FileVersion> remoteFileVersions = new ArrayList<FileVersion>();
    List<FileVersion> localFileVersions = new ArrayList<FileVersion>();
View Full Code Here

   
    clientB.createNewFolder("B-folder4");
    clientB.createNewFolder("B-folder5");
    clientB.up();
   
    SqlDatabase databaseB = clientB.loadLocalDatabase();
    DatabaseVersionHeader beforeDatabaseVersionHeader = databaseB.getLastDatabaseVersionHeader();
   
    clientB.up(); // double-up, has caused problems
   
    DatabaseVersionHeader afterDatabaseVersionHeader = databaseB.getLastDatabaseVersionHeader();
    assertEquals("Nothing changed. Local database file should not change.", beforeDatabaseVersionHeader, afterDatabaseVersionHeader);
   
    clientA.down();
    assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
    assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
View Full Code Here

    // Test 1: Check result sets for inconsistencies
    assertTrue("Status should return changes.", statusResult.getChangeSet().hasChanges());
    assertTrue("File should be uploaded.", upResult.getChangeSet().hasChanges());

    // Test 2: Check database for inconsistencies
    SqlDatabase database = clientA.loadLocalDatabase();

    assertNotNull("File should be uploaded.", database.getFileVersionByPath("symlink-name"));
    assertNotNull("There should be a new database version, because file should not have been added.", database.getLastDatabaseVersionHeader());

    // Test 3: Check file system for inconsistencies
    File repoPath = new File(((LocalTransferSettings) testConnection).getPath() + "/databases");
    String[] repoFileList = repoPath.list(new FilenameFilter() {
      @Override
View Full Code Here

   
    runUpThread.join();
    deleteFilesThread.join();
   
    // Test 1: There should be between 50 and 100 file histories in the database
    SqlDatabase databaseClientA = clientA.loadLocalDatabase();
   
    assertTrue("There should be less file histories than originally added files.", databaseClientA.getFileHistoriesWithFileVersions().size() < numFiles);
    assertTrue("There should be more (or equal size) file histories than files there are.", databaseClientA.getFileHistoriesWithFileVersions().size() >= numFilesRemaining);
   
    // Test 2: Now up the rest, there should be exactly 50 files in the database
    clientA.up();
    clientA.cleanup();
   
    databaseClientA = clientA.loadLocalDatabase();
    assertEquals("There should be EXACTLY "+numFilesRemaining+" file histories in the database.", numFilesRemaining, databaseClientA.getFileHistoriesWithFileVersions().size());
   
    // Test 3: After that, the sync between the clients should of course still work
    clientB.down();
    assertFileListEquals("Files of both clients should be identical.", clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
    assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());       
View Full Code Here

    // Test 1: Check result sets for inconsistencies
    assertTrue("Status should return changes.", statusResultFromUp.getChangeSet().hasChanges());
    assertTrue("File should be uploaded.", upResult.getChangeSet().hasChanges());
   
    // Test 2: Check database for inconsistencies
    SqlDatabase database = clientB.loadLocalDatabase();

    assertNotNull("File should be uploaded.", database.getFileVersionByPath("file1.jpg"));   
    assertEquals("There should be a new database version, because file should not have been added.", 2, database.getLocalDatabaseBranch().size());
   
    // B down
    clientA.down();

    // Test 1: file1.jpg permissions
View Full Code Here

public class GetDatabaseVersionHeadersFolderRequestHandler extends FolderRequestHandler {
  private SqlDatabase localDatabase;

  public GetDatabaseVersionHeadersFolderRequestHandler(Config config) {
    super(config);
    this.localDatabase = new SqlDatabase(config);
  }
View Full Code Here

  public WatchOperation(Config config, WatchOperationOptions options) {
    super(config);

    this.options = options;

    this.localDatabase = new SqlDatabase(config);
   
    this.watchThread = null;
    this.syncRunning = new AtomicBoolean(false);
    this.syncRequested = new AtomicBoolean(false);
    this.stopRequested = new AtomicBoolean(false);
View Full Code Here

  public LsRemoteOperation(Config config, TransferManager transferManager) {
    super(config);

    this.loadedTransferManager = transferManager;
    this.localDatabase = new SqlDatabase(config);
    this.eventBus = LocalEventBus.getInstance();
  }
View Full Code Here

  public RestoreOperation(Config config, RestoreOperationOptions options) {
    super(config, ACTION_ID);
   
    this.options = options;
    this.localDatabase = new SqlDatabase(config);
    this.downloader = new Downloader(config, transferManager);
  }
View Full Code Here

TOP

Related Classes of org.syncany.database.SqlDatabase

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.