accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] branch master updated: Update to commons-configuration2.5 (#1176)
Date Mon, 03 Jun 2019 20:45:11 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new d7a407a  Update to commons-configuration2.5 (#1176)
d7a407a is described below

commit d7a407a3d6367b96fbc513f5b94b3c0511a68bf0
Author: Christopher Tubbs <ctubbsii@apache.org>
AuthorDate: Mon Jun 3 16:45:05 2019 -0400

    Update to commons-configuration2.5 (#1176)
    
    * Update dependencies
    * Use FileBasedConfigurationBuilder to load configuration files
    * Use PropertiesConfigurationLayout to serialize/deserialize when needed
    * Simplified some calls to get system properties en route to updating
    the PropertiesConfiguration usages.
    
    Note: list delimiter is disabled by default now, so those API calls
    aren't needed and were removed; also removed setThrowsOnMissing(false)
    calls becuase that was also the default behavior
---
 assemble/pom.xml                                   | 25 ++++++++---
 assemble/src/main/assemblies/component.xml         |  5 ++-
 core/pom.xml                                       |  8 ++--
 .../accumulo/core/client/ClientConfiguration.java  | 36 ++++++++--------
 .../org/apache/accumulo/core/conf/Property.java    |  4 +-
 .../accumulo/core/conf/SiteConfiguration.java      | 21 +++++-----
 .../core/file/blockfile/cache/impl/ClassSize.java  |  5 +--
 minicluster/pom.xml                                |  8 ++--
 .../accumulo/cluster/RemoteShellOptions.java       |  5 +--
 .../minicluster/MiniAccumuloClusterTest.java       | 10 +++--
 pom.xml                                            | 22 +++++++---
 start/pom.xml                                      | 14 +++++--
 .../start/classloader/AccumuloClassLoader.java     | 12 +++---
 test/pom.xml                                       |  8 ++--
 .../conf/AccumuloClusterPropertyConfiguration.java | 13 +++---
 .../accumulo/test/RewriteTabletDirectoriesIT.java  | 14 ++++---
 .../java/org/apache/accumulo/test/VolumeIT.java    | 49 +++++++++++++---------
 17 files changed, 152 insertions(+), 107 deletions(-)

diff --git a/assemble/pom.xml b/assemble/pom.xml
index 39bd647..d85ab40 100644
--- a/assemble/pom.xml
+++ b/assemble/pom.xml
@@ -103,6 +103,11 @@
       <optional>true</optional>
     </dependency>
     <dependency>
+      <groupId>commons-beanutils</groupId>
+      <artifactId>commons-beanutils</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
       <groupId>commons-cli</groupId>
       <artifactId>commons-cli</artifactId>
       <optional>true</optional>
@@ -113,11 +118,6 @@
       <optional>true</optional>
     </dependency>
     <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-      <optional>true</optional>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
       <optional>true</optional>
@@ -255,11 +255,26 @@
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-configuration2</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-math3</artifactId>
       <optional>true</optional>
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-text</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-vfs2</artifactId>
       <optional>true</optional>
     </dependency>
diff --git a/assemble/src/main/assemblies/component.xml b/assemble/src/main/assemblies/component.xml
index 5c42583..ba01def 100644
--- a/assemble/src/main/assemblies/component.xml
+++ b/assemble/src/main/assemblies/component.xml
@@ -44,9 +44,9 @@
         <include>com.google.protobuf:protobuf-java</include>
         <include>com.sun.xml.bind:jaxb-core</include>
         <include>com.sun.xml.bind:jaxb-impl</include>
+        <include>commons-beanutils:commons-beanutils</include>
         <include>commons-cli:commons-cli</include>
         <include>commons-codec:commons-codec</include>
-        <include>commons-configuration:commons-configuration</include>
         <include>commons-io:commons-io</include>
         <include>commons-lang:commons-lang</include>
         <include>commons-logging:commons-logging</include>
@@ -60,7 +60,10 @@
         <include>jline:jline</include>
         <include>log4j:log4j</include>
         <include>org.apache.commons:commons-collections4</include>
+        <include>org.apache.commons:commons-configuration2</include>
+        <include>org.apache.commons:commons-lang3</include>
         <include>org.apache.commons:commons-math3</include>
+        <include>org.apache.commons:commons-text</include>
         <include>org.apache.commons:commons-vfs2</include>
         <include>org.apache.htrace:htrace-core4</include>
         <include>org.apache.htrace:htrace-core</include>
diff --git a/core/pom.xml b/core/pom.xml
index 640e7af..1b156ca 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -52,10 +52,6 @@
       <artifactId>protobuf-java</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
@@ -85,6 +81,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-configuration2</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-math3</artifactId>
     </dependency>
     <dependency>
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
index e2de49f..f7a2857 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
@@ -32,11 +32,13 @@ import java.util.UUID;
 
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.conf.PropertyType;
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.MapConfiguration;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.configuration2.CompositeConfiguration;
+import org.apache.commons.configuration2.Configuration;
+import org.apache.commons.configuration2.MapConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
+import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -145,8 +147,6 @@ public class ClientConfiguration {
 
   private ClientConfiguration(List<? extends Configuration> configs) {
     compositeConfig = new CompositeConfiguration(configs);
-    // Don't do list interpolation; the items in configs should already have set this
-    compositeConfig.setListDelimiter('\0');
   }
 
   /**
@@ -193,11 +193,11 @@ public class ClientConfiguration {
    * @since 1.9.0
    */
   public static ClientConfiguration fromFile(File file) {
-    PropertiesConfiguration props = new PropertiesConfiguration();
-    props.setListDelimiter('\0');
+    FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+        new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class)
+            .configure(new Parameters().properties().setFile(file));
     try {
-      props.load(file);
-      return new ClientConfiguration(Collections.singletonList(props));
+      return new ClientConfiguration(Collections.singletonList(propsBuilder.getConfiguration()));
     } catch (ConfigurationException e) {
       throw new IllegalArgumentException("Bad configuration file: " + file, e);
     }
@@ -213,7 +213,6 @@ public class ClientConfiguration {
    */
   public static ClientConfiguration fromMap(Map<String,String> properties) {
     MapConfiguration mapConf = new MapConfiguration(properties);
-    mapConf.setListDelimiter('\0');
     return new ClientConfiguration(Collections.singletonList(mapConf));
   }
 
@@ -224,15 +223,15 @@ public class ClientConfiguration {
     for (String path : paths) {
       File conf = new File(path);
       if (conf.isFile() && conf.canRead()) {
-        PropertiesConfiguration props = new PropertiesConfiguration();
-        props.setListDelimiter('\0');
+        FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+            new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class)
+                .configure(new Parameters().properties().setFile(conf));
         try {
-          props.load(conf);
+          configs.add(propsBuilder.getConfiguration());
           log.info("Loaded client configuration file {}", conf);
         } catch (ConfigurationException e) {
           throw new IllegalStateException("Error loading client configuration file " + conf,
e);
         }
-        configs.add(props);
       }
     }
     // We couldn't find the client configuration anywhere
@@ -245,9 +244,8 @@ public class ClientConfiguration {
 
   public static ClientConfiguration deserialize(String serializedConfig) {
     PropertiesConfiguration propConfig = new PropertiesConfiguration();
-    propConfig.setListDelimiter('\0');
     try {
-      propConfig.load(new StringReader(serializedConfig));
+      propConfig.getLayout().load(propConfig, new StringReader(serializedConfig));
     } catch (ConfigurationException e) {
       throw new IllegalArgumentException(
           "Error deserializing client configuration: " + serializedConfig, e);
@@ -306,7 +304,7 @@ public class ClientConfiguration {
     propConfig.copy(compositeConfig);
     StringWriter writer = new StringWriter();
     try {
-      propConfig.save(writer);
+      propConfig.getLayout().save(propConfig, writer);
     } catch (ConfigurationException e) {
       // this should never happen
       throw new IllegalStateException(e);
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index b758b89..97d9dfd 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -39,8 +39,8 @@ import org.apache.accumulo.core.util.format.DefaultFormatter;
 import org.apache.accumulo.core.util.interpret.DefaultScanInterpreter;
 import org.apache.accumulo.start.classloader.AccumuloClassLoader;
 import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
-import org.apache.commons.configuration.MapConfiguration;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.configuration2.MapConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
index e875318..d735622 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
@@ -17,7 +17,6 @@
 package org.apache.accumulo.core.conf;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -27,9 +26,11 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.function.Predicate;
 
-import org.apache.commons.configuration.CompositeConfiguration;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.configuration2.CompositeConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
+import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -87,18 +88,16 @@ public class SiteConfiguration extends AccumuloConfiguration {
   private static ImmutableMap<String,String> createMap(URL accumuloPropsLocation,
       Map<String,String> overrides) {
     CompositeConfiguration config = new CompositeConfiguration();
-    config.setThrowExceptionOnMissing(false);
-    config.setDelimiterParsingDisabled(true);
-    PropertiesConfiguration propsConfig = new PropertiesConfiguration();
-    propsConfig.setDelimiterParsingDisabled(true);
     if (accumuloPropsLocation != null) {
+      FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+          new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class)
+              .configure(new Parameters().properties().setURL(accumuloPropsLocation));
       try {
-        propsConfig.load(accumuloPropsLocation.openStream());
-      } catch (IOException | ConfigurationException e) {
+        config.addConfiguration(propsBuilder.getConfiguration());
+      } catch (ConfigurationException e) {
         throw new IllegalArgumentException(e);
       }
     }
-    config.addConfiguration(propsConfig);
 
     // Add all properties in config file
     Map<String,String> result = new HashMap<>();
diff --git a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/ClassSize.java
b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/ClassSize.java
index 6744ea4..a2f9427 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/ClassSize.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/impl/ClassSize.java
@@ -18,8 +18,6 @@
 
 package org.apache.accumulo.core.file.blockfile.cache.impl;
 
-import java.util.Properties;
-
 /**
  * Class for determining the "size" of a class, an attempt to calculate the actual bytes
that an
  * object of this class will occupy in memory
@@ -63,8 +61,7 @@ public class ClassSize {
    */
   static {
     // Figure out whether this is a 32 or 64 bit machine.
-    Properties sysProps = System.getProperties();
-    String arcModel = sysProps.getProperty("sun.arch.data.model");
+    String arcModel = System.getProperty("sun.arch.data.model");
 
     // Default value is set to 8, covering the case when arcModel is unknown
     REFERENCE = arcModel.equals(THIRTY_TWO) ? 4 : 8;
diff --git a/minicluster/pom.xml b/minicluster/pom.xml
index f178c8d..8add317 100644
--- a/minicluster/pom.xml
+++ b/minicluster/pom.xml
@@ -40,10 +40,6 @@
       <artifactId>guava</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
@@ -84,6 +80,10 @@
       <artifactId>accumulo-tserver</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-configuration2</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-client-api</artifactId>
     </dependency>
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/RemoteShellOptions.java
b/minicluster/src/main/java/org/apache/accumulo/cluster/RemoteShellOptions.java
index 61e044c..cd6cb36 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/RemoteShellOptions.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/RemoteShellOptions.java
@@ -57,9 +57,8 @@ public class RemoteShellOptions {
       justification = "code runs in same security context as user who provided input file
name")
   public RemoteShellOptions() {
     properties = new Properties();
-    Properties systemProperties = System.getProperties();
 
-    String propertyFile = systemProperties.getProperty(SSH_PROPERTIES_FILE);
+    String propertyFile = System.getProperty(SSH_PROPERTIES_FILE);
 
     // Load properties from the specified file
     if (propertyFile != null) {
@@ -90,7 +89,7 @@ public class RemoteShellOptions {
     }
 
     // Let other system properties override those in the file
-    for (Entry<Object,Object> entry : systemProperties.entrySet()) {
+    for (Entry<Object,Object> entry : System.getProperties().entrySet()) {
       if (!(entry.getKey() instanceof String)) {
         continue;
       }
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
index 4181ed5..a6ffabd 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
@@ -45,7 +45,9 @@ import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.core.util.Pair;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
 import org.apache.commons.io.FileUtils;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.junit.AfterClass;
@@ -233,8 +235,10 @@ public class MiniAccumuloClusterTest {
   public void testRandomPorts() throws Exception {
     File confDir = new File(testDir, "conf");
     File accumuloProps = new File(confDir, "accumulo.properties");
-    PropertiesConfiguration conf = new PropertiesConfiguration();
-    conf.load(accumuloProps);
+    FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+        new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class)
+            .configure(new Parameters().properties().setFile(accumuloProps));
+    PropertiesConfiguration conf = propsBuilder.getConfiguration();
     for (Property randomPortProp : new Property[] {Property.TSERV_CLIENTPORT, Property.MONITOR_PORT,
         Property.MONITOR_LOG4J_PORT, Property.MASTER_CLIENTPORT, Property.TRACE_PORT,
         Property.GC_PORT}) {
diff --git a/pom.xml b/pom.xml
index 9cdc557..abdf081 100644
--- a/pom.xml
+++ b/pom.xml
@@ -242,6 +242,11 @@
         <version>${jaxb.version}</version>
       </dependency>
       <dependency>
+        <groupId>commons-beanutils</groupId>
+        <artifactId>commons-beanutils</artifactId>
+        <version>1.9.3</version>
+      </dependency>
+      <dependency>
         <groupId>commons-cli</groupId>
         <artifactId>commons-cli</artifactId>
         <version>1.4</version>
@@ -252,11 +257,6 @@
         <version>1.12</version>
       </dependency>
       <dependency>
-        <groupId>commons-configuration</groupId>
-        <artifactId>commons-configuration</artifactId>
-        <version>1.10</version>
-      </dependency>
-      <dependency>
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
         <version>2.6</version>
@@ -415,6 +415,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.commons</groupId>
+        <artifactId>commons-configuration2</artifactId>
+        <version>2.5</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.commons</groupId>
         <artifactId>commons-jci-core</artifactId>
         <version>1.1</version>
       </dependency>
@@ -435,6 +440,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.commons</groupId>
+        <artifactId>commons-text</artifactId>
+        <version>1.6</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.commons</groupId>
         <artifactId>commons-vfs2</artifactId>
         <!-- commons-vfs2 version 2.2 has defects that impacts changing Accumulo classpath
contexts. -->
         <version>2.3</version>
@@ -1065,6 +1075,8 @@
                 <unusedDeclaredDependency>com.github.spotbugs:spotbugs-annotations:jar:${spotbugs.version}</unusedDeclaredDependency>
                 <!-- ignore unused native; analysis isn't possible with tar.gz dependency
-->
                 <unusedDeclaredDependency>org.apache.accumulo:accumulo-native:tar.gz:${project.version}</unusedDeclaredDependency>
+                <!-- ignore runtime dependencies of commons-configuration2 -->
+                <unusedDeclaredDependency>commons-beanutils:commons-beanutils:jar:*</unusedDeclaredDependency>
               </ignoredUnusedDeclaredDependencies>
             </configuration>
           </execution>
diff --git a/start/pom.xml b/start/pom.xml
index 818877b..f957e6e 100644
--- a/start/pom.xml
+++ b/start/pom.xml
@@ -27,10 +27,6 @@
   <description>A library for launching Apache Accumulo services.</description>
   <dependencies>
     <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
@@ -40,6 +36,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-configuration2</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-vfs2</artifactId>
     </dependency>
     <dependency>
@@ -51,6 +51,12 @@
       <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
+      <!-- runtime for commons-configuration2 -->
+      <groupId>commons-beanutils</groupId>
+      <artifactId>commons-beanutils</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-client-runtime</artifactId>
       <scope>runtime</scope>
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
index a8ff9a2..12751e6 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
@@ -28,7 +28,9 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -81,10 +83,10 @@ public class AccumuloClassLoader {
       return defaultValue;
     }
     try {
-      PropertiesConfiguration config = new PropertiesConfiguration();
-      config.setDelimiterParsingDisabled(true);
-      config.setThrowExceptionOnMissing(false);
-      config.load(accumuloConfigUrl);
+      FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+          new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class)
+              .configure(new Parameters().properties().setURL(accumuloConfigUrl));
+      PropertiesConfiguration config = propsBuilder.getConfiguration();
       String value = config.getString(propertyName);
       if (value != null)
         return value;
diff --git a/test/pom.xml b/test/pom.xml
index 5de7a13..79b0948 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -55,10 +55,6 @@
       <artifactId>commons-cli</artifactId>
     </dependency>
     <dependency>
-      <groupId>commons-configuration</groupId>
-      <artifactId>commons-configuration</artifactId>
-    </dependency>
-    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
     </dependency>
@@ -129,6 +125,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
+      <artifactId>commons-configuration2</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
     </dependency>
     <dependency>
diff --git a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
index 554e176..326430d 100644
--- a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
+++ b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
@@ -50,10 +50,9 @@ public abstract class AccumuloClusterPropertyConfiguration implements AccumuloCl
 
   @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")
   public static AccumuloClusterPropertyConfiguration get() {
-    Properties systemProperties = System.getProperties();
 
     String clusterTypeValue = null, clientConf = null;
-    String propertyFile = systemProperties.getProperty(ACCUMULO_IT_PROPERTIES_FILE);
+    String propertyFile = System.getProperty(ACCUMULO_IT_PROPERTIES_FILE);
 
     if (propertyFile != null) {
       // Check for properties provided in a file
@@ -91,11 +90,11 @@ public abstract class AccumuloClusterPropertyConfiguration implements
AccumuloCl
     }
 
     if (clusterTypeValue == null) {
-      clusterTypeValue = systemProperties.getProperty(ACCUMULO_CLUSTER_TYPE_KEY);
+      clusterTypeValue = System.getProperty(ACCUMULO_CLUSTER_TYPE_KEY);
     }
 
     if (clientConf == null) {
-      clientConf = systemProperties.getProperty(ACCUMULO_CLUSTER_CLIENT_CONF_KEY);
+      clientConf = System.getProperty(ACCUMULO_CLUSTER_CLIENT_CONF_KEY);
     }
 
     ClusterType type;
@@ -147,9 +146,7 @@ public abstract class AccumuloClusterPropertyConfiguration implements
AccumuloCl
 
     Map<String,String> configuration = new HashMap<>();
 
-    Properties systemProperties = System.getProperties();
-
-    String propertyFile = systemProperties.getProperty(ACCUMULO_IT_PROPERTIES_FILE);
+    String propertyFile = System.getProperty(ACCUMULO_IT_PROPERTIES_FILE);
 
     // Check for properties provided in a file
     if (propertyFile != null) {
@@ -181,7 +178,7 @@ public abstract class AccumuloClusterPropertyConfiguration implements
AccumuloCl
     }
 
     // Load any properties specified directly in the system properties
-    loadFromProperties(prefix, systemProperties, configuration);
+    loadFromProperties(prefix, System.getProperties(), configuration);
 
     return configuration;
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java b/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
index c4ab993..ebf8c03 100644
--- a/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
@@ -45,7 +45,9 @@ import org.apache.accumulo.server.init.Initialize;
 import org.apache.accumulo.server.util.Admin;
 import org.apache.accumulo.server.util.RandomizeVolumes;
 import org.apache.accumulo.test.functional.ConfigurableMacBase;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.RawLocalFileSystem;
@@ -132,10 +134,12 @@ public class RewriteTabletDirectoriesIT extends ConfigurableMacBase
{
         cluster.stop();
 
         // add the 2nd volume
-        PropertiesConfiguration conf = new PropertiesConfiguration();
-        conf.load(cluster.getAccumuloPropertiesPath());
-        conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2);
-        conf.save(cluster.getAccumuloPropertiesPath());
+        FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+            new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(
+                new Parameters().properties().setFileName(cluster.getAccumuloPropertiesPath()));
+        propsBuilder.getConfiguration().setProperty(Property.INSTANCE_VOLUMES.getKey(),
+            v1 + "," + v2);
+        propsBuilder.save();
 
         // initialize volume
         assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").getProcess().waitFor());
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index fc00947..de3b6e0 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -69,7 +69,9 @@ import org.apache.accumulo.server.log.WalStateManager.WalMarkerException;
 import org.apache.accumulo.server.log.WalStateManager.WalState;
 import org.apache.accumulo.server.util.Admin;
 import org.apache.accumulo.test.functional.ConfigurableMacBase;
-import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -275,12 +277,14 @@ public class VolumeIT extends ConfigurableMacBase {
     try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build())
{
       String[] tableNames = getUniqueNames(2);
 
-      PropertiesConfiguration conf = new PropertiesConfiguration();
+      String uuid = verifyAndShutdownCluster(client, tableNames[0]);
 
-      String uuid = verifyAndShutdownCluster(client, conf, tableNames[0]);
-
-      conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2 + "," + v3);
-      conf.save(cluster.getAccumuloPropertiesPath());
+      FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+          new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(
+              new Parameters().properties().setFileName(cluster.getAccumuloPropertiesPath()));
+      propsBuilder.getConfiguration().setProperty(Property.INSTANCE_VOLUMES.getKey(),
+          v1 + "," + v2 + "," + v3);
+      propsBuilder.save();
 
       // initialize volume
       assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").getProcess().waitFor());
@@ -295,8 +299,7 @@ public class VolumeIT extends ConfigurableMacBase {
   }
 
   // grab uuid before shutting down cluster
-  private String verifyAndShutdownCluster(AccumuloClient c, PropertiesConfiguration conf,
-      String tableName) throws Exception {
+  private String verifyAndShutdownCluster(AccumuloClient c, String tableName) throws Exception
{
     String uuid = c.instanceOperations().getInstanceID();
 
     verifyVolumesUsed(c, tableName, false, v1, v2);
@@ -304,7 +307,6 @@ public class VolumeIT extends ConfigurableMacBase {
     assertEquals(0, cluster.exec(Admin.class, "stopAll").getProcess().waitFor());
     cluster.stop();
 
-    conf.load(cluster.getAccumuloPropertiesPath());
     return uuid;
   }
 
@@ -312,13 +314,16 @@ public class VolumeIT extends ConfigurableMacBase {
   public void testNonConfiguredVolumes() throws Exception {
 
     String[] tableNames = getUniqueNames(2);
-    PropertiesConfiguration conf = new PropertiesConfiguration();
 
     try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build())
{
-      String uuid = verifyAndShutdownCluster(client, conf, tableNames[0]);
+      String uuid = verifyAndShutdownCluster(client, tableNames[0]);
 
-      conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v2 + "," + v3);
-      conf.save(cluster.getAccumuloPropertiesPath());
+      FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+          new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(
+              new Parameters().properties().setFileName(cluster.getAccumuloPropertiesPath()));
+      propsBuilder.getConfiguration().setProperty(Property.INSTANCE_VOLUMES.getKey(),
+          v2 + "," + v3);
+      propsBuilder.save();
 
       // initialize volume
       assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").getProcess().waitFor());
@@ -459,10 +464,12 @@ public class VolumeIT extends ConfigurableMacBase {
       assertEquals(0, cluster.exec(Admin.class, "stopAll").getProcess().waitFor());
       cluster.stop();
 
-      PropertiesConfiguration conf = new PropertiesConfiguration();
-      conf.load(cluster.getAccumuloPropertiesPath());
-      conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v2.toString());
-      conf.save(cluster.getAccumuloPropertiesPath());
+      FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+          new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(
+              new Parameters().properties().setFileName(cluster.getAccumuloPropertiesPath()));
+      propsBuilder.getConfiguration().setProperty(Property.INSTANCE_VOLUMES.getKey(),
+          v2.toString());
+      propsBuilder.save();
 
       // start cluster and verify that volume was decommissioned
       cluster.start();
@@ -514,12 +521,14 @@ public class VolumeIT extends ConfigurableMacBase {
     assertTrue("Failed to rename " + v2f + " to " + v9f, v2f.renameTo(v9f));
     Path v9 = new Path(v9f.toURI());
 
-    PropertiesConfiguration conf = new PropertiesConfiguration();
-    conf.load(cluster.getAccumuloPropertiesPath());
+    FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder =
+        new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class).configure(
+            new Parameters().properties().setFileName(cluster.getAccumuloPropertiesPath()));
+    PropertiesConfiguration conf = propsBuilder.getConfiguration();
     conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v8 + "," + v9);
     conf.setProperty(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey(),
         v1 + " " + v8 + "," + v2 + " " + v9);
-    conf.save(cluster.getAccumuloPropertiesPath());
+    propsBuilder.save();
 
     // start cluster and verify that volumes were replaced
     cluster.start();


Mime
View raw message