Search in sources :

Example 6 with IFileSyncService

use of org.jumpmind.symmetric.service.IFileSyncService 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());
}
Also used : FileTriggerRouter(org.jumpmind.symmetric.model.FileTriggerRouter) IFileSyncService(org.jumpmind.symmetric.service.IFileSyncService) OutgoingBatches(org.jumpmind.symmetric.model.OutgoingBatches) OutgoingBatch(org.jumpmind.symmetric.model.OutgoingBatch) File(java.io.File)

Aggregations

IFileSyncService (org.jumpmind.symmetric.service.IFileSyncService)6 FileTriggerRouter (org.jumpmind.symmetric.model.FileTriggerRouter)4 File (java.io.File)3 TriggerRouter (org.jumpmind.symmetric.model.TriggerRouter)3 Channel (org.jumpmind.symmetric.model.Channel)2 OutgoingBatch (org.jumpmind.symmetric.model.OutgoingBatch)2 OutgoingBatches (org.jumpmind.symmetric.model.OutgoingBatches)2 TriggerHistory (org.jumpmind.symmetric.model.TriggerHistory)2 ITriggerRouterService (org.jumpmind.symmetric.service.ITriggerRouterService)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 LastEventType (org.jumpmind.symmetric.model.FileSnapshot.LastEventType)1 Router (org.jumpmind.symmetric.model.Router)1 IRouterService (org.jumpmind.symmetric.service.IRouterService)1