accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [6/7] accumulo git commit: ACCUMULO-4348 Limit use of deprecated method
Date Wed, 22 Jun 2016 18:32:07 GMT
ACCUMULO-4348 Limit use of deprecated method

Move off the deprecated KerberosToken constructor where possible, and
suppress warnings where not immediately possible.


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

Branch: refs/heads/1.8
Commit: 5ba1c88de0bd99c66ddf21b7ba0085692d25422b
Parents: dbfef0a
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Wed Jun 22 14:19:55 2016 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Wed Jun 22 14:19:55 2016 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/cluster/ClusterUser.java   | 4 +++-
 .../accumulo/tserver/replication/AccumuloReplicaSystem.java  | 2 +-
 .../org/apache/accumulo/harness/AccumuloClusterHarness.java  | 4 +++-
 .../org/apache/accumulo/harness/SharedMiniClusterBase.java   | 8 ++++++--
 .../harness/conf/AccumuloMiniClusterConfiguration.java       | 4 +++-
 .../harness/conf/StandaloneAccumuloClusterConfiguration.java | 4 +++-
 .../org/apache/accumulo/test/randomwalk/Environment.java     | 4 +++-
 7 files changed, 22 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ba1c88d/minicluster/src/main/java/org/apache/accumulo/cluster/ClusterUser.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/ClusterUser.java b/minicluster/src/main/java/org/apache/accumulo/cluster/ClusterUser.java
index 6644d44..e99ca0b 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/ClusterUser.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/ClusterUser.java
@@ -81,7 +81,9 @@ public class ClusterUser {
     if (null != password) {
       return new PasswordToken(password);
     } else if (null != keytab) {
-      return new KerberosToken(principal, keytab, true);
+      @SuppressWarnings("deprecation")
+      KerberosToken krbToken = new KerberosToken(principal, keytab, true);
+      return krbToken;
     }
 
     throw new IllegalStateException("One of password and keytab must be non-null");

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ba1c88d/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java
index 0bd467c..589f07f 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java
@@ -193,7 +193,7 @@ public class AccumuloReplicaSystem implements ReplicaSystem {
             KerberosToken token;
             try {
               // Do *not* replace the current user
-              token = new KerberosToken(principal, keytab, false);
+              token = new KerberosToken(principal, keytab);
             } catch (IOException e) {
               log.error("Failed to create KerberosToken", e);
               return status;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ba1c88d/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
----------------------------------------------------------------------
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 ba95f2b..7483184 100644
--- a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
+++ b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
@@ -170,7 +170,9 @@ public abstract class AccumuloClusterHarness extends AccumuloITBase implements
M
           UserGroupInformation.loginUserFromKeytab(systemUser.getPrincipal(), systemUser.getKeytab().getAbsolutePath());
 
           // Open a connector as the system user (ensures the user will exist for us to assign
permissions to)
-          Connector conn = cluster.getConnector(systemUser.getPrincipal(), new KerberosToken(systemUser.getPrincipal(),
systemUser.getKeytab(), true));
+          @SuppressWarnings("deprecation")
+          KerberosToken krbToken = new KerberosToken(systemUser.getPrincipal(), systemUser.getKeytab(),
true);
+          Connector conn = cluster.getConnector(systemUser.getPrincipal(), krbToken);
 
           // Then, log back in as the "root" user and do the grant
           UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ba1c88d/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
index 79340f2..5b90597 100644
--- a/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
+++ b/test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
@@ -75,7 +75,9 @@ public abstract class SharedMiniClusterBase extends AccumuloITBase implements
Cl
       ClusterUser rootUser = krb.getRootUser();
       // Get the krb token
       principal = rootUser.getPrincipal();
-      token = new KerberosToken(principal, rootUser.getKeytab(), true);
+      @SuppressWarnings("deprecation")
+      KerberosToken krbToken = new KerberosToken(principal, rootUser.getKeytab(), true);
+      token = krbToken;
     } else {
       rootPassword = "rootPasswordShared1";
       token = new PasswordToken(rootPassword);
@@ -89,7 +91,9 @@ public abstract class SharedMiniClusterBase extends AccumuloITBase implements
Cl
       final ClusterUser systemUser = krb.getAccumuloServerUser(), rootUser = krb.getRootUser();
       // Login as the trace user
       // Open a connector as the system user (ensures the user will exist for us to assign
permissions to)
-      Connector conn = cluster.getConnector(systemUser.getPrincipal(), new KerberosToken(systemUser.getPrincipal(),
systemUser.getKeytab(), true));
+      @SuppressWarnings("deprecation")
+      KerberosToken krbToken = new KerberosToken(systemUser.getPrincipal(), systemUser.getKeytab(),
true);
+      Connector conn = cluster.getConnector(systemUser.getPrincipal(), krbToken);
 
       // Then, log back in as the "root" user and do the grant
       UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ba1c88d/test/src/main/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java
----------------------------------------------------------------------
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 0a43621..63f90ea 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
@@ -86,7 +86,9 @@ public class AccumuloMiniClusterConfiguration extends AccumuloClusterPropertyCon
 
       ClusterUser rootUser = AccumuloClusterHarness.getKdc().getRootUser();
       try {
-        return new KerberosToken(rootUser.getPrincipal(), rootUser.getKeytab(), true);
+        @SuppressWarnings("deprecation")
+        KerberosToken krbToken = new KerberosToken(rootUser.getPrincipal(), rootUser.getKeytab(),
true);
+        return krbToken;
       } catch (IOException e) {
         throw new RuntimeException(e);
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ba1c88d/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
----------------------------------------------------------------------
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 ba9dcef..e72d965 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
@@ -162,7 +162,9 @@ public class StandaloneAccumuloClusterConfiguration extends AccumuloClusterPrope
     if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false))
{
       File keytab = getAdminKeytab();
       try {
-        return new KerberosToken(getAdminPrincipal(), keytab, true);
+        @SuppressWarnings("deprecation")
+        KerberosToken krbToken = new KerberosToken(getAdminPrincipal(), keytab, true);
+        return krbToken;
       } catch (IOException e) {
         // The user isn't logged in
         throw new RuntimeException("Failed to create KerberosToken", e);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ba1c88d/test/src/main/java/org/apache/accumulo/test/randomwalk/Environment.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/Environment.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/Environment.java
index c162a38..b5036b7 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/Environment.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/Environment.java
@@ -169,7 +169,9 @@ public class Environment {
         throw new IllegalArgumentException("Provided keytab is not a normal file: " + keytab);
       }
       try {
-        return new KerberosToken(getUserName(), keytabFile, true);
+        @SuppressWarnings("deprecation")
+        KerberosToken krbToken = new KerberosToken(getUserName(), keytabFile, true);
+        return krbToken;
       } catch (IOException e) {
         throw new RuntimeException("Failed to login", e);
       }


Mime
View raw message