|
@@ -82,7 +82,7 @@ public class TestIntegration {
|
|
|
addEntries(listFile, "singlefile1/file1");
|
|
|
createFiles("singlefile1/file1");
|
|
|
|
|
|
- runTest(listFile, target, sync);
|
|
|
+ runTest(listFile, target, false, sync);
|
|
|
|
|
|
checkResult(target, 1);
|
|
|
} catch (IOException e) {
|
|
@@ -105,7 +105,7 @@ public class TestIntegration {
|
|
|
addEntries(listFile, "singlefile1/file1");
|
|
|
createFiles("singlefile1/file1", "target");
|
|
|
|
|
|
- runTest(listFile, target, sync);
|
|
|
+ runTest(listFile, target, false, sync);
|
|
|
|
|
|
checkResult(target, 1);
|
|
|
} catch (IOException e) {
|
|
@@ -129,7 +129,7 @@ public class TestIntegration {
|
|
|
createFiles("singlefile2/file2");
|
|
|
mkdirs(target.toString());
|
|
|
|
|
|
- runTest(listFile, target, sync);
|
|
|
+ runTest(listFile, target, true, sync);
|
|
|
|
|
|
checkResult(target, 1, "file2");
|
|
|
} catch (IOException e) {
|
|
@@ -152,7 +152,7 @@ public class TestIntegration {
|
|
|
addEntries(listFile, "singledir");
|
|
|
mkdirs(root + "/singledir/dir1");
|
|
|
|
|
|
- runTest(listFile, target, sync);
|
|
|
+ runTest(listFile, target, false, sync);
|
|
|
|
|
|
checkResult(target, 1, "dir1");
|
|
|
} catch (IOException e) {
|
|
@@ -171,7 +171,7 @@ public class TestIntegration {
|
|
|
mkdirs(root + "/singledir/dir1");
|
|
|
mkdirs(target.toString());
|
|
|
|
|
|
- runTest(listFile, target, false);
|
|
|
+ runTest(listFile, target, true, false);
|
|
|
|
|
|
checkResult(target, 1, "singledir/dir1");
|
|
|
} catch (IOException e) {
|
|
@@ -190,7 +190,7 @@ public class TestIntegration {
|
|
|
mkdirs(root + "/Usingledir/Udir1");
|
|
|
mkdirs(target.toString());
|
|
|
|
|
|
- runTest(listFile, target, true);
|
|
|
+ runTest(listFile, target, true, true);
|
|
|
|
|
|
checkResult(target, 1, "Udir1");
|
|
|
} catch (IOException e) {
|
|
@@ -214,7 +214,7 @@ public class TestIntegration {
|
|
|
createFiles("multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
mkdirs(target.toString());
|
|
|
|
|
|
- runTest(listFile, target, sync);
|
|
|
+ runTest(listFile, target, true, sync);
|
|
|
|
|
|
checkResult(target, 3, "file3", "file4", "file5");
|
|
|
} catch (IOException e) {
|
|
@@ -286,7 +286,7 @@ public class TestIntegration {
|
|
|
addEntries(listFile, "multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
createFiles("multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
|
|
|
- runTest(listFile, target, sync);
|
|
|
+ runTest(listFile, target, false, sync);
|
|
|
|
|
|
checkResult(target, 3, "file3", "file4", "file5");
|
|
|
} catch (IOException e) {
|
|
@@ -305,7 +305,7 @@ public class TestIntegration {
|
|
|
createFiles("multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
mkdirs(target.toString(), root + "/singledir/dir1");
|
|
|
|
|
|
- runTest(listFile, target, false);
|
|
|
+ runTest(listFile, target, true, false);
|
|
|
|
|
|
checkResult(target, 2, "multifile/file3", "multifile/file4", "multifile/file5", "singledir/dir1");
|
|
|
} catch (IOException e) {
|
|
@@ -324,7 +324,7 @@ public class TestIntegration {
|
|
|
createFiles("Umultifile/Ufile3", "Umultifile/Ufile4", "Umultifile/Ufile5");
|
|
|
mkdirs(target.toString(), root + "/Usingledir/Udir1");
|
|
|
|
|
|
- runTest(listFile, target, true);
|
|
|
+ runTest(listFile, target, true, true);
|
|
|
|
|
|
checkResult(target, 4, "Ufile3", "Ufile4", "Ufile5", "Udir1");
|
|
|
} catch (IOException e) {
|
|
@@ -343,7 +343,7 @@ public class TestIntegration {
|
|
|
createFiles("multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
mkdirs(root + "/singledir/dir1");
|
|
|
|
|
|
- runTest(listFile, target, false);
|
|
|
+ runTest(listFile, target, false, false);
|
|
|
|
|
|
checkResult(target, 2, "multifile/file3", "multifile/file4",
|
|
|
"multifile/file5", "singledir/dir1");
|
|
@@ -363,7 +363,7 @@ public class TestIntegration {
|
|
|
createFiles("multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
mkdirs(root + "/singledir/dir1");
|
|
|
|
|
|
- runTest(listFile, target, true);
|
|
|
+ runTest(listFile, target, false, true);
|
|
|
|
|
|
checkResult(target, 4, "file3", "file4", "file5", "dir1");
|
|
|
} catch (IOException e) {
|
|
@@ -382,7 +382,7 @@ public class TestIntegration {
|
|
|
createFiles("srcdir/file1", "dstdir/file1", "dstdir/file2");
|
|
|
|
|
|
Path target = new Path(root + "/dstdir");
|
|
|
- runTest(listFile, target, true, true, false);
|
|
|
+ runTest(listFile, target, false, true, true, false);
|
|
|
|
|
|
checkResult(target, 1, "file1");
|
|
|
} catch (IOException e) {
|
|
@@ -406,7 +406,7 @@ public class TestIntegration {
|
|
|
createWithContents("dstdir/file1", contents2);
|
|
|
|
|
|
Path target = new Path(root + "/dstdir");
|
|
|
- runTest(listFile, target, false, false, true);
|
|
|
+ runTest(listFile, target, false, false, false, true);
|
|
|
|
|
|
checkResult(target, 1, "file1");
|
|
|
|
|
@@ -436,7 +436,7 @@ public class TestIntegration {
|
|
|
createFiles("multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
createFiles("singledir/dir2/file6");
|
|
|
|
|
|
- runTest(listFile, target, false);
|
|
|
+ runTest(listFile, target, false, false);
|
|
|
|
|
|
checkResult(target, 2, "multifile/file3", "multifile/file4", "multifile/file5",
|
|
|
"singledir/dir2/file6");
|
|
@@ -459,7 +459,7 @@ public class TestIntegration {
|
|
|
createFiles("multifile/file3", "multifile/file4", "multifile/file5");
|
|
|
createFiles("singledir/dir2/file6");
|
|
|
|
|
|
- runTest(listFile, target, true);
|
|
|
+ runTest(listFile, target, false, true);
|
|
|
|
|
|
checkResult(target, 4, "file3", "file4", "file5", "dir2/file6");
|
|
|
} catch (IOException e) {
|
|
@@ -482,7 +482,7 @@ public class TestIntegration {
|
|
|
createFiles("singledir1/dir3/file7", "singledir1/dir3/file8",
|
|
|
"singledir1/dir3/file9");
|
|
|
|
|
|
- runTest(listFile, target, false);
|
|
|
+ runTest(listFile, target, false, false);
|
|
|
|
|
|
checkResult(target, 4, "file3", "file4", "file5",
|
|
|
"dir3/file7", "dir3/file8", "dir3/file9");
|
|
@@ -506,7 +506,7 @@ public class TestIntegration {
|
|
|
createFiles("singledir1/dir3/file7", "singledir1/dir3/file8",
|
|
|
"singledir1/dir3/file9");
|
|
|
|
|
|
- runTest(listFile, target, true);
|
|
|
+ runTest(listFile, target, false, true);
|
|
|
|
|
|
checkResult(target, 6, "file3", "file4", "file5",
|
|
|
"file7", "file8", "file9");
|
|
@@ -584,16 +584,19 @@ public class TestIntegration {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void runTest(Path listFile, Path target, boolean sync) throws IOException {
|
|
|
- runTest(listFile, target, sync, false, false);
|
|
|
+ private void runTest(Path listFile, Path target, boolean targetExists,
|
|
|
+ boolean sync) throws IOException {
|
|
|
+ runTest(listFile, target, targetExists, sync, false, false);
|
|
|
}
|
|
|
|
|
|
- private void runTest(Path listFile, Path target, boolean sync, boolean delete,
|
|
|
+ private void runTest(Path listFile, Path target, boolean targetExists,
|
|
|
+ boolean sync, boolean delete,
|
|
|
boolean overwrite) throws IOException {
|
|
|
DistCpOptions options = new DistCpOptions(listFile, target);
|
|
|
options.setSyncFolder(sync);
|
|
|
options.setDeleteMissing(delete);
|
|
|
options.setOverwrite(overwrite);
|
|
|
+ options.setTargetPathExists(targetExists);
|
|
|
try {
|
|
|
new DistCp(getConf(), options).execute();
|
|
|
} catch (Exception e) {
|