diff --git src/main/java/org/apache/hadoop/hbase/constraint/Constraints.java src/main/java/org/apache/hadoop/hbase/constraint/Constraints.java index 1ad87df..c78d894 100644 --- src/main/java/org/apache/hadoop/hbase/constraint/Constraints.java +++ src/main/java/org/apache/hadoop/hbase/constraint/Constraints.java @@ -365,7 +365,7 @@ public final class Constraints { private static Configuration readConfiguration(byte[] bytes) throws IOException { ByteArrayInputStream is = new ByteArrayInputStream(bytes); - Configuration conf = new Configuration(); + Configuration conf = new Configuration(false); conf.addResource(is); return conf; } diff --git src/test/java/org/apache/hadoop/hbase/constraint/CheckConfigurationConstraint.java src/test/java/org/apache/hadoop/hbase/constraint/CheckConfigurationConstraint.java index f3b21dc..1f6f20b 100644 --- src/test/java/org/apache/hadoop/hbase/constraint/CheckConfigurationConstraint.java +++ src/test/java/org/apache/hadoop/hbase/constraint/CheckConfigurationConstraint.java @@ -29,7 +29,7 @@ public class CheckConfigurationConstraint extends BaseConstraint { private static String value = "testValue"; public static Configuration getConfiguration() { - Configuration conf = new Configuration(); + Configuration conf = new Configuration(false); conf.set(key, value); return conf; } @@ -47,6 +47,11 @@ public class CheckConfigurationConstraint extends BaseConstraint { if (val == null || !val.equals(value)) throw new IllegalArgumentException( "Configuration was not passed correctly"); + // and then check to make sure we got a fresh config by checking for a + // hadoop-based config value, and if we don't find it, its fine + if (conf.getRaw("fs.file.impl") != null) + throw new IllegalArgumentException( + "Configuration was created improperly"); } } diff --git src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java index e842242..777da49 100644 --- src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java +++ src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java @@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.constraint; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.util.List; @@ -82,11 +83,11 @@ public class TestConstraints { // check to make sure that we overwrite configurations Constraints.add(desc, new Pair, Configuration>( - CheckConfigurationConstraint.class, new Configuration())); + CheckConfigurationConstraint.class, new Configuration(false))); try { Constraints.getConstraints(desc, this.getClass().getClassLoader()); - assertTrue("No exception thrown - configuration not overwritten", false); + fail("No exception thrown - configuration not overwritten"); } catch (IllegalArgumentException e) { // expect to have the exception, so don't do anything }