use of org.jumpmind.symmetric.model.FileTriggerRouter in project symmetric-ds by JumpMind.
the class FileTriggerTrackerTest method testTakeFullSnapshotRecursive.
@Test
public void testTakeFullSnapshotRecursive() throws Exception {
FileTrigger fileTrigger = new FileTrigger(directory.getAbsolutePath(), true, null, null);
Router router = new Router();
FileTriggerRouter fileTriggerRouter = new FileTriggerRouter(fileTrigger, router);
FileTriggerTracker tracker = new FileTriggerTracker(fileTriggerRouter, null, null, false, null);
DirectorySnapshot snapshot = new DirectorySnapshot(fileTriggerRouter);
tracker.takeFullSnapshot(snapshot);
assertEquals(4, snapshot.size());
}
use of org.jumpmind.symmetric.model.FileTriggerRouter in project symmetric-ds by JumpMind.
the class FileTriggerTrackerTest method testTakeFullSnapshotNonRecursive.
@Test
public void testTakeFullSnapshotNonRecursive() throws Exception {
FileTrigger fileTrigger = new FileTrigger(directory.getAbsolutePath(), false, null, null);
Router router = new Router();
FileTriggerRouter fileTriggerRouter = new FileTriggerRouter(fileTrigger, router);
FileTriggerTracker tracker = new FileTriggerTracker(fileTriggerRouter, null, null, false, null);
DirectorySnapshot snapshot = new DirectorySnapshot(fileTriggerRouter);
tracker.takeFullSnapshot(snapshot);
assertEquals(2, snapshot.size());
}
use of org.jumpmind.symmetric.model.FileTriggerRouter in project symmetric-ds by JumpMind.
the class FileTriggerTrackerTest method testTakeFullSnapshotIncludes.
@Test
public void testTakeFullSnapshotIncludes() throws Exception {
FileTrigger fileTrigger = new FileTrigger(directory.getAbsolutePath(), false, "*.txt", null);
Router router = new Router();
FileTriggerRouter fileTriggerRouter = new FileTriggerRouter(fileTrigger, router);
FileTriggerTracker tracker = new FileTriggerTracker(fileTriggerRouter, null, null, false, null);
DirectorySnapshot snapshot = new DirectorySnapshot(fileTriggerRouter);
tracker.takeFullSnapshot(snapshot);
assertEquals(1, snapshot.size());
assertEquals(snapshot.get(0).getFileName(), FileSyncUtils.getRelativePath(fileInDirectory1, directory));
}
use of org.jumpmind.symmetric.model.FileTriggerRouter in project symmetric-ds by JumpMind.
the class FileTriggerTrackerTest method testTakeFullSnapshotExcludes.
@Test
public void testTakeFullSnapshotExcludes() throws Exception {
FileTrigger fileTrigger = new FileTrigger(directory.getAbsolutePath(), false, null, "*.txt");
Router router = new Router();
FileTriggerRouter fileTriggerRouter = new FileTriggerRouter(fileTrigger, router);
FileTriggerTracker tracker = new FileTriggerTracker(fileTriggerRouter, null, null, false, null);
DirectorySnapshot snapshot = new DirectorySnapshot(fileTriggerRouter);
tracker.takeFullSnapshot(snapshot);
assertEquals(1, snapshot.size());
assertEquals(snapshot.get(0).getFileName(), FileSyncUtils.getRelativePath(fileInDirectory2, directory));
}
use of org.jumpmind.symmetric.model.FileTriggerRouter in project symmetric-ds by JumpMind.
the class FileSyncTest method testManual.
protected void testManual(ISymmetricEngine rootServer, ISymmetricEngine clientServer) throws Exception {
IFileSyncService fileSyncService = rootServer.getFileSyncService();
FileTriggerRouter fileTriggerRouter = fileSyncService.getFileTriggerRouter("all", "server_2_client");
fileTriggerRouter.setConflictStrategy(FileConflictStrategy.MANUAL);
fileSyncService.saveFileTriggerRouter(fileTriggerRouter);
pull("client");
File allFile1 = new File(allSvrSourceDir, "manual/test.txt");
allFile1.getParentFile().mkdirs();
FileUtils.write(allFile1, "server value");
File allFile1Target = new File(allClntTargetDir, allFile1.getParentFile().getName() + "/" + allFile1.getName());
allFile1Target.getParentFile().mkdirs();
FileUtils.write(allFile1Target, "client value");
pullFiles();
assertEquals("client value", FileUtils.readFileToString(allFile1Target));
OutgoingBatches batchesInError = rootServer.getOutgoingBatchService().getOutgoingBatchErrors(10);
List<OutgoingBatch> batches = batchesInError.getBatchesForChannel(Constants.CHANNEL_FILESYNC);
assertEquals(1, batches.size());
allFile1Target.delete();
pullFiles();
assertEquals("server value", FileUtils.readFileToString(allFile1Target));
batchesInError = rootServer.getOutgoingBatchService().getOutgoingBatchErrors(10);
batches = batchesInError.getBatchesForChannel(Constants.CHANNEL_FILESYNC);
assertEquals(0, batches.size());
}
Aggregations