Search in sources :

Example 6 with FileTrigger

use of org.jumpmind.symmetric.model.FileTrigger 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());
}
Also used : FileTriggerRouter(org.jumpmind.symmetric.model.FileTriggerRouter) FileTrigger(org.jumpmind.symmetric.model.FileTrigger) FileTriggerRouter(org.jumpmind.symmetric.model.FileTriggerRouter) Router(org.jumpmind.symmetric.model.Router) Test(org.junit.Test)

Example 7 with FileTrigger

use of org.jumpmind.symmetric.model.FileTrigger 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));
}
Also used : FileTriggerRouter(org.jumpmind.symmetric.model.FileTriggerRouter) FileTrigger(org.jumpmind.symmetric.model.FileTrigger) FileTriggerRouter(org.jumpmind.symmetric.model.FileTriggerRouter) Router(org.jumpmind.symmetric.model.Router) Test(org.junit.Test)

Example 8 with FileTrigger

use of org.jumpmind.symmetric.model.FileTrigger 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));
}
Also used : FileTriggerRouter(org.jumpmind.symmetric.model.FileTriggerRouter) FileTrigger(org.jumpmind.symmetric.model.FileTrigger) FileTriggerRouter(org.jumpmind.symmetric.model.FileTriggerRouter) Router(org.jumpmind.symmetric.model.Router) Test(org.junit.Test)

Aggregations

FileTrigger (org.jumpmind.symmetric.model.FileTrigger)8 FileTriggerRouter (org.jumpmind.symmetric.model.FileTriggerRouter)8 Router (org.jumpmind.symmetric.model.Router)5 Test (org.junit.Test)5 FileSnapshot (org.jumpmind.symmetric.model.FileSnapshot)4 File (java.io.File)3 ArrayList (java.util.ArrayList)2 Table (org.jumpmind.db.model.Table)2 CsvData (org.jumpmind.symmetric.io.data.CsvData)2 Data (org.jumpmind.symmetric.model.Data)2 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 ZipEntry (java.util.zip.ZipEntry)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 IoException (org.jumpmind.exception.IoException)1 DataMetaData (org.jumpmind.symmetric.model.DataMetaData)1 LastEventType (org.jumpmind.symmetric.model.FileSnapshot.LastEventType)1