Search in sources :

Example 21 with DatabaseRemoteFile

use of org.syncany.plugins.transfer.files.DatabaseRemoteFile in project syncany by syncany.

the class AbstractTransferManagerTest method cleanTestLocation.

private void cleanTestLocation(TransferManager transferManager) throws StorageException {
    Map<String, RemoteFile> normalFiles = transferManager.list(RemoteFile.class);
    Map<String, DatabaseRemoteFile> databaseFiles = transferManager.list(DatabaseRemoteFile.class);
    Map<String, MultichunkRemoteFile> multiChunkFiles = transferManager.list(MultichunkRemoteFile.class);
    for (RemoteFile remoteFile : normalFiles.values()) {
        transferManager.delete(remoteFile);
    }
    for (RemoteFile remoteFile : databaseFiles.values()) {
        transferManager.delete(remoteFile);
    }
    for (RemoteFile remoteFile : multiChunkFiles.values()) {
        transferManager.delete(remoteFile);
    }
}
Also used : MultichunkRemoteFile(org.syncany.plugins.transfer.files.MultichunkRemoteFile) DatabaseRemoteFile(org.syncany.plugins.transfer.files.DatabaseRemoteFile) RemoteFile(org.syncany.plugins.transfer.files.RemoteFile) MasterRemoteFile(org.syncany.plugins.transfer.files.MasterRemoteFile) DatabaseRemoteFile(org.syncany.plugins.transfer.files.DatabaseRemoteFile) MultichunkRemoteFile(org.syncany.plugins.transfer.files.MultichunkRemoteFile) SyncanyRemoteFile(org.syncany.plugins.transfer.files.SyncanyRemoteFile)

Example 22 with DatabaseRemoteFile

use of org.syncany.plugins.transfer.files.DatabaseRemoteFile in project syncany by syncany.

the class AbstractTransferManagerTest method testUploadListDownloadAndDelete.

@Test
public void testUploadListDownloadAndDelete() throws Exception {
    // Setup
    File tempFromDir = TestFileUtil.createTempDirectoryInSystemTemp();
    File tempToDir = TestFileUtil.createTempDirectoryInSystemTemp();
    // Create connection, upload, list, download
    TransferManager transferManager = loadPluginAndCreateTransferManager();
    transferManager.init(true);
    transferManager.connect();
    // Clear up previous test (if test location is reused)
    cleanTestLocation(transferManager);
    // Run!
    uploadDownloadListDelete(transferManager, tempFromDir, tempToDir, SyncanyRemoteFile.class, new SyncanyRemoteFile[] { new SyncanyRemoteFile() });
    uploadDownloadListDelete(transferManager, tempFromDir, tempToDir, MasterRemoteFile.class, new MasterRemoteFile[] { new MasterRemoteFile() });
    uploadDownloadListDelete(transferManager, tempFromDir, tempToDir, DatabaseRemoteFile.class, new DatabaseRemoteFile[] { new DatabaseRemoteFile("database-A-0001"), new DatabaseRemoteFile("database-B-0002") });
    uploadDownloadListDelete(transferManager, tempFromDir, tempToDir, MultichunkRemoteFile.class, new MultichunkRemoteFile[] { new MultichunkRemoteFile("multichunk-84f7e2b31440aaef9b73de3cadcf4e449aeb55a1"), new MultichunkRemoteFile("multichunk-beefbeefbeefbeefbeefbeefbeefbeefbeefbeef"), new MultichunkRemoteFile("multichunk-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") });
    // Clear up previous test (if test location is reused)
    cleanTestLocation(transferManager);
    // Clean local location
    TestFileUtil.deleteDirectory(tempFromDir);
    TestFileUtil.deleteDirectory(tempToDir);
}
Also used : TransferManager(org.syncany.plugins.transfer.TransferManager) TransactionAwareFeatureTransferManager(org.syncany.plugins.transfer.features.TransactionAwareFeatureTransferManager) SyncanyRemoteFile(org.syncany.plugins.transfer.files.SyncanyRemoteFile) MultichunkRemoteFile(org.syncany.plugins.transfer.files.MultichunkRemoteFile) DatabaseRemoteFile(org.syncany.plugins.transfer.files.DatabaseRemoteFile) MasterRemoteFile(org.syncany.plugins.transfer.files.MasterRemoteFile) RemoteFile(org.syncany.plugins.transfer.files.RemoteFile) MasterRemoteFile(org.syncany.plugins.transfer.files.MasterRemoteFile) File(java.io.File) DatabaseRemoteFile(org.syncany.plugins.transfer.files.DatabaseRemoteFile) MultichunkRemoteFile(org.syncany.plugins.transfer.files.MultichunkRemoteFile) SyncanyRemoteFile(org.syncany.plugins.transfer.files.SyncanyRemoteFile) Test(org.junit.Test)

Aggregations

DatabaseRemoteFile (org.syncany.plugins.transfer.files.DatabaseRemoteFile)22 File (java.io.File)11 Test (org.junit.Test)8 MultichunkRemoteFile (org.syncany.plugins.transfer.files.MultichunkRemoteFile)5 RemoteFile (org.syncany.plugins.transfer.files.RemoteFile)5 ArrayList (java.util.ArrayList)4 DatabaseVersion (org.syncany.database.DatabaseVersion)4 CleanupRemoteFile (org.syncany.plugins.transfer.files.CleanupRemoteFile)4 Connection (java.sql.Connection)3 TreeMap (java.util.TreeMap)3 Config (org.syncany.config.Config)3 ApplicationSqlDao (org.syncany.database.dao.ApplicationSqlDao)3 PreparedStatement (java.sql.PreparedStatement)2 List (java.util.List)2 CommandLineClient (org.syncany.cli.CommandLineClient)2 DatabaseVersionHeader (org.syncany.database.DatabaseVersionHeader)2 MemoryDatabase (org.syncany.database.MemoryDatabase)2 LsRemoteOperationResult (org.syncany.operations.ls_remote.LsRemoteOperationResult)2 TransferManager (org.syncany.plugins.transfer.TransferManager)2 MasterRemoteFile (org.syncany.plugins.transfer.files.MasterRemoteFile)2