Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java Thu Feb 28 23:05:24 2013 @@ -63,7 +63,7 @@ import org.apache.accumulo.core.iterator import org.apache.accumulo.core.iterators.system.MultiIterator; import org.apache.accumulo.core.iterators.system.VisibilityFilter; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.util.AddressUtil; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.core.util.MetadataTable; @@ -339,7 +339,7 @@ public class CollectTabletStats { } - private static List<KeyExtent> findTablets(boolean selectLocalTablets, Credential credentials, String table, Instance zki, + private static List<KeyExtent> findTablets(boolean selectLocalTablets, TCredentials credentials, String table, Instance zki, Map<KeyExtent,String> locations) throws Exception { SortedSet<KeyExtent> tablets = new TreeSet<KeyExtent>(); @@ -374,7 +374,7 @@ public class CollectTabletStats { return tabletsToTest; } - private static List<String> getTabletFiles(Credential token, Instance zki, String tableId, KeyExtent ke) { + private static List<String> getTabletFiles(TCredentials token, Instance zki, String tableId, KeyExtent ke) { List<String> files = new ArrayList<String>(); SortedMap<Key,Value> tkv = new TreeMap<Key,Value>();
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java Thu Feb 28 23:05:24 2013 @@ -46,7 +46,7 @@ import org.apache.accumulo.core.data.thr import org.apache.accumulo.core.data.thrift.TRange; import org.apache.accumulo.core.data.thrift.UpdateErrors; import org.apache.accumulo.core.master.thrift.TabletServerStatus; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.security.thrift.SecurityErrorCode; import org.apache.accumulo.core.security.thrift.ThriftSecurityException; import org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction; @@ -89,7 +89,7 @@ public class NullTserver { } @Override - public long startUpdate(TInfo tinfo, Credential credentials) { + public long startUpdate(TInfo tinfo, TCredentials credentials) { return updateSession++; } @@ -102,7 +102,7 @@ public class NullTserver { } @Override - public List<TKeyExtent> bulkImport(TInfo tinfo, Credential credentials, long tid, Map<TKeyExtent,Map<String,MapFileInfo>> files, boolean setTime) { + public List<TKeyExtent> bulkImport(TInfo tinfo, TCredentials credentials, long tid, Map<TKeyExtent,Map<String,MapFileInfo>> files, boolean setTime) { return null; } @@ -123,74 +123,74 @@ public class NullTserver { } @Override - public void splitTablet(TInfo tinfo, Credential credentials, TKeyExtent extent, ByteBuffer splitPoint) { + public void splitTablet(TInfo tinfo, TCredentials credentials, TKeyExtent extent, ByteBuffer splitPoint) { } @Override - public InitialMultiScan startMultiScan(TInfo tinfo, Credential credentials, Map<TKeyExtent,List<TRange>> batch, List<TColumn> columns, + public InitialMultiScan startMultiScan(TInfo tinfo, TCredentials credentials, Map<TKeyExtent,List<TRange>> batch, List<TColumn> columns, List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations, boolean waitForWrites) { return null; } @Override - public InitialScan startScan(TInfo tinfo, Credential credentials, TKeyExtent extent, TRange range, List<TColumn> columns, int batchSize, + public InitialScan startScan(TInfo tinfo, TCredentials credentials, TKeyExtent extent, TRange range, List<TColumn> columns, int batchSize, List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations, boolean waitForWrites, boolean isolated) { return null; } @Override - public void update(TInfo tinfo, Credential credentials, TKeyExtent keyExtent, TMutation mutation) { + public void update(TInfo tinfo, TCredentials credentials, TKeyExtent keyExtent, TMutation mutation) { } @Override - public TabletServerStatus getTabletServerStatus(TInfo tinfo, Credential credentials) throws ThriftSecurityException, TException { + public TabletServerStatus getTabletServerStatus(TInfo tinfo, TCredentials credentials) throws ThriftSecurityException, TException { return null; } @Override - public List<TabletStats> getTabletStats(TInfo tinfo, Credential credentials, String tableId) throws ThriftSecurityException, TException { + public List<TabletStats> getTabletStats(TInfo tinfo, TCredentials credentials, String tableId) throws ThriftSecurityException, TException { return null; } @Override - public TabletStats getHistoricalStats(TInfo tinfo, Credential credentials) throws ThriftSecurityException, TException { + public TabletStats getHistoricalStats(TInfo tinfo, TCredentials credentials) throws ThriftSecurityException, TException { return null; } @Override - public void halt(TInfo tinfo, Credential credentials, String lock) throws ThriftSecurityException, TException {} + public void halt(TInfo tinfo, TCredentials credentials, String lock) throws ThriftSecurityException, TException {} @Override - public void fastHalt(TInfo tinfo, Credential credentials, String lock) {} + public void fastHalt(TInfo tinfo, TCredentials credentials, String lock) {} @Override - public void loadTablet(TInfo tinfo, Credential credentials, String lock, TKeyExtent extent) throws TException {} + public void loadTablet(TInfo tinfo, TCredentials credentials, String lock, TKeyExtent extent) throws TException {} @Override - public void unloadTablet(TInfo tinfo, Credential credentials, String lock, TKeyExtent extent, boolean save) throws TException {} + public void unloadTablet(TInfo tinfo, TCredentials credentials, String lock, TKeyExtent extent, boolean save) throws TException {} @Override - public List<ActiveScan> getActiveScans(TInfo tinfo, Credential credentials) throws ThriftSecurityException, TException { + public List<ActiveScan> getActiveScans(TInfo tinfo, TCredentials credentials) throws ThriftSecurityException, TException { return new ArrayList<ActiveScan>(); } @Override - public void chop(TInfo tinfo, Credential credentials, String lock, TKeyExtent extent) throws TException {} + public void chop(TInfo tinfo, TCredentials credentials, String lock, TKeyExtent extent) throws TException {} @Override - public void flushTablet(TInfo tinfo, Credential credentials, String lock, TKeyExtent extent) throws TException { + public void flushTablet(TInfo tinfo, TCredentials credentials, String lock, TKeyExtent extent) throws TException { } @Override - public void compact(TInfo tinfo, Credential credentials, String lock, String tableId, ByteBuffer startRow, ByteBuffer endRow) throws TException { + public void compact(TInfo tinfo, TCredentials credentials, String lock, String tableId, ByteBuffer startRow, ByteBuffer endRow) throws TException { } @Override - public void flush(TInfo tinfo, Credential credentials, String lock, String tableId, ByteBuffer startRow, ByteBuffer endRow) throws TException { + public void flush(TInfo tinfo, TCredentials credentials, String lock, String tableId, ByteBuffer startRow, ByteBuffer endRow) throws TException { } @@ -201,11 +201,11 @@ public class NullTserver { * org.apache.accumulo.core.security.thrift.Credentials, java.util.List) */ @Override - public void removeLogs(TInfo tinfo, Credential credentials, List<String> filenames) throws TException { + public void removeLogs(TInfo tinfo, TCredentials credentials, List<String> filenames) throws TException { } @Override - public List<ActiveCompaction> getActiveCompactions(TInfo tinfo, Credential credentials) throws ThriftSecurityException, TException { + public List<ActiveCompaction> getActiveCompactions(TInfo tinfo, TCredentials credentials) throws ThriftSecurityException, TException { return new ArrayList<ActiveCompaction>(); } } Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java Thu Feb 28 23:05:24 2013 @@ -30,7 +30,7 @@ import org.apache.accumulo.core.client.I import org.apache.accumulo.core.client.MultiTableBatchWriter; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.security.CredentialHelper; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.security.tokens.PasswordToken; import org.apache.log4j.Logger; @@ -77,7 +77,7 @@ public class State { return stateMap.get(key); } - public HashMap<String, Object> getMap() { + public HashMap<String,Object> getMap() { return stateMap; } @@ -95,17 +95,17 @@ public class State { public Connector getConnector() throws AccumuloException, AccumuloSecurityException { if (connector == null) { - connector = getInstance().getConnector(getCredentials()); + connector = getInstance().getConnector(getCredentials().getPrincipal(), getCredentials().getToken()); } return connector; } - public Credential getCredentials() { + public TCredentials getCredentials() { String username = props.getProperty("USERNAME"); String password = props.getProperty("PASSWORD"); - return CredentialHelper.createSquelchError(username, new PasswordToken().setPassword(password.getBytes()), getInstance().getInstanceID()); + return CredentialHelper.createSquelchError(username, new PasswordToken(password), getInstance().getInstanceID()); } - + public Instance getInstance() { if (instance == null) { String instance = props.getProperty("INSTANCE"); @@ -154,8 +154,8 @@ public class State { files = libdir.list(); for (int i = 0; i < files.length; i++) { String f = files[i]; - if (f.matches("^accumulo-core-.+jar$") || f.matches("^accumulo-server-.+jar$") || f.matches("^accumulo-fate-.+jar$") || f.matches("^accumulo-trace-.+jar$") - || f.matches("^libthrift-.+jar$")) { + if (f.matches("^accumulo-core-.+jar$") || f.matches("^accumulo-server-.+jar$") || f.matches("^accumulo-fate-.+jar$") + || f.matches("^accumulo-trace-.+jar$") || f.matches("^libthrift-.+jar$")) { if (retval == null) { retval = String.format("%s/%s", libdir.getAbsolutePath(), f); } else { Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java Thu Feb 28 23:05:24 2013 @@ -40,7 +40,7 @@ public class CreateUser extends Test { try { log.debug("Creating user " + userName); - conn.securityOperations().createUser(userName, new PasswordToken().setPassword((userName + "pass").getBytes())); + conn.securityOperations().createLocalUser(userName, new PasswordToken(userName + "pass")); } catch (AccumuloSecurityException ex) { log.debug("Create user failed " + ex.getCause()); } Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java Thu Feb 28 23:05:24 2013 @@ -39,7 +39,7 @@ public class DropUser extends Test { try { log.debug("Dropping user " + userName); - conn.securityOperations().dropUser(userName); + conn.securityOperations().dropLocalUser(userName); } catch (AccumuloSecurityException ex) { log.debug("Unable to drop " + ex.getCause()); } Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java Thu Feb 28 23:05:24 2013 @@ -17,7 +17,6 @@ package org.apache.accumulo.test.randomwalk.multitable; import java.io.IOException; -import java.nio.charset.Charset; import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; @@ -56,7 +55,7 @@ public class CopyTool extends Configured } job.setInputFormatClass(AccumuloInputFormat.class); - AccumuloInputFormat.setConnectorInfo(job, args[0], new PasswordToken().setPassword(args[1].getBytes(Charset.forName("UTF-8")))); + AccumuloInputFormat.setConnectorInfo(job, args[0], new PasswordToken(args[1])); AccumuloInputFormat.setInputTableName(job, args[2]); AccumuloInputFormat.setScanAuthorizations(job, Constants.NO_AUTHS); AccumuloInputFormat.setZooKeeperInstance(job, args[3], args[4]); @@ -68,7 +67,7 @@ public class CopyTool extends Configured job.setNumReduceTasks(0); job.setOutputFormatClass(AccumuloOutputFormat.class); - AccumuloOutputFormat.setConnectorInfo(job, args[0], new PasswordToken().setPassword(args[1].getBytes(Charset.forName("UTF-8")))); + AccumuloOutputFormat.setConnectorInfo(job, args[0], new PasswordToken(args[1])); AccumuloOutputFormat.setCreateTables(job, true); AccumuloOutputFormat.setDefaultTableName(job, args[5]); AccumuloOutputFormat.setZooKeeperInstance(job, args[3], args[4]); Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java Thu Feb 28 23:05:24 2013 @@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.A import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -61,7 +61,7 @@ public class AlterTablePerm extends Test String tableName = WalkingSecurity.get(state).getTableName(); boolean hasPerm = WalkingSecurity.get(state).hasTablePermission(target, tableName, tabPerm); boolean canGive; - Credential source; + TCredentials source; if ("system".equals(sourceUser)) { source = WalkingSecurity.get(state).getSysCredentials(); } else if ("table".equals(sourceUser)) { Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java Thu Feb 28 23:05:24 2013 @@ -22,7 +22,8 @@ import java.util.Properties; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; +import org.apache.accumulo.core.security.tokens.PasswordToken; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -33,7 +34,7 @@ public class Authenticate extends Test { authenticate(WalkingSecurity.get(state).getSysCredentials(), state, props); } - public static void authenticate(Credential auth, State state, Properties props) throws Exception { + public static void authenticate(TCredentials auth, State state, Properties props) throws Exception { String targetProp = props.getProperty("target"); boolean success = Boolean.parseBoolean(props.getProperty("valid")); @@ -50,7 +51,7 @@ public class Authenticate extends Test { // Copy so if failed it doesn't mess with the password stored in state byte[] password = Arrays.copyOf(WalkingSecurity.get(state).getUserPassword(target), WalkingSecurity.get(state).getUserPassword(target).length); boolean hasPermission = WalkingSecurity.get(state).canAskAboutUser(auth, target); - + if (!success) for (int i = 0; i < password.length; i++) password[i]++; @@ -58,7 +59,7 @@ public class Authenticate extends Test { boolean result; try { - result = conn.securityOperations().authenticateUser(target, password); + result = conn.securityOperations().authenticateUser(target, new PasswordToken(password)); } catch (AccumuloSecurityException ae) { switch (ae.getErrorCode()) { case PERMISSION_DENIED: Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java Thu Feb 28 23:05:24 2013 @@ -22,9 +22,8 @@ import java.util.Random; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.tokens.SecurityToken; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -35,14 +34,14 @@ public class ChangePass extends Test { String target = props.getProperty("target"); String source = props.getProperty("source"); - Credential auth; + TCredentials auth; if (source.equals("system")) { auth = WalkingSecurity.get(state).getSysCredentials(); } else { auth = WalkingSecurity.get(state).getTabCredentials(); } Connector conn = state.getInstance().getConnector(auth); - + boolean hasPerm; boolean targetExists; if (target.equals("table")) { @@ -51,18 +50,18 @@ public class ChangePass extends Test { target = WalkingSecurity.get(state).getSysUserName(); targetExists = WalkingSecurity.get(state).userExists(target); - + hasPerm = WalkingSecurity.get(state).canChangePassword(auth, target); Random r = new Random(); byte[] newPassw = new byte[r.nextInt(50) + 1]; - for (int i =0; i < newPassw.length; i++) - newPassw[i] = (byte) ((r.nextInt(26)+65) & 0xFF); + for (int i = 0; i < newPassw.length; i++) + newPassw[i] = (byte) ((r.nextInt(26) + 65) & 0xFF); - SecurityToken newPass = new PasswordToken().setPassword(newPassw); + PasswordToken newPass = new PasswordToken(newPassw); try { - conn.securityOperations().changeLoginInfo(target, newPass); + conn.securityOperations().changeLocalUserPassword(target, newPass); } catch (AccumuloSecurityException ae) { switch (ae.getErrorCode()) { case PERMISSION_DENIED: Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/CreateUser.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/CreateUser.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/CreateUser.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/CreateUser.java Thu Feb 28 23:05:24 2013 @@ -22,7 +22,6 @@ import org.apache.accumulo.core.client.A import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.tokens.SecurityToken; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -36,9 +35,9 @@ public class CreateUser extends Test { boolean exists = WalkingSecurity.get(state).userExists(tableUserName); boolean hasPermission = WalkingSecurity.get(state).canCreateUser(WalkingSecurity.get(state).getSysCredentials(), tableUserName); - SecurityToken tabUserPass = new PasswordToken().setPassword("Super Sekret Table User Password".getBytes()); + PasswordToken tabUserPass = new PasswordToken("Super Sekret Table User Password"); try { - conn.securityOperations().createUser(tableUserName, tabUserPass); + conn.securityOperations().createLocalUser(tableUserName, tabUserPass); } catch (AccumuloSecurityException ae) { switch (ae.getErrorCode()) { case PERMISSION_DENIED: @@ -48,7 +47,7 @@ public class CreateUser extends Test { // create user anyway for sake of state { if (!exists) { - state.getConnector().securityOperations().createUser(tableUserName, tabUserPass); + state.getConnector().securityOperations().createLocalUser(tableUserName, tabUserPass); WalkingSecurity.get(state).createUser(tableUserName, tabUserPass); } return; Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java Thu Feb 28 23:05:24 2013 @@ -23,7 +23,7 @@ import org.apache.accumulo.core.client.A import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.security.thrift.SecurityErrorCode; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -37,7 +37,7 @@ public class DropTable extends Test { public static void dropTable(State state, Properties props) throws Exception { String sourceUser = props.getProperty("source", "system"); - Credential auth; + TCredentials auth; if (sourceUser.equals("table")) { auth = WalkingSecurity.get(state).getTabCredentials(); } else { Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java Thu Feb 28 23:05:24 2013 @@ -36,7 +36,7 @@ public class DropUser extends Test { boolean hasPermission = WalkingSecurity.get(state).canDropUser(WalkingSecurity.get(state).getSysCredentials(), tableUserName); try { - conn.securityOperations().dropUser(tableUserName); + conn.securityOperations().dropLocalUser(tableUserName); } catch (AccumuloSecurityException ae) { switch (ae.getErrorCode()) { case PERMISSION_DENIED: @@ -44,7 +44,7 @@ public class DropUser extends Test { throw new AccumuloException("Got a security exception when I should have had permission.", ae); else { if (exists) { - state.getConnector().securityOperations().dropUser(tableUserName); + state.getConnector().securityOperations().dropLocalUser(tableUserName); WalkingSecurity.get(state).dropUser(tableUserName); } return; Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java Thu Feb 28 23:05:24 2013 @@ -25,7 +25,6 @@ import org.apache.accumulo.core.security import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.tokens.SecurityToken; import org.apache.accumulo.test.randomwalk.Fixture; import org.apache.accumulo.test.randomwalk.State; @@ -44,14 +43,14 @@ public class SecurityFixture extends Fix if (conn.tableOperations().exists(secTableName)) conn.tableOperations().delete(secTableName); - Set<String> users = conn.securityOperations().listUsers(); + Set<String> users = conn.securityOperations().listLocalUsers(); if (users.contains(tableUserName)) - conn.securityOperations().dropUser(tableUserName); + conn.securityOperations().dropLocalUser(tableUserName); if (users.contains(systemUserName)) - conn.securityOperations().dropUser(systemUserName); + conn.securityOperations().dropLocalUser(systemUserName); - SecurityToken sysUserPass = new PasswordToken().setPassword("sysUser".getBytes()); - conn.securityOperations().createUser(systemUserName, sysUserPass); + PasswordToken sysUserPass = new PasswordToken("sysUser"); + conn.securityOperations().createLocalUser(systemUserName, sysUserPass); WalkingSecurity.get(state).setTableName(secTableName); state.set("rootUserPass", CredentialHelper.extractToken(state.getCredentials())); @@ -59,7 +58,7 @@ public class SecurityFixture extends Fix WalkingSecurity.get(state).setSysUserName(systemUserName); WalkingSecurity.get(state).createUser(systemUserName, sysUserPass); - WalkingSecurity.get(state).changePassword(tableUserName, new PasswordToken().setPassword(new byte[0])); + WalkingSecurity.get(state).changePassword(tableUserName, new PasswordToken(new byte[0])); WalkingSecurity.get(state).setTabUserName(tableUserName); @@ -91,11 +90,11 @@ public class SecurityFixture extends Fix String tableUserName = WalkingSecurity.get(state).getTabUserName(); log.debug("Dropping user: " + tableUserName); - conn.securityOperations().dropUser(tableUserName); + conn.securityOperations().dropLocalUser(tableUserName); } String systemUserName = WalkingSecurity.get(state).getSysUserName(); log.debug("Dropping user: " + systemUserName); - conn.securityOperations().dropUser(systemUserName); + conn.securityOperations().dropLocalUser(systemUserName); } } Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java Thu Feb 28 23:05:24 2013 @@ -23,7 +23,7 @@ import org.apache.accumulo.core.client.A import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.thrift.Credential; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; @@ -31,7 +31,7 @@ public class SetAuths extends Test { @Override public void visit(State state, Properties props) throws Exception { - Credential auth; + TCredentials auth; String authsString = props.getProperty("auths", "_random"); Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java Thu Feb 28 23:05:24 2013 @@ -46,7 +46,7 @@ public class Validate extends Test { throw new AccumuloException("Table existance out of sync"); boolean tableUserExists = WalkingSecurity.get(state).userExists(WalkingSecurity.get(state).getTabUserName()); - boolean cloudTableUserExists = conn.securityOperations().listUsers().contains(WalkingSecurity.get(state).getTabUserName()); + boolean cloudTableUserExists = conn.securityOperations().listLocalUsers().contains(WalkingSecurity.get(state).getTabUserName()); if (tableUserExists != cloudTableUserExists) throw new AccumuloException("Table User existance out of sync"); Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java Thu Feb 28 23:05:24 2013 @@ -17,7 +17,6 @@ package org.apache.accumulo.test.randomwalk.security; import java.io.IOException; -import java.nio.charset.Charset; import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -30,11 +29,11 @@ import org.apache.accumulo.core.security import org.apache.accumulo.core.security.CredentialHelper; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; -import org.apache.accumulo.core.security.thrift.Credential; import org.apache.accumulo.core.security.thrift.SecurityErrorCode; +import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.security.thrift.ThriftSecurityException; +import org.apache.accumulo.core.security.tokens.AuthenticationToken; import org.apache.accumulo.core.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.tokens.SecurityToken; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.server.security.SecurityOperation; import org.apache.accumulo.server.security.handler.Authenticator; @@ -109,7 +108,7 @@ public class WalkingSecurity extends Sec } @Override - public void initializeSecurity(Credential rootuser, String token) throws ThriftSecurityException { + public void initializeSecurity(TCredentials rootuser, String token) throws ThriftSecurityException { throw new UnsupportedOperationException("nope"); } @@ -139,14 +138,14 @@ public class WalkingSecurity extends Sec } @Override - public boolean authenticateUser(String principal, SecurityToken token) { + public boolean authenticateUser(String principal, AuthenticationToken token) { PasswordToken pass = (PasswordToken) state.get(principal + userPass); boolean ret = pass.equals(token); return ret; } @Override - public void createUser(String principal, SecurityToken token) throws AccumuloSecurityException { + public void createUser(String principal, AuthenticationToken token) throws AccumuloSecurityException { state.set(principal + userExists, Boolean.toString(true)); changePassword(principal, token); cleanUser(principal); @@ -161,7 +160,7 @@ public class WalkingSecurity extends Sec } @Override - public void changePassword(String principal, SecurityToken token) throws AccumuloSecurityException { + public void changePassword(String principal, AuthenticationToken token) throws AccumuloSecurityException { state.set(principal + userPass, token); state.set(principal + userPass + "time", System.currentTimeMillis()); } @@ -271,12 +270,12 @@ public class WalkingSecurity extends Sec return Boolean.parseBoolean(state.getString(tableExists)); } - public Credential getSysCredentials() { - return CredentialHelper.createSquelchError(getSysUserName(), new PasswordToken().setPassword(getSysPassword()), state.getInstance().getInstanceID()); + public TCredentials getSysCredentials() { + return CredentialHelper.createSquelchError(getSysUserName(), new PasswordToken(getSysPassword()), state.getInstance().getInstanceID()); } - public Credential getTabCredentials() { - return CredentialHelper.createSquelchError(getTabUserName(), new PasswordToken().setPassword(getTabPassword()), state.getInstance().getInstanceID()); + public TCredentials getTabCredentials() { + return CredentialHelper.createSquelchError(getTabUserName(), new PasswordToken(getTabPassword()), state.getInstance().getInstanceID()); } public byte[] getUserPassword(String user) { @@ -368,7 +367,8 @@ public class WalkingSecurity extends Sec return fs; } - public boolean canAskAboutUser(Credential credentials, String user) throws ThriftSecurityException { + @Override + public boolean canAskAboutUser(TCredentials credentials, String user) throws ThriftSecurityException { try { return super.canAskAboutUser(credentials, user); } catch (ThriftSecurityException tse) { @@ -379,9 +379,9 @@ public class WalkingSecurity extends Sec } @Override - public SecurityToken login(Properties properties) throws AccumuloSecurityException { + public AuthenticationToken login(Properties properties) throws AccumuloSecurityException { if (properties.containsKey("password")) - return new PasswordToken().setPassword(properties.getProperty("password").getBytes(Charset.forName("UTF-8"))); + return new PasswordToken(properties.getProperty("password")); throw new AccumuloSecurityException(properties.getProperty("user"), SecurityErrorCode.INSUFFICIENT_PROPERTIES); } Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java (original) +++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java Thu Feb 28 23:05:24 2013 @@ -17,7 +17,6 @@ package org.apache.accumulo.test.randomwalk.sequential; import java.io.IOException; -import java.nio.charset.Charset; import java.util.Iterator; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; @@ -87,7 +86,7 @@ public class MapRedVerifyTool extends Co } job.setInputFormatClass(AccumuloInputFormat.class); - AccumuloInputFormat.setConnectorInfo(job, args[0], new PasswordToken().setPassword(args[1].getBytes(Charset.forName("UTF-8")))); + AccumuloInputFormat.setConnectorInfo(job, args[0], new PasswordToken(args[1])); AccumuloInputFormat.setInputTableName(job, args[2]); AccumuloInputFormat.setZooKeeperInstance(job, args[3], args[4]); @@ -99,7 +98,7 @@ public class MapRedVerifyTool extends Co job.setNumReduceTasks(1); job.setOutputFormatClass(AccumuloOutputFormat.class); - AccumuloOutputFormat.setConnectorInfo(job, args[0], new PasswordToken().setPassword(args[1].getBytes(Charset.forName("UTF-8")))); + AccumuloOutputFormat.setConnectorInfo(job, args[0], new PasswordToken(args[1])); AccumuloOutputFormat.setCreateTables(job, true); AccumuloOutputFormat.setDefaultTableName(job, args[5]); AccumuloOutputFormat.setZooKeeperInstance(job, args[3], args[4]); Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java?rev=1451419&r1=1451418&r2=1451419&view=diff ============================================================================== --- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java (original) +++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java Thu Feb 28 23:05:24 2013 @@ -46,33 +46,32 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.rules.TemporaryFolder; - public class MiniAccumuloClusterTest { public static TemporaryFolder folder = new TemporaryFolder(); private static MiniAccumuloCluster accumulo; - + @BeforeClass public static void setupMiniCluster() throws Exception { - + folder.create(); Logger.getLogger("org.apache.zookeeper").setLevel(Level.ERROR); - + accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret"); accumulo.start(); } - + @Test(timeout = 30000) public void test() throws Exception { Connector conn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("root", "superSecret"); conn.tableOperations().create("table1"); - conn.securityOperations().createUser("user1", new PasswordToken().setPassword("pass1".getBytes())); + conn.securityOperations().createLocalUser("user1", new PasswordToken("pass1")); conn.securityOperations().changeUserAuthorizations("user1", new Authorizations("A", "B")); conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.WRITE); conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.READ); @@ -82,7 +81,7 @@ public class MiniAccumuloClusterTest { SummingCombiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("META", "COUNT"))); conn.tableOperations().attachIterator("table1", is); - + Connector uconn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("user1", "pass1"); BatchWriter bw = uconn.createBatchWriter("table1", new BatchWriterConfig()); @@ -102,7 +101,7 @@ public class MiniAccumuloClusterTest { m.put("META", "COUNT", new ColumnVisibility("A|B"), "1"); m.put("META", "CRC", new ColumnVisibility("A|B"), "123"); bw.addMutation(m); - + bw.close(); int count = 0; @@ -146,11 +145,11 @@ public class MiniAccumuloClusterTest { File jarFile = File.createTempFile("iterator", ".jar"); FileUtils.copyURLToFile(this.getClass().getResource("/FooFilter.jar"), jarFile); jarFile.deleteOnExit(); - + conn.instanceOperations().setProperty(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "cx1", jarFile.toURI().toString()); conn.tableOperations().setProperty("table2", Property.TABLE_CLASSPATH.getKey(), "cx1"); conn.tableOperations().attachIterator("table2", new IteratorSetting(100, "foocensor", "org.apache.accumulo.test.FooFilter")); - + BatchWriter bw = conn.createBatchWriter("table2", new BatchWriterConfig()); Mutation m1 = new Mutation("foo"); @@ -179,9 +178,9 @@ public class MiniAccumuloClusterTest { conn.instanceOperations().removeProperty(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "cx1"); conn.tableOperations().delete("table2"); - + } - + @AfterClass public static void tearDownMiniCluster() throws Exception { accumulo.stop();