use of org.apache.hadoop.tools.DistCpOptions in project hadoop by apache.
the class TestOptionsParser method testTargetPath.
@Test
public void testTargetPath() {
DistCpOptions options = OptionsParser.parse(new String[] { "-f", "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertEquals(options.getTargetPath(), new Path("hdfs://localhost:9820/target/"));
}
use of org.apache.hadoop.tools.DistCpOptions in project hadoop by apache.
the class TestOptionsParser method testLogPath.
@Test
public void testLogPath() {
DistCpOptions options = OptionsParser.parse(new String[] { "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertNull(options.getLogPath());
options = OptionsParser.parse(new String[] { "-log", "hdfs://localhost:9820/logs", "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertEquals(options.getLogPath(), new Path("hdfs://localhost:9820/logs"));
}
use of org.apache.hadoop.tools.DistCpOptions in project hadoop by apache.
the class TestOptionsParser method testParseSyncFolders.
@Test
public void testParseSyncFolders() {
DistCpOptions options = OptionsParser.parse(new String[] { "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertFalse(options.shouldSyncFolder());
options = OptionsParser.parse(new String[] { "-update", "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertTrue(options.shouldSyncFolder());
}
use of org.apache.hadoop.tools.DistCpOptions in project hadoop by apache.
the class TestOptionsParser method testExclusionsOption.
@Test
public void testExclusionsOption() {
DistCpOptions options = OptionsParser.parse(new String[] { "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertNull(options.getFiltersFile());
options = OptionsParser.parse(new String[] { "-filters", "/tmp/filters.txt", "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertEquals(options.getFiltersFile(), "/tmp/filters.txt");
}
use of org.apache.hadoop.tools.DistCpOptions in project hadoop by apache.
the class TestOptionsParser method testParseOverwrite.
@Test
public void testParseOverwrite() {
DistCpOptions options = OptionsParser.parse(new String[] { "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertFalse(options.shouldOverwrite());
options = OptionsParser.parse(new String[] { "-overwrite", "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.assertTrue(options.shouldOverwrite());
try {
OptionsParser.parse(new String[] { "-update", "-overwrite", "hdfs://localhost:9820/source/first", "hdfs://localhost:9820/target/" });
Assert.fail("Update and overwrite aren't allowed together");
} catch (IllegalArgumentException ignore) {
}
}
Aggregations