accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/2] git commit: ACCUMULO-2086 Use the tableID instead of the tableName where necessary.
Date Tue, 24 Dec 2013 03:52:55 GMT
Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 92bd40c6e -> 744f06bfb


ACCUMULO-2086 Use the tableID instead of the tableName where necessary.


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: e8c9aae904380f22e55a31e3a7422ecd4597b0b0
Parents: 92bd40c
Author: Josh Elser <elserj@apache.org>
Authored: Mon Dec 23 20:39:31 2013 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Dec 23 20:39:31 2013 -0500

----------------------------------------------------------------------
 .../test/randomwalk/security/TableOp.java       | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e8c9aae9/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
index a636355..0215365 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
@@ -64,12 +64,18 @@ public class TableOp extends Test {
       tp = TablePermission.valueOf(action);
     }
     
-    boolean tableExists = WalkingSecurity.get(state).getTableExists();
-    String tableName = WalkingSecurity.get(state).getTableName();
+    final boolean tableExists = WalkingSecurity.get(state).getTableExists();
+    final String tableName = WalkingSecurity.get(state).getTableName();
+    final String tableId = conn.tableOperations().tableIdMap().get(tableName);
+    
+    if (null == tableId) {
+      log.error("Could not determine tableID from name " + tableName);
+      return;
+    }
     
     switch (tp) {
       case READ: {
-        boolean canRead = WalkingSecurity.get(state).canScan(WalkingSecurity.get(state).getTabCredentials(),
tableName);
+        boolean canRead = WalkingSecurity.get(state).canScan(WalkingSecurity.get(state).getTabCredentials(),
tableId);
         Authorizations auths = WalkingSecurity.get(state).getUserAuthorizations(WalkingSecurity.get(state).getTabCredentials());
         boolean ambiguousZone = WalkingSecurity.get(state).inAmbiguousZone(conn.whoami(),
tp);
         boolean ambiguousAuths = WalkingSecurity.get(state).ambiguousAuthorizations(conn.whoami());
@@ -140,7 +146,7 @@ public class TableOp extends Test {
         break;
       }
       case WRITE:
-        boolean canWrite = WalkingSecurity.get(state).canWrite(WalkingSecurity.get(state).getTabCredentials(),
tableName);
+        boolean canWrite = WalkingSecurity.get(state).canWrite(WalkingSecurity.get(state).getTabCredentials(),
tableId);
         boolean ambiguousZone = WalkingSecurity.get(state).inAmbiguousZone(conn.whoami(),
tp);
         
         String key = WalkingSecurity.get(state).getLastKey() + "1";
@@ -214,7 +220,7 @@ public class TableOp extends Test {
           return;
         } catch (AccumuloSecurityException ae) {
           if (ae.getSecurityErrorCode().equals(SecurityErrorCode.PERMISSION_DENIED)) {
-            if (WalkingSecurity.get(state).canBulkImport(WalkingSecurity.get(state).getTabCredentials(),
tableName))
+            if (WalkingSecurity.get(state).canBulkImport(WalkingSecurity.get(state).getTabCredentials(),
tableId))
               throw new AccumuloException("Bulk Import failed when it should have worked:
" + tableName);
             return;
           } else if (ae.getSecurityErrorCode().equals(SecurityErrorCode.BAD_CREDENTIALS))
{
@@ -228,12 +234,12 @@ public class TableOp extends Test {
         fs.delete(dir, true);
         fs.delete(fail, true);
         
-        if (!WalkingSecurity.get(state).canBulkImport(WalkingSecurity.get(state).getTabCredentials(),
tableName))
+        if (!WalkingSecurity.get(state).canBulkImport(WalkingSecurity.get(state).getTabCredentials(),
tableId))
           throw new AccumuloException("Bulk Import succeeded when it should have failed:
" + dir + " table " + tableName);
         break;
       case ALTER_TABLE:
         AlterTable.renameTable(conn, state, tableName, tableName + "plus",
-            WalkingSecurity.get(state).canAlterTable(WalkingSecurity.get(state).getTabCredentials(),
tableName), tableExists);
+            WalkingSecurity.get(state).canAlterTable(WalkingSecurity.get(state).getTabCredentials(),
tableId), tableExists);
         break;
       
       case GRANT:


Mime
View raw message