|
@@ -42,6 +42,7 @@ import static java.util.concurrent.TimeUnit.*;
|
|
|
|
|
|
import junit.framework.TestCase;
|
|
import junit.framework.TestCase;
|
|
import static org.junit.Assert.assertArrayEquals;
|
|
import static org.junit.Assert.assertArrayEquals;
|
|
|
|
+import static org.junit.Assert.fail;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.hadoop.conf.Configuration.IntegerRanges;
|
|
import org.apache.hadoop.conf.Configuration.IntegerRanges;
|
|
@@ -49,6 +50,7 @@ import org.apache.hadoop.fs.Path;
|
|
import org.apache.hadoop.io.IOUtils;
|
|
import org.apache.hadoop.io.IOUtils;
|
|
import org.apache.hadoop.net.NetUtils;
|
|
import org.apache.hadoop.net.NetUtils;
|
|
import static org.apache.hadoop.util.PlatformName.IBM_JAVA;
|
|
import static org.apache.hadoop.util.PlatformName.IBM_JAVA;
|
|
|
|
+
|
|
import org.codehaus.jackson.map.ObjectMapper;
|
|
import org.codehaus.jackson.map.ObjectMapper;
|
|
import org.mockito.Mockito;
|
|
import org.mockito.Mockito;
|
|
|
|
|
|
@@ -1511,6 +1513,19 @@ public class TestConfiguration extends TestCase {
|
|
// it's expected behaviour.
|
|
// it's expected behaviour.
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void testNullValueProperties() throws Exception {
|
|
|
|
+ Configuration conf = new Configuration();
|
|
|
|
+ conf.setAllowNullValueProperties(true);
|
|
|
|
+ out = new BufferedWriter(new FileWriter(CONFIG));
|
|
|
|
+ startConfig();
|
|
|
|
+ appendProperty("attr", "value", true);
|
|
|
|
+ appendProperty("attr", "", true);
|
|
|
|
+ endConfig();
|
|
|
|
+ Path fileResource = new Path(CONFIG);
|
|
|
|
+ conf.addResource(fileResource);
|
|
|
|
+ assertEquals("value", conf.get("attr"));
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void main(String[] argv) throws Exception {
|
|
public static void main(String[] argv) throws Exception {
|
|
junit.textui.TestRunner.main(new String[]{
|
|
junit.textui.TestRunner.main(new String[]{
|
|
TestConfiguration.class.getName()
|
|
TestConfiguration.class.getName()
|