use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class RenameToExistingFileScenarioTest method testRenameFileButDestinationExists.
@Test
public void testRenameFileButDestinationExists() throws Exception {
// Scenario: A moves a file, but B creates another file at the same destination
// Setup
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
// A new/up
clientA.createNewFile("A-original");
clientA.up();
// B down/move/up
clientB.down();
assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
// A moves, and up
clientA.moveFile("A-original", "A-moved");
clientA.up();
// B creates file at same location
// << same as above
clientB.createNewFile("A-moved");
clientB.down();
assertConflictingFileExists("A-moved", clientB.getLocalFilesExcludeLockedAndNoRead());
// Sync them
clientB.sync();
clientA.sync();
assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class RestrictedXmlCharInFilenameScenarioTest method testEmptyFileCreateAndSync.
@Test
public void testEmptyFileCreateAndSync() throws Exception {
// Setup
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
// A
clientA.createNewFile("File|\u0002|", 100);
clientA.up();
// B
clientB.down();
assertFileEquals(clientA.getLocalFile("File|\u0002|"), clientB.getLocalFile("File|\u0002|"));
assertEquals(clientB.getLocalFile("File|\u0002|").length(), 100);
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class SingleFolderNoConflictsScenarioTest method testFolderNonEmptyMove1NoConflicts.
@Test
public void testFolderNonEmptyMove1NoConflicts() throws Exception {
// Setup
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
// Create files and upload
clientA.createNewFolder("folder");
clientA.createNewFile("folder/file");
clientA.up();
clientB.down();
clientB.moveFile("folder", "moved");
clientB.up();
clientA.down();
assertFalse("Deleted folder should not exist.", clientA.getLocalFile("folder").exists());
assertFalse("Deleted file should not exist.", clientA.getLocalFile("folder/file").exists());
assertFileEquals(clientA.getLocalFile("moved"), clientB.getLocalFile("moved"));
assertFileEquals(clientA.getLocalFile("moved/file"), clientB.getLocalFile("moved/file"));
assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
// Cleanup
clientA.deleteTestData();
clientB.deleteTestData();
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class SingleFolderNoConflictsScenarioTest method testFolderEmptyDeleteNoConflicts.
@Test
public void testFolderEmptyDeleteNoConflicts() throws Exception {
// Setup
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
// Create files and upload
clientA.createNewFolder("folder");
clientA.up();
clientB.down();
clientB.deleteFile("folder");
clientB.up();
clientA.down();
assertFalse("Deleted folder should not exist.", clientA.getLocalFile("folder").exists());
assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
// Cleanup
clientA.deleteTestData();
clientB.deleteTestData();
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class SingleFolderNoConflictsScenarioTest method testFolderNonEmptyNewNoConflicts.
@Test
public void testFolderNonEmptyNewNoConflicts() throws Exception {
// Setup
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
// Create files and upload
clientA.createNewFolder("folder");
clientA.createNewFile("folder/file");
clientA.up();
clientB.down();
assertFileEquals(clientA.getLocalFile("folder"), clientB.getLocalFile("folder"));
assertFileEquals(clientA.getLocalFile("folder/file"), clientB.getLocalFile("folder/file"));
assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
// Cleanup
clientA.deleteTestData();
clientB.deleteTestData();
}
Aggregations