|
@@ -37,36 +37,36 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testParseIgnoreFailure() {
|
|
public void testParseIgnoreFailure() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldIgnoreFailures());
|
|
Assert.assertFalse(options.shouldIgnoreFailures());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-i",
|
|
"-i",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldIgnoreFailures());
|
|
Assert.assertTrue(options.shouldIgnoreFailures());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testParseOverwrite() {
|
|
public void testParseOverwrite() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldOverwrite());
|
|
Assert.assertFalse(options.shouldOverwrite());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-overwrite",
|
|
"-overwrite",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldOverwrite());
|
|
Assert.assertTrue(options.shouldOverwrite());
|
|
|
|
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-update",
|
|
"-update",
|
|
"-overwrite",
|
|
"-overwrite",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Update and overwrite aren't allowed together");
|
|
Assert.fail("Update and overwrite aren't allowed together");
|
|
} catch (IllegalArgumentException ignore) {
|
|
} catch (IllegalArgumentException ignore) {
|
|
}
|
|
}
|
|
@@ -75,44 +75,44 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testLogPath() {
|
|
public void testLogPath() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertNull(options.getLogPath());
|
|
Assert.assertNull(options.getLogPath());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-log",
|
|
"-log",
|
|
- "hdfs://localhost:9820/logs",
|
|
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
- Assert.assertEquals(options.getLogPath(), new Path("hdfs://localhost:9820/logs"));
|
|
|
|
|
|
+ "hdfs://localhost:8020/logs",
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
|
|
+ Assert.assertEquals(options.getLogPath(), new Path("hdfs://localhost:8020/logs"));
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testParseBlokcing() {
|
|
public void testParseBlokcing() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldBlock());
|
|
Assert.assertTrue(options.shouldBlock());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-async",
|
|
"-async",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldBlock());
|
|
Assert.assertFalse(options.shouldBlock());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testParsebandwidth() {
|
|
public void testParsebandwidth() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getMapBandwidth(), 0, DELTA);
|
|
Assert.assertEquals(options.getMapBandwidth(), 0, DELTA);
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-bandwidth",
|
|
"-bandwidth",
|
|
"11.2",
|
|
"11.2",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getMapBandwidth(), 11.2, DELTA);
|
|
Assert.assertEquals(options.getMapBandwidth(), 11.2, DELTA);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -121,8 +121,8 @@ public class TestOptionsParser {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-bandwidth",
|
|
"-bandwidth",
|
|
"-11",
|
|
"-11",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
}
|
|
}
|
|
|
|
|
|
@Test(expected=IllegalArgumentException.class)
|
|
@Test(expected=IllegalArgumentException.class)
|
|
@@ -130,22 +130,22 @@ public class TestOptionsParser {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-bandwidth",
|
|
"-bandwidth",
|
|
"0",
|
|
"0",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testParseSkipCRC() {
|
|
public void testParseSkipCRC() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldSkipCRC());
|
|
Assert.assertFalse(options.shouldSkipCRC());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-update",
|
|
"-update",
|
|
"-skipcrccheck",
|
|
"-skipcrccheck",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldSyncFolder());
|
|
Assert.assertTrue(options.shouldSyncFolder());
|
|
Assert.assertTrue(options.shouldSkipCRC());
|
|
Assert.assertTrue(options.shouldSkipCRC());
|
|
}
|
|
}
|
|
@@ -153,22 +153,22 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testParseAtomicCommit() {
|
|
public void testParseAtomicCommit() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldAtomicCommit());
|
|
Assert.assertFalse(options.shouldAtomicCommit());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-atomic",
|
|
"-atomic",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldAtomicCommit());
|
|
Assert.assertTrue(options.shouldAtomicCommit());
|
|
|
|
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-atomic",
|
|
"-atomic",
|
|
"-update",
|
|
"-update",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Atomic and sync folders were allowed");
|
|
Assert.fail("Atomic and sync folders were allowed");
|
|
} catch (IllegalArgumentException ignore) { }
|
|
} catch (IllegalArgumentException ignore) { }
|
|
}
|
|
}
|
|
@@ -176,30 +176,30 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testParseWorkPath() {
|
|
public void testParseWorkPath() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertNull(options.getAtomicWorkPath());
|
|
Assert.assertNull(options.getAtomicWorkPath());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-atomic",
|
|
"-atomic",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertNull(options.getAtomicWorkPath());
|
|
Assert.assertNull(options.getAtomicWorkPath());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-atomic",
|
|
"-atomic",
|
|
"-tmp",
|
|
"-tmp",
|
|
- "hdfs://localhost:9820/work",
|
|
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
- Assert.assertEquals(options.getAtomicWorkPath(), new Path("hdfs://localhost:9820/work"));
|
|
|
|
|
|
+ "hdfs://localhost:8020/work",
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
|
|
+ Assert.assertEquals(options.getAtomicWorkPath(), new Path("hdfs://localhost:8020/work"));
|
|
|
|
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-tmp",
|
|
"-tmp",
|
|
- "hdfs://localhost:9820/work",
|
|
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/work",
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("work path was allowed without -atomic switch");
|
|
Assert.fail("work path was allowed without -atomic switch");
|
|
} catch (IllegalArgumentException ignore) {}
|
|
} catch (IllegalArgumentException ignore) {}
|
|
}
|
|
}
|
|
@@ -207,37 +207,37 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testParseSyncFolders() {
|
|
public void testParseSyncFolders() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldSyncFolder());
|
|
Assert.assertFalse(options.shouldSyncFolder());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-update",
|
|
"-update",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldSyncFolder());
|
|
Assert.assertTrue(options.shouldSyncFolder());
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testParseDeleteMissing() {
|
|
public void testParseDeleteMissing() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldDeleteMissing());
|
|
Assert.assertFalse(options.shouldDeleteMissing());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-update",
|
|
"-update",
|
|
"-delete",
|
|
"-delete",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldSyncFolder());
|
|
Assert.assertTrue(options.shouldSyncFolder());
|
|
Assert.assertTrue(options.shouldDeleteMissing());
|
|
Assert.assertTrue(options.shouldDeleteMissing());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-overwrite",
|
|
"-overwrite",
|
|
"-delete",
|
|
"-delete",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldOverwrite());
|
|
Assert.assertTrue(options.shouldOverwrite());
|
|
Assert.assertTrue(options.shouldDeleteMissing());
|
|
Assert.assertTrue(options.shouldDeleteMissing());
|
|
|
|
|
|
@@ -245,8 +245,8 @@ public class TestOptionsParser {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-atomic",
|
|
"-atomic",
|
|
"-delete",
|
|
"-delete",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Atomic and delete folders were allowed");
|
|
Assert.fail("Atomic and delete folders were allowed");
|
|
} catch (IllegalArgumentException ignore) { }
|
|
} catch (IllegalArgumentException ignore) { }
|
|
}
|
|
}
|
|
@@ -254,38 +254,38 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testParseMaps() {
|
|
public void testParseMaps() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getMaxMaps(), DistCpConstants.DEFAULT_MAPS);
|
|
Assert.assertEquals(options.getMaxMaps(), DistCpConstants.DEFAULT_MAPS);
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-m",
|
|
"-m",
|
|
"1",
|
|
"1",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getMaxMaps(), 1);
|
|
Assert.assertEquals(options.getMaxMaps(), 1);
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-m",
|
|
"-m",
|
|
"0",
|
|
"0",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getMaxMaps(), 1);
|
|
Assert.assertEquals(options.getMaxMaps(), 1);
|
|
|
|
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-m",
|
|
"-m",
|
|
"hello",
|
|
"hello",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Non numberic map parsed");
|
|
Assert.fail("Non numberic map parsed");
|
|
} catch (IllegalArgumentException ignore) { }
|
|
} catch (IllegalArgumentException ignore) { }
|
|
|
|
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-mapredXslConf",
|
|
"-mapredXslConf",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Non numberic map parsed");
|
|
Assert.fail("Non numberic map parsed");
|
|
} catch (IllegalArgumentException ignore) { }
|
|
} catch (IllegalArgumentException ignore) { }
|
|
}
|
|
}
|
|
@@ -293,8 +293,8 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testParseNumListstatusThreads() {
|
|
public void testParseNumListstatusThreads() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
// If command line argument isn't set, we expect .getNumListstatusThreads
|
|
// If command line argument isn't set, we expect .getNumListstatusThreads
|
|
// option to be zero (so that we know when to override conf properties).
|
|
// option to be zero (so that we know when to override conf properties).
|
|
Assert.assertEquals(0, options.getNumListstatusThreads());
|
|
Assert.assertEquals(0, options.getNumListstatusThreads());
|
|
@@ -302,23 +302,23 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"--numListstatusThreads",
|
|
"--numListstatusThreads",
|
|
"12",
|
|
"12",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(12, options.getNumListstatusThreads());
|
|
Assert.assertEquals(12, options.getNumListstatusThreads());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"--numListstatusThreads",
|
|
"--numListstatusThreads",
|
|
"0",
|
|
"0",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(0, options.getNumListstatusThreads());
|
|
Assert.assertEquals(0, options.getNumListstatusThreads());
|
|
|
|
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"--numListstatusThreads",
|
|
"--numListstatusThreads",
|
|
"hello",
|
|
"hello",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Non numberic numListstatusThreads parsed");
|
|
Assert.fail("Non numberic numListstatusThreads parsed");
|
|
} catch (IllegalArgumentException ignore) { }
|
|
} catch (IllegalArgumentException ignore) { }
|
|
|
|
|
|
@@ -326,8 +326,8 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"--numListstatusThreads",
|
|
"--numListstatusThreads",
|
|
"100",
|
|
"100",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(DistCpOptions.MAX_NUM_LISTSTATUS_THREADS,
|
|
Assert.assertEquals(DistCpOptions.MAX_NUM_LISTSTATUS_THREADS,
|
|
options.getNumListstatusThreads());
|
|
options.getNumListstatusThreads());
|
|
}
|
|
}
|
|
@@ -336,10 +336,10 @@ public class TestOptionsParser {
|
|
public void testSourceListing() {
|
|
public void testSourceListing() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getSourceFileListing(),
|
|
Assert.assertEquals(options.getSourceFileListing(),
|
|
- new Path("hdfs://localhost:9820/source/first"));
|
|
|
|
|
|
+ new Path("hdfs://localhost:8020/source/first"));
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -347,9 +347,9 @@ public class TestOptionsParser {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Both source listing & source paths allowed");
|
|
Assert.fail("Both source listing & source paths allowed");
|
|
} catch (IllegalArgumentException ignore) {}
|
|
} catch (IllegalArgumentException ignore) {}
|
|
}
|
|
}
|
|
@@ -358,7 +358,7 @@ public class TestOptionsParser {
|
|
public void testMissingSourceInfo() {
|
|
public void testMissingSourceInfo() {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.fail("Neither source listing not source paths present");
|
|
Assert.fail("Neither source listing not source paths present");
|
|
} catch (IllegalArgumentException ignore) {}
|
|
} catch (IllegalArgumentException ignore) {}
|
|
}
|
|
}
|
|
@@ -367,7 +367,7 @@ public class TestOptionsParser {
|
|
public void testMissingTarget() {
|
|
public void testMissingTarget() {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
- "-f", "hdfs://localhost:9820/source"});
|
|
|
|
|
|
+ "-f", "hdfs://localhost:8020/source"});
|
|
Assert.fail("Missing target allowed");
|
|
Assert.fail("Missing target allowed");
|
|
} catch (IllegalArgumentException ignore) {}
|
|
} catch (IllegalArgumentException ignore) {}
|
|
}
|
|
}
|
|
@@ -376,7 +376,7 @@ public class TestOptionsParser {
|
|
public void testInvalidArgs() {
|
|
public void testInvalidArgs() {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
- "-m", "-f", "hdfs://localhost:9820/source"});
|
|
|
|
|
|
+ "-m", "-f", "hdfs://localhost:8020/source"});
|
|
Assert.fail("Missing map value");
|
|
Assert.fail("Missing map value");
|
|
} catch (IllegalArgumentException ignore) {}
|
|
} catch (IllegalArgumentException ignore) {}
|
|
}
|
|
}
|
|
@@ -387,14 +387,14 @@ public class TestOptionsParser {
|
|
"-strategy",
|
|
"-strategy",
|
|
"dynamic",
|
|
"dynamic",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getCopyStrategy(), "dynamic");
|
|
Assert.assertEquals(options.getCopyStrategy(), "dynamic");
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getCopyStrategy(), DistCpConstants.UNIFORMSIZE);
|
|
Assert.assertEquals(options.getCopyStrategy(), DistCpConstants.UNIFORMSIZE);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -402,17 +402,17 @@ public class TestOptionsParser {
|
|
public void testTargetPath() {
|
|
public void testTargetPath() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
- Assert.assertEquals(options.getTargetPath(), new Path("hdfs://localhost:9820/target/"));
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
|
|
+ Assert.assertEquals(options.getTargetPath(), new Path("hdfs://localhost:8020/target/"));
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testPreserve() {
|
|
public void testPreserve() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
@@ -423,8 +423,8 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-p",
|
|
"-p",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
@@ -436,8 +436,8 @@ public class TestOptionsParser {
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-p",
|
|
"-p",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
@@ -450,8 +450,8 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-pbr",
|
|
"-pbr",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
@@ -464,8 +464,8 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-pbrgup",
|
|
"-pbrgup",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
@@ -478,8 +478,8 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-pbrgupcaxt",
|
|
"-pbrgupcaxt",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
Assert.assertTrue(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
@@ -493,8 +493,8 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-pc",
|
|
"-pc",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.BLOCKSIZE));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.REPLICATION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
Assert.assertFalse(options.shouldPreserve(FileAttribute.PERMISSION));
|
|
@@ -507,8 +507,8 @@ public class TestOptionsParser {
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-p",
|
|
"-p",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(DistCpOptionSwitch.PRESERVE_STATUS_DEFAULT.length() - 2,
|
|
Assert.assertEquals(DistCpOptionSwitch.PRESERVE_STATUS_DEFAULT.length() - 2,
|
|
options.getPreserveAttributes().size());
|
|
options.getPreserveAttributes().size());
|
|
|
|
|
|
@@ -516,15 +516,15 @@ public class TestOptionsParser {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-pabcd",
|
|
"-pabcd",
|
|
"-f",
|
|
"-f",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target"});
|
|
Assert.fail("Invalid preserve attribute");
|
|
Assert.fail("Invalid preserve attribute");
|
|
}
|
|
}
|
|
catch (NoSuchElementException ignore) {}
|
|
catch (NoSuchElementException ignore) {}
|
|
|
|
|
|
Builder builder = new DistCpOptions.Builder(
|
|
Builder builder = new DistCpOptions.Builder(
|
|
- new Path("hdfs://localhost:9820/source/first"),
|
|
|
|
- new Path("hdfs://localhost:9820/target/"));
|
|
|
|
|
|
+ new Path("hdfs://localhost:8020/source/first"),
|
|
|
|
+ new Path("hdfs://localhost:8020/target/"));
|
|
Assert.assertFalse(
|
|
Assert.assertFalse(
|
|
builder.build().shouldPreserve(FileAttribute.PERMISSION));
|
|
builder.build().shouldPreserve(FileAttribute.PERMISSION));
|
|
builder.preserve(FileAttribute.PERMISSION);
|
|
builder.preserve(FileAttribute.PERMISSION);
|
|
@@ -552,8 +552,8 @@ public class TestOptionsParser {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
"-atomic",
|
|
"-atomic",
|
|
"-i",
|
|
"-i",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
options.appendToConf(conf);
|
|
options.appendToConf(conf);
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.IGNORE_FAILURES.getConfigLabel(), false));
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.IGNORE_FAILURES.getConfigLabel(), false));
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.ATOMIC_COMMIT.getConfigLabel(), false));
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.ATOMIC_COMMIT.getConfigLabel(), false));
|
|
@@ -570,8 +570,8 @@ public class TestOptionsParser {
|
|
"-pu",
|
|
"-pu",
|
|
"-bandwidth",
|
|
"-bandwidth",
|
|
"11.2",
|
|
"11.2",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
options.appendToConf(conf);
|
|
options.appendToConf(conf);
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.DELETE_MISSING.getConfigLabel(), false));
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.DELETE_MISSING.getConfigLabel(), false));
|
|
@@ -644,8 +644,8 @@ public class TestOptionsParser {
|
|
DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
|
|
DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
|
|
|
|
|
|
DistCpOptions options = OptionsParser.parse(new String[] { "-update",
|
|
DistCpOptions options = OptionsParser.parse(new String[] { "-update",
|
|
- "-append", "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "-append", "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
options.appendToConf(conf);
|
|
options.appendToConf(conf);
|
|
Assert.assertTrue(conf.getBoolean(
|
|
Assert.assertTrue(conf.getBoolean(
|
|
DistCpOptionSwitch.APPEND.getConfigLabel(), false));
|
|
DistCpOptionSwitch.APPEND.getConfigLabel(), false));
|
|
@@ -655,8 +655,8 @@ public class TestOptionsParser {
|
|
// make sure -append is only valid when -update is specified
|
|
// make sure -append is only valid when -update is specified
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] { "-append",
|
|
OptionsParser.parse(new String[] { "-append",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail("Append should fail if update option is not specified");
|
|
fail("Append should fail if update option is not specified");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
GenericTestUtils.assertExceptionContains(
|
|
GenericTestUtils.assertExceptionContains(
|
|
@@ -667,8 +667,8 @@ public class TestOptionsParser {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-append", "-update", "-skipcrccheck",
|
|
"-append", "-update", "-skipcrccheck",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail("Append should fail if skipCrc option is specified");
|
|
fail("Append should fail if skipCrc option is specified");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
GenericTestUtils.assertExceptionContains(
|
|
GenericTestUtils.assertExceptionContains(
|
|
@@ -687,8 +687,8 @@ public class TestOptionsParser {
|
|
|
|
|
|
DistCpOptions options = OptionsParser.parse(new String[] { "-update",
|
|
DistCpOptions options = OptionsParser.parse(new String[] { "-update",
|
|
optionStr, "s1", "s2",
|
|
optionStr, "s1", "s2",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
options.appendToConf(conf);
|
|
options.appendToConf(conf);
|
|
Assert.assertTrue(conf.getBoolean(optionLabel, false));
|
|
Assert.assertTrue(conf.getBoolean(optionLabel, false));
|
|
Assert.assertTrue(isDiff?
|
|
Assert.assertTrue(isDiff?
|
|
@@ -698,8 +698,8 @@ public class TestOptionsParser {
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
optionStr, "s1", ".", "-update",
|
|
optionStr, "s1", ".", "-update",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
options.appendToConf(conf);
|
|
options.appendToConf(conf);
|
|
Assert.assertTrue(conf.getBoolean(optionLabel, false));
|
|
Assert.assertTrue(conf.getBoolean(optionLabel, false));
|
|
Assert.assertTrue(isDiff?
|
|
Assert.assertTrue(isDiff?
|
|
@@ -710,8 +710,8 @@ public class TestOptionsParser {
|
|
// -diff/-rdiff requires two option values
|
|
// -diff/-rdiff requires two option values
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {optionStr, "s1", "-update",
|
|
OptionsParser.parse(new String[] {optionStr, "s1", "-update",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail(optionStr + " should fail with only one snapshot name");
|
|
fail(optionStr + " should fail with only one snapshot name");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
GenericTestUtils.assertExceptionContains(
|
|
GenericTestUtils.assertExceptionContains(
|
|
@@ -721,8 +721,8 @@ public class TestOptionsParser {
|
|
// make sure -diff/-rdiff is only valid when -update is specified
|
|
// make sure -diff/-rdiff is only valid when -update is specified
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {optionStr, "s1", "s2",
|
|
OptionsParser.parse(new String[] {optionStr, "s1", "s2",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail(optionStr + " should fail if -update option is not specified");
|
|
fail(optionStr + " should fail if -update option is not specified");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
GenericTestUtils.assertExceptionContains(
|
|
GenericTestUtils.assertExceptionContains(
|
|
@@ -732,8 +732,8 @@ public class TestOptionsParser {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-diff", "s1", "s2", "-update", "-delete",
|
|
"-diff", "s1", "s2", "-update", "-delete",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail("Should fail as -delete and -diff/-rdiff are mutually exclusive");
|
|
fail("Should fail as -delete and -diff/-rdiff are mutually exclusive");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
assertExceptionContains(
|
|
assertExceptionContains(
|
|
@@ -743,8 +743,8 @@ public class TestOptionsParser {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {
|
|
OptionsParser.parse(new String[] {
|
|
"-diff", "s1", "s2", "-delete",
|
|
"-diff", "s1", "s2", "-delete",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail("Should fail as -delete and -diff/-rdiff are mutually exclusive");
|
|
fail("Should fail as -delete and -diff/-rdiff are mutually exclusive");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
assertExceptionContains(
|
|
assertExceptionContains(
|
|
@@ -754,8 +754,8 @@ public class TestOptionsParser {
|
|
try {
|
|
try {
|
|
OptionsParser.parse(new String[] {optionStr, "s1", "s2",
|
|
OptionsParser.parse(new String[] {optionStr, "s1", "s2",
|
|
"-delete", "-overwrite",
|
|
"-delete", "-overwrite",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail("Should fail as -delete and -diff are mutually exclusive");
|
|
fail("Should fail as -delete and -diff are mutually exclusive");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
assertExceptionContains(
|
|
assertExceptionContains(
|
|
@@ -768,8 +768,8 @@ public class TestOptionsParser {
|
|
optionStr, "s1", "s2",
|
|
optionStr, "s1", "s2",
|
|
optionStrOther, "s2", "s1",
|
|
optionStrOther, "s2", "s1",
|
|
"-update",
|
|
"-update",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/" });
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/" });
|
|
fail(optionStr + " should fail if " + optionStrOther
|
|
fail(optionStr + " should fail if " + optionStrOther
|
|
+ " is also specified");
|
|
+ " is also specified");
|
|
} catch (IllegalArgumentException e) {
|
|
} catch (IllegalArgumentException e) {
|
|
@@ -791,15 +791,15 @@ public class TestOptionsParser {
|
|
@Test
|
|
@Test
|
|
public void testExclusionsOption() {
|
|
public void testExclusionsOption() {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertNull(options.getFiltersFile());
|
|
Assert.assertNull(options.getFiltersFile());
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
options = OptionsParser.parse(new String[] {
|
|
"-filters",
|
|
"-filters",
|
|
"/tmp/filters.txt",
|
|
"/tmp/filters.txt",
|
|
- "hdfs://localhost:9820/source/first",
|
|
|
|
- "hdfs://localhost:9820/target/"});
|
|
|
|
|
|
+ "hdfs://localhost:8020/source/first",
|
|
|
|
+ "hdfs://localhost:8020/target/"});
|
|
Assert.assertEquals(options.getFiltersFile(), "/tmp/filters.txt");
|
|
Assert.assertEquals(options.getFiltersFile(), "/tmp/filters.txt");
|
|
}
|
|
}
|
|
}
|
|
}
|