You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2013/12/24 06:03:19 UTC
git commit: ACCUMULO-2087 ACCUMULO-2086 Fixing formatting.
Updated Branches:
refs/heads/1.6.0-SNAPSHOT 31f4fbf79 -> 0d294ad64
ACCUMULO-2087 ACCUMULO-2086 Fixing formatting.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/0d294ad6
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0d294ad6
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0d294ad6
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 0d294ad64ed5a12c44e1c33bc5561897e3aef512
Parents: 31f4fbf
Author: Josh Elser <el...@apache.org>
Authored: Mon Dec 23 23:55:35 2013 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Mon Dec 23 23:55:35 2013 -0500
----------------------------------------------------------------------
.../accumulo/core/client/impl/Tables.java | 16 ++++++-----
.../test/randomwalk/security/TableOp.java | 28 ++++++++++----------
2 files changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/0d294ad6/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 ba11f1e..7cf5ccc 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
@@ -198,22 +198,26 @@ 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/0d294ad6/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 0215365..347be89 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);