You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2018/02/01 17:41:18 UTC
[accumulo] 01/01: Merge branch '1.7' into 1.8
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch 1.8
in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 53c0e4ffd9083a7dc13c0d93c65b6a081da0cf56
Merge: d6d8a7d 1fe3ba1
Author: Keith Turner <kt...@apache.org>
AuthorDate: Thu Feb 1 12:37:53 2018 -0500
Merge branch '1.7' into 1.8
.../org/apache/accumulo/core/conf/Property.java | 155 +++++++++++++--------
.../apache/accumulo/core/conf/PropertyTest.java | 58 ++++++++
2 files changed, 156 insertions(+), 57 deletions(-)
diff --cc core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 26762fb,1733124..f64b9e2
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@@ -804,20 -811,12 +826,12 @@@ public enum Property
* property key
* @return true if key is valid for a table property (recognized, or has a recognized prefix)
*/
- public synchronized static boolean isValidTablePropertyKey(String key) {
- if (validTableProperties == null) {
- validTableProperties = new HashSet<>();
- for (Property p : Property.values()) {
- if (!p.getType().equals(PropertyType.PREFIX) && p.getKey().startsWith(Property.TABLE_PREFIX.getKey())) {
- validTableProperties.add(p.getKey());
- }
- }
- }
-
- return validTableProperties.contains(key) || key.startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey())
- || key.startsWith(Property.TABLE_ITERATOR_PREFIX.getKey()) || key.startsWith(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey())
- || key.startsWith(Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey()) || key.startsWith(Property.TABLE_REPLICATION_TARGET.getKey())
- || key.startsWith(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey()) || key.startsWith(TABLE_SAMPLER_OPTS.getKey());
+ public static boolean isValidTablePropertyKey(String key) {
+ return validTableProperties.contains(key)
+ || (key.startsWith(Property.TABLE_PREFIX.getKey()) && (key.startsWith(Property.TABLE_CONSTRAINT_PREFIX.getKey())
+ || key.startsWith(Property.TABLE_ITERATOR_PREFIX.getKey()) || key.startsWith(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey())
- || key.startsWith(Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey()) || key.startsWith(Property.TABLE_REPLICATION_TARGET.getKey()) || key
- .startsWith(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey())));
++ || key.startsWith(Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey()) || key.startsWith(Property.TABLE_REPLICATION_TARGET.getKey())
++ || key.startsWith(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey()) || key.startsWith(TABLE_SAMPLER_OPTS.getKey())));
}
/**
@@@ -851,10 -849,10 +865,9 @@@
*/
public static boolean isValidZooPropertyKey(String key) {
// white list prefixes
- return key.startsWith(Property.TABLE_PREFIX.getKey()) || key.startsWith(Property.TSERV_PREFIX.getKey()) || key.startsWith(Property.LOGGER_PREFIX.getKey())
- || key.startsWith(Property.MASTER_PREFIX.getKey()) || key.startsWith(Property.GC_PREFIX.getKey())
- || key.startsWith(Property.MONITOR_PREFIX.getKey() + "banner.") || key.startsWith(VFS_CONTEXT_CLASSPATH_PROPERTY.getKey())
- || key.startsWith(REPLICATION_PREFIX.getKey());
+ return key.startsWith(Property.TABLE_PREFIX.getKey()) || key.startsWith(Property.TSERV_PREFIX.getKey()) || key.startsWith(Property.MASTER_PREFIX.getKey())
+ || key.startsWith(Property.GC_PREFIX.getKey()) || key.startsWith(Property.MONITOR_PREFIX.getKey() + "banner.")
- || key.startsWith(VFS_CONTEXT_CLASSPATH_PROPERTY.getKey()) || key.startsWith(Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey())
- || key.startsWith(REPLICATION_PREFIX.getKey());
++ || key.startsWith(VFS_CONTEXT_CLASSPATH_PROPERTY.getKey()) || key.startsWith(REPLICATION_PREFIX.getKey());
}
/**
diff --cc core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
index 79f2f21,d25c8c2..7d1c8dc
--- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
@@@ -151,4 -148,66 +152,61 @@@ public class PropertyTest
}
}
}
+
- @Test
- public void testGCDeadServerWaitSecond() {
- assertEquals("1h", Property.GC_WAL_DEAD_SERVER_WAIT.getDefaultValue());
- }
-
+ @SuppressWarnings("deprecation")
+ private Property getDeprecatedProperty() {
+ return Property.INSTANCE_DFS_DIR;
+ }
+
+ @Test
+ public void testAnnotations() {
+ assertTrue(Property.TABLE_VOLUME_CHOOSER.isExperimental());
- assertFalse(Property.LOGGER_DIR.isExperimental());
++ assertFalse(Property.TABLE_SAMPLER.isExperimental());
+
+ assertTrue(Property.INSTANCE_SECRET.isSensitive());
+ assertFalse(Property.INSTANCE_VOLUMES.isSensitive());
+
+ assertTrue(getDeprecatedProperty().isDeprecated());
+ assertFalse(Property.INSTANCE_VOLUMES_REPLACEMENTS.isDeprecated());
+
+ }
+
+ @Test
+ public void testGetPropertyByKey() {
+ for (Property prop : Property.values()) {
+ assertSame(prop, Property.getPropertyByKey(prop.getKey()));
+ }
+ }
+
+ @Test
+ public void testIsValidPropertyKey() {
+ for (Property prop : Property.values()) {
+ assertTrue(Property.isValidPropertyKey(prop.getKey()));
+ if (prop.getType().equals(PropertyType.PREFIX)) {
+ assertTrue(Property.isValidPropertyKey(prop.getKey() + "foo9"));
+ }
+ }
+
+ assertFalse(Property.isValidPropertyKey("abc.def"));
+ }
+
+ @Test
+ public void testIsValidTablePropertyKey() {
+ for (Property prop : Property.values()) {
+ if (prop.getKey().startsWith("table.") && !prop.getKey().equals("table.")) {
+ assertTrue(Property.isValidTablePropertyKey(prop.getKey()));
+
+ if (prop.getType().equals(PropertyType.PREFIX)) {
+ assertTrue(Property.isValidTablePropertyKey(prop.getKey() + "foo9"));
+ } else {
+ assertFalse(Property.isValidTablePropertyKey(prop.getKey() + "foo9"));
+ }
+ } else {
+ assertFalse(Property.isValidTablePropertyKey(prop.getKey()));
+ }
+
+ }
+
+ assertFalse(Property.isValidTablePropertyKey("abc.def"));
+ }
}
--
To stop receiving notification emails like this one, please contact
kturner@apache.org.