Search in sources :

Example 11 with TransferManager

use of org.syncany.plugins.transfer.TransferManager 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)

Example 12 with TransferManager

use of org.syncany.plugins.transfer.TransferManager in project syncany by syncany.

the class AbstractTransferManagerTest method testDeleteNonExistentFile.

@Test
public void testDeleteNonExistentFile() throws StorageException {
    TransferManager transferManager = loadPluginAndCreateTransferManager();
    transferManager.connect();
    // does not
    boolean deleteSuccess = transferManager.delete(new MultichunkRemoteFile("multichunk-dddddddddddddddddddddddddddddddddddddddd"));
    // exist
    assertTrue(deleteSuccess);
}
Also used : TransferManager(org.syncany.plugins.transfer.TransferManager) TransactionAwareFeatureTransferManager(org.syncany.plugins.transfer.features.TransactionAwareFeatureTransferManager) MultichunkRemoteFile(org.syncany.plugins.transfer.files.MultichunkRemoteFile) Test(org.junit.Test)

Aggregations

TransferManager (org.syncany.plugins.transfer.TransferManager)12 Test (org.junit.Test)8 File (java.io.File)7 MultichunkRemoteFile (org.syncany.plugins.transfer.files.MultichunkRemoteFile)7 TransactionAware (org.syncany.plugins.transfer.features.TransactionAware)5 DatabaseRemoteFile (org.syncany.plugins.transfer.files.DatabaseRemoteFile)5 UnreliableLocalTransferSettings (org.syncany.plugins.unreliable_local.UnreliableLocalTransferSettings)5 TestClient (org.syncany.tests.util.TestClient)5 FilenameFilter (java.io.FilenameFilter)4 StorageException (org.syncany.plugins.transfer.StorageException)4 TransactionAwareFeatureTransferManager (org.syncany.plugins.transfer.features.TransactionAwareFeatureTransferManager)4 RemoteFile (org.syncany.plugins.transfer.files.RemoteFile)4 CleanupOperationOptions (org.syncany.operations.cleanup.CleanupOperationOptions)3 TransferPlugin (org.syncany.plugins.transfer.TransferPlugin)3 TransferSettings (org.syncany.plugins.transfer.TransferSettings)3 ActionRemoteFile (org.syncany.plugins.transfer.files.ActionRemoteFile)3 TempRemoteFile (org.syncany.plugins.transfer.files.TempRemoteFile)3 TransactionRemoteFile (org.syncany.plugins.transfer.files.TransactionRemoteFile)3 Persister (org.simpleframework.xml.core.Persister)2 CleanupOperationResult (org.syncany.operations.cleanup.CleanupOperationResult)2