accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/3] git commit: ACCUMULO-3138 Pass down the SSL/CredentialProvider ClientConfiguration into the input format
Date Wed, 17 Sep 2014 04:57:51 GMT
ACCUMULO-3138 Pass down the SSL/CredentialProvider ClientConfiguration into the input format


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3e4d07b2
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3e4d07b2
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3e4d07b2

Branch: refs/heads/master
Commit: 3e4d07b2fd967328fe1161b0dfad1fdf72191829
Parents: 2e27350
Author: Josh Elser <elserj@apache.org>
Authored: Wed Sep 17 00:56:25 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Wed Sep 17 00:56:25 2014 -0400

----------------------------------------------------------------------
 .../test/functional/AccumuloInputFormatIT.java  | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3e4d07b2/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
b/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
index 5f33436..acd7440 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.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.BatchWriter;
 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.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
@@ -69,11 +70,27 @@ public class AccumuloInputFormatIT extends SimpleMacIT {
     conn.tableOperations().create(table);
     insertData(table, currentTimeMillis());
 
+    ClientConfiguration clientConf = new ClientConfiguration().withInstance(conn.getInstance().getInstanceName()).withZkHosts(
+        conn.getInstance().getZooKeepers()), clusterClientConf = getStaticCluster().getClientConfig();
+
+    // Pass SSL and CredentialProvider options into the ClientConfiguration given to AccumuloInputFormat
+    boolean sslEnabled = Boolean.valueOf(clusterClientConf.get(ClientProperty.INSTANCE_RPC_SSL_ENABLED));
+    if (sslEnabled) {
+      ClientProperty[] sslProperties = new ClientProperty[] {ClientProperty.INSTANCE_RPC_SSL_ENABLED,
ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH,
+          ClientProperty.RPC_SSL_KEYSTORE_PATH, ClientProperty.RPC_SSL_KEYSTORE_TYPE, ClientProperty.RPC_SSL_KEYSTORE_PASSWORD,
+          ClientProperty.RPC_SSL_TRUSTSTORE_PATH, ClientProperty.RPC_SSL_TRUSTSTORE_TYPE,
ClientProperty.RPC_SSL_TRUSTSTORE_PASSWORD,
+          ClientProperty.RPC_USE_JSSE, ClientProperty.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS};
+
+      for (ClientProperty prop : sslProperties) {
+        // The default property is returned if it's not in the ClientConfiguration so we
don't have to check if the value is actually defined
+        clientConf.setProperty(prop, clusterClientConf.get(prop));
+      }
+    }
+
     @SuppressWarnings("deprecation")
     Job job = new Job();
     AccumuloInputFormat.setInputTableName(job, table);
-    AccumuloInputFormat.setZooKeeperInstance(job, new ClientConfiguration().withInstance(conn.getInstance().getInstanceName())
-        .withZkHosts(conn.getInstance().getZooKeepers()));
+    AccumuloInputFormat.setZooKeeperInstance(job, clientConf);
     AccumuloInputFormat.setConnectorInfo(job, "root", new PasswordToken(ROOT_PASSWORD));
 
     // split table


Mime
View raw message