|
@@ -32,6 +32,8 @@ import java.util.NoSuchElementException;
|
|
|
|
|
|
public class TestOptionsParser {
|
|
|
|
|
|
+ private static final float DELTA = 0.001f;
|
|
|
+
|
|
|
@Test
|
|
|
public void testParseIgnoreFailure() {
|
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
@@ -104,14 +106,14 @@ public class TestOptionsParser {
|
|
|
DistCpOptions options = OptionsParser.parse(new String[] {
|
|
|
"hdfs://localhost:8020/source/first",
|
|
|
"hdfs://localhost:8020/target/"});
|
|
|
- Assert.assertEquals(options.getMapBandwidth(), DistCpConstants.DEFAULT_BANDWIDTH_MB);
|
|
|
+ Assert.assertEquals(options.getMapBandwidth(), DistCpConstants.DEFAULT_BANDWIDTH_MB, DELTA);
|
|
|
|
|
|
options = OptionsParser.parse(new String[] {
|
|
|
"-bandwidth",
|
|
|
- "11",
|
|
|
+ "11.2",
|
|
|
"hdfs://localhost:8020/source/first",
|
|
|
"hdfs://localhost:8020/target/"});
|
|
|
- Assert.assertEquals(options.getMapBandwidth(), 11);
|
|
|
+ Assert.assertEquals(options.getMapBandwidth(), 11.2, DELTA);
|
|
|
}
|
|
|
|
|
|
@Test(expected=IllegalArgumentException.class)
|
|
@@ -585,8 +587,8 @@ public class TestOptionsParser {
|
|
|
options.appendToConf(conf);
|
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.IGNORE_FAILURES.getConfigLabel(), false));
|
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.ATOMIC_COMMIT.getConfigLabel(), false));
|
|
|
- Assert.assertEquals(conf.getInt(DistCpOptionSwitch.BANDWIDTH.getConfigLabel(), -1),
|
|
|
- DistCpConstants.DEFAULT_BANDWIDTH_MB);
|
|
|
+ Assert.assertEquals(conf.getFloat(DistCpOptionSwitch.BANDWIDTH.getConfigLabel(), -1),
|
|
|
+ DistCpConstants.DEFAULT_BANDWIDTH_MB, DELTA);
|
|
|
|
|
|
conf = new Configuration();
|
|
|
Assert.assertFalse(conf.getBoolean(DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
|
|
@@ -597,14 +599,14 @@ public class TestOptionsParser {
|
|
|
"-delete",
|
|
|
"-pu",
|
|
|
"-bandwidth",
|
|
|
- "11",
|
|
|
+ "11.2",
|
|
|
"hdfs://localhost:8020/source/first",
|
|
|
"hdfs://localhost:8020/target/"});
|
|
|
options.appendToConf(conf);
|
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
|
|
|
Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.DELETE_MISSING.getConfigLabel(), false));
|
|
|
Assert.assertEquals(conf.get(DistCpOptionSwitch.PRESERVE_STATUS.getConfigLabel()), "U");
|
|
|
- Assert.assertEquals(conf.getInt(DistCpOptionSwitch.BANDWIDTH.getConfigLabel(), -1), 11);
|
|
|
+ Assert.assertEquals(conf.getFloat(DistCpOptionSwitch.BANDWIDTH.getConfigLabel(), -1), 11.2, DELTA);
|
|
|
}
|
|
|
|
|
|
@Test
|