You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/02/25 20:48:35 UTC

svn commit: r1449860 - /accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java

Author: ecn
Date: Mon Feb 25 19:48:34 2013
New Revision: 1449860

URL: http://svn.apache.org/r1449860
Log:
ACCUMULO-1105 found a bad refactor of the authentication stuff in RW tests

Modified:
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java?rev=1449860&r1=1449859&r2=1449860&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java (original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java Mon Feb 25 19:48:34 2013
@@ -32,7 +32,6 @@ import org.apache.accumulo.core.client.Z
 import org.apache.accumulo.core.security.CredentialHelper;
 import org.apache.accumulo.core.security.thrift.Credential;
 import org.apache.accumulo.core.security.tokens.PasswordToken;
-import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.log4j.Logger;
 
 public class State {
@@ -96,10 +95,7 @@ public class State {
   
   public Connector getConnector() throws AccumuloException, AccumuloSecurityException {
     if (connector == null) {
-      String instance = props.getProperty("INSTANCE");
-      String zookeepers = props.getProperty("ZOOKEEPERS");
-      Credential credentials = getCredentials();
-      connector = new ZooKeeperInstance(instance, zookeepers).getConnector(credentials.getPrincipal(), credentials.getToken());
+      connector = getInstance().getConnector(getCredentials());
     }
     return connector;
   }
@@ -107,12 +103,14 @@ public class State {
   public Credential getCredentials() {
     String username = props.getProperty("USERNAME");
     String password = props.getProperty("PASSWORD");
-    return CredentialHelper.createSquelchError(username, new PasswordToken().setPassword(password.getBytes()), this.getInstance().getInstanceID());
+    return CredentialHelper.createSquelchError(username, new PasswordToken().setPassword(password.getBytes()), getInstance().getInstanceID());
   }
 
   public Instance getInstance() {
     if (instance == null) {
-      instance = HdfsZooInstance.getInstance();
+      String instance = props.getProperty("INSTANCE");
+      String zookeepers = props.getProperty("ZOOKEEPERS");
+      this.instance = new ZooKeeperInstance(instance, zookeepers);
     }
     return instance;
   }