accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo] 01/01: Merge branch '1.8'
Date Thu, 01 Feb 2018 17:54:43 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit d90d39e9d077aed862f5061a144831e91fc1ae67
Merge: 05c165b 53c0e4f
Author: Keith Turner <kturner@apache.org>
AuthorDate: Thu Feb 1 12:53:27 2018 -0500

    Merge branch '1.8'

 .../org/apache/accumulo/core/conf/Property.java    | 157 +++++++++++++--------
 .../apache/accumulo/core/conf/PropertyTest.java    |  58 ++++++++
 2 files changed, 157 insertions(+), 58 deletions(-)

diff --cc core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 2fd28a7,f64b9e2..36f379e
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@@ -643,8 -606,18 +645,17 @@@ public enum Property 
  
    ;
  
-   private String key, defaultValue, description;
+   private String key;
+   private String defaultValue;
+   private String computedDefaultValue;
+   private String description;
+   private boolean annotationsComputed = false;
+   private boolean defaultValueComputed = false;
+   private boolean isSensitive;
+   private boolean isDeprecated;
+   private boolean isExperimental;
+   private boolean isInterpolated;
    private PropertyType type;
 -  private static final Logger log = LoggerFactory.getLogger(Property.class);
  
    private Property(String name, String defaultValue, PropertyType type, String description)
{
      this.key = name;
@@@ -842,21 -826,12 +864,13 @@@
     *          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())
-         || key.startsWith(TABLE_SUMMARIZER_PREFIX.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(TABLE_SAMPLER_OPTS.getKey())));
++            || key.startsWith(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey()) || key.startsWith(TABLE_SAMPLER_OPTS.getKey())
|| key
++              .startsWith(TABLE_SUMMARIZER_PREFIX.getKey())));
    }
  
    /**
diff --cc core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
index a80183c,7d1c8dc..f7ce8f7
--- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
@@@ -130,4 -152,61 +131,61 @@@ public class PropertyTest 
        }
      }
    }
+ 
+   @SuppressWarnings("deprecation")
+   private Property getDeprecatedProperty() {
+     return Property.INSTANCE_DFS_DIR;
+   }
+ 
+   @Test
+   public void testAnnotations() {
 -    assertTrue(Property.TABLE_VOLUME_CHOOSER.isExperimental());
++    assertTrue(Property.GENERAL_VOLUME_CHOOSER.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.

Mime
View raw message