FileSystemSyncEndpoint implements SyncEndpoint { protected File getSyncToFile(MonitoredFile syncFile, File watchDir) { File syncToFile; if (null == watchDir) { syncToFile = new File(syncToDir, syncFile.getName()); } else { URI relativeFileURI = watchDir.toURI().relativize(syncFile.toURI()); syncToFile = new File(syncToDir, relativeFileURI.getPath()); } return syncToFile; } FileSystemSyncEndpoint(File syncToDir, boolean syncDeletes); boolean syncFile(MonitoredFile syncFile, File watchDir); @Override SyncResultType syncFileAndReturnDetailedResult(MonitoredFile monitoredFile,
                                                          File watchDir); Iterator<String> getFilesList(); @Override void addEndPointListener(EndPointListener listener); @Override void removeEndPointListener(EndPointListener listener); @Override void deleteContent(String spaceId, String contentId);  }
@Test public void testGetSyncFile() throws Exception { File syncToDir = new File("/a/b/c"); FileSystemSyncEndpoint syncEndpoint = new FileSystemSyncEndpoint(syncToDir, true); File watchDir = new File("/a/b/d/e"); MonitoredFile syncFile = new MonitoredFile(new File("/a/b/d/e/f/g.txt")); File syncToFile = syncEndpoint.getSyncToFile(syncFile, watchDir); assertEquals(new File("/a/b/c/f/g.txt").getAbsolutePath(), syncToFile.getAbsolutePath()); }