use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class IgnoredFileScenarioTest method testIgnoredDirectory.
@Test
public void testIgnoredDirectory() throws Exception {
// Scenario: A ignores files with a regular expression, creates it then ups, B should not have the file
// Setup
File tempDir = TestFileUtil.createTempDirectoryInSystemTemp();
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
//Create ignore file and reload it
File syncanyIgnore = clientA.getLocalFile(Config.FILE_IGNORE);
TestFileUtil.createFileWithContent(syncanyIgnore, "builds");
clientA.getConfig().getIgnoredFiles().loadPatterns();
// A new/up
clientA.createNewFolder("builds");
clientA.createNewFile("builds/test.txt");
clientA.up();
clientB.down();
// The ignored file should not exist at B
assertTrue(clientA.getLocalFile("builds/test.txt").exists());
assertFalse(clientB.getLocalFile("builds/test.txt").exists());
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
TestFileUtil.deleteDirectory(tempDir);
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class IgnoredFileScenarioTest method testIgnoredFileBasicRecursive.
@Test
public void testIgnoredFileBasicRecursive() throws Exception {
// Scenario: A ignores a file, creates it then ups, B should not have the file
// Setup
File tempDir = TestFileUtil.createTempDirectoryInSystemTemp();
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
//Create ignore file and reload it
File syncanyIgnore = clientA.getLocalFile(Config.FILE_IGNORE);
TestFileUtil.createFileWithContent(syncanyIgnore, "ignoredfile.txt");
clientA.getConfig().getIgnoredFiles().loadPatterns();
// A new/up
clientA.createNewFile("ignoredfile.txt");
clientA.createNewFile("nonignoredfile.txt");
clientA.createNewFolder("sub");
clientA.createNewFileInFolder("ignoredfile.txt", "sub");
clientA.up();
clientB.down();
// The ignored file should not exist at B
assertTrue(clientA.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientA.getLocalFile("nonignoredfile.txt").exists());
assertTrue(clientA.getLocalFile("sub").exists());
assertTrue(clientA.getLocalFileInFolder("ignoredfile.txt", "sub").exists());
assertFalse(clientB.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientB.getLocalFile("nonignoredfile.txt").exists());
assertTrue(clientB.getLocalFile("sub").exists());
assertFalse(clientB.getLocalFileInFolder("ignoredfile.txt", "sub").exists());
//Delete ignore file and reload patterns
TestFileUtil.deleteFile(syncanyIgnore);
clientA.getConfig().getIgnoredFiles().loadPatterns();
clientA.up();
clientB.down();
// All files should be synced
assertTrue(clientA.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientA.getLocalFile("nonignoredfile.txt").exists());
assertTrue(clientA.getLocalFile("sub").exists());
assertTrue(clientA.getLocalFileInFolder("ignoredfile.txt", "sub").exists());
assertTrue(clientB.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientB.getLocalFile("nonignoredfile.txt").exists());
assertTrue(clientB.getLocalFile("sub").exists());
assertTrue(clientB.getLocalFileInFolder("ignoredfile.txt", "sub").exists());
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
TestFileUtil.deleteDirectory(tempDir);
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class IgnoredFileScenarioTest method testIgnoredFileRegex.
@Test
public void testIgnoredFileRegex() throws Exception {
// Scenario: A ignores files with a regular expression, creates it then ups, B should not have the file
// Setup
File tempDir = TestFileUtil.createTempDirectoryInSystemTemp();
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
//Create ignore file and reload it
File syncanyIgnore = clientA.getLocalFile(Config.FILE_IGNORE);
TestFileUtil.createFileWithContent(syncanyIgnore, "regex:.*.bak");
clientA.getConfig().getIgnoredFiles().loadPatterns();
// A new/up
clientA.createNewFile("ignoredfile.bak");
clientA.up();
clientB.down();
// The ignored file should not exist at B
assertTrue(clientA.getLocalFile("ignoredfile.bak").exists());
assertFalse(clientB.getLocalFile("ignoredfile.bak").exists());
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
TestFileUtil.deleteDirectory(tempDir);
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class IgnoredFileScenarioTest method testIgnoredFileBasic.
@Test
public void testIgnoredFileBasic() throws Exception {
// Scenario: A ignores a file, creates it then ups, B should not have the file
// Setup
File tempDir = TestFileUtil.createTempDirectoryInSystemTemp();
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
//Create ignore file and reload it
File syncanyIgnore = clientA.getLocalFile(Config.FILE_IGNORE);
TestFileUtil.createFileWithContent(syncanyIgnore, "ignoredfile.txt");
clientA.getConfig().getIgnoredFiles().loadPatterns();
// A new/up
clientA.createNewFile("ignoredfile.txt");
clientA.createNewFile("nonignoredfile.txt");
clientA.up();
clientB.down();
// The ignored file should not exist at B
assertTrue(clientA.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientA.getLocalFile("nonignoredfile.txt").exists());
assertFalse(clientB.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientB.getLocalFile("nonignoredfile.txt").exists());
//Delete ignore file and reload patterns
TestFileUtil.deleteFile(syncanyIgnore);
clientA.getConfig().getIgnoredFiles().loadPatterns();
clientA.up();
clientB.down();
// All files should be synced
assertTrue(clientA.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientA.getLocalFile("nonignoredfile.txt").exists());
assertTrue(clientB.getLocalFile("ignoredfile.txt").exists());
assertTrue(clientB.getLocalFile("nonignoredfile.txt").exists());
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
TestFileUtil.deleteDirectory(tempDir);
}
use of org.syncany.plugins.transfer.TransferSettings in project syncany by syncany.
the class Issue200ScenarioTest method testIssue200.
@Test
public void testIssue200() throws Exception {
// Setup
TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();
TestClient clientA = new TestClient("A", testConnection);
TestClient clientB = new TestClient("B", testConnection);
// Run
clientA.createNewFolder("folder");
clientA.createNewFile("folder/file");
clientA.upWithForceChecksum();
clientB.down();
assertFileListEquals(clientA.getLocalFilesExcludeLockedAndNoRead(), clientB.getLocalFilesExcludeLockedAndNoRead());
assertSqlDatabaseEquals(clientA.getDatabaseFile(), clientB.getDatabaseFile());
clientA.changeFile("folder/file");
clientA.upWithForceChecksum();
clientB.deleteFile("folder/file");
clientB.down();
assertTrue(clientB.getLocalFile("folder/file").exists());
// Tear down
clientA.deleteTestData();
clientB.deleteTestData();
}
Aggregations