You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mw...@apache.org on 2018/04/04 18:57:42 UTC
[accumulo] branch master updated: #408 Removed use of deprecated
ClientConfiguration (#412)
This is an automated email from the ASF dual-hosted git repository.
mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/master by this push:
new ea4ffe2 #408 Removed use of deprecated ClientConfiguration (#412)
ea4ffe2 is described below
commit ea4ffe282d4444b37b3790107e03f8519f55aff3
Author: Mike Walch <mw...@apache.org>
AuthorDate: Wed Apr 4 14:57:39 2018 -0400
#408 Removed use of deprecated ClientConfiguration (#412)
* Accumulo shell now uses accumulo-client.properties
---
INSTALL.md | 20 +++-
.../org/apache/accumulo/core/cli/ClientOpts.java | 26 ++---
.../accumulo/core/client/ClientConfiguration.java | 2 +-
.../accumulo/core/client/ConnectionInfo.java | 13 ++-
.../org/apache/accumulo/core/client/Connector.java | 2 +-
.../core/client/impl/ClientConfConverter.java | 101 ++++++++++++++++
.../accumulo/core/client/impl/ClientContext.java | 6 +
.../core/client/impl/ConnectionInfoFactory.java | 39 +------
.../core/client/impl/ConnectionInfoImpl.java | 17 ++-
.../apache/accumulo/core/conf/ClientProperty.java | 39 +++++++
.../accumulo/core/trace/DistributedTrace.java | 24 ++--
.../core/client/impl/ClientConfConverterTest.java | 45 ++++++++
.../apache/accumulo/cluster/AccumuloCluster.java | 6 +
.../standalone/StandaloneAccumuloCluster.java | 29 +++--
.../accumulo/minicluster/MiniAccumuloCluster.java | 2 +
.../minicluster/impl/MiniAccumuloClusterImpl.java | 17 +++
.../minicluster/impl/MiniAccumuloConfigImpl.java | 7 ++
pom.xml | 21 ++++
shell/pom.xml | 4 -
.../main/java/org/apache/accumulo/shell/Shell.java | 98 +++++++---------
.../org/apache/accumulo/shell/ShellOptionsJC.java | 101 ++++++++--------
.../org/apache/accumulo/shell/ShellConfigTest.java | 34 ++----
.../apache/accumulo/shell/ShellOptionsJCTest.java | 14 +--
.../accumulo/shell/ShellSetInstanceTest.java | 127 +++------------------
.../accumulo/harness/AccumuloClusterHarness.java | 20 ++--
.../harness/conf/AccumuloClusterConfiguration.java | 3 -
.../conf/AccumuloClusterPropertyConfiguration.java | 3 -
.../conf/AccumuloMiniClusterConfiguration.java | 14 ---
.../StandaloneAccumuloClusterConfiguration.java | 58 +++-------
.../apache/accumulo/test/BatchWriterIterator.java | 7 +-
.../apache/accumulo/test/ConditionalWriterIT.java | 11 +-
.../accumulo/test/DetectDeadTabletServersIT.java | 5 +-
.../org/apache/accumulo/test/IMMLGBenchmark.java | 7 +-
.../test/MasterRepairsDualAssignmentIT.java | 4 +-
.../accumulo/test/MetaConstraintRetryIT.java | 4 +-
.../accumulo/test/MultiTableBatchWriterIT.java | 3 +-
.../org/apache/accumulo/test/ShellConfigIT.java | 12 +-
.../org/apache/accumulo/test/ShellServerIT.java | 11 +-
.../ThriftServerBindsBeforeZooKeeperLockIT.java | 16 ++-
.../test/TracerRecoversAfterOfflineTableIT.java | 2 +-
.../apache/accumulo/test/TransportCachingIT.java | 5 +-
.../java/org/apache/accumulo/test/UsersIT.java | 2 +-
.../java/org/apache/accumulo/test/VolumeIT.java | 9 +-
.../functional/BalanceAfterCommsFailureIT.java | 5 +-
.../BalanceInPresenceOfOfflineTableIT.java | 13 +--
.../test/functional/BulkSplitOptimizationIT.java | 4 +-
.../test/functional/ChaoticBalancerIT.java | 10 +-
.../accumulo/test/functional/CompactionIT.java | 6 +-
.../test/functional/ConfigurableMacBase.java | 13 +--
.../accumulo/test/functional/ConnectorIT.java | 2 +-
.../accumulo/test/functional/CredentialsIT.java | 4 +-
.../apache/accumulo/test/functional/DeleteIT.java | 6 +-
.../test/functional/DynamicThreadPoolsIT.java | 8 +-
.../accumulo/test/functional/FateStarvationIT.java | 6 +-
.../test/functional/GarbageCollectorIT.java | 7 +-
.../accumulo/test/functional/KerberosProxyIT.java | 16 +--
.../test/functional/MasterAssignmentIT.java | 4 +-
.../accumulo/test/functional/MasterFailoverIT.java | 10 +-
.../apache/accumulo/test/functional/MaxOpenIT.java | 6 +-
.../test/functional/MetadataMaxFilesIT.java | 6 +-
.../accumulo/test/functional/PermissionsIT.java | 7 +-
.../accumulo/test/functional/ReadWriteIT.java | 71 +++++-------
.../test/functional/RecoveryWithEmptyRFileIT.java | 4 +-
.../apache/accumulo/test/functional/RenameIT.java | 12 +-
.../apache/accumulo/test/functional/RestartIT.java | 41 +++----
.../accumulo/test/functional/RestartStressIT.java | 2 +-
.../accumulo/test/functional/ScanIteratorIT.java | 4 +-
.../test/functional/SimpleBalancerFairnessIT.java | 2 +-
.../apache/accumulo/test/functional/SplitIT.java | 13 +--
.../apache/accumulo/test/functional/TableIT.java | 8 +-
.../accumulo/test/functional/WriteAheadLogIT.java | 8 +-
.../accumulo/test/functional/WriteLotsIT.java | 10 +-
.../test/mapreduce/AccumuloFileOutputFormatIT.java | 3 +-
.../mapreduce/AccumuloMultiTableInputFormatIT.java | 6 +-
.../test/mapreduce/AccumuloRowInputFormatIT.java | 6 +-
.../accumulo/test/master/SuspendedTabletsIT.java | 8 +-
.../accumulo/test/performance/NullTserver.java | 3 +-
.../metadata/MetadataBatchScanTest.java | 3 +-
...GarbageCollectorCommunicatesWithTServersIT.java | 5 +-
.../replication/ReplicationOperationsImplIT.java | 4 +-
80 files changed, 645 insertions(+), 691 deletions(-)
diff --git a/INSTALL.md b/INSTALL.md
index e0141eb..f96f526 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -42,10 +42,11 @@ For convenience, consider adding `accumulo-X.Y.Z/bin/` to your shell's path.
Accumulo requires running [Zookeeper] and [HDFS] instances which should be set up
before configuring Accumulo.
-The primary configuration files for Accumulo are `accumulo-env.sh` and `accumulo-site.xml`
-which are located in the `conf/` directory.
+The primary configuration files for Accumulo are `accumulo-site.xml`, `accumulo-env.sh`,
+and `accumulo-client.properties` which are located in the `conf/` directory.
-Follow the steps below to configure `accumulo-site.xml`:
+The `accumulo-site.xml` file configures Accumulo server processes (i.e tablet server, master,
+monitor, etc). Follow these steps to set it up:
1. Run `accumulo-util build-native` to build native code. If this command fails, disable
native maps by setting `tserver.memory.maps.native.enabled` to `false`.
@@ -59,7 +60,7 @@ Follow the steps below to configure `accumulo-site.xml`:
4. (Optional) Change `instance.secret` (which is used by Accumulo processes to communicate)
from the default. This value should match on all servers.
-Follow the steps below to configure `accumulo-env.sh`:
+The `accumulo-env.sh` file sets up environment variables needed by Accumulo:
1. Set `HADOOP_PREFIX` and `ZOOKEEPER_HOME` to the location of your Hadoop and Zookeeper
installations. Accumulo will use these locations to find Hadoop and Zookeeper jars and add
@@ -81,6 +82,17 @@ Follow the steps below to configure `accumulo-env.sh`:
3. (Optional) Review the memory settings for the Accumulo master, garbage collector, and monitor
in the `JAVA_OPTS` section of `accumulo-env.sh`.
+The `accumulo-client.properties` file is used by the Accumulo shell and can be passed to Accumulo
+clients to simplify connecting to Accumulo. Below are steps to configure it.
+
+1. Set `instance.name` and `instance.zookeepers` to the Accumulo instance and zookeeper connection
+ string of your instance.
+
+2. Pick an authentication method and set `auth.method` accordingly. The most common `auth.method`
+ is `password` which typically requires `auth.username` and `auth.password` to be set. For the
+ Accumulo shell, `auth.password` can be commented out and the shell will prompt you for the
+ password of `auth.username` at login.
+
## Initialization
Accumulo needs to initialize the locations where it stores data in Zookeeper
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 bd594b2..f256a92 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
@@ -229,26 +229,24 @@ public class ClientOpts extends Help {
* Automatically update the options to use a KerberosToken when SASL is enabled for RPCs. Don't overwrite the options if the user has provided something
* specifically.
*/
- public void updateKerberosCredentials() {
- ClientConfiguration clientConfig;
- try {
- if (clientConfigFile == null)
- clientConfig = ClientConfiguration.loadDefault();
- else
- clientConfig = ClientConfiguration.fromFile(new File(clientConfigFile));
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
+ public void updateKerberosCredentials(String clientConfigFile) {
+ boolean saslEnabled = false;
+ if (clientConfigFile != null) {
+ saslEnabled = Connector.builder().usingProperties(clientConfigFile).info().saslEnabled();
}
- updateKerberosCredentials(clientConfig);
+ updateKerberosCredentials(saslEnabled);
+ }
+
+ public void updateKerberosCredentials() {
+ updateKerberosCredentials(true);
}
/**
* Automatically update the options to use a KerberosToken when SASL is enabled for RPCs. Don't overwrite the options if the user has provided something
* specifically.
*/
- public void updateKerberosCredentials(ClientConfiguration clientConfig) {
- final boolean clientConfSaslEnabled = Boolean.parseBoolean(clientConfig.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED));
- if ((saslEnabled || clientConfSaslEnabled) && null == tokenClassName) {
+ public void updateKerberosCredentials(boolean clientSaslEnabled) {
+ if ((saslEnabled || clientSaslEnabled) && null == tokenClassName) {
tokenClassName = KerberosToken.CLASS_NAME;
// ACCUMULO-3701 We need to ensure we're logged in before parseArgs returns as the MapReduce Job is going to make a copy of the current user (UGI)
// when it is instantiated.
@@ -274,7 +272,7 @@ public class ClientOpts extends Help {
super.parseArgs(programName, args, others);
startDebugLogging();
startTracing(programName);
- updateKerberosCredentials();
+ updateKerberosCredentials(clientConfigFile);
}
protected Instance cachedInstance = null;
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 a269229..f3e2fb8 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
@@ -224,7 +224,7 @@ public class ClientConfiguration {
}
// 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.");
+ log.debug("Found no client.conf in default paths. Using default client configuration values.");
}
return new ClientConfiguration(configs);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ConnectionInfo.java b/core/src/main/java/org/apache/accumulo/core/client/ConnectionInfo.java
index 9a43073..b06b223 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ConnectionInfo.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ConnectionInfo.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.client;
+import java.io.File;
import java.util.Properties;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
@@ -35,7 +36,7 @@ public interface ConnectionInfo {
/**
* @return Zookeeper connection information for Accumulo instance
*/
- String getZookeepers();
+ String getZooKeepers();
/**
* @return Accumulo principal/username
@@ -48,6 +49,16 @@ public interface ConnectionInfo {
AuthenticationToken getAuthenticationToken();
/**
+ * @return Keytab File if Kerberos is used or null
+ */
+ File getKeytab();
+
+ /**
+ * @return True if SASL enabled
+ */
+ boolean saslEnabled();
+
+ /**
* @return All Accumulo client properties set for this connection
*/
Properties getProperties();
diff --git a/core/src/main/java/org/apache/accumulo/core/client/Connector.java b/core/src/main/java/org/apache/accumulo/core/client/Connector.java
index c089598..5829ce8 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/Connector.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Connector.java
@@ -549,7 +549,7 @@ public abstract class Connector {
* @return this builder
* @since 2.0.0
*/
- public static PropertyOptions builder() {
+ public static ConnectionInfoOptions builder() {
return new ConnectorImpl.ConnectorBuilderImpl();
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
new file mode 100644
index 0000000..2de50ac
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.client.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.conf.ClientProperty;
+
+@SuppressWarnings("deprecation")
+public class ClientConfConverter {
+
+ private static Map<String, String> confProps = new HashMap<>();
+ private static Map<String, String> propsConf = new HashMap<>();
+
+ static {
+ propsConf.put(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST.getKey());
+ propsConf.put(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT_SEC.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_ZK_TIMEOUT.getKey());
+ propsConf.put(ClientProperty.SSL_ENABLED.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_ENABLED.getKey());
+ propsConf.put(ClientProperty.SSL_KEYSTORE_PATH.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PATH.getKey());
+ propsConf.put(ClientProperty.SSL_KEYSTORE_TYPE.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_TYPE.getKey());
+ propsConf.put(ClientProperty.SSL_KEYSTORE_PASSWORD.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PASSWORD.getKey());
+ propsConf.put(ClientProperty.SSL_TRUSTSTORE_PATH.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PATH.getKey());
+ propsConf.put(ClientProperty.SSL_TRUSTSTORE_TYPE.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_TYPE.getKey());
+ propsConf.put(ClientProperty.SSL_TRUSTSTORE_PASSWORD.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PASSWORD.getKey());
+ propsConf.put(ClientProperty.SSL_USE_JSSE.getKey(),
+ ClientConfiguration.ClientProperty.RPC_USE_JSSE.getKey());
+ propsConf.put(ClientProperty.SASL_ENABLED.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey());
+ propsConf.put(ClientProperty.SASL_QOP.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SASL_QOP.getKey());
+ propsConf.put(ClientProperty.SASL_KERBEROS_SERVER_PRIMARY.getKey(),
+ ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey());
+
+ for (Map.Entry<String, String> entry : propsConf.entrySet()) {
+ confProps.put(entry.getValue(), entry.getKey());
+ }
+ }
+
+ public static ClientConfiguration toClientConf(Properties properties) {
+ ClientConfiguration config = ClientConfiguration.create();
+ for (Object keyObj : properties.keySet()) {
+ String propKey = (String) keyObj;
+ String val = properties.getProperty(propKey);
+ String confKey = propsConf.get(propKey);
+ if (confKey == null) {
+ config.setProperty(propKey, val);
+ } else {
+ config.setProperty(confKey, val);
+ }
+ if (propKey.equals(ClientProperty.SSL_KEYSTORE_PATH.getKey())) {
+ config.setProperty(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH, "true");
+ }
+ }
+ return config;
+ }
+
+ public static Properties toProperties(ClientConfiguration clientConf) {
+ Properties props = new Properties();
+ Iterator<String> clientConfIter = clientConf.getKeys();
+ while (clientConfIter.hasNext()) {
+ String confKey = clientConfIter.next();
+ String val = clientConf.getString(confKey);
+ String propKey = confProps.get(confKey);
+ if (propKey == null) {
+ if (!confKey.equals(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH.getKey())) {
+ props.setProperty(confKey, val);
+ }
+ } else {
+ props.setProperty(propKey, val);
+ }
+ }
+ return props;
+ }
+}
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 49c5750..b0baff3 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
@@ -30,6 +30,7 @@ import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.ZooKeeperInstance;
@@ -73,6 +74,11 @@ public class ClientContext {
return () -> Suppliers.memoizeWithExpiration(() -> s.get(), 100, TimeUnit.MILLISECONDS).get();
}
+ public ClientContext(ConnectionInfo connectionInfo) {
+ this(ConnectionInfoFactory.getInstance(connectionInfo), ConnectionInfoFactory.getCredentials(connectionInfo), ConnectionInfoFactory
+ .getClientConfiguration(connectionInfo), ConnectionInfoFactory.getBatchWriterConfig(connectionInfo));
+ }
+
/**
* Instantiate a client context
*/
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoFactory.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoFactory.java
index 1aafc06..c1cb17c 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoFactory.java
@@ -47,7 +47,7 @@ public class ConnectionInfoFactory {
}
public static ClientContext getClientContext(ConnectionInfo info) {
- return new ClientContext(getInstance(info), getCredentials(info), getClientConfiguration(info), getBatchWriterConfig(info));
+ return new ClientContext(info);
}
public static Instance getInstance(ConnectionInfo info) {
@@ -80,41 +80,6 @@ public class ConnectionInfoFactory {
}
public static ClientConfiguration getClientConfiguration(ConnectionInfo info) {
- ClientConfiguration config = ClientConfiguration.create();
- for (Object keyObj : info.getProperties().keySet()) {
- String key = (String) keyObj;
- String val = info.getProperties().getProperty(key);
- if (key.equals(ClientProperty.INSTANCE_ZOOKEEPERS.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST, val);
- } else if (key.equals(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT_SEC.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.INSTANCE_ZK_TIMEOUT, val);
- } else if (key.equals(ClientProperty.SSL_ENABLED.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_ENABLED, val);
- } else if (key.equals(ClientProperty.SSL_KEYSTORE_PATH.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PATH, val);
- config.setProperty(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH, "true");
- } else if (key.equals(ClientProperty.SSL_KEYSTORE_TYPE.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_TYPE, val);
- } else if (key.equals(ClientProperty.SSL_KEYSTORE_PASSWORD.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PASSWORD, val);
- } else if (key.equals(ClientProperty.SSL_TRUSTSTORE_PATH.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PATH, val);
- } else if (key.equals(ClientProperty.SSL_TRUSTSTORE_TYPE.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PATH, val);
- } else if (key.equals(ClientProperty.SSL_TRUSTSTORE_PASSWORD.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PATH, val);
- } else if (key.equals(ClientProperty.SSL_USE_JSSE.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_USE_JSSE, val);
- } else if (key.equals(ClientProperty.SASL_ENABLED.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_ENABLED, val);
- } else if (key.equals(ClientProperty.SASL_QOP.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.RPC_SASL_QOP, val);
- } else if (key.equals(ClientProperty.SASL_KERBEROS_SERVER_PRIMARY.getKey())) {
- config.setProperty(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY, val);
- } else {
- config.setProperty(key, val);
- }
- }
- return config;
+ return ClientConfConverter.toClientConf(info.getProperties());
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoImpl.java
index 916625c..16701fc 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoImpl.java
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.client.impl;
+import java.io.File;
import java.util.Properties;
import org.apache.accumulo.core.client.ConnectionInfo;
@@ -38,7 +39,7 @@ public class ConnectionInfoImpl implements ConnectionInfo {
}
@Override
- public String getZookeepers() {
+ public String getZooKeepers() {
return getString(ClientProperty.INSTANCE_ZOOKEEPERS);
}
@@ -57,6 +58,20 @@ public class ConnectionInfoImpl implements ConnectionInfo {
return token;
}
+ @Override
+ public File getKeytab() {
+ String keyTab = getString(ClientProperty.AUTH_KERBEROS_KEYTAB_PATH);
+ if (keyTab == null) {
+ return null;
+ }
+ return new File(keyTab);
+ }
+
+ @Override
+ public boolean saslEnabled() {
+ return Boolean.valueOf(getString(ClientProperty.SASL_ENABLED));
+ }
+
private String getString(ClientProperty property) {
return property.getValue(properties);
}
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java b/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java
index b645b10..be6240e 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java
@@ -16,6 +16,8 @@
*/
package org.apache.accumulo.core.conf;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Properties;
@@ -64,6 +66,8 @@ public enum ClientProperty {
TRACE_SPAN_RECEIVERS("trace.span.receivers", "org.apache.accumulo.tracer.ZooTraceClient", "A list of span receiver classes to send trace spans"),
TRACE_ZOOKEEPER_PATH("trace.zookeeper.path", Constants.ZTRACERS, "The zookeeper node where tracers are registered");
+ public static final String TRACE_SPAN_RECEIVER_PREFIX = "trace.span.receiver";
+
private String key;
private String defaultValue;
private String description;
@@ -130,4 +134,39 @@ public enum ClientProperty {
}
return Long.parseLong(value);
}
+
+ public Integer getInteger(Properties properties) {
+ String value = getValue(properties);
+ if (value.isEmpty()) {
+ return null;
+ }
+ return Integer.parseInt(value);
+ }
+
+ public boolean getBoolean(Properties properties) {
+ String value = getValue(properties);
+ if (value.isEmpty()) {
+ return false;
+ }
+ return Boolean.valueOf(value);
+ }
+
+ public static Properties getPrefix(Properties properties, String prefix) {
+ Properties props = new Properties();
+ for (Object keyObj : properties.keySet()) {
+ String key = (String) keyObj;
+ if (key.startsWith(prefix)) {
+ props.put(key, properties.getProperty(key));
+ }
+ }
+ return props;
+ }
+
+ public static Map<String,String> toMap(Properties properties) {
+ Map<String,String> propMap = new HashMap<>();
+ for (Object obj : properties.keySet()) {
+ propMap.put((String) obj, properties.getProperty((String) obj));
+ }
+ return propMap;
+ }
}
diff --git a/core/src/main/java/org/apache/accumulo/core/trace/DistributedTrace.java b/core/src/main/java/org/apache/accumulo/core/trace/DistributedTrace.java
index 4cf819f..d1cc7bf 100644
--- a/core/src/main/java/org/apache/accumulo/core/trace/DistributedTrace.java
+++ b/core/src/main/java/org/apache/accumulo/core/trace/DistributedTrace.java
@@ -20,11 +20,11 @@ import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Properties;
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.fate.zookeeper.ZooReader;
@@ -56,7 +56,7 @@ public class DistributedTrace {
private static final HashSet<SpanReceiver> receivers = new HashSet<>();
/**
- * @deprecated since 1.7, use {@link DistributedTrace#enable(String, String, org.apache.accumulo.core.client.ClientConfiguration)} instead
+ * @deprecated since 1.7, use {@link DistributedTrace#enable(String, String, Properties)} instead
*/
@Deprecated
public static void enable(Instance instance, ZooReader zoo, String application, String address) throws IOException, KeeperException, InterruptedException {
@@ -82,7 +82,7 @@ public class DistributedTrace {
* of the class will be used.
*/
public static void enable(String hostname, String service) {
- enable(hostname, service, ClientConfiguration.loadDefault());
+ enable(hostname, service, new Properties());
}
/**
@@ -90,13 +90,13 @@ public class DistributedTrace {
* of the class will be used. Properties required in the client configuration include
* {@link org.apache.accumulo.core.client.ClientConfiguration.ClientProperty#TRACE_SPAN_RECEIVERS} and any properties specific to the span receiver.
*/
- public static void enable(String hostname, String service, ClientConfiguration conf) {
- String spanReceivers = conf.get(ClientProperty.TRACE_SPAN_RECEIVERS);
- String zookeepers = conf.get(ClientProperty.INSTANCE_ZK_HOST);
- long timeout = ConfigurationTypeHelper.getTimeInMillis(conf.get(ClientProperty.INSTANCE_ZK_TIMEOUT));
- String zkPath = conf.get(ClientProperty.TRACE_ZK_PATH);
- Map<String,String> properties = conf.getAllPropertiesWithPrefix(ClientProperty.TRACE_SPAN_RECEIVER_PREFIX);
- enableTracing(hostname, service, spanReceivers, zookeepers, timeout, zkPath, properties);
+ public static void enable(String hostname, String service, Properties properties) {
+ String spanReceivers = ClientProperty.TRACE_SPAN_RECEIVERS.getValue(properties);
+ String zookeepers = ClientProperty.INSTANCE_ZOOKEEPERS.getValue(properties);
+ long timeout = ConfigurationTypeHelper.getTimeInMillis(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT_SEC.getValue(properties));
+ String zkPath = ClientProperty.TRACE_ZOOKEEPER_PATH.getValue(properties);
+ Map<String,String> props = ClientProperty.toMap(ClientProperty.getPrefix(properties, ClientProperty.TRACE_SPAN_RECEIVER_PREFIX));
+ enableTracing(hostname, service, spanReceivers, zookeepers, timeout, zkPath, props);
}
/**
@@ -164,7 +164,7 @@ public class DistributedTrace {
log.warn("Failed to load SpanReceiver {}", className);
} else {
receivers.add(rcvr);
- log.info("SpanReceiver {} was loaded successfully.", className);
+ log.debug("SpanReceiver {} was loaded successfully.", className);
}
}
for (SpanReceiver rcvr : receivers) {
diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ClientConfConverterTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientConfConverterTest.java
new file mode 100644
index 0000000..dd104e3
--- /dev/null
+++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ClientConfConverterTest.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.client.impl;
+
+import java.util.Properties;
+
+import org.apache.accumulo.core.conf.ClientProperty;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ClientConfConverterTest {
+
+ @Test
+ public void testBasic() {
+ Properties before = new Properties();
+ before.setProperty(ClientProperty.INSTANCE_NAME.getKey(), "instance");
+ before.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), "zookeepers");
+ before.setProperty(ClientProperty.AUTH_METHOD.getKey(), "password");
+ before.setProperty(ClientProperty.AUTH_PASSWORD.getKey(), "mypass");
+ before.setProperty(ClientProperty.SSL_ENABLED.getKey(), "true");
+ before.setProperty(ClientProperty.SSL_KEYSTORE_PATH.getKey(), "key_path");
+ before.setProperty(ClientProperty.SSL_KEYSTORE_PASSWORD.getKey(), "key_pass");
+ before.setProperty(ClientProperty.SSL_TRUSTSTORE_PATH.getKey(), "trust_path");
+ before.setProperty(ClientProperty.SASL_ENABLED.getKey(), "true");
+ before.setProperty(ClientProperty.SASL_KERBEROS_SERVER_PRIMARY.getKey(), "primary");
+ before.setProperty(ClientProperty.BATCH_WRITER_MAX_WRITE_THREADS.getKey(), "5");
+
+ Properties after = ClientConfConverter.toProperties(ClientConfConverter.toClientConf(before));
+ Assert.assertEquals(before, after);
+ }
+}
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java
index 8e80358..45d59c3 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java
@@ -21,6 +21,7 @@ import java.io.IOException;
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.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
@@ -58,6 +59,11 @@ public interface AccumuloCluster {
ClientConfiguration getClientConfig();
/**
+ * @return Connection Info for cluster
+ */
+ ConnectionInfo getConnectionInfo();
+
+ /**
* Get server side config derived from accumulo-site.xml
*/
AccumuloConfiguration getSiteConfiguration();
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
index da9a6bb..113ed31 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
@@ -28,9 +28,9 @@ import org.apache.accumulo.cluster.ClusterUser;
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.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.impl.ClientConfConverter;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ConfigurationCopy;
@@ -56,21 +56,15 @@ public class StandaloneAccumuloCluster implements AccumuloCluster {
static final List<ServerType> ALL_SERVER_TYPES = Collections.unmodifiableList(Arrays.asList(ServerType.MASTER, ServerType.TABLET_SERVER, ServerType.TRACER,
ServerType.GARBAGE_COLLECTOR, ServerType.MONITOR));
- private Instance instance;
- private ClientConfiguration clientConf;
+ private ConnectionInfo info;
private String accumuloHome, clientAccumuloConfDir, serverAccumuloConfDir, hadoopConfDir;
private Path tmp;
private List<ClusterUser> users;
private String clientCmdPrefix;
private String serverCmdPrefix;
- public StandaloneAccumuloCluster(ClientConfiguration clientConf, Path tmp, List<ClusterUser> users) {
- this(new ZooKeeperInstance(clientConf), clientConf, tmp, users);
- }
-
- public StandaloneAccumuloCluster(Instance instance, ClientConfiguration clientConf, Path tmp, List<ClusterUser> users) {
- this.instance = instance;
- this.clientConf = clientConf;
+ public StandaloneAccumuloCluster(ConnectionInfo info, Path tmp, List<ClusterUser> users) {
+ this.info = info;
this.tmp = tmp;
this.users = users;
}
@@ -123,22 +117,27 @@ public class StandaloneAccumuloCluster implements AccumuloCluster {
@Override
public String getInstanceName() {
- return instance.getInstanceName();
+ return info.getInstanceName();
}
@Override
public String getZooKeepers() {
- return instance.getZooKeepers();
+ return info.getZooKeepers();
}
@Override
public Connector getConnector(String user, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
- return instance.getConnector(user, token);
+ return Connector.builder().forInstance(getInstanceName(), getZooKeepers()).usingToken(user, token).build();
}
@Override
public ClientConfiguration getClientConfig() {
- return clientConf;
+ return ClientConfConverter.toClientConf(info.getProperties());
+ }
+
+ @Override
+ public ConnectionInfo getConnectionInfo() {
+ return info;
}
@Override
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
index ba52f80..cec6e6d 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
@@ -118,7 +118,9 @@ public class MiniAccumuloCluster {
/**
* @since 1.6.0
+ * @deprecated since 2.0.0
*/
+ @Deprecated
public ClientConfiguration getClientConfig() {
return impl.getClientConfig();
}
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 af92622..60b7e42 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
@@ -59,6 +59,7 @@ import org.apache.accumulo.core.Constants;
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.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.ZooKeeperInstance;
@@ -70,6 +71,7 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
@@ -441,6 +443,16 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
writeConfigProperties(clientConfFile,
Maps.filterEntries(config.getSiteConfig(), v -> ClientConfiguration.ClientProperty.getPropertyByKey(v.getKey()) != null));
+ Map<String, String> clientProps = new HashMap<>();
+ clientProps.put(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), config.getZooKeepers());
+ clientProps.put(ClientProperty.INSTANCE_NAME.getKey(), config.getInstanceName());
+ clientProps.put(ClientProperty.AUTH_METHOD.getKey(), "password");
+ clientProps.put(ClientProperty.AUTH_USERNAME.getKey(), config.getRootUserName());
+ clientProps.put(ClientProperty.AUTH_PASSWORD.getKey(), config.getRootPassword());
+
+ File clientPropsFile = config.getClientPropsFile();
+ writeConfigProperties(clientPropsFile, clientProps);
+
File siteFile = new File(config.getConfDir(), "accumulo-site.xml");
writeConfig(siteFile, config.getSiteConfig().entrySet());
@@ -743,6 +755,11 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
}
@Override
+ public ConnectionInfo getConnectionInfo() {
+ return Connector.builder().forInstance(getInstanceName(), getZooKeepers()).usingPassword(config.getRootUserName(), config.getRootPassword()).info();
+ }
+
+ @Override
public FileSystem getFileSystem() {
try {
return FileSystem.get(new URI(dfsUri), new Configuration());
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java
index e1942ab..98ce54a 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java
@@ -538,6 +538,13 @@ public class MiniAccumuloConfigImpl {
}
/**
+ * @return location of accumulo-client.properties file for connecting to this mini cluster
+ */
+ public File getClientPropsFile() {
+ return new File(getConfDir(), "accumulo-client.properties");
+ }
+
+ /**
* sets system properties set for service processes
*
* @since 1.6.0
diff --git a/pom.xml b/pom.xml
index 2f3d960..08dc77e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1413,6 +1413,27 @@
</build>
<profiles>
<profile>
+ <!-- This profile skips all Quality Assurance checks -->
+ <id>skipQA</id>
+ <properties>
+ <accumulo.skip>true</accumulo.skip>
+ <apilyzer.skip>true</apilyzer.skip>
+ <checkstyle.skip>true</checkstyle.skip>
+ <enforcer.skip>true</enforcer.skip>
+ <findbugs.skip>true</findbugs.skip>
+ <formatter.skip>true</formatter.skip>
+ <impsort.skip>true</impsort.skip>
+ <maven.plugin.skip>true</maven.plugin.skip>
+ <mdep.analyze.skip>true</mdep.analyze.skip>
+ <modernizer.skip>true</modernizer.skip>
+ <rat.skip>true</rat.skip>
+ <skipITs>true</skipITs>
+ <skipTests>true</skipTests>
+ <sort.skip>true</sort.skip>
+ <warbucks.skip>true</warbucks.skip>
+ </properties>
+ </profile>
+ <profile>
<id>m2e</id>
<activation>
<property>
diff --git a/shell/pom.xml b/shell/pom.xml
index 8a0a25f..1cb11e6 100644
--- a/shell/pom.xml
+++ b/shell/pom.xml
@@ -52,10 +52,6 @@
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- </dependency>
- <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 708561e..d6b385d 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -37,16 +37,14 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
-import java.util.UUID;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
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.IteratorSetting;
@@ -56,9 +54,8 @@ import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.data.thrift.TConstraintViolationSummary;
@@ -70,8 +67,6 @@ import org.apache.accumulo.core.util.format.DefaultFormatter;
import org.apache.accumulo.core.util.format.Formatter;
import org.apache.accumulo.core.util.format.FormatterConfig;
import org.apache.accumulo.core.util.format.FormatterFactory;
-import org.apache.accumulo.core.volume.VolumeConfiguration;
-import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.shell.commands.AboutCommand;
import org.apache.accumulo.shell.commands.AddAuthsCommand;
import org.apache.accumulo.shell.commands.AddSplitsCommand;
@@ -171,9 +166,7 @@ import org.apache.commons.cli.MissingOptionException;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.vfs2.FileSystemException;
-import org.apache.hadoop.fs.Path;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -294,15 +287,8 @@ public class Shell extends ShellOptions implements KeywordExecutable {
authTimeout = TimeUnit.MINUTES.toNanos(options.getAuthTimeout());
disableAuthTimeout = options.isAuthTimeoutDisabled();
- ClientConfiguration clientConf;
- try {
- clientConf = options.getClientConfiguration();
- } catch (Exception e) {
- printException(e);
- return true;
- }
-
- if (Boolean.parseBoolean(clientConf.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED))) {
+ Properties properties = options.getClientProperties();
+ if (ClientProperty.SASL_ENABLED.getBoolean(properties)) {
log.debug("SASL is enabled, disabling authorization timeout");
disableAuthTimeout = true;
}
@@ -312,17 +298,22 @@ public class Shell extends ShellOptions implements KeywordExecutable {
try {
user = options.getUsername();
} catch (Exception e) {
- printException(e);
- return true;
+ logError(e.getMessage());
+ exitCode = 1;
+ return false;
}
String password = options.getPassword();
tabCompletion = !options.isTabCompletionDisabled();
- // Use a ZK, or HdfsZK Accumulo instance
- setInstance(options);
+ try {
+ setInstance(options);
+ } catch (Exception e) {
+ logError(e.getMessage());
+ exitCode = 1;
+ return false;
+ }
- // AuthenticationToken options
try {
token = options.getAuthenticationToken();
} catch (Exception e) {
@@ -372,7 +363,7 @@ public class Shell extends ShellOptions implements KeywordExecutable {
}
if (!options.isFake()) {
- DistributedTrace.enable(InetAddress.getLocalHost().getHostName(), "shell", clientConf);
+ DistributedTrace.enable(InetAddress.getLocalHost().getHostName(), "shell", properties);
}
this.setTableName("");
@@ -456,9 +447,7 @@ public class Shell extends ShellOptions implements KeywordExecutable {
instance = DeprecationUtil.makeMockInstance("fake");
} else {
String instanceName, hosts;
- if (options.isHdfsZooInstance()) {
- instanceName = hosts = null;
- } else if (options.getZooKeeperInstance().size() > 0) {
+ if (options.getZooKeeperInstance().size() > 0) {
List<String> zkOpts = options.getZooKeeperInstance();
instanceName = zkOpts.get(0);
hosts = zkOpts.get(1);
@@ -466,58 +455,49 @@ public class Shell extends ShellOptions implements KeywordExecutable {
instanceName = options.getZooKeeperInstanceName();
hosts = options.getZooKeeperHosts();
}
- final ClientConfiguration clientConf;
- try {
- clientConf = options.getClientConfiguration();
- } catch (ConfigurationException | FileNotFoundException e) {
- throw new IllegalArgumentException("Unable to load client config from " + options.getClientConfigFile(), e);
- }
- instance = getZooInstance(instanceName, hosts, clientConf);
+ final Properties properties = options.getClientProperties();
+ instance = getZooInstance(instanceName, hosts, properties);
}
}
/**
- * Get the ZooKeepers. Use the value passed in (if there was one), then fall back to the ClientConf, finally trying the accumulo-site.xml.
+ * Get the ZooKeepers. Use the value passed in (if there was one), then fall back to value in accumulo-client.properties
*
* @param keepers
* ZooKeepers passed to the shell
- * @param clientConfig
- * ClientConfiguration instance
+ * @param properties
+ * Client properties
* @return The ZooKeepers to connect to
*/
- static String getZooKeepers(String keepers, ClientConfiguration clientConfig) {
+ static String getZooKeepers(String keepers, Properties properties) {
if (null != keepers) {
return keepers;
}
-
- if (clientConfig.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) {
- return clientConfig.get(ClientProperty.INSTANCE_ZK_HOST);
- }
-
- return SiteConfiguration.getInstance().get(Property.INSTANCE_ZK_HOST);
+ return properties.getProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey());
}
- /*
- * Takes instanceName and keepers as separate arguments, rather than just packaged into the clientConfig, so that we can fail over to accumulo-site.xml or
- * HDFS config if they're unspecified.
+ /**
+ * Determines Instance using command line options and properties
+ *
+ * @param instanceName Instance name set on CL
+ * @param keepersOption ZooKeeper CL options
+ * @param properties Config properties
+ * @return Instance
+ * @throws IllegalArgumentException if no instance name or zookeeper can be determined
*/
- private static Instance getZooInstance(String instanceName, String keepersOption, ClientConfiguration clientConfig) {
- UUID instanceId = null;
+ private static Instance getZooInstance(String instanceName, String keepersOption, Properties properties) {
if (instanceName == null) {
- instanceName = clientConfig.get(ClientProperty.INSTANCE_NAME);
+ instanceName = properties.getProperty(ClientProperty.INSTANCE_NAME.getKey());
}
+ String keepers = getZooKeepers(keepersOption, properties);
- String keepers = getZooKeepers(keepersOption, clientConfig);
- if (instanceName == null) {
- AccumuloConfiguration conf = SiteConfiguration.getInstance();
- Path instanceDir = new Path(VolumeConfiguration.getVolumeUris(conf)[0], "instance_id");
- instanceId = UUID.fromString(ZooUtil.getInstanceIDFromHdfs(instanceDir, conf));
+ if (keepers == null) {
+ throw new IllegalArgumentException("ZooKeepers must be set using -z or -zh on command line or in accumulo-client.properties");
}
- if (instanceId != null) {
- return new ZooKeeperInstance(clientConfig.withInstance(instanceId).withZkHosts(keepers));
- } else {
- return new ZooKeeperInstance(clientConfig.withInstance(instanceName).withZkHosts(keepers));
+ if (instanceName == null) {
+ throw new IllegalArgumentException("Instance name must be set using -z or -zi on command line or in accumulo-client.properties");
}
+ return new ZooKeeperInstance(instanceName, keepers);
}
public Connector getConnector() {
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 1ea2beb..ba2f823 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java
@@ -17,21 +17,21 @@
package org.apache.accumulo.shell;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Scanner;
import java.util.TreeMap;
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
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.accumulo.core.conf.SiteConfiguration;
-import org.apache.commons.configuration.ConfigurationException;
+import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.hadoop.security.UserGroupInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +45,7 @@ import com.beust.jcommander.converters.FileConverter;
public class ShellOptionsJC {
private static final Logger log = LoggerFactory.getLogger(ShellOptionsJC.class);
- @Parameter(names = {"-u", "--user"}, description = "username (defaults to your OS user)")
+ @Parameter(names = {"-u", "--user"}, description = "username")
private String username = null;
public static class PasswordConverter implements IStringConverter<String> {
@@ -164,9 +164,6 @@ public class ShellOptionsJC {
converter = FileConverter.class)
private File execFileVerbose;
- @Parameter(names = {"-h", "--hdfsZooInstance"}, description = "use hdfs zoo instance")
- private boolean hdfsZooInstance;
-
@Parameter(names = {"-z", "--zooKeeperInstance"}, description = "use a zookeeper instance with the given instance name and list of zoo hosts. "
+ "Syntax: -z <zoo-instance-name> <zoo-hosts>. Where <zoo-hosts> is a comma separated list of zookeeper servers.", arity = 2)
private List<String> zooKeeperInstance = new ArrayList<>();
@@ -177,9 +174,8 @@ public class ShellOptionsJC {
@Parameter(names = "--sasl", description = "use SASL to connect to Accumulo (Kerberos)")
private boolean useSasl = false;
- @Parameter(names = "--config-file", description = "read the given client config file. "
- + "If omitted, the path searched can be specified with $ACCUMULO_CLIENT_CONF_PATH, "
- + "which defaults to ~/.accumulo/config:$ACCUMULO_CONF_DIR/client.conf:/etc/accumulo/client.conf")
+ @Parameter(names = "--config-file", description = "Read the given accumulo-client.properties file. If omitted, the following locations will be searched "
+ + "~/.accumulo/accumulo-client.properties:$ACCUMULO_CONF_DIR/accumulo-client.properties:/etc/accumulo/accumulo-client.properties")
private String clientConfigFile = null;
@Parameter(names = {"-zi", "--zooKeeperInstanceName"}, description = "use a zookeeper instance with the given instance name. "
@@ -201,30 +197,33 @@ public class ShellOptionsJC {
public String getUsername() throws Exception {
if (null == username) {
- final ClientConfiguration clientConf = getClientConfiguration();
- if (Boolean.parseBoolean(clientConf.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED))) {
- if (!UserGroupInformation.isSecurityEnabled()) {
- throw new RuntimeException("Kerberos security is not enabled");
+ username = getClientProperties().getProperty(ClientProperty.AUTH_USERNAME.getKey());
+ if (username == null || username.isEmpty()) {
+ if (ClientProperty.SASL_ENABLED.getBoolean(getClientProperties())) {
+ if (!UserGroupInformation.isSecurityEnabled()) {
+ throw new IllegalArgumentException("Kerberos security is not enabled. Run with --sasl or set 'sasl.enabled' in accumulo-client.properties");
+ }
+ UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
+ username = ugi.getUserName();
+ } else {
+ throw new IllegalArgumentException("Username is not set. Run with '-u myuser' or set 'auth.username' in accumulo-client.properties");
}
- UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
- username = ugi.getUserName();
- } else {
- username = System.getProperty("user.name", "root");
}
}
return username;
}
public String getPassword() {
+ if (password == null) {
+ password = getClientProperties().getProperty(ClientProperty.AUTH_PASSWORD.getKey());
+ }
return password;
}
public AuthenticationToken getAuthenticationToken() throws Exception {
if (null == authenticationToken) {
- final ClientConfiguration clientConf = getClientConfiguration();
- // Automatically use a KerberosToken if the client conf is configured for SASL
- final boolean saslEnabled = Boolean.parseBoolean(clientConf.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED));
- if (saslEnabled) {
+ // Automatically use a KerberosToken if shell is configured for SASL
+ if (ClientProperty.SASL_ENABLED.getBoolean(getClientProperties())) {
authenticationToken = new KerberosToken();
}
}
@@ -263,10 +262,6 @@ public class ShellOptionsJC {
return execFileVerbose;
}
- public boolean isHdfsZooInstance() {
- return hdfsZooInstance;
- }
-
public List<String> getZooKeeperInstance() {
return zooKeeperInstance;
}
@@ -299,40 +294,54 @@ public class ShellOptionsJC {
}
public String getClientConfigFile() {
+ if (clientConfigFile == null) {
+ List<String> searchPaths = new LinkedList<>();
+ searchPaths.add(System.getProperty("user.home") + "/.accumulo/accumulo-client.properties");
+ if (System.getenv("ACCUMULO_CONF_DIR") != null) {
+ searchPaths.add(System.getenv("ACCUMULO_CONF_DIR") + "/accumulo-client.properties");
+ }
+ searchPaths.add("/etc/accumulo/accumulo-client.properties");
+ for (String path : searchPaths) {
+ File file = new File(path);
+ if (file.isFile() && file.canRead()) {
+ clientConfigFile = file.getAbsolutePath();
+ break;
+ }
+ }
+ }
return clientConfigFile;
}
- public ClientConfiguration getClientConfiguration() throws ConfigurationException, FileNotFoundException {
- ClientConfiguration clientConfig = clientConfigFile == null ? ClientConfiguration.loadDefault() : ClientConfiguration.fromFile(new File(
- getClientConfigFile()));
+ public Properties getClientProperties() {
+ Properties props = new Properties();
+ if (getClientConfigFile() != null) {
+ try (InputStream is = new FileInputStream(getClientConfigFile())) {
+ props.load(is);
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Failed to load properties from " + getClientConfigFile());
+ }
+ }
if (useSsl()) {
- clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SSL_ENABLED, "true");
+ props.setProperty(ClientProperty.SSL_ENABLED.getKey(), "true");
}
if (useSasl()) {
- clientConfig.setProperty(ClientProperty.INSTANCE_RPC_SASL_ENABLED, "true");
+ props.setProperty(ClientProperty.SASL_ENABLED.getKey(), "true");
}
if (!getZooKeeperInstance().isEmpty()) {
List<String> zkOpts = getZooKeeperInstance();
String instanceName = zkOpts.get(0);
String hosts = zkOpts.get(1);
- clientConfig.setProperty(ClientProperty.INSTANCE_ZK_HOST, hosts);
- clientConfig.setProperty(ClientProperty.INSTANCE_NAME, instanceName);
+ props.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), hosts);
+ props.setProperty(ClientProperty.INSTANCE_NAME.getKey(), instanceName);
}
// If the user provided the hosts, set the ZK for tracing too
if (null != zooKeeperHosts && !zooKeeperHosts.isEmpty()) {
- clientConfig.setProperty(ClientProperty.INSTANCE_ZK_HOST, zooKeeperHosts);
+ props.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), zooKeeperHosts);
}
if (null != zooKeeperInstanceName && !zooKeeperInstanceName.isEmpty()) {
- clientConfig.setProperty(ClientProperty.INSTANCE_NAME, zooKeeperInstanceName);
+ props.setProperty(ClientProperty.INSTANCE_NAME.getKey(), zooKeeperInstanceName);
}
-
- // Automatically try to add in the proper ZK from accumulo-site for backwards compat.
- if (!clientConfig.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) {
- AccumuloConfiguration siteConf = SiteConfiguration.getInstance();
- clientConfig.withZkHosts(siteConf.get(Property.INSTANCE_ZK_HOST));
- }
-
- return clientConfig;
+ return props;
}
public boolean useSasl() {
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 5494e23..9892f7e 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellConfigTest.java
@@ -26,9 +26,10 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
+import java.util.Properties;
-import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.shell.ShellTest.TestOutputStream;
import org.apache.log4j.Level;
import org.junit.After;
@@ -101,7 +102,7 @@ public class ShellConfigTest {
@Test
public void testTokenWithoutOptions() throws IOException {
- assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName())));
+ assertFalse(shell.config(args("--fake", "-u", "foo", "-tc", PasswordToken.class.getName())));
assertFalse(output.get().contains(ParameterException.class.getName()));
}
@@ -112,32 +113,21 @@ public class ShellConfigTest {
@Test
public void testTokenAndOptionAndPassword() throws IOException {
- assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-l", "password=foo", "-p", "bar")));
+ assertFalse(shell.config(args("--fake", "-tc", PasswordToken.class.getName(), "-u", "foo", "-l", "password=foo", "-p", "bar")));
assertTrue(output.get().contains(ParameterException.class.getName()));
}
- /**
- * Tests getting the ZK hosts config value will fail on String parameter, client config and then fall back to Site configuration. SiteConfiguration will get
- * the accumulo-site.xml from the classpath in src/test/resources
- */
@Test
- public void testZooKeeperHostFallBackToSite() throws Exception {
- ClientConfiguration clientConfig = ClientConfiguration.create();
- assertFalse("Client config contains zk hosts", clientConfig.containsKey(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST.getKey()));
- assertEquals("ShellConfigTestZKHostValue", Shell.getZooKeepers(null, clientConfig));
+ public void testZooKeeperHostFromClientProps() {
+ Properties props = new Properties();
+ props.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), "cc_hostname");
+ assertEquals("cc_hostname", Shell.getZooKeepers(null, props));
}
@Test
- public void testZooKeeperHostFromClientConfig() throws Exception {
- ClientConfiguration clientConfig = ClientConfiguration.create();
- clientConfig.withZkHosts("cc_hostname");
- assertEquals("cc_hostname", Shell.getZooKeepers(null, clientConfig));
- }
-
- @Test
- public void testZooKeeperHostFromOption() throws Exception {
- ClientConfiguration clientConfig = ClientConfiguration.create();
- clientConfig.withZkHosts("cc_hostname");
- assertEquals("opt_hostname", Shell.getZooKeepers("opt_hostname", clientConfig));
+ public void testZooKeeperHostFromOption() {
+ Properties props = new Properties();
+ props.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), "cc_hostname");
+ assertEquals("opt_hostname", Shell.getZooKeepers("opt_hostname", props));
}
}
diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java
index f8d74ef..e977db9 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java
@@ -18,8 +18,9 @@ package org.apache.accumulo.shell;
import static org.junit.Assert.assertEquals;
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
+import java.util.Properties;
+
+import org.apache.accumulo.core.conf.ClientProperty;
import org.junit.Before;
import org.junit.Test;
@@ -41,8 +42,8 @@ public class ShellOptionsJCTest {
jc.setProgramName("accumulo shell");
jc.addObject(options);
jc.parse(new String[] {"--sasl"});
- ClientConfiguration clientConf = options.getClientConfiguration();
- assertEquals("true", clientConf.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED));
+ Properties properties = options.getClientProperties();
+ assertEquals("true", properties.getProperty(ClientProperty.SASL_ENABLED.getKey()));
}
@Test
@@ -54,9 +55,8 @@ public class ShellOptionsJCTest {
jc.setProgramName("accumulo shell");
jc.addObject(options);
jc.parse(new String[] {"-zh", zk});
- ClientConfiguration clientConf = options.getClientConfiguration();
-
- assertEquals(zk, clientConf.get(ClientProperty.INSTANCE_ZK_HOST));
+ Properties properties = options.getClientProperties();
+ assertEquals(zk, properties.getProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey()));
}
}
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 1216c74..9855f98 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java
@@ -16,12 +16,10 @@
*/
package org.apache.accumulo.shell;
-import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.expect;
import static org.powermock.api.easymock.PowerMock.createMock;
import static org.powermock.api.easymock.PowerMock.expectLastCall;
import static org.powermock.api.easymock.PowerMock.expectNew;
-import static org.powermock.api.easymock.PowerMock.mockStatic;
import static org.powermock.api.easymock.PowerMock.replay;
import static org.powermock.api.easymock.PowerMock.verify;
@@ -29,22 +27,17 @@ import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.UUID;
+import java.util.Properties;
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.ConfigSanityCheck;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.core.zookeeper.ZooUtil;
-import org.apache.hadoop.fs.Path;
import org.apache.log4j.Level;
-import org.easymock.EasyMock;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -133,94 +126,6 @@ public class ShellSetInstanceTest {
}
@Test
- public void testSetInstance_HdfsZooInstance_Explicit() throws Exception {
- testSetInstance_HdfsZooInstance(true, false, false);
- }
-
- @Test
- public void testSetInstance_HdfsZooInstance_InstanceGiven() throws Exception {
- testSetInstance_HdfsZooInstance(false, true, false);
- }
-
- @Test
- public void testSetInstance_HdfsZooInstance_HostsGiven() throws Exception {
- testSetInstance_HdfsZooInstance(false, false, true);
- }
-
- @Test
- public void testSetInstance_HdfsZooInstance_Implicit() throws Exception {
- testSetInstance_HdfsZooInstance(false, false, false);
- }
-
- private void testSetInstance_HdfsZooInstance(boolean explicitHdfs, boolean onlyInstance, boolean onlyHosts) throws Exception {
- ClientConfiguration clientConf = createMock(ClientConfiguration.class);
- ShellOptionsJC opts = createMock(ShellOptionsJC.class);
- expect(opts.isFake()).andReturn(false);
- expect(opts.getClientConfiguration()).andReturn(clientConf);
- expect(opts.isHdfsZooInstance()).andReturn(explicitHdfs);
- if (!explicitHdfs) {
- expect(opts.getZooKeeperInstance()).andReturn(Collections.emptyList());
- if (onlyInstance) {
- expect(opts.getZooKeeperInstanceName()).andReturn("instance");
- expect(clientConf.withInstance("instance")).andReturn(clientConf);
- } else {
- expect(opts.getZooKeeperInstanceName()).andReturn(null);
- }
- if (onlyHosts) {
- expect(opts.getZooKeeperHosts()).andReturn("host3,host4");
- expect(clientConf.withZkHosts("host3,host4")).andReturn(clientConf);
- } else {
- expect(opts.getZooKeeperHosts()).andReturn(null);
- }
- }
- replay(opts);
-
- if (!onlyInstance) {
- expect(clientConf.get(ClientProperty.INSTANCE_NAME)).andReturn(null);
- }
-
- mockStatic(ConfigSanityCheck.class);
- ConfigSanityCheck.validate(EasyMock.<AccumuloConfiguration> anyObject());
- expectLastCall().atLeastOnce();
- replay(ConfigSanityCheck.class);
-
- if (!onlyHosts) {
- expect(clientConf.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())).andReturn(true).atLeastOnce();
- expect(clientConf.get(ClientProperty.INSTANCE_ZK_HOST)).andReturn("host1,host2").atLeastOnce();
- expect(clientConf.withZkHosts("host1,host2")).andReturn(clientConf);
- }
- if (!onlyInstance) {
- expect(clientConf.containsKey(Property.INSTANCE_VOLUMES.getKey())).andReturn(false).atLeastOnce();
- @SuppressWarnings("deprecation")
- String INSTANCE_DFS_DIR_KEY = Property.INSTANCE_DFS_DIR.getKey();
- @SuppressWarnings("deprecation")
- String INSTANCE_DFS_URI_KEY = Property.INSTANCE_DFS_URI.getKey();
- expect(clientConf.containsKey(INSTANCE_DFS_DIR_KEY)).andReturn(true).atLeastOnce();
- expect(clientConf.containsKey(INSTANCE_DFS_URI_KEY)).andReturn(true).atLeastOnce();
- expect(clientConf.getString(INSTANCE_DFS_URI_KEY)).andReturn("hdfs://nn1").atLeastOnce();
- expect(clientConf.getString(INSTANCE_DFS_DIR_KEY)).andReturn("/dfs").atLeastOnce();
- }
-
- UUID randomUUID = null;
- if (!onlyInstance) {
- mockStatic(ZooUtil.class);
- randomUUID = UUID.randomUUID();
- expect(ZooUtil.getInstanceIDFromHdfs(anyObject(Path.class), anyObject(AccumuloConfiguration.class))).andReturn(randomUUID.toString());
- replay(ZooUtil.class);
- expect(clientConf.withInstance(randomUUID)).andReturn(clientConf);
- }
- replay(clientConf);
-
- ZooKeeperInstance theInstance = createMock(ZooKeeperInstance.class);
-
- expectNew(ZooKeeperInstance.class, new Class<?>[] {ClientConfiguration.class}, clientConf).andReturn(theInstance);
- replay(theInstance, ZooKeeperInstance.class);
-
- shell.setInstance(opts);
- verify(theInstance, ZooKeeperInstance.class);
- }
-
- @Test
public void testSetInstance_ZKInstance_DashZ() throws Exception {
testSetInstance_ZKInstance(true);
}
@@ -231,37 +136,31 @@ public class ShellSetInstanceTest {
}
private void testSetInstance_ZKInstance(boolean dashZ) throws Exception {
- ClientConfiguration clientConf = createMock(ClientConfiguration.class);
+ Properties props = createMock(Properties.class);
ShellOptionsJC opts = createMock(ShellOptionsJC.class);
expect(opts.isFake()).andReturn(false);
- expect(opts.getClientConfiguration()).andReturn(clientConf);
- expect(opts.isHdfsZooInstance()).andReturn(false);
- expect(clientConf.getKeys()).andReturn(Arrays.asList(ClientProperty.INSTANCE_NAME.getKey(), ClientProperty.INSTANCE_ZK_HOST.getKey()).iterator());
- expect(clientConf.getString(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey())).andReturn(null);
+ expect(opts.getClientProperties()).andReturn(new Properties());
+ expect(props.getProperty(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey())).andReturn(null);
if (dashZ) {
- expect(clientConf.withInstance("foo")).andReturn(clientConf);
- expect(clientConf.getString(ClientProperty.INSTANCE_NAME.getKey())).andReturn("foo");
- expect(clientConf.withZkHosts("host1,host2")).andReturn(clientConf);
- expect(clientConf.getString(ClientProperty.INSTANCE_ZK_HOST.getKey())).andReturn("host1,host2");
+ expect(props.getProperty(ClientProperty.INSTANCE_NAME.getKey())).andReturn("foo");
+ expect(props.getProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey())).andReturn("host1,host2");
List<String> zl = new java.util.ArrayList<>();
- zl.add("foo");
- zl.add("host1,host2");
+ zl.add("bar");
+ zl.add("host3,host4");
expect(opts.getZooKeeperInstance()).andReturn(zl);
expectLastCall().anyTimes();
} else {
- expect(clientConf.withInstance("bar")).andReturn(clientConf);
- expect(clientConf.getString(ClientProperty.INSTANCE_NAME.getKey())).andReturn("bar");
- expect(clientConf.withZkHosts("host3,host4")).andReturn(clientConf);
- expect(clientConf.getString(ClientProperty.INSTANCE_ZK_HOST.getKey())).andReturn("host3,host4");
+ expect(props.getProperty(ClientProperty.INSTANCE_NAME.getKey())).andReturn("bar");
+ expect(props.getProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey())).andReturn("host3,host4");
expect(opts.getZooKeeperInstance()).andReturn(Collections.emptyList());
expect(opts.getZooKeeperInstanceName()).andReturn("bar");
expect(opts.getZooKeeperHosts()).andReturn("host3,host4");
}
- replay(clientConf);
+ replay(props);
replay(opts);
ZooKeeperInstance theInstance = createMock(ZooKeeperInstance.class);
- expectNew(ZooKeeperInstance.class, new Class<?>[] {ClientConfiguration.class}, clientConf).andReturn(theInstance);
+ expectNew(ZooKeeperInstance.class, new Class<?>[] {String.class, String.class}, "bar", "host3,host4").andReturn(theInstance);
replay(theInstance, ZooKeeperInstance.class);
shell.setInstance(opts);
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 fdb8cfa..bc91306 100644
--- a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
+++ b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
@@ -27,7 +27,6 @@ import org.apache.accumulo.cluster.ClusterControl;
import org.apache.accumulo.cluster.ClusterUser;
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.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.admin.SecurityOperations;
@@ -39,7 +38,6 @@ import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.harness.conf.AccumuloClusterConfiguration;
import org.apache.accumulo.harness.conf.AccumuloClusterPropertyConfiguration;
-import org.apache.accumulo.harness.conf.AccumuloMiniClusterConfiguration;
import org.apache.accumulo.harness.conf.StandaloneAccumuloClusterConfiguration;
import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
@@ -119,8 +117,6 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase implements M
// Intrinsically performs the callback to let tests alter MiniAccumuloConfig and core-site.xml
MiniAccumuloClusterImpl impl = miniClusterHarness.create(this, getAdminToken(), krb);
cluster = impl;
- // MAC makes a ClientConf for us, just set it
- ((AccumuloMiniClusterConfiguration) clusterConf).setClientConf(impl.getClientConfig());
// Login as the "root" user
if (null != krb) {
ClusterUser rootUser = krb.getRootUser();
@@ -130,8 +126,7 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase implements M
break;
case STANDALONE:
StandaloneAccumuloClusterConfiguration conf = (StandaloneAccumuloClusterConfiguration) clusterConf;
- ClientConfiguration clientConf = conf.getClientConf();
- StandaloneAccumuloCluster standaloneCluster = new StandaloneAccumuloCluster(conf.getInstance(), clientConf, conf.getTmpDirectory(), conf.getUsers());
+ StandaloneAccumuloCluster standaloneCluster = new StandaloneAccumuloCluster(cluster.getConnectionInfo(), conf.getTmpDirectory(), conf.getUsers());
// If these are provided in the configuration, pass them into the cluster
standaloneCluster.setAccumuloHome(conf.getAccumuloHome());
standaloneCluster.setClientAccumuloConfDir(conf.getClientAccumuloConfDir());
@@ -142,7 +137,7 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase implements M
// 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.hasSasl()) {
+ if (saslEnabled()) {
UserGroupInformation.setConfiguration(hadoopConfiguration);
// Login as the admin user to start the tests
UserGroupInformation.loginUserFromKeytab(conf.getAdminPrincipal(), conf.getAdminKeytab().getAbsolutePath());
@@ -253,8 +248,15 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase implements M
}
public static ConnectionInfo getConnectionInfo() {
- return Connector.builder().forInstance(getCluster().getInstanceName(), getCluster().getZooKeepers()).usingToken(getAdminPrincipal(), getAdminToken())
- .info();
+ checkState(initialized);
+ return getCluster().getConnectionInfo();
+ }
+
+ public static boolean saslEnabled() {
+ if (initialized) {
+ return getConnectionInfo().saslEnabled();
+ }
+ return false;
}
public static AuthenticationToken getAdminToken() {
diff --git a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java
index 31ed94a..8e07173 100644
--- a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java
+++ b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java
@@ -16,7 +16,6 @@
*/
package org.apache.accumulo.harness.conf;
-import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.harness.AccumuloClusterHarness.ClusterType;
@@ -30,6 +29,4 @@ public interface AccumuloClusterConfiguration {
String getAdminPrincipal();
AuthenticationToken getAdminToken();
-
- ClientConfiguration getClientConf();
}
diff --git a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
index 5062384..7193e18 100644
--- a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
+++ b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
@@ -38,7 +38,6 @@ public abstract class AccumuloClusterPropertyConfiguration implements AccumuloCl
private static final Logger log = LoggerFactory.getLogger(AccumuloClusterPropertyConfiguration.class);
public static final String ACCUMULO_IT_PROPERTIES_FILE = "accumulo.it.properties";
-
public static final String ACCUMULO_CLUSTER_TYPE_KEY = "accumulo.it.cluster.type";
public static final String ACCUMULO_MINI_PREFIX = "accumulo.it.cluster.mini.";
@@ -46,8 +45,6 @@ public abstract class AccumuloClusterPropertyConfiguration implements AccumuloCl
public static final String ACCUMULO_CLUSTER_CLIENT_CONF_KEY = "accumulo.it.cluster.clientconf";
- protected ClusterType clusterType;
-
public static AccumuloClusterPropertyConfiguration get() {
Properties systemProperties = System.getProperties();
diff --git a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java
index dea72e5..b012a38 100644
--- a/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java
+++ b/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java
@@ -16,13 +16,10 @@
*/
package org.apache.accumulo.harness.conf;
-import static java.util.Objects.requireNonNull;
-
import java.io.IOException;
import java.util.Map;
import org.apache.accumulo.cluster.ClusterUser;
-import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.KerberosToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
@@ -49,7 +46,6 @@ public class AccumuloMiniClusterConfiguration extends AccumuloClusterPropertyCon
private final Map<String,String> conf;
private final boolean saslEnabled;
- private ClientConfiguration clientConf;
public AccumuloMiniClusterConfiguration() {
ClusterType type = getClusterType();
@@ -105,14 +101,4 @@ public class AccumuloMiniClusterConfiguration extends AccumuloClusterPropertyCon
public ClusterType getClusterType() {
return ClusterType.MINI;
}
-
- @Override
- public ClientConfiguration getClientConf() {
- return clientConf;
- }
-
- public void setClientConf(ClientConfiguration conf) {
- requireNonNull(conf, "Client configuration was null");
- this.clientConf = conf;
- }
}
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 f29c79f..243d0ab 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
@@ -27,10 +27,8 @@ import java.util.Map;
import java.util.Map.Entry;
import org.apache.accumulo.cluster.ClusterUser;
-import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.ConnectionInfo;
+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;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
@@ -76,27 +74,19 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
private Map<String,String> conf;
private String serverUser;
- private File clientConfFile;
- private ClientConfiguration clientConf;
+ private ConnectionInfo connectionInfo;
private List<ClusterUser> clusterUsers;
+ private File clientPropsFile;
- public StandaloneAccumuloClusterConfiguration(File clientConfFile) {
+ public StandaloneAccumuloClusterConfiguration(File clientPropsFile) {
ClusterType type = getClusterType();
if (ClusterType.STANDALONE != type) {
throw new IllegalStateException("Expected only to see standalone cluster state");
}
this.conf = getConfiguration(type);
- this.clientConfFile = clientConfFile;
- this.clientConf = ClientConfiguration.fromFile(clientConfFile);
- // Update instance name if not already set
- if (!clientConf.containsKey(ClientProperty.INSTANCE_NAME.getKey())) {
- clientConf.withInstance(getInstanceName());
- }
- // Update zookeeper hosts if not already set
- if (!clientConf.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) {
- clientConf.withZkHosts(getZooKeepers());
- }
+ this.clientPropsFile = clientPropsFile;
+ connectionInfo = Connector.builder().forInstance(getInstanceName(), getZooKeepers()).usingToken(getAdminPrincipal(), getAdminToken()).info();
// The user Accumulo is running as
serverUser = conf.get(ACCUMULO_STANDALONE_SERVER_USER);
@@ -135,6 +125,10 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
return principal;
}
+ public ConnectionInfo getConnectionInfo() {
+ return connectionInfo;
+ }
+
public String getPassword() {
String password = conf.get(ACCUMULO_STANDALONE_PASSWORD_KEY);
if (null == password) {
@@ -145,8 +139,8 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
public File getAdminKeytab() {
String keytabPath = conf.get(ACCUMULO_STANDALONE_ADMIN_KEYTAB_KEY);
- if (null == keytabPath) {
- throw new RuntimeException("SASL is enabled, but " + ACCUMULO_STANDALONE_ADMIN_KEYTAB_KEY + " was not provided");
+ if (keytabPath == null || keytabPath.isEmpty()) {
+ return null;
}
File keytab = new File(keytabPath);
if (!keytab.exists() || !keytab.isFile()) {
@@ -157,8 +151,8 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
@Override
public AuthenticationToken getAdminToken() {
- if (clientConf.hasSasl()) {
- File keytab = getAdminKeytab();
+ File keytab = getAdminKeytab();
+ if (keytab != null) {
try {
UserGroupInformation.loginUserFromKeytab(getAdminPrincipal(), keytab.getAbsolutePath());
return new KerberosToken();
@@ -172,10 +166,6 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
}
public String getZooKeepers() {
- if (clientConf.containsKey(ClientProperty.INSTANCE_ZK_HOST.getKey())) {
- return clientConf.get(ClientProperty.INSTANCE_ZK_HOST);
- }
-
String zookeepers = conf.get(ACCUMULO_STANDALONE_ZOOKEEPERS_KEY);
if (null == zookeepers) {
zookeepers = ACCUMULO_STANDALONE_ZOOKEEPERS_DEFAULT;
@@ -184,10 +174,6 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
}
public String getInstanceName() {
- if (clientConf.containsKey(ClientProperty.INSTANCE_NAME.getKey())) {
- return clientConf.get(ClientProperty.INSTANCE_NAME);
- }
-
String instanceName = conf.get(ACCUMULO_STANDALONE_INSTANCE_NAME_KEY);
if (null == instanceName) {
instanceName = ACCUMULO_STANDALONE_INSTANCE_NAME_DEFAULT;
@@ -195,11 +181,6 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
return instanceName;
}
- public Instance getInstance() {
- // Make sure the ZKI is created with the ClientConf so it gets things like SASL passed through to the connector
- return new ZooKeeperInstance(clientConf);
- }
-
@Override
public ClusterType getClusterType() {
return ClusterType.STANDALONE;
@@ -229,13 +210,8 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
return conf.get(ACCUMULO_STANDALONE_CLIENT_CMD_PREFIX);
}
- @Override
- public ClientConfiguration getClientConf() {
- return clientConf;
- }
-
- public File getClientConfFile() {
- return clientConfFile;
+ public File getClientPropsFile() {
+ return clientPropsFile;
}
public Path getTmpDirectory() {
diff --git a/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java b/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java
index 6a6604f..a372297 100644
--- a/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java
+++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterIterator.java
@@ -26,13 +26,10 @@ import java.util.concurrent.TimeUnit;
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.Connector;
-import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.impl.TabletLocator;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.data.ByteSequence;
@@ -156,10 +153,8 @@ public class BatchWriterIterator extends WrappingIterator {
}
private void initBatchWriter() {
- ClientConfiguration cc = ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zookeeperHost).withZkTimeout(zookeeperTimeout);
- Instance instance = new ZooKeeperInstance(cc);
try {
- connector = instance.getConnector(username, auth);
+ connector = Connector.builder().forInstance(instanceName, zookeeperHost).usingToken(username, auth).withZkTimeout(zookeeperTimeout).build();
} catch (Exception e) {
log.error("failed to connect to Accumulo instance " + instanceName, e);
throw new RuntimeException(e);
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 21c3799..8dfd817 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -47,7 +47,6 @@ import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
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.ConditionalWriter;
import org.apache.accumulo.core.client.ConditionalWriter.Result;
import org.apache.accumulo.core.client.ConditionalWriter.Status;
@@ -233,12 +232,10 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
String tableName = getUniqueNames(1)[0];
String user = null;
- ClientConfiguration clientConf = cluster.getClientConfig();
- final boolean saslEnabled = clientConf.hasSasl();
ClusterUser user1 = getUser(0);
user = user1.getPrincipal();
- if (saslEnabled) {
+ if (saslEnabled()) {
// The token is pointless for kerberos
conn.securityOperations().createLocalUser(user, null);
} else {
@@ -1197,13 +1194,11 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
// test against table user does not have read and/or write permissions for
Connector conn = getConnector();
String user = null;
- ClientConfiguration clientConf = cluster.getClientConfig();
- final boolean saslEnabled = clientConf.hasSasl();
// Create a new user
ClusterUser user1 = getUser(0);
user = user1.getPrincipal();
- if (saslEnabled) {
+ if (saslEnabled()) {
conn.securityOperations().createLocalUser(user, null);
} else {
conn.securityOperations().createLocalUser(user, new PasswordToken(user1.getPassword()));
@@ -1426,7 +1421,7 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
String tableName = getUniqueNames(1)[0];
conn.tableOperations().create(tableName);
- DistributedTrace.enable("localhost", "testTrace", mac.getClientConfig());
+ DistributedTrace.enable("localhost", "testTrace", mac.getConnectionInfo().getProperties());
sleepUninterruptibly(1, TimeUnit.SECONDS);
Span root = Trace.on("traceTest");
try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig())) {
diff --git a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
index 50e50b6..b55a53c 100644
--- a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
@@ -24,10 +24,8 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.MasterClient;
import org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
@@ -84,8 +82,7 @@ public class DetectDeadTabletServersIT extends ConfigurableMacBase {
}
private MasterMonitorInfo getStats(Connector c) throws Exception {
- Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
- ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
Client client = null;
while (true) {
try {
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 99ce613..87cb057 100644
--- a/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
+++ b/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
@@ -33,13 +33,10 @@ import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
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.Connector;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.security.Authorizations;
@@ -54,8 +51,8 @@ import com.google.common.collect.Iterators;
*/
public class IMMLGBenchmark {
public static void main(String[] args) throws Exception {
- ZooKeeperInstance zki = new ZooKeeperInstance(ClientConfiguration.create().withInstance("test16").withZkHosts("localhost"));
- Connector conn = zki.getConnector("root", new PasswordToken("secret"));
+
+ Connector conn = Connector.builder().forInstance("test16", "localhost").usingPassword("root", "secret").build();
int numlg = Integer.parseInt(args[0]);
diff --git a/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
index 4e333d7..8d8f81b 100644
--- a/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
@@ -28,8 +28,6 @@ import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.impl.KeyExtent;
@@ -72,7 +70,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacBase {
public void test() throws Exception {
// make some tablets, spread 'em around
Connector c = getConnector();
- ClientContext context = new ClientContext(c.getInstance(), new Credentials("root", new PasswordToken(ROOT_PASSWORD)), getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
String table = this.getUniqueNames(1)[0];
c.securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
c.securityOperations().grantTablePermission("root", RootTable.NAME, TablePermission.WRITE);
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java b/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
index 539a337..9ee2962 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
@@ -18,7 +18,6 @@
package org.apache.accumulo.test;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.Table;
import org.apache.accumulo.core.client.impl.Writer;
import org.apache.accumulo.core.data.Mutation;
@@ -43,8 +42,7 @@ public class MetaConstraintRetryIT extends AccumuloClusterHarness {
getConnector().securityOperations().grantTablePermission(getAdminPrincipal(), MetadataTable.NAME, TablePermission.WRITE);
- Credentials credentials = new Credentials(getAdminPrincipal(), getAdminToken());
- ClientContext context = new ClientContext(getConnector().getInstance(), credentials, cluster.getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
Writer w = new Writer(context, MetadataTable.ID);
KeyExtent extent = new KeyExtent(Table.ID.of("5"), null, null);
diff --git a/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
index 8f61809..b5362e9 100644
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -32,7 +32,6 @@ import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.MultiTableBatchWriterImpl;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
@@ -63,7 +62,7 @@ public class MultiTableBatchWriterIT extends AccumuloClusterHarness {
}
public MultiTableBatchWriter getMultiTableBatchWriter() {
- ClientContext context = new ClientContext(connector.getInstance(), new Credentials(getAdminPrincipal(), getAdminToken()), getCluster().getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
return new MultiTableBatchWriterImpl(context, new BatchWriterConfig());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java b/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
index f90435d..793736f 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
@@ -67,28 +67,28 @@ public class ShellConfigIT extends AccumuloClusterHarness {
// ensure experimental props do not show up in config output unless set
AuthenticationToken token = getAdminToken();
- File clientConfFile = null;
+ File clientPropsFile = null;
switch (getClusterType()) {
case MINI:
MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) getCluster();
- clientConfFile = mac.getConfig().getClientConfFile();
+ clientPropsFile = mac.getConfig().getClientPropsFile();
break;
case STANDALONE:
StandaloneAccumuloClusterConfiguration standaloneConf = (StandaloneAccumuloClusterConfiguration) getClusterConfiguration();
- clientConfFile = standaloneConf.getClientConfFile();
+ clientPropsFile = standaloneConf.getClientPropsFile();
break;
default:
Assert.fail("Unknown cluster type");
}
- Assert.assertNotNull(clientConfFile);
+ Assert.assertNotNull(clientPropsFile);
TestShell ts = null;
if (token instanceof PasswordToken) {
String passwd = new String(((PasswordToken) token).getPassword(), UTF_8);
- ts = new TestShell(getAdminPrincipal(), passwd, getCluster().getInstanceName(), getCluster().getZooKeepers(), clientConfFile);
+ ts = new TestShell(getAdminPrincipal(), passwd, getCluster().getInstanceName(), getCluster().getZooKeepers(), clientPropsFile);
} else if (token instanceof KerberosToken) {
- ts = new TestShell(getAdminPrincipal(), null, getCluster().getInstanceName(), getCluster().getZooKeepers(), clientConfFile);
+ ts = new TestShell(getAdminPrincipal(), null, getCluster().getInstanceName(), getCluster().getZooKeepers(), clientPropsFile);
} else {
Assert.fail("Unknown token type");
}
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 2040c91..55c6644 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
@@ -44,7 +44,7 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.Scanner;
@@ -160,14 +160,13 @@ public class ShellServerIT extends SharedMiniClusterBase {
public Shell shell;
TestShell(String user, String rootPass, String instanceName, String zookeepers, File configFile) throws IOException {
- ClientConfiguration clientConf;
- clientConf = ClientConfiguration.fromFile(configFile);
+ ConnectionInfo info = Connector.builder().usingProperties(configFile.getAbsolutePath()).info();
// start the shell
output = new TestOutputStream();
input = new StringInputStream();
shell = new Shell(new ConsoleReader(input, output));
shell.setLogErrorsToConsole();
- if (clientConf.hasSasl()) {
+ if (info.saslEnabled()) {
// Pull the kerberos principal out when we're using SASL
shell.config("-u", user, "-z", instanceName, zookeepers, "--config-file", configFile.getAbsolutePath());
} else {
@@ -291,7 +290,7 @@ public class ShellServerIT extends SharedMiniClusterBase {
@Before
public void setupShell() throws Exception {
ts = new TestShell(getPrincipal(), getRootPassword(), getCluster().getConfig().getInstanceName(), getCluster().getConfig().getZooKeepers(), getCluster()
- .getConfig().getClientConfFile());
+ .getConfig().getClientPropsFile());
}
@AfterClass
@@ -342,7 +341,7 @@ public class ShellServerIT extends SharedMiniClusterBase {
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().hasSasl()) {
+ if (getCluster().getConnectionInfo().saslEnabled()) {
// 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/ThriftServerBindsBeforeZooKeeperLockIT.java b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
index 76e0c67..0f1cd74 100644
--- a/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
@@ -24,7 +24,6 @@ import java.util.Collection;
import java.util.List;
import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.util.MonitorUtil;
import org.apache.accumulo.fate.zookeeper.ZooReader;
@@ -66,10 +65,9 @@ public class ThriftServerBindsBeforeZooKeeperLockIT extends AccumuloClusterHarne
getClusterControl().start(ServerType.MONITOR, "localhost");
}
- final ZooKeeperInstance inst = new ZooKeeperInstance(cluster.getClientConfig());
while (true) {
try {
- MonitorUtil.getLocation(inst);
+ MonitorUtil.getLocation(getConnector().getInstance());
break;
} catch (Exception e) {
LOG.debug("Failed to find active monitor location, retrying", e);
@@ -125,13 +123,13 @@ public class ThriftServerBindsBeforeZooKeeperLockIT extends AccumuloClusterHarne
@Test
public void testMasterService() throws Exception {
final MiniAccumuloClusterImpl cluster = (MiniAccumuloClusterImpl) getCluster();
- final ZooKeeperInstance inst = new ZooKeeperInstance(cluster.getClientConfig());
+ final String instanceID = getConnector().getInstance().getInstanceID();
// Wait for the Master to grab its lock
while (true) {
- final ZooReader reader = new ZooReader(inst.getZooKeepers(), 30000);
+ final ZooReader reader = new ZooReader(cluster.getZooKeepers(), 30000);
try {
- List<String> locks = reader.getChildren(Constants.ZROOT + "/" + inst.getInstanceID() + Constants.ZMASTER_LOCK);
+ List<String> locks = reader.getChildren(Constants.ZROOT + "/" + instanceID + Constants.ZMASTER_LOCK);
if (locks.size() > 0) {
break;
}
@@ -186,13 +184,13 @@ public class ThriftServerBindsBeforeZooKeeperLockIT extends AccumuloClusterHarne
@Test
public void testGarbageCollectorPorts() throws Exception {
final MiniAccumuloClusterImpl cluster = (MiniAccumuloClusterImpl) getCluster();
- final ZooKeeperInstance inst = new ZooKeeperInstance(cluster.getClientConfig());
+ String instanceID = getConnector().getInstance().getInstanceID();
// Wait for the Master to grab its lock
while (true) {
- final ZooReader reader = new ZooReader(inst.getZooKeepers(), 30000);
+ final ZooReader reader = new ZooReader(cluster.getZooKeepers(), 30000);
try {
- List<String> locks = reader.getChildren(Constants.ZROOT + "/" + inst.getInstanceID() + Constants.ZGC_LOCK);
+ List<String> locks = reader.getChildren(Constants.ZROOT + "/" + instanceID + Constants.ZGC_LOCK);
if (locks.size() > 0) {
break;
}
diff --git a/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java b/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
index e3734b1..d92ecd2 100644
--- a/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
@@ -76,7 +76,7 @@ public class TracerRecoversAfterOfflineTableIT extends ConfigurableMacBase {
log.info("Start a distributed trace span");
- DistributedTrace.enable("localhost", "testTrace", getClientConfig());
+ DistributedTrace.enable("localhost", "testTrace", getConnectionInfo().getProperties());
Span root = Trace.on("traceTest");
BatchWriter bw = conn.createBatchWriter(tableName, null);
Mutation m = new Mutation("m");
diff --git a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
index 9663bb7..c224c2f 100644
--- a/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TransportCachingIT.java
@@ -24,11 +24,9 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.ThriftTransportKey;
import org.apache.accumulo.core.client.impl.ThriftTransportPool;
import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
@@ -55,8 +53,7 @@ public class TransportCachingIT extends AccumuloClusterHarness {
public void testCachedTransport() {
Connector conn = getConnector();
Instance instance = conn.getInstance();
- ClientConfiguration clientConf = cluster.getClientConfig();
- ClientContext context = new ClientContext(instance, new Credentials(getAdminPrincipal(), getAdminToken()), clientConf);
+ ClientContext context = new ClientContext(getConnectionInfo());
long rpcTimeout = ConfigurationTypeHelper.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT.getDefaultValue());
// create list of servers
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 363702d..dd509f3 100644
--- a/test/src/main/java/org/apache/accumulo/test/UsersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UsersIT.java
@@ -40,7 +40,7 @@ public class UsersIT extends AccumuloClusterHarness {
// Ensure that the user exists
if (!currentUsers.contains(user0.getPrincipal())) {
PasswordToken token = null;
- if (!getCluster().getClientConfig().hasSasl()) {
+ if (!saslEnabled()) {
token = new PasswordToken(user0.getPassword());
}
conn.securityOperations().createLocalUser(user0.getPrincipal(), token);
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index 9eb8fef..2dae135 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -44,7 +44,6 @@ import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.admin.DiskUsage;
import org.apache.accumulo.core.client.admin.NewTableConfiguration;
import org.apache.accumulo.core.client.impl.Table;
@@ -274,7 +273,7 @@ public class VolumeIT extends ConfigurableMacBase {
String[] tableNames = getUniqueNames(2);
// grab this before shutting down cluster
- String uuid = new ZooKeeperInstance(cluster.getClientConfig()).getInstanceID();
+ String uuid = getConnector().getInstance().getInstanceID();
verifyVolumesUsed(tableNames[0], false, v1, v2);
@@ -317,7 +316,7 @@ public class VolumeIT extends ConfigurableMacBase {
String[] tableNames = getUniqueNames(2);
// grab this before shutting down cluster
- String uuid = new ZooKeeperInstance(cluster.getClientConfig()).getInstanceID();
+ String uuid = getConnector().getInstance().getInstanceID();
verifyVolumesUsed(tableNames[0], false, v1, v2);
@@ -501,7 +500,7 @@ public class VolumeIT extends ConfigurableMacBase {
// check that root tablet is not on volume 1
ZooReader zreader = new ZooReader(cluster.getZooKeepers(), 30000);
- String zpath = ZooUtil.getRoot(new ZooKeeperInstance(cluster.getClientConfig())) + RootTable.ZROOT_TABLET_PATH;
+ String zpath = ZooUtil.getRoot(getConnector().getInstance()) + RootTable.ZROOT_TABLET_PATH;
String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
Assert.assertTrue(rootTabletDir.startsWith(v2.toString()));
@@ -562,7 +561,7 @@ public class VolumeIT extends ConfigurableMacBase {
// check that root tablet is not on volume 1 or 2
ZooReader zreader = new ZooReader(cluster.getZooKeepers(), 30000);
- String zpath = ZooUtil.getRoot(new ZooKeeperInstance(cluster.getClientConfig())) + RootTable.ZROOT_TABLET_PATH;
+ String zpath = ZooUtil.getRoot(getConnector().getInstance()) + RootTable.ZROOT_TABLET_PATH;
String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
Assert.assertTrue(rootTabletDir.startsWith(v8.toString()) || rootTabletDir.startsWith(v9.toString()));
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
index fcd0126..fadfdc5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
@@ -30,10 +30,8 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.MasterClient;
import org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.master.thrift.MasterClientService;
import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
@@ -100,8 +98,7 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacBase {
}
private void checkBalance(Connector c) throws Exception {
- Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
- ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
MasterMonitorInfo stats = null;
int unassignedTablets = 1;
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 67f0683..ec9a526 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
@@ -28,12 +28,10 @@ import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
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.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.TableExistsException;
import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.impl.ClientContext;
import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.MasterClient;
@@ -125,10 +123,9 @@ public class BalanceInPresenceOfOfflineTableIT extends AccumuloClusterHarness {
TestIngest.Opts opts = new TestIngest.Opts();
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
- ClientConfiguration conf = cluster.getClientConfig();
- if (conf.hasSasl()) {
- opts.updateKerberosCredentials(cluster.getClientConfig());
- vopts.updateKerberosCredentials(cluster.getClientConfig());
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
+ vopts.updateKerberosCredentials();
} else {
opts.setPrincipal("root");
vopts.setPrincipal("root");
@@ -154,10 +151,10 @@ public class BalanceInPresenceOfOfflineTableIT extends AccumuloClusterHarness {
MasterClientService.Iface client = null;
MasterMonitorInfo stats = null;
- Instance instance = new ZooKeeperInstance(cluster.getClientConfig());
+ Instance instance = getConnector().getInstance();
while (true) {
try {
- client = MasterClient.getConnectionWithRetry(new ClientContext(instance, creds, cluster.getClientConfig()));
+ client = MasterClient.getConnectionWithRetry(new ClientContext(getConnectionInfo()));
stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(instance));
break;
} catch (ThriftSecurityException exception) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
index 6b7ca47..e253dfb 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
@@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
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.Connector;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.KerberosToken;
@@ -128,8 +127,7 @@ public class BulkSplitOptimizationIT extends AccumuloClusterHarness {
opts.setPassword(new Password(new String(token.getPassword(), UTF_8)));
opts.setPrincipal(getAdminPrincipal());
} else if (adminToken instanceof KerberosToken) {
- ClientConfiguration clientConf = cluster.getClientConfig();
- opts.updateKerberosCredentials(clientConf);
+ opts.updateKerberosCredentials(saslEnabled());
} else {
Assert.fail("Unknown token type");
}
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 712babb..d801659 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
@@ -22,7 +22,7 @@ import java.util.stream.Stream;
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.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.admin.NewTableConfiguration;
import org.apache.accumulo.core.conf.Property;
@@ -67,10 +67,10 @@ public class ChaoticBalancerIT extends AccumuloClusterHarness {
vopts.rows = opts.rows = 20000;
opts.setTableName(tableName);
vopts.setTableName(tableName);
- ClientConfiguration clientConfig = getCluster().getClientConfig();
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
- vopts.updateKerberosCredentials(clientConfig);
+ ConnectionInfo connectionInfo = getCluster().getConnectionInfo();
+ if (connectionInfo.saslEnabled()) {
+ opts.updateKerberosCredentials(connectionInfo.saslEnabled());
+ vopts.updateKerberosCredentials(connectionInfo.saslEnabled());
} else {
opts.setPrincipal(getAdminPrincipal());
vopts.setPrincipal(getAdminPrincipal());
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 6df3549..4806234 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
@@ -28,7 +28,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
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.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.admin.InstanceOperations;
@@ -122,7 +121,6 @@ public class CompactionIT extends AccumuloClusterHarness {
int beforeCount = countFiles(c);
final AtomicBoolean fail = new AtomicBoolean(false);
- final ClientConfiguration clientConf = cluster.getClientConfig();
final int THREADS = 5;
for (int count = 0; count < THREADS; count++) {
ExecutorService executor = Executors.newFixedThreadPool(THREADS);
@@ -140,8 +138,8 @@ public class CompactionIT extends AccumuloClusterHarness {
opts.dataSize = 50;
opts.cols = 1;
opts.setTableName(tableName);
- if (clientConf.hasSasl()) {
- opts.updateKerberosCredentials(clientConf);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
PasswordToken passwordToken = (PasswordToken) getAdminToken();
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 c243f76..05255f3 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
@@ -27,11 +27,8 @@ import java.util.Map;
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.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.util.MonitorUtil;
@@ -181,13 +178,7 @@ public class ConfigurableMacBase extends AccumuloITBase {
return getCluster().exec(clazz, args);
}
- protected String getMonitor() throws KeeperException, InterruptedException {
- Instance instance = new ZooKeeperInstance(getCluster().getClientConfig());
- return MonitorUtil.getLocation(instance);
+ protected String getMonitor() throws KeeperException, InterruptedException, AccumuloSecurityException, AccumuloException {
+ return MonitorUtil.getLocation(getConnector().getInstance());
}
-
- protected ClientConfiguration getClientConfig() throws Exception {
- return ClientConfiguration.fromFile(getCluster().getConfig().getClientConfFile());
- }
-
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConnectorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConnectorIT.java
index 5846ec0..7c6971d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConnectorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConnectorIT.java
@@ -45,7 +45,7 @@ public class ConnectorIT extends AccumuloClusterHarness {
ConnectionInfo info = Connector.builder().forInstance(instanceName, zookeepers).usingPassword(user, password).info();
Assert.assertEquals(instanceName, info.getInstanceName());
- Assert.assertEquals(zookeepers, info.getZookeepers());
+ Assert.assertEquals(zookeepers, info.getZooKeepers());
Assert.assertEquals(user, info.getPrincipal());
Assert.assertTrue(info.getAuthenticationToken() instanceof PasswordToken);
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 9ba87a5..7a324d2 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
@@ -27,7 +27,6 @@ import java.util.Set;
import org.apache.accumulo.cluster.ClusterUser;
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.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.Scanner;
@@ -61,10 +60,9 @@ public class CredentialsIT extends AccumuloClusterHarness {
Connector conn = getConnector();
inst = conn.getInstance();
- ClientConfiguration clientConf = cluster.getClientConfig();
ClusterUser user = getUser(0);
username = user.getPrincipal();
- saslEnabled = clientConf.hasSasl();
+ saslEnabled = saslEnabled();
// 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/DeleteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
index 189f68f..dee606f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
@@ -25,7 +25,6 @@ import org.apache.accumulo.cluster.AccumuloCluster;
import org.apache.accumulo.core.cli.BatchWriterOpts;
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.Connector;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.KerberosToken;
@@ -77,9 +76,8 @@ public class DeleteIT extends AccumuloClusterHarness {
}
if (null != keytab) {
assertNull("Given keytab, expect null password", password);
- ClientConfiguration clientConfig = cluster.getClientConfig();
- opts.updateKerberosCredentials(clientConfig);
- vopts.updateKerberosCredentials(clientConfig);
+ opts.updateKerberosCredentials(saslEnabled());
+ vopts.updateKerberosCredentials(saslEnabled());
}
BatchWriterOpts BWOPTS = new BatchWriterOpts();
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 4f29212..8273a72 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
@@ -23,7 +23,6 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.cli.BatchWriterOpts;
-import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.impl.ClientContext;
import org.apache.accumulo.core.client.impl.Credentials;
@@ -87,9 +86,8 @@ public class DynamicThreadPoolsIT extends AccumuloClusterHarness {
opts.rows = 500 * 1000;
opts.createTable = true;
opts.setTableName(firstTable);
- ClientConfiguration clientConf = cluster.getClientConfig();
- if (clientConf.hasSasl()) {
- opts.updateKerberosCredentials(clientConf);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
}
@@ -107,7 +105,7 @@ public class DynamicThreadPoolsIT extends AccumuloClusterHarness {
MasterMonitorInfo stats = null;
while (true) {
try {
- client = MasterClient.getConnectionWithRetry(new ClientContext(c.getInstance(), creds, clientConf));
+ client = MasterClient.getConnectionWithRetry(new ClientContext(getConnectionInfo()));
stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
break;
} catch (ThriftNotActiveServiceException e) {
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 f110e3f..2d88f3b 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
@@ -21,7 +21,6 @@ import java.util.List;
import java.util.Random;
import org.apache.accumulo.core.cli.BatchWriterOpts;
-import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.TestIngest;
@@ -53,9 +52,8 @@ public class FateStarvationIT extends AccumuloClusterHarness {
opts.rows = 100000;
opts.cols = 1;
opts.setTableName(tableName);
- ClientConfiguration clientConf = cluster.getClientConfig();
- if (clientConf.hasSasl()) {
- opts.updateKerberosCredentials(clientConf);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index bd5c8bc..9d47e55 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -32,12 +32,13 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
@@ -92,11 +93,11 @@ public class GarbageCollectorIT extends ConfigurableMacBase {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- private void killMacGc() throws ProcessNotFoundException, InterruptedException, KeeperException {
+ private void killMacGc() throws ProcessNotFoundException, InterruptedException, KeeperException, AccumuloSecurityException, AccumuloException {
// kill gc started by MAC
getCluster().killProcess(ServerType.GARBAGE_COLLECTOR, getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR).iterator().next());
// delete lock in zookeeper if there, this will allow next GC to start quickly
- String path = ZooUtil.getRoot(new ZooKeeperInstance(getCluster().getClientConfig())) + Constants.ZGC_LOCK;
+ String path = ZooUtil.getRoot(getConnector().getInstance()) + Constants.ZGC_LOCK;
ZooReaderWriter zk = new ZooReaderWriter(cluster.getZooKeepers(), 30000, OUR_SECRET);
try {
ZooLock.deleteLock(zk, path);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
index c69eba2..4ebe850 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
@@ -37,7 +37,6 @@ import java.util.Properties;
import org.apache.accumulo.cluster.ClusterUser;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.security.tokens.KerberosToken;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
@@ -491,8 +490,7 @@ public class KerberosProxyIT extends AccumuloITBase {
rootUgi.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
- ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
- Connector conn = inst.getConnector(rootUgi.getUserName(), new KerberosToken());
+ Connector conn = mac.getConnector(rootUgi.getUserName(), new KerberosToken());
conn.tableOperations().create(tableName);
conn.securityOperations().createLocalUser(userWithoutCredentials1, new PasswordToken("ignored"));
conn.securityOperations().grantTablePermission(userWithoutCredentials1, tableName, TablePermission.READ);
@@ -504,8 +502,7 @@ public class KerberosProxyIT extends AccumuloITBase {
realUgi.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
- ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
- Connector conn = inst.getConnector(proxyPrincipal, new KerberosToken());
+ Connector conn = mac.getConnector(proxyPrincipal, new KerberosToken());
try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) {
s.iterator().hasNext();
Assert.fail("Expected to see an exception");
@@ -521,8 +518,7 @@ public class KerberosProxyIT extends AccumuloITBase {
proxyUser1.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
- ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
- Connector conn = inst.getConnector(userWithoutCredentials1, new KerberosToken(userWithoutCredentials1));
+ Connector conn = mac.getConnector(userWithoutCredentials1, new KerberosToken(userWithoutCredentials1));
Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
assertFalse(s.iterator().hasNext());
return null;
@@ -532,8 +528,7 @@ public class KerberosProxyIT extends AccumuloITBase {
proxyUser2.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
- ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
- Connector conn = inst.getConnector(userWithoutCredentials2, new KerberosToken(userWithoutCredentials3));
+ Connector conn = mac.getConnector(userWithoutCredentials2, new KerberosToken(userWithoutCredentials3));
try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) {
s.iterator().hasNext();
Assert.fail("Expected to see an exception");
@@ -549,9 +544,8 @@ public class KerberosProxyIT extends AccumuloITBase {
proxyUser3.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
- ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
try {
- inst.getConnector(userWithoutCredentials3, new KerberosToken(userWithoutCredentials3));
+ mac.getConnector(userWithoutCredentials3, new KerberosToken(userWithoutCredentials3));
Assert.fail("Should not be able to create a Connector as this user cannot be proxied");
} catch (org.apache.accumulo.core.client.AccumuloSecurityException e) {
// Expected, this user cannot be proxied
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
index ce4ebd1..e96889d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
@@ -26,7 +26,6 @@ import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.Table;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
@@ -90,8 +89,7 @@ public class MasterAssignmentIT extends AccumuloClusterHarness {
}
private TabletLocationState getTabletLocationState(Connector c, String tableId) throws FileNotFoundException, ConfigurationException {
- Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
- ClientContext context = new ClientContext(c.getInstance(), creds, getCluster().getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
try (MetaDataTableScanner s = new MetaDataTableScanner(context, new Range(KeyExtent.getMetadataEntry(Table.ID.of(tableId), null)))) {
TabletLocationState tlState = s.next();
return tlState;
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 2baedd1..a4159d0 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
@@ -21,7 +21,6 @@ import java.util.Map;
import org.apache.accumulo.cluster.ClusterControl;
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.Connector;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.harness.AccumuloClusterHarness;
@@ -53,9 +52,8 @@ public class MasterFailoverIT extends AccumuloClusterHarness {
c.tableOperations().create(names[0]);
TestIngest.Opts opts = new TestIngest.Opts();
opts.setTableName(names[0]);
- ClientConfiguration clientConf = cluster.getClientConfig();
- if (clientConf.hasSasl()) {
- opts.updateKerberosCredentials(clientConf);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
}
@@ -69,8 +67,8 @@ public class MasterFailoverIT extends AccumuloClusterHarness {
c.tableOperations().rename(names[0], names[1]);
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
vopts.setTableName(names[1]);
- if (clientConf.hasSasl()) {
- vopts.updateKerberosCredentials(clientConf);
+ if (saslEnabled()) {
+ vopts.updateKerberosCredentials();
} 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 eb699a3..cec1bb8 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
@@ -24,7 +24,6 @@ import java.util.Random;
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.Connector;
import org.apache.accumulo.core.client.admin.InstanceOperations;
import org.apache.accumulo.core.conf.Property;
@@ -92,7 +91,6 @@ public class MaxOpenIT extends AccumuloClusterHarness {
public void run() throws Exception {
final Connector c = getConnector();
final String tableName = getUniqueNames(1)[0];
- final ClientConfiguration clientConf = cluster.getClientConfig();
c.tableOperations().create(tableName);
c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
c.tableOperations().addSplits(tableName, TestIngest.getSplitPoints(0, NUM_TO_INGEST, NUM_TABLETS));
@@ -106,8 +104,8 @@ public class MaxOpenIT extends AccumuloClusterHarness {
opts.cols = 1;
opts.random = i;
opts.setTableName(tableName);
- if (clientConf.hasSasl()) {
- opts.updateKerberosCredentials(clientConf);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
index 9dcf6cd..8ee1afb 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
@@ -26,10 +26,8 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.MasterClient;
import org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
@@ -86,13 +84,11 @@ public class MetadataMaxFilesIT extends ConfigurableMacBase {
log.info("starting up");
cluster.start();
- Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
-
while (true) {
MasterMonitorInfo stats = null;
Client client = null;
try {
- ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
client = MasterClient.getConnectionWithRetry(context);
log.info("Fetching stats");
stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
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 4227fd1..616796a 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
@@ -34,7 +34,6 @@ import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
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.Connector;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.Scanner;
@@ -321,8 +320,7 @@ public class PermissionsIT extends AccumuloClusterHarness {
}
break;
case OBTAIN_DELEGATION_TOKEN:
- ClientConfiguration clientConf = cluster.getClientConfig();
- if (clientConf.hasSasl()) {
+ if (saslEnabled()) {
// TODO Try to obtain a delegation token without the permission
}
break;
@@ -464,8 +462,7 @@ public class PermissionsIT extends AccumuloClusterHarness {
throw new IllegalStateException("Should be able to rename a table");
break;
case OBTAIN_DELEGATION_TOKEN:
- ClientConfiguration clientConf = cluster.getClientConfig();
- if (clientConf.hasSasl()) {
+ if (saslEnabled()) {
// 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 072c85c..21b0d34 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
@@ -64,11 +64,9 @@ import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchScanner;
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.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.admin.NewTableConfiguration;
import org.apache.accumulo.core.client.admin.TableOperations;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
@@ -126,8 +124,7 @@ public class ReadWriteIT extends AccumuloClusterHarness {
@Test(expected = RuntimeException.class)
public void invalidInstanceName() throws Exception {
- final Connector conn = getConnector();
- new ZooKeeperInstance("fake_instance_name", conn.getInstance().getZooKeepers());
+ Connector.builder().forInstance("fake_instance_name", cluster.getZooKeepers()).usingToken(getAdminPrincipal(), getAdminToken()).build();
}
@Test
@@ -138,8 +135,8 @@ public class ReadWriteIT extends AccumuloClusterHarness {
cluster.getClusterControl().startAllServers(ServerType.MONITOR);
Connector connector = getConnector();
String tableName = getUniqueNames(1)[0];
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
+ ingest(connector, getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
+ verify(connector, getAdminPrincipal(), ROWS, COLS, 50, 0, tableName);
String monitorLocation = null;
while (null == monitorLocation) {
monitorLocation = MonitorUtil.getLocation(getConnector().getInstance());
@@ -196,13 +193,11 @@ public class ReadWriteIT extends AccumuloClusterHarness {
cluster.start();
}
- public static void ingest(Connector connector, ClientConfiguration clientConfig, String principal, int rows, int cols, int width, int offset, String tableName)
- throws Exception {
- ingest(connector, clientConfig, principal, rows, cols, width, offset, COLF, tableName);
+ public static void ingest(Connector connector, String principal, int rows, int cols, int width, int offset, String tableName) throws Exception {
+ ingest(connector, principal, rows, cols, width, offset, COLF, tableName);
}
- public static void ingest(Connector connector, ClientConfiguration clientConfig, String principal, int rows, int cols, int width, int offset, String colf,
- String tableName) throws Exception {
+ public static void ingest(Connector connector, String principal, int rows, int cols, int width, int offset, String colf, String tableName) throws Exception {
TestIngest.Opts opts = new TestIngest.Opts();
opts.rows = rows;
opts.cols = cols;
@@ -211,8 +206,8 @@ public class ReadWriteIT extends AccumuloClusterHarness {
opts.columnFamily = colf;
opts.createTable = true;
opts.setTableName(tableName);
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(principal);
}
@@ -220,13 +215,11 @@ public class ReadWriteIT extends AccumuloClusterHarness {
TestIngest.ingest(connector, opts, new BatchWriterOpts());
}
- public static void verify(Connector connector, ClientConfiguration clientConfig, String principal, int rows, int cols, int width, int offset, String tableName)
- throws Exception {
- verify(connector, clientConfig, principal, rows, cols, width, offset, COLF, tableName);
+ public static void verify(Connector connector, String principal, int rows, int cols, int width, int offset, String tableName) throws Exception {
+ verify(connector, principal, rows, cols, width, offset, COLF, tableName);
}
- private static void verify(Connector connector, ClientConfiguration clientConfig, String principal, int rows, int cols, int width, int offset, String colf,
- String tableName) throws Exception {
+ private static void verify(Connector connector, String principal, int rows, int cols, int width, int offset, String colf, String tableName) throws Exception {
ScannerOpts scannerOpts = new ScannerOpts();
VerifyIngest.Opts opts = new VerifyIngest.Opts();
opts.rows = rows;
@@ -235,8 +228,8 @@ public class ReadWriteIT extends AccumuloClusterHarness {
opts.startRow = offset;
opts.columnFamily = colf;
opts.setTableName(tableName);
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(principal);
}
@@ -260,10 +253,9 @@ public class ReadWriteIT extends AccumuloClusterHarness {
@Override
public Integer call() {
try {
- 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.hasSasl()) {
+ if (saslEnabled()) {
String principal = getAdminPrincipal();
AuthenticationToken token = getAdminToken();
assertTrue("Expected KerberosToken, but was " + token.getClass(), token instanceof KerberosToken);
@@ -289,10 +281,9 @@ public class ReadWriteIT extends AccumuloClusterHarness {
@Override
public Integer call() {
try {
- 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.hasSasl()) {
+ if (saslEnabled()) {
String principal = getAdminPrincipal();
AuthenticationToken token = getAdminToken();
assertTrue("Expected KerberosToken, but was " + token.getClass(), token instanceof KerberosToken);
@@ -327,8 +318,8 @@ public class ReadWriteIT extends AccumuloClusterHarness {
// write a few large values
Connector connector = getConnector();
String table = getUniqueNames(1)[0];
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2, 1, 500000, 0, table);
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2, 1, 500000, 0, table);
+ ingest(connector, getAdminPrincipal(), 2, 1, 500000, 0, table);
+ verify(connector, getAdminPrincipal(), 2, 1, 500000, 0, table);
}
@Test
@@ -342,7 +333,7 @@ public class ReadWriteIT extends AccumuloClusterHarness {
static void interleaveTest(final Connector connector, final String tableName) throws Exception {
final AtomicBoolean fail = new AtomicBoolean(false);
final int CHUNKSIZE = ROWS / 10;
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50, 0, tableName);
+ ingest(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, 0, tableName);
int i;
for (i = 0; i < ROWS; i += CHUNKSIZE) {
final int start = i;
@@ -350,18 +341,18 @@ public class ReadWriteIT extends AccumuloClusterHarness {
@Override
public void run() {
try {
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50, start, tableName);
+ verify(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, start, tableName);
} catch (Exception ex) {
fail.set(true);
}
}
};
verify.start();
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50, i + CHUNKSIZE, tableName);
+ ingest(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, i + CHUNKSIZE, tableName);
verify.join();
assertFalse(fail.get());
}
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), CHUNKSIZE, 1, 50, i, tableName);
+ verify(connector, getAdminPrincipal(), CHUNKSIZE, 1, 50, i, tableName);
}
public static Text t(String s) {
@@ -382,7 +373,7 @@ public class ReadWriteIT extends AccumuloClusterHarness {
connector.tableOperations().create(tableName);
connector.tableOperations().setProperty(tableName, "table.group.g1", "colf");
connector.tableOperations().setProperty(tableName, "table.groups.enabled", "g1");
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2000, 1, 50, 0, tableName);
+ ingest(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
connector.tableOperations().compact(tableName, null, null, true, true);
BatchWriter bw = connector.createBatchWriter(tableName, new BatchWriterConfig());
bw.addMutation(m("zzzzzzzzzzz", "colf2", "cq", "value"));
@@ -436,8 +427,8 @@ public class ReadWriteIT extends AccumuloClusterHarness {
private void verifyLocalityGroupsInRFile(final Connector connector, final String tableName) throws Exception, AccumuloException, AccumuloSecurityException,
TableNotFoundException {
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2000, 1, 50, 0, tableName);
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), 2000, 1, 50, 0, tableName);
+ ingest(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
+ verify(connector, getAdminPrincipal(), 2000, 1, 50, 0, tableName);
connector.tableOperations().flush(tableName, null, null, true);
try (BatchScanner bscanner = connector.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1)) {
String tableId = connector.tableOperations().tableIdMap().get(tableName);
@@ -452,7 +443,7 @@ public class ReadWriteIT extends AccumuloClusterHarness {
System.setOut(newOut);
List<String> args = new ArrayList<>();
args.add(entry.getKey().getColumnQualifier().toString());
- if (ClusterType.STANDALONE == getClusterType() && cluster.getClientConfig().hasSasl()) {
+ if (ClusterType.STANDALONE == getClusterType() && saslEnabled()) {
args.add("--config");
StandaloneAccumuloCluster sac = (StandaloneAccumuloCluster) cluster;
String hadoopConfDir = sac.getHadoopConfDir();
@@ -484,9 +475,9 @@ public class ReadWriteIT extends AccumuloClusterHarness {
int i = 0;
for (String cfg : config) {
to.setLocalityGroups(table, getGroups(cfg));
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * (i + 1), 1, 50, ROWS * i, table);
+ ingest(connector, getAdminPrincipal(), ROWS * (i + 1), 1, 50, ROWS * i, table);
to.flush(table, null, null, true);
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), 0, 1, 50, ROWS * (i + 1), table);
+ verify(connector, getAdminPrincipal(), 0, 1, 50, ROWS * (i + 1), table);
i++;
}
to.delete(table);
@@ -494,12 +485,12 @@ public class ReadWriteIT extends AccumuloClusterHarness {
config = new String[] {"lg1:colf", null, "lg1:colf,xyz", "lg1:colf;lg2:colf",};
i = 1;
for (String cfg : config) {
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
- ingest(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table);
+ ingest(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
+ ingest(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table);
to.setLocalityGroups(table, getGroups(cfg));
to.flush(table, null, null, true);
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
- verify(connector, getCluster().getClientConfig(), getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table);
+ verify(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, table);
+ verify(connector, getAdminPrincipal(), ROWS * i, 1, 50, 0, "xyz", table);
i++;
}
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java
index 1f11b20..c82d014 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java
@@ -67,8 +67,8 @@ public class RecoveryWithEmptyRFileIT extends ConfigurableMacBase {
log.info("Ingest some data, verify it was stored properly, replace an underlying rfile with an empty one and verify we can scan.");
Connector connector = getConnector();
String tableName = getUniqueNames(1)[0];
- ReadWriteIT.ingest(connector, cluster.getClientConfig(), "root", ROWS, COLS, 50, 0, tableName);
- ReadWriteIT.verify(connector, cluster.getClientConfig(), "root", ROWS, COLS, 50, 0, tableName);
+ ReadWriteIT.ingest(connector, "root", ROWS, COLS, 50, 0, tableName);
+ ReadWriteIT.verify(connector, "root", ROWS, COLS, 50, 0, tableName);
connector.tableOperations().flush(tableName, null, null, true);
connector.tableOperations().offline(tableName, true);
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 05d230a..68be450 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
@@ -18,7 +18,7 @@ package org.apache.accumulo.test.functional;
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.ConnectionInfo;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.TestIngest;
@@ -43,9 +43,9 @@ public class RenameIT extends AccumuloClusterHarness {
opts.createTable = true;
opts.setTableName(name1);
- final ClientConfiguration clientConfig = cluster.getClientConfig();
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
+ final ConnectionInfo connectionInfo = cluster.getConnectionInfo();
+ if (connectionInfo.saslEnabled()) {
+ opts.updateKerberosCredentials(connectionInfo.saslEnabled());
} else {
opts.setPrincipal(getAdminPrincipal());
}
@@ -56,8 +56,8 @@ public class RenameIT extends AccumuloClusterHarness {
TestIngest.ingest(c, opts, bwOpts);
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
- if (clientConfig.hasSasl()) {
- vopts.updateKerberosCredentials(clientConfig);
+ if (connectionInfo.saslEnabled()) {
+ vopts.updateKerberosCredentials(connectionInfo.saslEnabled());
} 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 1f09d42..0efdb43 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
@@ -33,7 +33,6 @@ import org.apache.accumulo.cluster.ClusterUser;
import org.apache.accumulo.core.Constants;
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.Connector;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.KerberosToken;
@@ -125,9 +124,8 @@ public class RestartIT extends AccumuloClusterHarness {
ClusterUser rootUser = getAdminUser();
args = new String[] {"-u", getAdminPrincipal(), "--keytab", rootUser.getKeytab().getAbsolutePath(), "-i", cluster.getInstanceName(), "-z",
cluster.getZooKeepers(), "--rows", "" + OPTS.rows, "--table", tableName};
- ClientConfiguration clientConfig = cluster.getClientConfig();
- OPTS.updateKerberosCredentials(clientConfig);
- VOPTS.updateKerberosCredentials(clientConfig);
+ OPTS.updateKerberosCredentials(saslEnabled());
+ VOPTS.updateKerberosCredentials(saslEnabled());
} else {
throw new RuntimeException("Unknown token");
}
@@ -157,10 +155,9 @@ public class RestartIT extends AccumuloClusterHarness {
c.tableOperations().create(tableName);
OPTS.setTableName(tableName);
VOPTS.setTableName(tableName);
- ClientConfiguration clientConfig = cluster.getClientConfig();
- if (clientConfig.hasSasl()) {
- OPTS.updateKerberosCredentials(clientConfig);
- VOPTS.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ OPTS.updateKerberosCredentials();
+ VOPTS.updateKerberosCredentials();
} else {
OPTS.setPrincipal(getAdminPrincipal());
VOPTS.setPrincipal(getAdminPrincipal());
@@ -224,9 +221,8 @@ public class RestartIT extends AccumuloClusterHarness {
ClusterUser rootUser = getAdminUser();
args = new String[] {"-u", getAdminPrincipal(), "--keytab", rootUser.getKeytab().getAbsolutePath(), "-i", cluster.getInstanceName(), "-z",
cluster.getZooKeepers(), "--rows", Integer.toString(VOPTS.rows), "--table", tableName};
- ClientConfiguration clientConfig = cluster.getClientConfig();
- OPTS.updateKerberosCredentials(clientConfig);
- VOPTS.updateKerberosCredentials(clientConfig);
+ OPTS.updateKerberosCredentials(saslEnabled());
+ VOPTS.updateKerberosCredentials(saslEnabled());
} else {
throw new RuntimeException("Unknown token");
}
@@ -268,10 +264,9 @@ public class RestartIT extends AccumuloClusterHarness {
c.tableOperations().create(tableName);
OPTS.setTableName(tableName);
VOPTS.setTableName(tableName);
- ClientConfiguration clientConfig = cluster.getClientConfig();
- if (clientConfig.hasSasl()) {
- OPTS.updateKerberosCredentials(clientConfig);
- VOPTS.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ OPTS.updateKerberosCredentials();
+ VOPTS.updateKerberosCredentials();
} else {
OPTS.setPrincipal(getAdminPrincipal());
VOPTS.setPrincipal(getAdminPrincipal());
@@ -304,9 +299,8 @@ public class RestartIT extends AccumuloClusterHarness {
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
OPTS.setTableName(tableName);
- ClientConfiguration clientConfig = cluster.getClientConfig();
- if (clientConfig.hasSasl()) {
- OPTS.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ OPTS.updateKerberosCredentials();
} else {
OPTS.setPrincipal(getAdminPrincipal());
}
@@ -324,10 +318,9 @@ public class RestartIT extends AccumuloClusterHarness {
Connector c = getConnector();
String tableName = getUniqueNames(1)[0];
VOPTS.setTableName(tableName);
- ClientConfiguration clientConfig = cluster.getClientConfig();
- if (clientConfig.hasSasl()) {
- OPTS.updateKerberosCredentials(clientConfig);
- VOPTS.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ OPTS.updateKerberosCredentials();
+ VOPTS.updateKerberosCredentials();
} else {
OPTS.setPrincipal(getAdminPrincipal());
VOPTS.setPrincipal(getAdminPrincipal());
@@ -346,8 +339,8 @@ public class RestartIT extends AccumuloClusterHarness {
c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), "20K");
TestIngest.Opts opts = new TestIngest.Opts();
opts.setTableName(tableName);
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RestartStressIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RestartStressIT.java
index 45767d3..3f77486 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/RestartStressIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/RestartStressIT.java
@@ -141,7 +141,7 @@ public class RestartStressIT extends AccumuloClusterHarness {
if (token instanceof PasswordToken) {
VOPTS.setPrincipal(getAdminPrincipal());
} else if (token instanceof KerberosToken) {
- VOPTS.updateKerberosCredentials(cluster.getClientConfig());
+ VOPTS.updateKerberosCredentials(saslEnabled());
} else {
throw new RuntimeException("Unrecognized token");
}
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 1de2282..311b853 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
@@ -31,7 +31,6 @@ import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchScanner;
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.Connector;
import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.client.MutationsRejectedException;
@@ -73,11 +72,10 @@ public class ScanIteratorIT extends AccumuloClusterHarness {
tableName = getUniqueNames(1)[0];
connector.tableOperations().create(tableName);
- ClientConfiguration clientConfig = cluster.getClientConfig();
ClusterUser clusterUser = getUser(0);
user = clusterUser.getPrincipal();
PasswordToken userToken;
- if (clientConfig.hasSasl()) {
+ if (saslEnabled()) {
userToken = null;
saslEnabled = true;
} else {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
index 4348d66..99909d3 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
@@ -77,7 +77,7 @@ public class SimpleBalancerFairnessIT extends ConfigurableMacBase {
c.tableOperations().flush("test_ingest", null, null, false);
sleepUninterruptibly(45, TimeUnit.SECONDS);
Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
- ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
MasterMonitorInfo stats = null;
int unassignedTablets = 1;
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 f31b5c3..dfdbd64 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
@@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.cluster.ClusterUser;
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.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.admin.InstanceOperations;
@@ -131,10 +130,9 @@ public class SplitIT extends AccumuloClusterHarness {
opts.rows = 100000;
opts.setTableName(table);
- ClientConfiguration clientConfig = cluster.getClientConfig();
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
- vopts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
+ vopts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
vopts.setPrincipal(getAdminPrincipal());
@@ -166,7 +164,7 @@ public class SplitIT extends AccumuloClusterHarness {
}
String[] args;
- if (clientConfig.hasSasl()) {
+ if (saslEnabled()) {
ClusterUser rootUser = getAdminUser();
args = new String[] {"-i", cluster.getInstanceName(), "-u", rootUser.getPrincipal(), "--keytab", rootUser.getKeytab().getAbsolutePath(), "-z",
cluster.getZooKeepers()};
@@ -203,9 +201,8 @@ public class SplitIT extends AccumuloClusterHarness {
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
- ClientConfiguration clientConfig = getCluster().getClientConfig();
String password = null, keytab = null;
- if (clientConfig.hasSasl()) {
+ if (saslEnabled()) {
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 8989400..b8a07c2 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
@@ -25,7 +25,6 @@ import java.io.FileNotFoundException;
import org.apache.accumulo.cluster.AccumuloCluster;
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.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.admin.TableOperations;
@@ -71,10 +70,9 @@ public class TableIT extends AccumuloClusterHarness {
TestIngest.Opts opts = new TestIngest.Opts();
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
- ClientConfiguration clientConfig = getCluster().getClientConfig();
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
- vopts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
+ vopts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
vopts.setPrincipal(getAdminPrincipal());
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 cbb2405..fdb29bc 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
@@ -18,7 +18,6 @@ package org.apache.accumulo.test.functional;
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.Connector;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.harness.AccumuloClusterHarness;
@@ -58,10 +57,9 @@ public class WriteAheadLogIT extends AccumuloClusterHarness {
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
opts.setTableName(tableName);
- ClientConfiguration clientConfig = cluster.getClientConfig();
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
- vopts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
+ vopts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
vopts.setPrincipal(getAdminPrincipal());
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 c38f178..6dae13d 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
@@ -23,7 +23,6 @@ import java.util.concurrent.atomic.AtomicReference;
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.Connector;
import org.apache.accumulo.harness.AccumuloClusterHarness;
import org.apache.accumulo.test.TestIngest;
@@ -43,7 +42,6 @@ public class WriteLotsIT extends AccumuloClusterHarness {
final String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
final AtomicReference<Exception> ref = new AtomicReference<>();
- final ClientConfiguration clientConfig = getCluster().getClientConfig();
final int THREADS = 5;
ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, THREADS, 0, TimeUnit.SECONDS, new ArrayBlockingQueue<>(THREADS));
for (int i = 0; i < THREADS; i++) {
@@ -56,8 +54,8 @@ public class WriteLotsIT extends AccumuloClusterHarness {
opts.startRow = index * 10000;
opts.rows = 10000;
opts.setTableName(tableName);
- if (clientConfig.hasSasl()) {
- opts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ opts.updateKerberosCredentials();
} else {
opts.setPrincipal(getAdminPrincipal());
}
@@ -80,8 +78,8 @@ public class WriteLotsIT extends AccumuloClusterHarness {
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
vopts.rows = 10000 * THREADS;
vopts.setTableName(tableName);
- if (clientConfig.hasSasl()) {
- vopts.updateKerberosCredentials(clientConfig);
+ if (saslEnabled()) {
+ vopts.updateKerberosCredentials();
} else {
vopts.setPrincipal(getAdminPrincipal());
}
diff --git a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java
index e160077..7bcc712 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloFileOutputFormatIT.java
@@ -159,9 +159,8 @@ public class AccumuloFileOutputFormatIT extends AccumuloClusterHarness {
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, getAdminPrincipal(), getAdminToken());
+ AccumuloInputFormat.setConnectionInfo(job, getConnectionInfo());
AccumuloInputFormat.setInputTableName(job, table);
- AccumuloInputFormat.setZooKeeperInstance(job, getCluster().getClientConfig());
AccumuloFileOutputFormat.setOutputPath(job, new Path(args[1]));
AccumuloFileOutputFormat.setSampler(job, SAMPLER_CONFIG);
diff --git a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloMultiTableInputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloMultiTableInputFormatIT.java
index 350a183..a717478 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloMultiTableInputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloMultiTableInputFormatIT.java
@@ -30,7 +30,6 @@ import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.mapreduce.AccumuloMultiTableInputFormat;
import org.apache.accumulo.core.client.mapreduce.InputTableConfig;
import org.apache.accumulo.core.client.mapreduce.RangeInputSplit;
-import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
@@ -88,8 +87,6 @@ public class AccumuloMultiTableInputFormatIT extends AccumuloClusterHarness {
throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <table1> <table2>");
}
- String user = getAdminPrincipal();
- AuthenticationToken pass = getAdminToken();
String table1 = args[0];
String table2 = args[1];
@@ -98,7 +95,7 @@ public class AccumuloMultiTableInputFormatIT extends AccumuloClusterHarness {
job.setInputFormatClass(AccumuloMultiTableInputFormat.class);
- AccumuloMultiTableInputFormat.setConnectorInfo(job, user, pass);
+ AccumuloMultiTableInputFormat.setConnectionInfo(job, getConnectionInfo());
InputTableConfig tableConfig1 = new InputTableConfig();
InputTableConfig tableConfig2 = new InputTableConfig();
@@ -108,7 +105,6 @@ public class AccumuloMultiTableInputFormatIT extends AccumuloClusterHarness {
configMap.put(table2, tableConfig2);
AccumuloMultiTableInputFormat.setInputTableConfigs(job, configMap);
- AccumuloMultiTableInputFormat.setZooKeeperInstance(job, getCluster().getClientConfig());
job.setMapperClass(TestMapper.class);
job.setMapOutputKeyClass(Key.class);
diff --git a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java
index c03d462..6516dfd 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloRowInputFormatIT.java
@@ -33,7 +33,6 @@ import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
import org.apache.accumulo.core.client.mapreduce.AccumuloRowInputFormat;
-import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyValue;
import org.apache.accumulo.core.data.Mutation;
@@ -142,8 +141,6 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <table>");
}
- String user = getAdminPrincipal();
- AuthenticationToken pass = getAdminToken();
String table = args[0];
Job job = Job.getInstance(getConf(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
@@ -151,9 +148,8 @@ public class AccumuloRowInputFormatIT extends AccumuloClusterHarness {
job.setInputFormatClass(AccumuloRowInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, pass);
+ AccumuloRowInputFormat.setConnectionInfo(job, getConnectionInfo());
AccumuloInputFormat.setInputTableName(job, table);
- AccumuloRowInputFormat.setZooKeeperInstance(job, getCluster().getClientConfig());
job.setMapperClass(TestMapper.class);
job.setMapOutputKeyClass(Key.class);
diff --git a/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java b/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java
index 8eed076..0ddfb2d 100644
--- a/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java
@@ -40,13 +40,9 @@ import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.impl.ClientContext;
import org.apache.accumulo.core.client.impl.ClientExec;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.MasterClient;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.impl.KeyExtent;
@@ -164,9 +160,7 @@ public class SuspendedTabletsIT extends ConfigurableMacBase {
* callback which shuts down some tablet servers.
*/
private void suspensionTestBody(TServerKiller serverStopper) throws Exception {
- Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
- Instance instance = new ZooKeeperInstance(getCluster().getClientConfig());
- ClientContext ctx = new ClientContext(instance, creds, getCluster().getClientConfig());
+ ClientContext ctx = new ClientContext(getConnectionInfo());
String tableName = getUniqueNames(1)[0];
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/NullTserver.java
index 8784fd4..522d1bc 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/NullTserver.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/NullTserver.java
@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.cli.Help;
-import org.apache.accumulo.core.client.ClientConfiguration;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.impl.Table;
@@ -280,7 +279,7 @@ public class NullTserver {
opts.parseArgs(NullTserver.class.getName(), args);
// modify metadata
- ZooKeeperInstance zki = new ZooKeeperInstance(ClientConfiguration.create().withInstance(opts.iname).withZkHosts(opts.keepers));
+ ZooKeeperInstance zki = new ZooKeeperInstance(opts.iname, opts.keepers);
Instance inst = HdfsZooInstance.getInstance();
AccumuloServerContext context = new AccumuloServerContext(inst, new ServerConfigurationFactory(zki));
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 2704004..777dc78 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
@@ -29,7 +29,6 @@ import org.apache.accumulo.core.cli.ClientOpts;
import org.apache.accumulo.core.client.BatchScanner;
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.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.Scanner;
@@ -68,7 +67,7 @@ public class MetadataBatchScanTest {
ClientOpts opts = new ClientOpts();
opts.parseArgs(MetadataBatchScanTest.class.getName(), args);
- Instance inst = new ZooKeeperInstance(ClientConfiguration.create().withInstance("acu14").withZkHosts("localhost"));
+ Instance inst = new ZooKeeperInstance("acu14", "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/replication/GarbageCollectorCommunicatesWithTServersIT.java b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
index 8aaf65b..e947583 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
@@ -30,10 +30,8 @@ import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.impl.ClientContext;
import org.apache.accumulo.core.client.impl.ClientExecReturn;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.MasterClient;
import org.apache.accumulo.core.client.impl.Table;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
@@ -365,8 +363,7 @@ public class GarbageCollectorCommunicatesWithTServersIT extends ConfigurableMacB
conn.tableOperations().flush(otherTable, null, null, true);
// Get the tservers which the master deems as active
- final ClientContext context = new ClientContext(conn.getInstance(), new Credentials("root", new PasswordToken(ConfigurableMacBase.ROOT_PASSWORD)),
- getClientConfig());
+ final ClientContext context = new ClientContext(getConnectionInfo());
List<String> tservers = MasterClient.execute(context, new ClientExecReturn<List<String>,MasterClientService.Client>() {
@Override
public List<String> execute(MasterClientService.Client client) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java
index 5fb22b7..930e122 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java
@@ -29,11 +29,9 @@ import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
import org.apache.accumulo.core.client.impl.ReplicationOperationsImpl;
import org.apache.accumulo.core.client.impl.Table;
import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
@@ -97,7 +95,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase {
}
};
- ClientContext context = new ClientContext(inst, new Credentials("root", new PasswordToken(ROOT_PASSWORD)), getClientConfig());
+ ClientContext context = new ClientContext(getConnectionInfo());
return new ReplicationOperationsImpl(context) {
@Override
protected boolean getMasterDrain(final TInfo tinfo, final TCredentials rpcCreds, final String tableName, final Set<String> wals)
--
To stop receiving notification emails like this one, please contact
mwalch@apache.org.