asfgit closed pull request #357: ACCUMULO-4611 Deprecate commons config in api URL: https://github.com/apache/accumulo/pull/357
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/assemble/pom.xml b/assemble/pom.xml index 2fb053c1f0..f0dd1ba689 100644 --- a/assemble/pom.xml +++ b/assemble/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo</artifactId> <packaging>pom</packaging> diff --git a/core/pom.xml b/core/pom.xml index 9b6f171b13..bdf80703b3 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-core</artifactId> <name>Apache Accumulo Core</name> @@ -194,13 +194,6 @@ <!--Allow API data types to reference thrift types, but do not analyze thrift types --> <allow>org[.]apache[.]accumulo[.].*[.]thrift[.].*</allow> - <!--ClientConfiguration indirectly extends - AbstractConfiguration and EventSource. These two types - bring in many types from apache commons. Added these two - types instead of all of the types they reference.--> - <allow>org[.]apache[.]commons[.]configuration[.]Configuration</allow> - <allow>org[.]apache[.]commons[.]configuration[.]AbstractConfiguration</allow> - <allow>org[.]apache[.]commons[.]configuration[.]event[.]EventSource</allow> <!--Type from hadoop used in API. If adding a new type from Hadoop to the Accumulo API ensure its annotated as stable.--> @@ -212,6 +205,12 @@ <allow>org[.]apache[.]hadoop[.]util[.]Progressable</allow> <!--ugghhh--> <allow>org[.]apache[.]log4j[.](Level|Logger)</allow> + <!-- allow javax security exceptions for Authentication tokens --> + <allow>javax[.]security[.]auth[.]DestroyFailedException</allow> + <!-- allow questionable Hadoop exceptions for mapreduce --> + <allow>org[.]apache[.]hadoop[.]mapred[.](FileAlreadyExistsException|InvalidJobConfException)</allow> + <!-- allow lexicoders to throw iterator exceptions --> + <allow>org[.]apache[.]accumulo[.]core[.]iterators[.]ValueFormatException</allow> </allows> </configuration> </execution> diff --git a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java index 362bad9779..4073455214 100644 --- a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java +++ b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java @@ -234,7 +234,7 @@ public void updateKerberosCredentials() { if (clientConfigFile == null) clientConfig = ClientConfiguration.loadDefault(); else - clientConfig = new ClientConfiguration(clientConfigFile); + clientConfig = ClientConfiguration.fromFile(new File(clientConfigFile)); } catch (Exception e) { throw new IllegalArgumentException(e); } @@ -347,7 +347,7 @@ public ClientConfiguration getClientConfiguration() throws IllegalArgumentExcept if (clientConfigFile == null) clientConfig = ClientConfiguration.loadDefault(); else - clientConfig = new ClientConfiguration(clientConfigFile); + clientConfig = ClientConfiguration.fromFile(new File(clientConfigFile)); } catch (Exception e) { throw new IllegalArgumentException(e); } 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 c941ba474c..51e818e83f 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 @@ -21,12 +21,17 @@ import java.io.File; import java.io.StringReader; import java.io.StringWriter; +import java.math.BigDecimal; +import java.math.BigInteger; import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.UUID; import org.apache.accumulo.core.conf.Property; @@ -35,7 +40,15 @@ 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.configuration.event.ConfigurationErrorEvent; +import org.apache.commons.configuration.event.ConfigurationErrorListener; +import org.apache.commons.configuration.event.ConfigurationEvent; +import org.apache.commons.configuration.event.ConfigurationListener; +import org.apache.commons.configuration.interpol.ConfigurationInterpolator; +import org.apache.commons.lang.text.StrSubstitutor; +import org.apache.commons.logging.Log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -147,30 +160,46 @@ public static ClientProperty getPropertyByKey(String key) { } } - public ClientConfiguration(String configFile) throws ConfigurationException { - this(new PropertiesConfiguration(), configFile); + // helper for the constructor which takes a String file name + private static PropertiesConfiguration newPropsFile(String file) throws ConfigurationException { + PropertiesConfiguration props = new PropertiesConfiguration(); + props.setListDelimiter('\0'); + props.load(file); + return props; } - private ClientConfiguration(PropertiesConfiguration propertiesConfiguration, String configFile) throws ConfigurationException { - super(propertiesConfiguration); - // Don't do list interpolation - this.setListDelimiter('\0'); - propertiesConfiguration.setListDelimiter('\0'); - propertiesConfiguration.load(configFile); + // helper for the constructor which takes a File + private static PropertiesConfiguration newPropsFile(File file) throws ConfigurationException { + PropertiesConfiguration props = new PropertiesConfiguration(); + props.setListDelimiter('\0'); + props.load(file); + return props; } - public ClientConfiguration(File configFile) throws ConfigurationException { - this(new PropertiesConfiguration(), configFile); + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API; use {@link #fromFile(File)} instead. + */ + @Deprecated + public ClientConfiguration(String configFile) throws ConfigurationException { + this(Collections.singletonList(newPropsFile(configFile))); } - private ClientConfiguration(PropertiesConfiguration propertiesConfiguration, File configFile) throws ConfigurationException { - super(propertiesConfiguration); - // Don't do list interpolation - this.setListDelimiter('\0'); - propertiesConfiguration.setListDelimiter('\0'); - propertiesConfiguration.load(configFile); + /** + * Load a client configuration from the provided configuration properties file + * + * @param configFile + * the path to the properties file + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API; use {@link #fromFile(File)} instead. + */ + @Deprecated + public ClientConfiguration(File configFile) throws ConfigurationException { + this(Collections.singletonList(newPropsFile(configFile))); } + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated public ClientConfiguration(List<? extends Configuration> configs) { super(configs); // Don't do list interpolation @@ -192,8 +221,9 @@ public ClientConfiguration(List<? extends Configuration> configs) { * * @see PropertiesConfiguration * @see #loadDefault() + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API */ - + @Deprecated public ClientConfiguration(Configuration... configs) { this(Arrays.asList(configs)); } @@ -221,23 +251,66 @@ public static ClientConfiguration loadDefault() { return loadFromSearchPath(getDefaultSearchPath()); } - private static ClientConfiguration loadFromSearchPath(List<String> paths) { + /** + * Initializes an empty configuration object to be further configured with other methods on the class. + * + * @since 1.9.0 + */ + public static ClientConfiguration create() { + return new ClientConfiguration(Collections.<Configuration> emptyList()); + } + + /** + * Initializes a configuration object from the contents of a configuration file. Currently supports Java "properties" files. The returned object can be + * further configured with subsequent calls to other methods on this class. + * + * @param file + * the path to the configuration file + * @since 1.9.0 + */ + public static ClientConfiguration fromFile(File file) { try { - List<Configuration> configs = new LinkedList<>(); - for (String path : paths) { - File conf = new File(path); - if (conf.isFile() && conf.canRead()) { - configs.add(new ClientConfiguration(conf)); + return new ClientConfiguration(file); + } catch (ConfigurationException e) { + throw new IllegalArgumentException("Bad configuration file: " + file, e); + } + } + + /** + * Initializes a configuration object from the contents of a map. The returned object can be further configured with subsequent calls to other methods on this + * class. + * + * @param properties + * a map containing the configuration properties to use + * @since 1.9.0 + */ + public static ClientConfiguration fromMap(Map<String,String> properties) { + MapConfiguration mapConf = new MapConfiguration(properties); + mapConf.setListDelimiter('\0'); + return new ClientConfiguration(Collections.singletonList(mapConf)); + } + + private static ClientConfiguration loadFromSearchPath(List<String> paths) { + List<Configuration> configs = new LinkedList<>(); + for (String path : paths) { + File conf = new File(path); + if (conf.isFile() && conf.canRead()) { + PropertiesConfiguration props = new PropertiesConfiguration(); + props.setListDelimiter('\0'); + try { + props.load(conf); + 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 - if (configs.isEmpty()) { - log.warn("Found no client.conf in default paths. Using default client configuration values."); - } - return new ClientConfiguration(configs); - } catch (ConfigurationException e) { - throw new IllegalStateException("Error loading client configuration", e); } + // We couldn't find the client configuration anywhere + if (configs.isEmpty()) { + log.warn("Found no client.conf in default paths. Using default client configuration values."); + } + return new ClientConfiguration(configs); } public static ClientConfiguration deserialize(String serializedConfig) { @@ -354,14 +427,32 @@ private void checkType(ClientProperty property, PropertyType type) { * */ public void setProperty(ClientProperty prop, String value) { - this.setProperty(prop.getKey(), value); + with(prop, value); } /** * Same as {@link #setProperty(ClientProperty, String)} but returns the ClientConfiguration for chaining purposes */ public ClientConfiguration with(ClientProperty prop, String value) { - this.setProperty(prop.getKey(), value); + return with(prop.getKey(), value); + } + + /** + * Sets the value of property to value + * + * @since 1.9.0 + */ + public void setProperty(String prop, String value) { + with(prop, value); + } + + /** + * Same as {@link #setProperty(String, String)} but returns the ClientConfiguration for chaining purposes + * + * @since 1.9.0 + */ + public ClientConfiguration with(String prop, String value) { + super.setProperty(prop, value); return this; } @@ -472,6 +563,15 @@ public ClientConfiguration withSasl(boolean saslEnabled) { return with(ClientProperty.INSTANCE_RPC_SASL_ENABLED, String.valueOf(saslEnabled)); } + /** + * Show whether SASL has been set on this configuration. + * + * @since 1.9.0 + */ + public boolean hasSasl() { + return getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), Boolean.parseBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getDefaultValue())); + } + /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_RPC_SASL_ENABLED and ClientProperty.GENERAL_KERBEROS_PRINCIPAL. * @@ -484,4 +584,747 @@ public ClientConfiguration withSasl(boolean saslEnabled) { public ClientConfiguration withSasl(boolean saslEnabled, String kerberosServerPrimary) { return withSasl(saslEnabled).with(ClientProperty.KERBEROS_SERVER_PRIMARY, kerberosServerPrimary); } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Configuration getConfiguration(int index) { + return super.getConfiguration(index); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Configuration getSource(String key) { + return super.getSource(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void removeConfiguration(Configuration config) { + super.removeConfiguration(config); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void addConfiguration(Configuration config) { + super.addConfiguration(config); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Configuration getInMemoryConfiguration() { + return super.getInMemoryConfiguration(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Log getLogger() { + return super.getLogger(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Configuration subset(String prefix) { + return super.subset(prefix); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Configuration interpolatedConfiguration() { + return super.interpolatedConfiguration(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void setLogger(Log log) { + super.setLogger(log); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public ConfigurationInterpolator getInterpolator() { + return super.getInterpolator(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public synchronized StrSubstitutor getSubstitutor() { + return super.getSubstitutor(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void append(Configuration c) { + super.append(c); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void copy(Configuration c) { + super.copy(c); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void addConfigurationListener(ConfigurationListener l) { + super.addConfigurationListener(l); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean removeConfigurationListener(ConfigurationListener l) { + return super.removeConfigurationListener(l); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean removeErrorListener(ConfigurationErrorListener l) { + return super.removeErrorListener(l); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void addErrorListener(ConfigurationErrorListener l) { + super.addErrorListener(l); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void addErrorLogListener() { + super.addErrorLogListener(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void addProperty(String key, Object value) { + super.addProperty(key, value); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected void addPropertyDirect(String key, Object token) { + super.addPropertyDirect(key, token); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void clear() { + super.clear(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void clearConfigurationListeners() { + super.clearConfigurationListeners(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void clearErrorListeners() { + super.clearErrorListeners(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void clearProperty(String key) { + super.clearProperty(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected void clearPropertyDirect(String key) { + super.clearPropertyDirect(key); + } + + @Override + public boolean containsKey(String key) { + return super.containsKey(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected ConfigurationErrorEvent createErrorEvent(int type, String propName, Object propValue, Throwable ex) { + return super.createErrorEvent(type, propName, propValue, ex); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected ConfigurationEvent createEvent(int type, String propName, Object propValue, boolean before) { + return super.createEvent(type, propName, propValue, before); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected ConfigurationInterpolator createInterpolator() { + return super.createInterpolator(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected void fireError(int type, String propName, Object propValue, Throwable ex) { + super.fireError(type, propName, propValue, ex); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected void fireEvent(int type, String propName, Object propValue, boolean before) { + super.fireEvent(type, propName, propValue, before); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public BigDecimal getBigDecimal(String key) { + return super.getBigDecimal(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public BigDecimal getBigDecimal(String key, BigDecimal defaultValue) { + return super.getBigDecimal(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public BigInteger getBigInteger(String key) { + return super.getBigInteger(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public BigInteger getBigInteger(String key, BigInteger defaultValue) { + return super.getBigInteger(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean getBoolean(String key) { + return super.getBoolean(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean getBoolean(String key, boolean defaultValue) { + return super.getBoolean(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Boolean getBoolean(String key, Boolean defaultValue) { + return super.getBoolean(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public byte getByte(String key) { + return super.getByte(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public byte getByte(String key, byte defaultValue) { + return super.getByte(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Byte getByte(String key, Byte defaultValue) { + return super.getByte(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @SuppressWarnings("rawtypes") + @Override + public Collection getConfigurationListeners() { + return super.getConfigurationListeners(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public double getDouble(String key) { + return super.getDouble(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Double getDouble(String key, Double defaultValue) { + return super.getDouble(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public double getDouble(String key, double defaultValue) { + return super.getDouble(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @SuppressWarnings("rawtypes") + @Override + public Collection getErrorListeners() { + return super.getErrorListeners(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public float getFloat(String key) { + return super.getFloat(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Float getFloat(String key, Float defaultValue) { + return super.getFloat(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public float getFloat(String key, float defaultValue) { + return super.getFloat(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public int getInt(String key) { + return super.getInt(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public int getInt(String key, int defaultValue) { + return super.getInt(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Integer getInteger(String key, Integer defaultValue) { + return super.getInteger(key, defaultValue); + } + + @SuppressWarnings("unchecked") + @Override + public Iterator<String> getKeys() { + return super.getKeys(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @SuppressWarnings("unchecked") + @Override + public Iterator<String> getKeys(String key) { + return super.getKeys(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @SuppressWarnings("rawtypes") + @Override + public List getList(String key) { + return super.getList(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @SuppressWarnings("rawtypes") + @Override + public List getList(String key, List defaultValue) { + return super.getList(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public char getListDelimiter() { + return super.getListDelimiter(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public long getLong(String key) { + return super.getLong(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public long getLong(String key, long defaultValue) { + return super.getLong(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Long getLong(String key, Long defaultValue) { + return super.getLong(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public int getNumberOfConfigurations() { + return super.getNumberOfConfigurations(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Properties getProperties(String key) { + return super.getProperties(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Properties getProperties(String key, Properties defaults) { + return super.getProperties(key, defaults); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Object getProperty(String key) { + return super.getProperty(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public short getShort(String key) { + return super.getShort(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public short getShort(String key, short defaultValue) { + return super.getShort(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public Short getShort(String key, Short defaultValue) { + return super.getShort(key, defaultValue); + } + + @Override + public String getString(String key) { + return super.getString(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public String getString(String key, String defaultValue) { + return super.getString(key, defaultValue); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public String[] getStringArray(String key) { + return super.getStringArray(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected Object interpolate(Object value) { + return super.interpolate(value); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected String interpolate(String base) { + return super.interpolate(base); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @SuppressWarnings("rawtypes") + @Override + protected String interpolateHelper(String base, List priorVariables) { + return super.interpolateHelper(base, priorVariables); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean isDelimiterParsingDisabled() { + return super.isDelimiterParsingDisabled(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean isDetailEvents() { + return super.isDetailEvents(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean isEmpty() { + return super.isEmpty(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public boolean isThrowExceptionOnMissing() { + return super.isThrowExceptionOnMissing(); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + protected Object resolveContainerStore(String key) { + return super.resolveContainerStore(key); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void setDelimiterParsingDisabled(boolean delimiterParsingDisabled) { + super.setDelimiterParsingDisabled(delimiterParsingDisabled); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void setDetailEvents(boolean enable) { + super.setDetailEvents(enable); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void setListDelimiter(char listDelimiter) { + super.setListDelimiter(listDelimiter); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void setProperty(String key, Object value) { + super.setProperty(key, value); + } + + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated + @Override + public void setThrowExceptionOnMissing(boolean throwExceptionOnMissing) { + super.setThrowExceptionOnMissing(throwExceptionOnMissing); + } + } diff --git a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java index 4a4dd5f25b..32fb62df54 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java +++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java @@ -95,7 +95,7 @@ public ZooKeeperInstance(String instanceName, String zooKeepers) { * A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port. * @param sessionTimeout * zoo keeper session time out in milliseconds. - * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(Configuration)} instead. + * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(ClientConfiguration)} instead. */ @Deprecated public ZooKeeperInstance(String instanceName, String zooKeepers, int sessionTimeout) { @@ -108,7 +108,7 @@ public ZooKeeperInstance(String instanceName, String zooKeepers, int sessionTime * The UUID that identifies the accumulo instance you want to connect to. * @param zooKeepers * A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port. - * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(Configuration)} instead. + * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(ClientConfiguration)} instead. */ @Deprecated public ZooKeeperInstance(UUID instanceId, String zooKeepers) { @@ -123,7 +123,7 @@ public ZooKeeperInstance(UUID instanceId, String zooKeepers) { * A comma separated list of zoo keeper server locations. Each location can contain an optional port, of the format host:port. * @param sessionTimeout * zoo keeper session time out in milliseconds. - * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(Configuration)} instead. + * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(ClientConfiguration)} instead. */ @Deprecated public ZooKeeperInstance(UUID instanceId, String zooKeepers, int sessionTimeout) { @@ -135,7 +135,10 @@ public ZooKeeperInstance(UUID instanceId, String zooKeepers, int sessionTimeout) * Client configuration for specifying connection options. See {@link ClientConfiguration} which extends Configuration with convenience methods * specific to Accumulo. * @since 1.6.0 + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API; use + * {@link #ZooKeeperInstance(ClientConfiguration)} instead. */ + @Deprecated public ZooKeeperInstance(Configuration config) { this(config, new ZooCacheFactory()); } @@ -145,7 +148,9 @@ public ZooKeeperInstance(Configuration config) { if (config instanceof ClientConfiguration) { this.clientConf = (ClientConfiguration) config; } else { - this.clientConf = new ClientConfiguration(config); + @SuppressWarnings("deprecation") + ClientConfiguration cliConf = new ClientConfiguration(config); + this.clientConf = cliConf; } this.instanceId = clientConf.get(ClientProperty.INSTANCE_ID); this.instanceName = clientConf.get(ClientProperty.INSTANCE_NAME); @@ -160,6 +165,16 @@ public ZooKeeperInstance(Configuration config) { } } + /** + * @param config + * Client configuration for specifying connection options. See {@link ClientConfiguration} which extends Configuration with convenience methods + * specific to Accumulo. + * @since 1.9.0 + */ + public ZooKeeperInstance(ClientConfiguration config) { + this(config, new ZooCacheFactory()); + } + @Override public String getInstanceID() { if (instanceId == null) { diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java index 6828174b61..9f326b749d 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java @@ -124,11 +124,9 @@ public SslConnectionParams getClientSslParams() { * Retrieve SASL configuration to initiate an RPC connection to a server */ public SaslConnectionParams getSaslParams() { - final boolean defaultVal = Boolean.parseBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getDefaultValue()); - // Use the clientConf if we have it if (null != clientConf) { - if (!clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), defaultVal)) { + if (!clientConf.hasSasl()) { return null; } return new SaslConnectionParams(clientConf, getCredentials().getToken()); diff --git a/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java b/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java index 4400da5dbd..4519a9882e 100644 --- a/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java +++ b/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java @@ -35,7 +35,6 @@ import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.commons.configuration.MapConfiguration; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.authentication.util.KerberosName; @@ -130,13 +129,7 @@ public static SaslMechanism get(String mechanismName) { protected final Map<String,String> saslProperties; public SaslConnectionParams(AccumuloConfiguration conf, AuthenticationToken token) { - this(new ClientConfiguration(createMapConfiguration(conf)), token); - } - - private static MapConfiguration createMapConfiguration(AccumuloConfiguration conf) { - MapConfiguration mapConf = new MapConfiguration(getProperties(conf)); - mapConf.setListDelimiter('\0'); - return mapConf; + this(ClientConfiguration.fromMap(getProperties(conf)), token); } public SaslConnectionParams(ClientConfiguration conf, AuthenticationToken token) { diff --git a/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java index 81918ccc07..cfef356d3c 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/ClientConfigurationTest.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.Arrays; -import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.PropertiesConfiguration; @@ -65,7 +64,9 @@ private ClientConfiguration createConfig() { third.addProperty(ClientProperty.INSTANCE_ZK_HOST.getKey(), "thirdZkHosts"); third.addProperty(ClientProperty.INSTANCE_NAME.getKey(), "thirdInstanceName"); third.addProperty(ClientProperty.INSTANCE_ZK_TIMEOUT.getKey(), "123s"); - return new ClientConfiguration(Arrays.asList(first, second, third)); + @SuppressWarnings("deprecation") + ClientConfiguration clientConf = new ClientConfiguration(Arrays.asList(first, second, third)); + return clientConf; } @Test diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java index 4eb348e778..44abf83303 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientContextTest.java @@ -69,8 +69,7 @@ public void loadSensitivePropertyFromCredentialProvider() { } String absPath = getKeyStoreUrl(keystore); - ClientConfiguration clientConf = new ClientConfiguration(); - clientConf.addProperty(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath); + ClientConfiguration clientConf = ClientConfiguration.create().with(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath); AccumuloConfiguration accClientConf = ClientContext.convertClientConfig(clientConf); Assert.assertEquals("mysecret", accClientConf.get(Property.INSTANCE_SECRET)); @@ -82,7 +81,7 @@ public void defaultValueForSensitiveProperty() { return; } - ClientConfiguration clientConf = new ClientConfiguration(); + ClientConfiguration clientConf = ClientConfiguration.create(); AccumuloConfiguration accClientConf = ClientContext.convertClientConfig(clientConf); Assert.assertEquals(Property.INSTANCE_SECRET.getDefaultValue(), accClientConf.get(Property.INSTANCE_SECRET)); @@ -95,8 +94,7 @@ public void sensitivePropertiesIncludedInProperties() { } String absPath = getKeyStoreUrl(keystore); - ClientConfiguration clientConf = new ClientConfiguration(); - clientConf.addProperty(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath); + ClientConfiguration clientConf = ClientConfiguration.create().with(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey(), absPath); AccumuloConfiguration accClientConf = ClientContext.convertClientConfig(clientConf); Map<String,String> props = new HashMap<>(); diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java index 825060b7d0..ab8ec8c1b9 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java @@ -38,7 +38,7 @@ public void waitForStoreTransitionScannerConfiguredCorrectly() throws Exception Instance instance = EasyMock.createMock(Instance.class); Credentials credentials = EasyMock.createMock(Credentials.class); - ClientContext context = new ClientContext(instance, credentials, new ClientConfiguration()); + ClientContext context = new ClientContext(instance, credentials, ClientConfiguration.create()); TableOperationsImpl topsImpl = new TableOperationsImpl(context); Connector connector = EasyMock.createMock(Connector.class); diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java index bab52f6d6e..b3fe548ac9 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java @@ -171,7 +171,7 @@ static TabletLocatorImpl createLocators(String table, Object... data) { @Before public void setUp() { testInstance = new TestInstance("instance1", "tserver1"); - context = new ClientContext(testInstance, new Credentials("test", null), new ClientConfiguration()); + context = new ClientContext(testInstance, new Credentials("test", null), ClientConfiguration.create()); } private void runTest(Text tableName, List<Range> ranges, TabletLocatorImpl tab1TabletCache, Map<String,Map<KeyExtent,List<Range>>> expected) throws Exception { diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java index a7e5e0a578..665ecb4871 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java @@ -80,7 +80,7 @@ public void testSetConnectorInfoClassOfQConfigurationStringString() throws Accum @Test public void testSetZooKeeperInstance() { Configuration conf = new Configuration(); - ConfiguratorBase.setZooKeeperInstance(this.getClass(), conf, new ClientConfiguration().withInstance("testInstanceName").withZkHosts("testZooKeepers") + ConfiguratorBase.setZooKeeperInstance(this.getClass(), conf, ClientConfiguration.create().withInstance("testInstanceName").withZkHosts("testZooKeepers") .withSsl(true).withZkTimeout(1234)); ClientConfiguration clientConf = ClientConfiguration.deserialize(conf.get(ConfiguratorBase.enumToConfKey(this.getClass(), ConfiguratorBase.InstanceOpts.CLIENT_CONFIG))); diff --git a/docs/pom.xml b/docs/pom.xml index 32dbf0913e..9d88ad38db 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-docs</artifactId> <packaging>pom</packaging> diff --git a/examples/simple/pom.xml b/examples/simple/pom.xml index ed1e09917e..87765d718e 100644 --- a/examples/simple/pom.xml +++ b/examples/simple/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-examples-simple</artifactId> diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/reservations/ARS.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/reservations/ARS.java index eff8e21a2a..7528fd6135 100644 --- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/reservations/ARS.java +++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/reservations/ARS.java @@ -281,7 +281,7 @@ public void run() { } else if (tokens[0].equals("quit") && tokens.length == 1) { break; } else if (tokens[0].equals("connect") && tokens.length == 6 && ars == null) { - ZooKeeperInstance zki = new ZooKeeperInstance(new ClientConfiguration().withInstance(tokens[1]).withZkHosts(tokens[2])); + ZooKeeperInstance zki = new ZooKeeperInstance(ClientConfiguration.create().withInstance(tokens[1]).withZkHosts(tokens[2])); Connector conn = zki.getConnector(tokens[3], new PasswordToken(tokens[4])); if (conn.tableOperations().exists(tokens[5])) { ars = new ARS(conn, tokens[5]); diff --git a/fate/pom.xml b/fate/pom.xml index 9686a2f8e5..898dc58a86 100644 --- a/fate/pom.xml +++ b/fate/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-fate</artifactId> <name>Apache Accumulo Fate</name> diff --git a/iterator-test-harness/pom.xml b/iterator-test-harness/pom.xml index beeafb9006..a4f1486614 100644 --- a/iterator-test-harness/pom.xml +++ b/iterator-test-harness/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-iterator-test-harness</artifactId> <name>Apache Accumulo Iterator Test Harness</name> diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml index 1e7a76c9c4..f5ef46ad74 100644 --- a/maven-plugin/pom.xml +++ b/maven-plugin/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-maven-plugin</artifactId> <packaging>maven-plugin</packaging> diff --git a/minicluster/pom.xml b/minicluster/pom.xml index 054aed2f4a..8d6e1a6003 100644 --- a/minicluster/pom.xml +++ b/minicluster/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-minicluster</artifactId> <name>Apache Accumulo MiniCluster</name> @@ -147,7 +147,6 @@ </excludes> <allows> <allow>org[.]apache[.]accumulo[.]core[.](client|data|security)[.](?!.*(impl|thrift|crypto).*).*</allow> - <allow>org.apache.commons.configuration.PropertiesConfiguration</allow> </allows> </configuration> </execution> diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java index 4681dfb2bb..87dc488dfe 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java @@ -38,9 +38,14 @@ * Construct an {@link Instance} entry point to Accumulo using a {@link MiniAccumuloCluster} directory */ public MiniAccumuloInstance(String instanceName, File directory) throws FileNotFoundException { - super(new ClientConfiguration(getConfigProperties(directory)).withInstance(instanceName).withZkHosts(getZooKeepersFromDir(directory))); + super(ClientConfiguration.fromFile(new File(new File(directory, "conf"), "client.conf")).withInstance(instanceName) + .withZkHosts(getZooKeepersFromDir(directory))); } + /** + * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into Accumulo API + */ + @Deprecated public static PropertiesConfiguration getConfigProperties(File directory) { try { PropertiesConfiguration conf = new PropertiesConfiguration(); diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java index c0a60b4bf1..f4658919ff 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java @@ -92,8 +92,6 @@ import org.apache.accumulo.server.zookeeper.ZooReaderWriterFactory; import org.apache.accumulo.start.Main; import org.apache.accumulo.start.classloader.vfs.MiniDFSUtil; -import org.apache.commons.configuration.AbstractConfiguration; -import org.apache.commons.configuration.MapConfiguration; import org.apache.commons.io.FileUtils; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.impl.VFSClassLoader; @@ -751,13 +749,7 @@ public Connector getConnector(String user, AuthenticationToken token) throws Acc @Override public ClientConfiguration getClientConfig() { - return new ClientConfiguration(getConfigs(config)).withInstance(this.getInstanceName()).withZkHosts(this.getZooKeepers()); - } - - private static List<AbstractConfiguration> getConfigs(MiniAccumuloConfigImpl config) { - MapConfiguration cfg = new MapConfiguration(config.getSiteConfig()); - cfg.setListDelimiter('\0'); - return Collections.<AbstractConfiguration> singletonList(cfg); + return ClientConfiguration.fromMap(config.getSiteConfig()).withInstance(this.getInstanceName()).withZkHosts(this.getZooKeepers()); } @Override diff --git a/pom.xml b/pom.xml index f2fbb354ac..c24862f151 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ </parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <packaging>pom</packaging> <name>Apache Accumulo Project</name> <description>Apache Accumulo is a sorted, distributed key/value store based @@ -797,7 +797,7 @@ <plugin> <groupId>net.revelc.code</groupId> <artifactId>apilyzer-maven-plugin</artifactId> - <version>1.0.1</version> + <version>1.2.0</version> </plugin> <plugin> <groupId>com.googlecode.maven-java-formatter-plugin</groupId> diff --git a/proxy/pom.xml b/proxy/pom.xml index e6c8d60c7b..93768b1d98 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-proxy</artifactId> <name>Apache Accumulo Proxy</name> diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java b/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java index 11a7cf7f78..457ea5a042 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java @@ -220,7 +220,7 @@ public static ServerAddress createProxyServer(HostAndPort address, TProtocolFact sslParams = SslConnectionParams.forClient(ClientContext.convertClientConfig(clientConf)); break; case SASL: - if (!clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (!clientConf.hasSasl()) { // ACCUMULO-3651 Changed level to error and added FATAL to message for slf4j capability log.error("FATAL: SASL thrift server was requested but it is disabled in client configuration"); throw new RuntimeException("SASL is not enabled in configuration"); diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index a62e1a1e20..5e02cb64ef 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -18,6 +18,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; +import java.io.File; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; @@ -112,7 +113,6 @@ import org.apache.accumulo.proxy.thrift.WriterOptions; import org.apache.accumulo.server.rpc.ThriftServerType; import org.apache.accumulo.server.rpc.UGIAssumingProcessor; -import org.apache.commons.configuration.ConfigurationException; import org.apache.hadoop.io.Text; import org.apache.thrift.TException; import org.slf4j.Logger; @@ -197,11 +197,7 @@ public ProxyServer(Properties props) { ClientConfiguration clientConf; if (props.containsKey("clientConfigurationFile")) { String clientConfFile = props.getProperty("clientConfigurationFile"); - try { - clientConf = new ClientConfiguration(clientConfFile); - } catch (ConfigurationException e) { - throw new RuntimeException(e); - } + clientConf = ClientConfiguration.fromFile(new File(clientConfFile)); } else { clientConf = ClientConfiguration.loadDefault(); } diff --git a/server/base/pom.xml b/server/base/pom.xml index 6533a58ca2..f6fbe57678 100644 --- a/server/base/pom.xml +++ b/server/base/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-server-base</artifactId> diff --git a/server/gc/pom.xml b/server/gc/pom.xml index 707b97a05f..893fd0e5ff 100644 --- a/server/gc/pom.xml +++ b/server/gc/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-gc</artifactId> diff --git a/server/master/pom.xml b/server/master/pom.xml index e0ae3be57e..f411be95da 100644 --- a/server/master/pom.xml +++ b/server/master/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-master</artifactId> diff --git a/server/monitor/pom.xml b/server/monitor/pom.xml index fb4ec7b90c..f2b9e10669 100644 --- a/server/monitor/pom.xml +++ b/server/monitor/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-monitor</artifactId> diff --git a/server/native/pom.xml b/server/native/pom.xml index 1d38e8dfd2..022d1d25fa 100644 --- a/server/native/pom.xml +++ b/server/native/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-native</artifactId> diff --git a/server/tracer/pom.xml b/server/tracer/pom.xml index 3888a75940..855a65cafa 100644 --- a/server/tracer/pom.xml +++ b/server/tracer/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-tracer</artifactId> diff --git a/server/tserver/pom.xml b/server/tserver/pom.xml index f1efe3cd73..6678b8d89c 100644 --- a/server/tserver/pom.xml +++ b/server/tserver/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>accumulo-tserver</artifactId> diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java index 3ac5f2f4b5..8031f26cb1 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java @@ -46,7 +46,7 @@ public void peerTypeExtractionFromConfiguration() { Instance inst = EasyMock.createMock(Instance.class); VolumeManager fs = EasyMock.createMock(VolumeManager.class); Credentials creds = new Credentials("foo", new PasswordToken("bar")); - ClientContext context = new ClientContext(inst, creds, new ClientConfiguration()); + ClientContext context = new ClientContext(inst, creds, ClientConfiguration.create()); Map<String,String> data = new HashMap<>(); @@ -65,7 +65,7 @@ public void noPeerConfigurationThrowsAnException() { Instance inst = EasyMock.createMock(Instance.class); VolumeManager fs = EasyMock.createMock(VolumeManager.class); Credentials creds = new Credentials("foo", new PasswordToken("bar")); - ClientContext context = new ClientContext(inst, creds, new ClientConfiguration()); + ClientContext context = new ClientContext(inst, creds, ClientConfiguration.create()); Map<String,String> data = new HashMap<>(); ConfigurationCopy conf = new ConfigurationCopy(data); diff --git a/shell/pom.xml b/shell/pom.xml index 068b0755e3..8e6ccd237d 100644 --- a/shell/pom.xml +++ b/shell/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-shell</artifactId> <name>Apache Accumulo Shell</name> diff --git a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java index c099302cbd..1ea2beb4e8 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java +++ b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java @@ -303,7 +303,8 @@ public String getClientConfigFile() { } public ClientConfiguration getClientConfiguration() throws ConfigurationException, FileNotFoundException { - ClientConfiguration clientConfig = clientConfigFile == null ? ClientConfiguration.loadDefault() : new ClientConfiguration(getClientConfigFile()); + ClientConfiguration clientConfig = clientConfigFile == null ? ClientConfiguration.loadDefault() : ClientConfiguration.fromFile(new File( + getClientConfigFile())); if (useSsl()) { clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SSL_ENABLED, "true"); } diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java index d948768286..125a7fc9df 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java @@ -120,21 +120,21 @@ public void testTokenAndOptionAndPassword() throws IOException { */ @Test public void testZooKeeperHostFallBackToSite() throws Exception { - ClientConfiguration clientConfig = new ClientConfiguration(); + ClientConfiguration clientConfig = ClientConfiguration.create(); assertFalse("Client config contains zk hosts", clientConfig.containsKey(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST.getKey())); assertEquals("ShellConfigTestZKHostValue", Shell.getZooKeepers(null, clientConfig)); } @Test public void testZooKeeperHostFromClientConfig() throws Exception { - ClientConfiguration clientConfig = new ClientConfiguration(); + ClientConfiguration clientConfig = ClientConfiguration.create(); clientConfig.withZkHosts("cc_hostname"); assertEquals("cc_hostname", Shell.getZooKeepers(null, clientConfig)); } @Test public void testZooKeeperHostFromOption() throws Exception { - ClientConfiguration clientConfig = new ClientConfiguration(); + ClientConfiguration clientConfig = ClientConfiguration.create(); clientConfig.withZkHosts("cc_hostname"); assertEquals("opt_hostname", Shell.getZooKeepers("opt_hostname", clientConfig)); } diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java index ff8709de2b..b9a3378b86 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java @@ -213,7 +213,7 @@ private void testSetInstance_HdfsZooInstance(boolean explicitHdfs, boolean onlyI ZooKeeperInstance theInstance = createMock(ZooKeeperInstance.class); - expectNew(ZooKeeperInstance.class, clientConf).andReturn(theInstance); + expectNew(ZooKeeperInstance.class, new Class<?>[] {ClientConfiguration.class}, clientConf).andReturn(theInstance); replay(theInstance, ZooKeeperInstance.class); shell.setInstance(opts); @@ -261,7 +261,7 @@ private void testSetInstance_ZKInstance(boolean dashZ) throws Exception { replay(opts); ZooKeeperInstance theInstance = createMock(ZooKeeperInstance.class); - expectNew(ZooKeeperInstance.class, clientConf).andReturn(theInstance); + expectNew(ZooKeeperInstance.class, new Class<?>[] {ClientConfiguration.class}, clientConf).andReturn(theInstance); replay(theInstance, ZooKeeperInstance.class); shell.setInstance(opts); diff --git a/start/pom.xml b/start/pom.xml index b81abed7b5..991097dc0d 100644 --- a/start/pom.xml +++ b/start/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-start</artifactId> <name>Apache Accumulo Start</name> diff --git a/test/pom.xml b/test/pom.xml index bd727bdc57..efc598afbf 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-test</artifactId> <name>Apache Accumulo Testing</name> diff --git a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java index 4cdaf60f06..fdda4d7f46 100644 --- a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java +++ b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java @@ -28,7 +28,6 @@ import org.apache.accumulo.cluster.ClusterUsers; import org.apache.accumulo.cluster.standalone.StandaloneAccumuloCluster; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.admin.SecurityOperations; import org.apache.accumulo.core.client.admin.TableOperations; @@ -141,7 +140,7 @@ public void setupCluster() throws Exception { // For SASL, we need to get the Hadoop configuration files as well otherwise UGI will log in as SIMPLE instead of KERBEROS Configuration hadoopConfiguration = standaloneCluster.getHadoopConfiguration(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { UserGroupInformation.setConfiguration(hadoopConfiguration); // Login as the admin user to start the tests UserGroupInformation.loginUserFromKeytab(conf.getAdminPrincipal(), conf.getAdminKeytab().getAbsolutePath()); diff --git a/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java b/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java index 99a1cdc1a0..cb8554c2e1 100644 --- a/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java +++ b/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java @@ -35,7 +35,6 @@ import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.harness.AccumuloClusterHarness.ClusterType; -import org.apache.commons.configuration.ConfigurationException; import org.apache.hadoop.fs.Path; import org.apache.hadoop.security.UserGroupInformation; import org.slf4j.Logger; @@ -87,11 +86,7 @@ public StandaloneAccumuloClusterConfiguration(File clientConfFile) { this.conf = getConfiguration(type); this.clientConfFile = clientConfFile; - try { - this.clientConf = new ClientConfiguration(clientConfFile); - } catch (ConfigurationException e) { - throw new RuntimeException("Failed to load client configuration from " + clientConfFile); - } + this.clientConf = ClientConfiguration.fromFile(clientConfFile); // Update instance name if not already set if (!clientConf.containsKey(ClientProperty.INSTANCE_NAME.getKey())) { clientConf.withInstance(getInstanceName()); @@ -160,7 +155,7 @@ public File getAdminKeytab() { @Override public AuthenticationToken getAdminToken() { - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { File keytab = getAdminKeytab(); try { UserGroupInformation.loginUserFromKeytab(getAdminPrincipal(), keytab.getAbsolutePath()); diff --git a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java index 3f592ae030..226a65ecdb 100644 --- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java @@ -48,7 +48,6 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.ConditionalWriter; import org.apache.accumulo.core.client.ConditionalWriter.Result; import org.apache.accumulo.core.client.ConditionalWriter.Status; @@ -235,7 +234,7 @@ public void testFields() throws Exception { String user = null; ClientConfiguration clientConf = cluster.getClientConfig(); - final boolean saslEnabled = clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false); + final boolean saslEnabled = clientConf.hasSasl(); ClusterUser user1 = getUser(0); user = user1.getPrincipal(); @@ -1202,7 +1201,7 @@ public void testSecurity() throws Exception { Connector conn = getConnector(); String user = null; ClientConfiguration clientConf = cluster.getClientConfig(); - final boolean saslEnabled = clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false); + final boolean saslEnabled = clientConf.hasSasl(); // Create a new user ClusterUser user1 = getUser(0); diff --git a/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java b/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java index 140410bf4e..4b7e26a738 100644 --- a/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java +++ b/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java @@ -54,7 +54,7 @@ */ public class IMMLGBenchmark { public static void main(String[] args) throws Exception { - ZooKeeperInstance zki = new ZooKeeperInstance(new ClientConfiguration().withInstance("test16").withZkHosts("localhost")); + ZooKeeperInstance zki = new ZooKeeperInstance(ClientConfiguration.create().withInstance("test16").withZkHosts("localhost")); Connector conn = zki.getConnector("root", new PasswordToken("secret")); int numlg = Integer.parseInt(args[0]); diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java index 95f0a8c85f..6b515b276f 100644 --- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java @@ -43,7 +43,6 @@ import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; @@ -72,7 +71,6 @@ import org.apache.accumulo.test.categories.SunnyDayTests; import org.apache.accumulo.test.functional.SlowIterator; import org.apache.accumulo.tracer.TraceServer; -import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; @@ -158,17 +156,13 @@ public String getErrorMessage() { TestShell(String user, String rootPass, String instanceName, String zookeepers, File configFile) throws IOException { ClientConfiguration clientConf; - try { - clientConf = new ClientConfiguration(configFile); - } catch (ConfigurationException e) { - throw new IOException(e); - } + clientConf = ClientConfiguration.fromFile(configFile); // start the shell output = new TestOutputStream(); input = new StringInputStream(); shell = new Shell(new ConsoleReader(input, output)); shell.setLogErrorsToConsole(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { // Pull the kerberos principal out when we're using SASL shell.config("-u", user, "-z", instanceName, zookeepers, "--config-file", configFile.getAbsolutePath()); } else { @@ -343,7 +337,7 @@ public void exporttableImporttable() throws Exception { ts.exec("exporttable -t " + table + " " + exportUri, true); DistCp cp = newDistCp(new Configuration(false)); String import_ = "file://" + new File(rootPath, "ShellServerIT.import").toString(); - if (getCluster().getClientConfig().getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (getCluster().getClientConfig().hasSasl()) { // DistCp bugs out trying to get a fs delegation token to perform the cp. Just copy it ourselves by hand. FileSystem fs = getCluster().getFileSystem(); FileSystem localFs = FileSystem.getLocal(new Configuration(false)); diff --git a/test/src/main/java/org/apache/accumulo/test/UsersIT.java b/test/src/main/java/org/apache/accumulo/test/UsersIT.java index 131f042cb8..363702d4f6 100644 --- a/test/src/main/java/org/apache/accumulo/test/UsersIT.java +++ b/test/src/main/java/org/apache/accumulo/test/UsersIT.java @@ -23,7 +23,6 @@ import org.apache.accumulo.cluster.ClusterUser; import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.PasswordToken; @@ -41,7 +40,7 @@ public void testCreateExistingUser() throws Exception { // Ensure that the user exists if (!currentUsers.contains(user0.getPrincipal())) { PasswordToken token = null; - if (!getCluster().getClientConfig().getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (!getCluster().getClientConfig().hasSasl()) { token = new PasswordToken(user0.getPassword()); } conn.securityOperations().createLocalUser(user0.getPrincipal(), token); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java index 2fe560211f..c62b90c14e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java @@ -26,7 +26,6 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableExistsException; @@ -123,7 +122,7 @@ public void test() throws Exception { TestIngest.Opts opts = new TestIngest.Opts(); VerifyIngest.Opts vopts = new VerifyIngest.Opts(); ClientConfiguration conf = cluster.getClientConfig(); - if (conf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (conf.hasSasl()) { opts.updateKerberosCredentials(cluster.getClientConfig()); vopts.updateKerberosCredentials(cluster.getClientConfig()); } else { diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java index 21d6351d1c..ede79dd459 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java @@ -23,7 +23,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.harness.AccumuloClusterHarness; @@ -70,7 +69,7 @@ public void test() throws Exception { opts.setTableName(tableName); vopts.setTableName(tableName); ClientConfiguration clientConfig = getCluster().getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); vopts.updateKerberosCredentials(clientConfig); } else { diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java index e5fecf86e9..4fface4b08 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java @@ -29,7 +29,6 @@ import org.apache.accumulo.core.cli.ClientOpts.Password; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.InstanceOperations; @@ -141,7 +140,7 @@ public void run() { opts.dataSize = 50; opts.cols = 1; opts.setTableName(tableName); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { opts.updateKerberosCredentials(clientConf); } else { opts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java index cce906f59e..5dfa6eb6e0 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableMacBase.java @@ -182,7 +182,7 @@ protected String getMonitor() throws KeeperException, InterruptedException { } protected ClientConfiguration getClientConfig() throws Exception { - return new ClientConfiguration(getCluster().getConfig().getClientConfFile()); + return ClientConfiguration.fromFile(getCluster().getConfig().getClientConfFile()); } } diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java index b383d0a866..66ef7df897 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java @@ -28,7 +28,6 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; @@ -65,7 +64,7 @@ public void createLocalUser() throws AccumuloException, AccumuloSecurityExceptio ClientConfiguration clientConf = cluster.getClientConfig(); ClusterUser user = getUser(0); username = user.getPrincipal(); - saslEnabled = clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false); + saslEnabled = clientConf.hasSasl(); // Create the user if it doesn't exist Set<String> users = conn.securityOperations().listLocalUsers(); if (!users.contains(username)) { diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java index b4eb5cc615..8af17e745e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java @@ -24,7 +24,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.Credentials; @@ -88,7 +87,7 @@ public void test() throws Exception { opts.createTable = true; opts.setTableName(firstTable); ClientConfiguration clientConf = cluster.getClientConfig(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { opts.updateKerberosCredentials(clientConf); } else { opts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java index c5f9eab8e4..f110e3f6d7 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java @@ -22,7 +22,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.accumulo.test.TestIngest; @@ -55,7 +54,7 @@ public void run() throws Exception { opts.cols = 1; opts.setTableName(tableName); ClientConfiguration clientConf = cluster.getClientConfig(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { opts.updateKerberosCredentials(clientConf); } else { opts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java index 8ac67d9463..2baedd1cdd 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java @@ -22,7 +22,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.harness.AccumuloClusterHarness; @@ -55,7 +54,7 @@ public void test() throws Exception { TestIngest.Opts opts = new TestIngest.Opts(); opts.setTableName(names[0]); ClientConfiguration clientConf = cluster.getClientConfig(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { opts.updateKerberosCredentials(clientConf); } else { opts.setPrincipal(getAdminPrincipal()); @@ -70,7 +69,7 @@ public void test() throws Exception { c.tableOperations().rename(names[0], names[1]); VerifyIngest.Opts vopts = new VerifyIngest.Opts(); vopts.setTableName(names[1]); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { vopts.updateKerberosCredentials(clientConf); } else { vopts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java index 102afaf13e..cd774e4195 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java @@ -25,7 +25,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.admin.InstanceOperations; import org.apache.accumulo.core.conf.Property; @@ -107,7 +106,7 @@ public void run() throws Exception { opts.cols = 1; opts.random = i; opts.setTableName(tableName); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { opts.updateKerberosCredentials(clientConf); } else { opts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java index 7bf52eeedd..48f57f61b8 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java @@ -35,7 +35,6 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.Scanner; @@ -321,7 +320,7 @@ private void testMissingSystemPermission(String tableNamePrefix, Connector root_ break; case OBTAIN_DELEGATION_TOKEN: ClientConfiguration clientConf = cluster.getClientConfig(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { // TODO Try to obtain a delegation token without the permission } break; @@ -464,7 +463,7 @@ private void testGrantedSystemPermission(String tableNamePrefix, Connector root_ break; case OBTAIN_DELEGATION_TOKEN: ClientConfiguration clientConf = cluster.getClientConfig(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { // TODO Try to obtain a delegation token with the permission } break; diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java index a799cb37e7..25cc8e4abd 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java @@ -62,7 +62,6 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.ZooKeeperInstance; @@ -207,7 +206,7 @@ public static void ingest(Connector connector, ClientConfiguration clientConfig, opts.columnFamily = colf; opts.createTable = true; opts.setTableName(tableName); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); } else { opts.setPrincipal(principal); @@ -231,7 +230,7 @@ private static void verify(Connector connector, ClientConfiguration clientConfig opts.startRow = offset; opts.columnFamily = colf; opts.setTableName(tableName); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); } else { opts.setPrincipal(principal); @@ -259,7 +258,7 @@ public Integer call() { ClientConfiguration clientConf = cluster.getClientConfig(); // Invocation is different for SASL. We're only logged in via this processes memory (not via some credentials cache on disk) // Need to pass along the keytab because of that. - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { String principal = getAdminPrincipal(); AuthenticationToken token = getAdminToken(); assertTrue("Expected KerberosToken, but was " + token.getClass(), token instanceof KerberosToken); @@ -288,7 +287,7 @@ public Integer call() { ClientConfiguration clientConf = cluster.getClientConfig(); // Invocation is different for SASL. We're only logged in via this processes memory (not via some credentials cache on disk) // Need to pass along the keytab because of that. - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { String principal = getAdminPrincipal(); AuthenticationToken token = getAdminToken(); assertTrue("Expected KerberosToken, but was " + token.getClass(), token instanceof KerberosToken); @@ -423,7 +422,7 @@ public void sunnyLG() throws Exception { System.setOut(newOut); List<String> args = new ArrayList<>(); args.add(entry.getKey().getColumnQualifier().toString()); - if (ClusterType.STANDALONE == getClusterType() && cluster.getClientConfig().getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (ClusterType.STANDALONE == getClusterType() && cluster.getClientConfig().hasSasl()) { args.add("--config"); StandaloneAccumuloCluster sac = (StandaloneAccumuloCluster) cluster; String hadoopConfDir = sac.getHadoopConfDir(); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RenameIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RenameIT.java index 47438a6e38..05d230a976 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/RenameIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/RenameIT.java @@ -19,7 +19,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.accumulo.test.TestIngest; @@ -45,7 +44,7 @@ public void renameTest() throws Exception { opts.setTableName(name1); final ClientConfiguration clientConfig = cluster.getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); } else { opts.setPrincipal(getAdminPrincipal()); @@ -57,7 +56,7 @@ public void renameTest() throws Exception { TestIngest.ingest(c, opts, bwOpts); VerifyIngest.Opts vopts = new VerifyIngest.Opts(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { vopts.updateKerberosCredentials(clientConfig); } else { vopts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RestartIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RestartIT.java index 3f9dd830eb..1f09d42540 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/RestartIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/RestartIT.java @@ -34,7 +34,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; @@ -159,7 +158,7 @@ public void restartMasterRecovery() throws Exception { OPTS.setTableName(tableName); VOPTS.setTableName(tableName); ClientConfiguration clientConfig = cluster.getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { OPTS.updateKerberosCredentials(clientConfig); VOPTS.updateKerberosCredentials(clientConfig); } else { @@ -270,7 +269,7 @@ public void killedTabletServer() throws Exception { OPTS.setTableName(tableName); VOPTS.setTableName(tableName); ClientConfiguration clientConfig = cluster.getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { OPTS.updateKerberosCredentials(clientConfig); VOPTS.updateKerberosCredentials(clientConfig); } else { @@ -306,7 +305,7 @@ public void killedTabletServerDuringShutdown() throws Exception { c.tableOperations().create(tableName); OPTS.setTableName(tableName); ClientConfiguration clientConfig = cluster.getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { OPTS.updateKerberosCredentials(clientConfig); } else { OPTS.setPrincipal(getAdminPrincipal()); @@ -326,7 +325,7 @@ public void shutdownDuringCompactingSplitting() throws Exception { String tableName = getUniqueNames(1)[0]; VOPTS.setTableName(tableName); ClientConfiguration clientConfig = cluster.getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { OPTS.updateKerberosCredentials(clientConfig); VOPTS.updateKerberosCredentials(clientConfig); } else { @@ -347,7 +346,7 @@ public void shutdownDuringCompactingSplitting() throws Exception { c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), "20K"); TestIngest.Opts opts = new TestIngest.Opts(); opts.setTableName(tableName); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); } else { opts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java index 662cf7524a..aa4b93fed7 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java @@ -32,7 +32,6 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.MutationsRejectedException; @@ -47,7 +46,6 @@ import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.harness.AccumuloClusterHarness; -import org.apache.accumulo.test.functional.AuthsIterator; import org.apache.hadoop.io.Text; import org.apache.hadoop.security.UserGroupInformation; import org.junit.After; @@ -79,7 +77,7 @@ public void setup() throws Exception { ClusterUser clusterUser = getUser(0); user = clusterUser.getPrincipal(); PasswordToken userToken; - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { userToken = null; saslEnabled = true; } else { diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java index 80e79e7db9..35743280b7 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java @@ -29,7 +29,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.InstanceOperations; @@ -132,7 +131,7 @@ public void tabletShouldSplit() throws Exception { opts.setTableName(table); ClientConfiguration clientConfig = cluster.getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); vopts.updateKerberosCredentials(clientConfig); } else { @@ -165,7 +164,7 @@ public void tabletShouldSplit() throws Exception { assertTrue("Count should be cgreater than 10: " + count, count > 10); String[] args; - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { ClusterUser rootUser = getAdminUser(); args = new String[] {"-i", cluster.getInstanceName(), "-u", rootUser.getPrincipal(), "--keytab", rootUser.getKeytab().getAbsolutePath(), "-z", cluster.getZooKeepers()}; @@ -204,7 +203,7 @@ public void deleteSplit() throws Exception { c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K"); ClientConfiguration clientConfig = getCluster().getClientConfig(); String password = null, keytab = null; - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { keytab = getAdminUser().getKeytab().getAbsolutePath(); } else { password = new String(((PasswordToken) getAdminToken()).getPassword(), UTF_8); diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java index b40569e4ef..db49c8a905 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java @@ -26,7 +26,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.TableOperations; @@ -72,7 +71,7 @@ public void test() throws Exception { TestIngest.Opts opts = new TestIngest.Opts(); VerifyIngest.Opts vopts = new VerifyIngest.Opts(); ClientConfiguration clientConfig = getCluster().getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); vopts.updateKerberosCredentials(clientConfig); } else { diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java index 0074f5f00f..cbb2405e81 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/WriteAheadLogIT.java @@ -19,7 +19,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.harness.AccumuloClusterHarness; @@ -60,7 +59,7 @@ public void test() throws Exception { opts.setTableName(tableName); ClientConfiguration clientConfig = cluster.getClientConfig(); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); vopts.updateKerberosCredentials(clientConfig); } else { diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java index 719dbdb6d8..2c5a2d1b5d 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/WriteLotsIT.java @@ -24,7 +24,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.accumulo.test.TestIngest; @@ -57,7 +56,7 @@ public void run() { opts.startRow = index * 10000; opts.rows = 10000; opts.setTableName(tableName); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { opts.updateKerberosCredentials(clientConfig); } else { opts.setPrincipal(getAdminPrincipal()); @@ -81,7 +80,7 @@ public void run() { VerifyIngest.Opts vopts = new VerifyIngest.Opts(); vopts.rows = 10000 * THREADS; vopts.setTableName(tableName); - if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConfig.hasSasl()) { vopts.updateKerberosCredentials(clientConfig); } else { vopts.setPrincipal(getAdminPrincipal()); diff --git a/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java index 049a5da41c..d41c03d350 100644 --- a/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java +++ b/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java @@ -167,7 +167,7 @@ public int run(String[] args) throws Exception { job.setInputFormat(AccumuloInputFormat.class); - ClientConfiguration clientConfig = new ClientConfiguration().withInstance(instanceName).withZkHosts(zooKeepers); + ClientConfiguration clientConfig = ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers); AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass)); AccumuloInputFormat.setInputTableName(job, table1); diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java index 1b5bab22ad..461d6ac063 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java @@ -67,7 +67,7 @@ public static void main(String[] args) throws Exception { ClientOpts opts = new ClientOpts(); opts.parseArgs(MetadataBatchScanTest.class.getName(), args); - Instance inst = new ZooKeeperInstance(new ClientConfiguration().withInstance("acu14").withZkHosts("localhost")); + Instance inst = new ZooKeeperInstance(ClientConfiguration.create().withInstance("acu14").withZkHosts("localhost")); final Connector connector = inst.getConnector(opts.getPrincipal(), opts.getToken()); TreeSet<Long> splits = new TreeSet<>(); diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java index 40cacdb6db..c9da60bc8c 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java @@ -16,6 +16,8 @@ */ package org.apache.accumulo.test.performance.thrift; +import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly; + import java.net.InetAddress; import java.nio.ByteBuffer; import java.util.ArrayList; @@ -56,11 +58,13 @@ import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException; import org.apache.accumulo.core.tabletserver.thrift.TDurability; import org.apache.accumulo.core.tabletserver.thrift.TSamplerConfiguration; +import org.apache.accumulo.core.tabletserver.thrift.TUnloadTabletGoal; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Iface; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Processor; import org.apache.accumulo.core.tabletserver.thrift.TabletStats; import org.apache.accumulo.core.trace.thrift.TInfo; +import org.apache.accumulo.core.util.HostAndPort; import org.apache.accumulo.server.AccumuloServerContext; import org.apache.accumulo.server.client.ClientServiceHandler; import org.apache.accumulo.server.client.HdfsZooInstance; @@ -76,10 +80,6 @@ import org.apache.thrift.TException; import com.beust.jcommander.Parameter; -import org.apache.accumulo.core.util.HostAndPort; - -import static org.apache.accumulo.fate.util.UtilWaitThread.sleepUninterruptibly; -import org.apache.accumulo.core.tabletserver.thrift.TUnloadTabletGoal; /** * The purpose of this class is to server as fake tserver that is a data sink like /dev/null. NullTserver modifies the metadata location entries for a table to @@ -138,8 +138,8 @@ public void splitTablet(TInfo tinfo, TCredentials credentials, TKeyExtent extent @Override public InitialMultiScan startMultiScan(TInfo tinfo, TCredentials credentials, Map<TKeyExtent,List<TRange>> batch, List<TColumn> columns, - List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations, boolean waitForWrites, TSamplerConfiguration tsc, long batchTimeOut, - String context) { + List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations, boolean waitForWrites, TSamplerConfiguration tsc, + long batchTimeOut, String context) { return null; } @@ -234,7 +234,7 @@ public void closeConditionalUpdate(TInfo tinfo, long sessID) throws TException { } @Override - public void removeLogs(TInfo tinfo, TCredentials credentials, List<String> filenames) throws TException { } + public void removeLogs(TInfo tinfo, TCredentials credentials, List<String> filenames) throws TException {} } static class Opts extends Help { @@ -253,14 +253,14 @@ public static void main(String[] args) throws Exception { opts.parseArgs(NullTserver.class.getName(), args); // modify metadata - ZooKeeperInstance zki = new ZooKeeperInstance(new ClientConfiguration().withInstance(opts.iname).withZkHosts(opts.keepers)); + ZooKeeperInstance zki = new ZooKeeperInstance(ClientConfiguration.create().withInstance(opts.iname).withZkHosts(opts.keepers)); AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(zki)); TransactionWatcher watcher = new TransactionWatcher(); ThriftClientHandler tch = new ThriftClientHandler(new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance())), watcher); Processor<Iface> processor = new Processor<Iface>(tch); - TServerUtils.startTServer(context.getConfiguration(), ThriftServerType.CUSTOM_HS_HA, processor, "NullTServer", - "null tserver", 2, 1, 1000, 10 * 1024 * 1024, null, null, -1, HostAndPort.fromParts("0.0.0.0", opts.port)); + TServerUtils.startTServer(context.getConfiguration(), ThriftServerType.CUSTOM_HS_HA, processor, "NullTServer", "null tserver", 2, 1, 1000, + 10 * 1024 * 1024, null, null, -1, HostAndPort.fromParts("0.0.0.0", opts.port)); HostAndPort addr = HostAndPort.fromParts(InetAddress.getLocalHost().getHostName(), opts.port); diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java index 251a064e2b..86a613d1ed 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java @@ -19,7 +19,6 @@ import java.io.IOException; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; @@ -63,7 +62,7 @@ public int run(String[] args) throws Exception { return 1; } - ClientConfiguration clientConf = new ClientConfiguration().withInstance(args[3]).withZkHosts(args[4]); + ClientConfiguration clientConf = ClientConfiguration.create().withInstance(args[3]).withZkHosts(args[4]); job.setInputFormatClass(AccumuloInputFormat.class); AccumuloInputFormat.setInputTableName(job, args[2]); @@ -72,7 +71,7 @@ public int run(String[] args) throws Exception { final String principal; final AuthenticationToken token; - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { // Use the Kerberos creds to request a DelegationToken for MapReduce to use // We could use the specified keytab (args[1]), but we're already logged in and don't need to, so we can just use the current user KerberosToken kt = new KerberosToken(); diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java index 4dced9632a..2d9d74736e 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java @@ -20,7 +20,6 @@ import java.util.Set; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.security.Authorizations; @@ -37,7 +36,7 @@ public void setUp(State state, Environment env) throws Exception { String secTableName, systemUserName, tableUserName, secNamespaceName; // A best-effort sanity check to guard against not password-based auth ClientConfiguration clientConf = ClientConfiguration.loadDefault(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { throw new IllegalStateException("Security module currently cannot support Kerberos/SASL instances"); } diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java index 5de5cf7d2b..2ec74ffbaf 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java @@ -20,7 +20,6 @@ import java.util.Iterator; import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; @@ -102,7 +101,7 @@ public int run(String[] args) throws Exception { AccumuloOutputFormat.setZooKeeperInstance(job, clientConf); job.setInputFormatClass(AccumuloInputFormat.class); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + if (clientConf.hasSasl()) { // Better be logged in KerberosToken token = new KerberosToken(); try { diff --git a/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java b/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java index 2f82bfa866..cca442fdf2 100644 --- a/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java +++ b/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java @@ -48,7 +48,8 @@ public void init(Properties scaleProps, Properties testProps, int numTabletServe String password = this.scaleProps.getProperty("PASSWORD"); System.out.println(password); - conn = new ZooKeeperInstance(new ClientConfiguration().withInstance(instanceName).withZkHosts(zookeepers)).getConnector(user, new PasswordToken(password)); + conn = new ZooKeeperInstance(ClientConfiguration.create().withInstance(instanceName).withZkHosts(zookeepers)).getConnector(user, + new PasswordToken(password)); } protected void startTimer() { diff --git a/trace/pom.xml b/trace/pom.xml index a801bfa2c6..bc1d7480fa 100644 --- a/trace/pom.xml +++ b/trace/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-project</artifactId> - <version>1.8.2-SNAPSHOT</version> + <version>1.9.0-SNAPSHOT</version> </parent> <artifactId>accumulo-trace</artifactId> <name>Apache Accumulo Trace</name> ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services