@Test public void testSingleFileFromFilesystem() throws Exception { FilesystemConfig sourceConfig = new FilesystemConfig(); sourceConfig.setPath(filesystemSourceFile.getAbsolutePath()); NfsConfig targetConfig = getNfsConfig(nfs); targetConfig.setSubPath(targetDirectoryName + NfsFile.separator + testFileName); SyncConfig syncConfig = new SyncConfig().withSource(sourceConfig).withTarget(targetConfig); EcsSync sync = new EcsSync(); sync.setSyncConfig(syncConfig); sync.run(); byte[] sourceBytes = Files.readAllBytes(filesystemSourceFile.toPath()); byte[] targetBytes = readBytes(targetFile); Assert.assertArrayEquals(sourceBytes, targetBytes); }
@Test public void testSingleFileToFilesystem() throws Exception { NfsConfig sourceConfig = getNfsConfig(nfs); sourceConfig.setSubPath(sourceDirectoryName + NfsFile.separator + testFileName); FilesystemConfig targetConfig = new FilesystemConfig(); targetConfig.setPath(filesystemTargetFile.getAbsolutePath()); SyncConfig syncConfig = new SyncConfig().withSource(sourceConfig).withTarget(targetConfig); EcsSync sync = new EcsSync(); sync.setSyncConfig(syncConfig); sync.run(); byte[] sourceBytes = readBytes(sourceFile); byte[] targetBytes = Files.readAllBytes(filesystemTargetFile.toPath()); Assert.assertArrayEquals(sourceBytes, targetBytes); }
@Test public void testSingleFile() throws Exception { NfsConfig sourceConfig = getNfsConfig(nfs); sourceConfig.setSubPath(sourceDirectoryName + NfsFile.separator + testFileName); NfsConfig targetConfig = getNfsConfig(nfs); targetConfig.setSubPath(targetDirectoryName + NfsFile.separator + testFileName); SyncConfig syncConfig = new SyncConfig().withSource(sourceConfig).withTarget(targetConfig); EcsSync sync = new EcsSync(); sync.setSyncConfig(syncConfig); sync.run(); byte[] sourceBytes = readBytes(sourceFile); byte[] targetBytes = readBytes(targetFile); Assert.assertArrayEquals(sourceBytes, targetBytes); }
config.setServer(server); config.setMountPath(mountPath); config.setSubPath(tempDir.getPath().substring(1)); config.setStoreMetadata(true);