You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2014/07/14 13:04:56 UTC

git commit: HBASE-11506 IntegrationTestWithCellVisibilityLoadAndVerify allow User to be passed as arg (Ram)

Repository: hbase
Updated Branches:
  refs/heads/master 470d00ea9 -> 586c5931a


HBASE-11506 IntegrationTestWithCellVisibilityLoadAndVerify allow User to
be passed as arg (Ram)


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

Branch: refs/heads/master
Commit: 586c5931a5183f835e97e1fe2011534b8e71830e
Parents: 470d00e
Author: Ramkrishna <ra...@intel.com>
Authored: Mon Jul 14 16:31:43 2014 +0530
Committer: Ramkrishna <ra...@intel.com>
Committed: Mon Jul 14 16:31:43 2014 +0530

----------------------------------------------------------------------
 ...tionTestWithCellVisibilityLoadAndVerify.java | 28 +++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/586c5931/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestWithCellVisibilityLoadAndVerify.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestWithCellVisibilityLoadAndVerify.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestWithCellVisibilityLoadAndVerify.java
index 7b59909..32cdfa2 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestWithCellVisibilityLoadAndVerify.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestWithCellVisibilityLoadAndVerify.java
@@ -72,9 +72,13 @@ import org.junit.experimental.categories.Category;
  * This class can be run as a unit test, as an integration test, or from the command line.
  * 
  * Originally taken from Apache Bigtop.
+ * Issue user names as comma seperated list.
+ *./hbase IntegrationTestWithCellVisibilityLoadAndVerify -u usera,userb
  */
 @Category(IntegrationTests.class)
 public class IntegrationTestWithCellVisibilityLoadAndVerify extends IntegrationTestLoadAndVerify {
+  private static final String ERROR_STR = 
+      "Two user names are to be specified seperated by a ',' like 'usera,userb'";
   private static final char NOT = '!';
   private static final char OR = '|';
   private static final char AND = '&';
@@ -94,6 +98,8 @@ public class IntegrationTestWithCellVisibilityLoadAndVerify extends IntegrationT
   private static final String NUM_TO_WRITE_KEY = "loadmapper.num_to_write";
   private static final long NUM_TO_WRITE_DEFAULT = 100 * 1000;
   private static final int SCANNER_CACHING = 500;
+  private static String USER_OPT = "users";
+  private static String userNames = "user1,user2";
 
   private long numRowsLoadedWithExp1, numRowsLoadedWithExp2, numRowsLoadWithExp3,
       numRowsLoadWithExp4;
@@ -113,12 +119,25 @@ public class IntegrationTestWithCellVisibilityLoadAndVerify extends IntegrationT
     conf.set("hbase.coprocessor.master.classes", VisibilityController.class.getName());
     conf.set("hbase.coprocessor.region.classes", VisibilityController.class.getName());
     conf.set("hbase.superuser", User.getCurrent().getName());
+    conf.setBoolean("dfs.permissions", false);
     super.setUpCluster();
-    USER1 = User.createUserForTesting(conf, "user1", new String[] {});
-    USER2 = User.createUserForTesting(conf, "user2", new String[] {});
+    String[] users = userNames.split(",");
+    if (users.length != 2) {
+      System.err.println(ERROR_STR);
+      throw new IOException(ERROR_STR);
+    }
+    System.out.println(userNames + " "+users[0]+ " "+users[1]);
+    USER1 = User.createUserForTesting(conf, users[0], new String[] {});
+    USER2 = User.createUserForTesting(conf, users[1], new String[] {});
     addLabelsAndAuths();
   }
 
+  @Override
+  protected void addOptions() {
+    super.addOptions();
+    addOptWithArg("u", USER_OPT, "User names to be passed");
+  }
+
   private void addLabelsAndAuths() throws Exception {
     try {
       VisibilityClient.addLabels(util.getConfiguration(), LABELS);
@@ -325,7 +344,7 @@ public class IntegrationTestWithCellVisibilityLoadAndVerify extends IntegrationT
   }
 
   public void usage() {
-    System.err.println(this.getClass().getSimpleName() + " [-Doptions]");
+    System.err.println(this.getClass().getSimpleName() + " -u usera,userb [-Doptions]");
     System.err.println("  Loads a table with cell visibilities and verifies with Authorizations");
     System.err.println("Options");
     System.err
@@ -369,6 +388,9 @@ public class IntegrationTestWithCellVisibilityLoadAndVerify extends IntegrationT
     }
     // We always want loadAndVerify action
     args.add("loadAndVerify");
+    if (cmd.hasOption(USER_OPT)) {
+      userNames = cmd.getOptionValue(USER_OPT);
+    }
     super.processOptions(cmd);
   }