You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2014/01/30 22:57:53 UTC

[02/10] git commit: Revert "ACCUMULO-2087 ACCUMULO-2086 Fixing formatting."

Revert "ACCUMULO-2087 ACCUMULO-2086 Fixing formatting."

This reverts commit 0d294ad64ed5a12c44e1c33bc5561897e3aef512.


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

Branch: refs/heads/master
Commit: 12aa01e9a26d077a0a131590932b0cb2fc4783fb
Parents: cba77ea
Author: John Vines <vi...@apache.org>
Authored: Thu Jan 30 11:29:03 2014 -0500
Committer: John Vines <vi...@apache.org>
Committed: Thu Jan 30 11:29:03 2014 -0500

----------------------------------------------------------------------
 .../accumulo/core/client/impl/Tables.java       | 16 +++++------
 .../test/randomwalk/security/TableOp.java       | 28 ++++++++++----------
 2 files changed, 20 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/12aa01e9/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
index 215f381..bed4234 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
@@ -287,26 +287,22 @@ public class Tables {
 
   /**
    * Returns the namespace for a given table ID.
-   * 
-   * @param instance
-   *          The Accumulo Instance
-   * @param tableId
-   *          The tableId
+   * @param instance The Accumulo Instance
+   * @param tableId The tableId
    * @return The namespace which this table resides in.
-   * @throws IllegalArgumentException
-   *           if the table doesn't exist in ZooKeeper
+   * @throws IllegalArgumentException if the table doesn't exist in ZooKeeper
    */
   public static String getNamespace(Instance instance, String tableId) throws IllegalArgumentException {
     ArgumentChecker.notNull(instance, tableId);
-
+    
     ZooCache zc = getZooCache(instance);
     byte[] n = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE);
-
+    
     // We might get null out of ZooCache if this tableID doesn't exist
     if (null == n) {
       throw new IllegalArgumentException("Table with id " + tableId + " does not exist");
     }
-
+    
     return new String(n, Constants.UTF8);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/12aa01e9/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 347be89..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
@@ -50,11 +50,11 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 
 public class TableOp extends Test {
-
+  
   @Override
   public void visit(State state, Properties props) throws Exception {
     Connector conn = state.getInstance().getConnector(WalkingSecurity.get(state).getTabUserName(), WalkingSecurity.get(state).getTabToken());
-
+    
     String action = props.getProperty("action", "_random");
     TablePermission tp;
     if ("_random".equalsIgnoreCase(action)) {
@@ -63,23 +63,23 @@ public class TableOp extends Test {
     } else {
       tp = TablePermission.valueOf(action);
     }
-
+    
     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(), 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());
-
+        
         Scanner scan = null;
         try {
           scan = conn.createScanner(tableName, conn.securityOperations().getUserAuthorizations(conn.whoami()));
@@ -133,22 +133,22 @@ public class TableOp extends Test {
             else
               throw new AccumuloException("Mismatched authorizations! ", re.getCause());
           }
-
+          
           throw new AccumuloException("Unexpected exception!", re);
         } finally {
           if (scan != null) {
             scan.close();
             scan = null;
           }
-
+          
         }
-
+        
         break;
       }
       case WRITE:
         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";
         Mutation m = new Mutation(new Text(key));
         for (String s : WalkingSecurity.get(state).getAuthsArray()) {
@@ -172,7 +172,7 @@ public class TableOp extends Test {
             // For now, just wait a second and go again if they can write!
             if (!canWrite)
               return;
-
+            
             if (ambiguousZone) {
               Thread.sleep(1000);
               try {
@@ -233,7 +233,7 @@ public class TableOp extends Test {
           WalkingSecurity.get(state).increaseAuthMap(s, 1);
         fs.delete(dir, true);
         fs.delete(fail, true);
-
+        
         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;
@@ -241,7 +241,7 @@ public class TableOp extends Test {
         AlterTable.renameTable(conn, state, tableName, tableName + "plus",
             WalkingSecurity.get(state).canAlterTable(WalkingSecurity.get(state).getTabCredentials(), tableId), tableExists);
         break;
-
+      
       case GRANT:
         props.setProperty("task", "grant");
         props.setProperty("perm", "random");
@@ -249,7 +249,7 @@ public class TableOp extends Test {
         props.setProperty("target", "system");
         AlterTablePerm.alter(state, props);
         break;
-
+      
       case DROP_TABLE:
         props.setProperty("source", "table");
         DropTable.dropTable(state, props);