hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [04/30] hbase-site git commit: Published site at .
Date Mon, 18 Sep 2017 15:13:11 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/2bb8bd01/testdevapidocs/src-html/org/apache/hadoop/hbase/security/access/TestAccessController.PingCoprocessor.html
----------------------------------------------------------------------
diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/security/access/TestAccessController.PingCoprocessor.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/security/access/TestAccessController.PingCoprocessor.html
index 6899321..da046b2 100644
--- a/testdevapidocs/src-html/org/apache/hadoop/hbase/security/access/TestAccessController.PingCoprocessor.html
+++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/security/access/TestAccessController.PingCoprocessor.html
@@ -865,2376 +865,2351 @@
 <span class="sourceLineNo">857</span>  }<a name="line.857"></a>
 <span class="sourceLineNo">858</span><a name="line.858"></a>
 <span class="sourceLineNo">859</span>  @Test (timeout=180000)<a name="line.859"></a>
-<span class="sourceLineNo">860</span>  public void testMergeRegions() throws Exception {<a name="line.860"></a>
-<span class="sourceLineNo">861</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.861"></a>
-<span class="sourceLineNo">862</span>    createTestTable(tableName);<a name="line.862"></a>
-<span class="sourceLineNo">863</span>    try {<a name="line.863"></a>
-<span class="sourceLineNo">864</span>      final List&lt;HRegion&gt; regions = TEST_UTIL.getHBaseCluster().findRegionsForTable(tableName);<a name="line.864"></a>
-<span class="sourceLineNo">865</span>      assertTrue("not enough regions: " + regions.size(), regions.size() &gt;= 2);<a name="line.865"></a>
-<span class="sourceLineNo">866</span><a name="line.866"></a>
-<span class="sourceLineNo">867</span>      AccessTestAction action = new AccessTestAction() {<a name="line.867"></a>
-<span class="sourceLineNo">868</span>        @Override<a name="line.868"></a>
-<span class="sourceLineNo">869</span>        public Object run() throws Exception {<a name="line.869"></a>
-<span class="sourceLineNo">870</span>          ACCESS_CONTROLLER.preMerge(ObserverContext.createAndPrepare(RSCP_ENV, null),<a name="line.870"></a>
-<span class="sourceLineNo">871</span>            regions.get(0), regions.get(1));<a name="line.871"></a>
-<span class="sourceLineNo">872</span>          return null;<a name="line.872"></a>
-<span class="sourceLineNo">873</span>        }<a name="line.873"></a>
-<span class="sourceLineNo">874</span>      };<a name="line.874"></a>
-<span class="sourceLineNo">875</span><a name="line.875"></a>
-<span class="sourceLineNo">876</span>      verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_GROUP_ADMIN);<a name="line.876"></a>
-<span class="sourceLineNo">877</span>      verifyDenied(action, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ,<a name="line.877"></a>
-<span class="sourceLineNo">878</span>        USER_GROUP_WRITE, USER_GROUP_CREATE);<a name="line.878"></a>
-<span class="sourceLineNo">879</span>    } finally {<a name="line.879"></a>
-<span class="sourceLineNo">880</span>      deleteTable(TEST_UTIL, tableName);<a name="line.880"></a>
-<span class="sourceLineNo">881</span>    }<a name="line.881"></a>
-<span class="sourceLineNo">882</span>  }<a name="line.882"></a>
-<span class="sourceLineNo">883</span><a name="line.883"></a>
-<span class="sourceLineNo">884</span>  @Test (timeout=180000)<a name="line.884"></a>
-<span class="sourceLineNo">885</span>  public void testFlush() throws Exception {<a name="line.885"></a>
-<span class="sourceLineNo">886</span>    AccessTestAction action = new AccessTestAction() {<a name="line.886"></a>
-<span class="sourceLineNo">887</span>      @Override<a name="line.887"></a>
-<span class="sourceLineNo">888</span>      public Object run() throws Exception {<a name="line.888"></a>
-<span class="sourceLineNo">889</span>        ACCESS_CONTROLLER.preFlush(ObserverContext.createAndPrepare(RCP_ENV, null));<a name="line.889"></a>
-<span class="sourceLineNo">890</span>        return null;<a name="line.890"></a>
-<span class="sourceLineNo">891</span>      }<a name="line.891"></a>
-<span class="sourceLineNo">892</span>    };<a name="line.892"></a>
-<span class="sourceLineNo">893</span><a name="line.893"></a>
-<span class="sourceLineNo">894</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_GROUP_CREATE,<a name="line.894"></a>
-<span class="sourceLineNo">895</span>      USER_GROUP_ADMIN);<a name="line.895"></a>
-<span class="sourceLineNo">896</span>    verifyDenied(action, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE);<a name="line.896"></a>
-<span class="sourceLineNo">897</span>  }<a name="line.897"></a>
-<span class="sourceLineNo">898</span><a name="line.898"></a>
-<span class="sourceLineNo">899</span>  @Test (timeout=180000)<a name="line.899"></a>
-<span class="sourceLineNo">900</span>  public void testCompact() throws Exception {<a name="line.900"></a>
-<span class="sourceLineNo">901</span>    AccessTestAction action = new AccessTestAction() {<a name="line.901"></a>
-<span class="sourceLineNo">902</span>      @Override<a name="line.902"></a>
-<span class="sourceLineNo">903</span>      public Object run() throws Exception {<a name="line.903"></a>
-<span class="sourceLineNo">904</span>        ACCESS_CONTROLLER.preCompact(ObserverContext.createAndPrepare(RCP_ENV, null), null, null,<a name="line.904"></a>
-<span class="sourceLineNo">905</span>          ScanType.COMPACT_RETAIN_DELETES, null);<a name="line.905"></a>
-<span class="sourceLineNo">906</span>        return null;<a name="line.906"></a>
-<span class="sourceLineNo">907</span>      }<a name="line.907"></a>
-<span class="sourceLineNo">908</span>    };<a name="line.908"></a>
-<span class="sourceLineNo">909</span><a name="line.909"></a>
-<span class="sourceLineNo">910</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_GROUP_CREATE,<a name="line.910"></a>
-<span class="sourceLineNo">911</span>      USER_GROUP_ADMIN);<a name="line.911"></a>
-<span class="sourceLineNo">912</span>    verifyDenied(action, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE);<a name="line.912"></a>
-<span class="sourceLineNo">913</span>  }<a name="line.913"></a>
-<span class="sourceLineNo">914</span><a name="line.914"></a>
-<span class="sourceLineNo">915</span>  private void verifyRead(AccessTestAction action) throws Exception {<a name="line.915"></a>
-<span class="sourceLineNo">916</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW, USER_RO,<a name="line.916"></a>
-<span class="sourceLineNo">917</span>      USER_GROUP_READ);<a name="line.917"></a>
-<span class="sourceLineNo">918</span>    verifyDenied(action, USER_NONE, USER_GROUP_CREATE, USER_GROUP_ADMIN, USER_GROUP_WRITE);<a name="line.918"></a>
-<span class="sourceLineNo">919</span>  }<a name="line.919"></a>
-<span class="sourceLineNo">920</span><a name="line.920"></a>
-<span class="sourceLineNo">921</span>  private void verifyReadWrite(AccessTestAction action) throws Exception {<a name="line.921"></a>
-<span class="sourceLineNo">922</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW);<a name="line.922"></a>
-<span class="sourceLineNo">923</span>    verifyDenied(action, USER_NONE, USER_RO, USER_GROUP_ADMIN, USER_GROUP_CREATE, USER_GROUP_READ,<a name="line.923"></a>
-<span class="sourceLineNo">924</span>        USER_GROUP_WRITE);<a name="line.924"></a>
-<span class="sourceLineNo">925</span>  }<a name="line.925"></a>
-<span class="sourceLineNo">926</span><a name="line.926"></a>
-<span class="sourceLineNo">927</span>  @Test (timeout=180000)<a name="line.927"></a>
-<span class="sourceLineNo">928</span>  public void testRead() throws Exception {<a name="line.928"></a>
-<span class="sourceLineNo">929</span>    // get action<a name="line.929"></a>
-<span class="sourceLineNo">930</span>    AccessTestAction getAction = new AccessTestAction() {<a name="line.930"></a>
-<span class="sourceLineNo">931</span>      @Override<a name="line.931"></a>
-<span class="sourceLineNo">932</span>      public Object run() throws Exception {<a name="line.932"></a>
-<span class="sourceLineNo">933</span>        Get g = new Get(TEST_ROW);<a name="line.933"></a>
-<span class="sourceLineNo">934</span>        g.addFamily(TEST_FAMILY);<a name="line.934"></a>
-<span class="sourceLineNo">935</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.935"></a>
-<span class="sourceLineNo">936</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.936"></a>
-<span class="sourceLineNo">937</span>          t.get(g);<a name="line.937"></a>
-<span class="sourceLineNo">938</span>        }<a name="line.938"></a>
-<span class="sourceLineNo">939</span>        return null;<a name="line.939"></a>
-<span class="sourceLineNo">940</span>      }<a name="line.940"></a>
-<span class="sourceLineNo">941</span>    };<a name="line.941"></a>
-<span class="sourceLineNo">942</span>    verifyRead(getAction);<a name="line.942"></a>
-<span class="sourceLineNo">943</span><a name="line.943"></a>
-<span class="sourceLineNo">944</span>    // action for scanning<a name="line.944"></a>
-<span class="sourceLineNo">945</span>    AccessTestAction scanAction = new AccessTestAction() {<a name="line.945"></a>
-<span class="sourceLineNo">946</span>      @Override<a name="line.946"></a>
-<span class="sourceLineNo">947</span>      public Object run() throws Exception {<a name="line.947"></a>
-<span class="sourceLineNo">948</span>        Scan s = new Scan();<a name="line.948"></a>
-<span class="sourceLineNo">949</span>        s.addFamily(TEST_FAMILY);<a name="line.949"></a>
-<span class="sourceLineNo">950</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.950"></a>
-<span class="sourceLineNo">951</span>            Table table = conn.getTable(TEST_TABLE)) {<a name="line.951"></a>
-<span class="sourceLineNo">952</span>          ResultScanner scanner = table.getScanner(s);<a name="line.952"></a>
-<span class="sourceLineNo">953</span>          try {<a name="line.953"></a>
-<span class="sourceLineNo">954</span>            for (Result r = scanner.next(); r != null; r = scanner.next()) {<a name="line.954"></a>
-<span class="sourceLineNo">955</span>              // do nothing<a name="line.955"></a>
-<span class="sourceLineNo">956</span>            }<a name="line.956"></a>
-<span class="sourceLineNo">957</span>          } finally {<a name="line.957"></a>
-<span class="sourceLineNo">958</span>            scanner.close();<a name="line.958"></a>
-<span class="sourceLineNo">959</span>          }<a name="line.959"></a>
-<span class="sourceLineNo">960</span>        }<a name="line.960"></a>
-<span class="sourceLineNo">961</span>        return null;<a name="line.961"></a>
-<span class="sourceLineNo">962</span>      }<a name="line.962"></a>
-<span class="sourceLineNo">963</span>    };<a name="line.963"></a>
-<span class="sourceLineNo">964</span>    verifyRead(scanAction);<a name="line.964"></a>
-<span class="sourceLineNo">965</span>  }<a name="line.965"></a>
-<span class="sourceLineNo">966</span><a name="line.966"></a>
-<span class="sourceLineNo">967</span>  @Test (timeout=180000)<a name="line.967"></a>
-<span class="sourceLineNo">968</span>  // test put, delete, increment<a name="line.968"></a>
-<span class="sourceLineNo">969</span>  public void testWrite() throws Exception {<a name="line.969"></a>
-<span class="sourceLineNo">970</span>    // put action<a name="line.970"></a>
-<span class="sourceLineNo">971</span>    AccessTestAction putAction = new AccessTestAction() {<a name="line.971"></a>
-<span class="sourceLineNo">972</span>      @Override<a name="line.972"></a>
-<span class="sourceLineNo">973</span>      public Object run() throws Exception {<a name="line.973"></a>
-<span class="sourceLineNo">974</span>        Put p = new Put(TEST_ROW);<a name="line.974"></a>
-<span class="sourceLineNo">975</span>        p.addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(1));<a name="line.975"></a>
-<span class="sourceLineNo">976</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.976"></a>
-<span class="sourceLineNo">977</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.977"></a>
-<span class="sourceLineNo">978</span>          t.put(p);<a name="line.978"></a>
-<span class="sourceLineNo">979</span>        }<a name="line.979"></a>
-<span class="sourceLineNo">980</span>        return null;<a name="line.980"></a>
-<span class="sourceLineNo">981</span>      }<a name="line.981"></a>
-<span class="sourceLineNo">982</span>    };<a name="line.982"></a>
-<span class="sourceLineNo">983</span>    verifyWrite(putAction);<a name="line.983"></a>
-<span class="sourceLineNo">984</span><a name="line.984"></a>
-<span class="sourceLineNo">985</span>    // delete action<a name="line.985"></a>
-<span class="sourceLineNo">986</span>    AccessTestAction deleteAction = new AccessTestAction() {<a name="line.986"></a>
-<span class="sourceLineNo">987</span>      @Override<a name="line.987"></a>
-<span class="sourceLineNo">988</span>      public Object run() throws Exception {<a name="line.988"></a>
-<span class="sourceLineNo">989</span>        Delete d = new Delete(TEST_ROW);<a name="line.989"></a>
-<span class="sourceLineNo">990</span>        d.addFamily(TEST_FAMILY);<a name="line.990"></a>
-<span class="sourceLineNo">991</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.991"></a>
-<span class="sourceLineNo">992</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.992"></a>
-<span class="sourceLineNo">993</span>          t.delete(d);<a name="line.993"></a>
-<span class="sourceLineNo">994</span>        }<a name="line.994"></a>
-<span class="sourceLineNo">995</span>        return null;<a name="line.995"></a>
-<span class="sourceLineNo">996</span>      }<a name="line.996"></a>
-<span class="sourceLineNo">997</span>    };<a name="line.997"></a>
-<span class="sourceLineNo">998</span>    verifyWrite(deleteAction);<a name="line.998"></a>
-<span class="sourceLineNo">999</span><a name="line.999"></a>
-<span class="sourceLineNo">1000</span>    // increment action<a name="line.1000"></a>
-<span class="sourceLineNo">1001</span>    AccessTestAction incrementAction = new AccessTestAction() {<a name="line.1001"></a>
-<span class="sourceLineNo">1002</span>      @Override<a name="line.1002"></a>
-<span class="sourceLineNo">1003</span>      public Object run() throws Exception {<a name="line.1003"></a>
-<span class="sourceLineNo">1004</span>        Increment inc = new Increment(TEST_ROW);<a name="line.1004"></a>
-<span class="sourceLineNo">1005</span>        inc.addColumn(TEST_FAMILY, TEST_QUALIFIER, 1);<a name="line.1005"></a>
-<span class="sourceLineNo">1006</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1006"></a>
-<span class="sourceLineNo">1007</span>            Table t = conn.getTable(TEST_TABLE);) {<a name="line.1007"></a>
-<span class="sourceLineNo">1008</span>          t.increment(inc);<a name="line.1008"></a>
-<span class="sourceLineNo">1009</span>        }<a name="line.1009"></a>
-<span class="sourceLineNo">1010</span>        return null;<a name="line.1010"></a>
-<span class="sourceLineNo">1011</span>      }<a name="line.1011"></a>
-<span class="sourceLineNo">1012</span>    };<a name="line.1012"></a>
-<span class="sourceLineNo">1013</span>    verifyWrite(incrementAction);<a name="line.1013"></a>
-<span class="sourceLineNo">1014</span>  }<a name="line.1014"></a>
-<span class="sourceLineNo">1015</span><a name="line.1015"></a>
-<span class="sourceLineNo">1016</span>  @Test (timeout=180000)<a name="line.1016"></a>
-<span class="sourceLineNo">1017</span>  public void testReadWrite() throws Exception {<a name="line.1017"></a>
-<span class="sourceLineNo">1018</span>    // action for checkAndDelete<a name="line.1018"></a>
-<span class="sourceLineNo">1019</span>    AccessTestAction checkAndDeleteAction = new AccessTestAction() {<a name="line.1019"></a>
-<span class="sourceLineNo">1020</span>      @Override<a name="line.1020"></a>
-<span class="sourceLineNo">1021</span>      public Object run() throws Exception {<a name="line.1021"></a>
-<span class="sourceLineNo">1022</span>        Delete d = new Delete(TEST_ROW);<a name="line.1022"></a>
-<span class="sourceLineNo">1023</span>        d.addFamily(TEST_FAMILY);<a name="line.1023"></a>
-<span class="sourceLineNo">1024</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1024"></a>
-<span class="sourceLineNo">1025</span>            Table t = conn.getTable(TEST_TABLE);) {<a name="line.1025"></a>
-<span class="sourceLineNo">1026</span>          t.checkAndDelete(TEST_ROW, TEST_FAMILY, TEST_QUALIFIER,<a name="line.1026"></a>
-<span class="sourceLineNo">1027</span>              Bytes.toBytes("test_value"), d);<a name="line.1027"></a>
-<span class="sourceLineNo">1028</span>        }<a name="line.1028"></a>
-<span class="sourceLineNo">1029</span>        return null;<a name="line.1029"></a>
-<span class="sourceLineNo">1030</span>      }<a name="line.1030"></a>
-<span class="sourceLineNo">1031</span>    };<a name="line.1031"></a>
-<span class="sourceLineNo">1032</span>    verifyReadWrite(checkAndDeleteAction);<a name="line.1032"></a>
-<span class="sourceLineNo">1033</span><a name="line.1033"></a>
-<span class="sourceLineNo">1034</span>    // action for checkAndPut()<a name="line.1034"></a>
-<span class="sourceLineNo">1035</span>    AccessTestAction checkAndPut = new AccessTestAction() {<a name="line.1035"></a>
-<span class="sourceLineNo">1036</span>      @Override<a name="line.1036"></a>
-<span class="sourceLineNo">1037</span>      public Object run() throws Exception {<a name="line.1037"></a>
-<span class="sourceLineNo">1038</span>        Put p = new Put(TEST_ROW);<a name="line.1038"></a>
-<span class="sourceLineNo">1039</span>        p.addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(1));<a name="line.1039"></a>
-<span class="sourceLineNo">1040</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1040"></a>
-<span class="sourceLineNo">1041</span>            Table t = conn.getTable(TEST_TABLE);) {<a name="line.1041"></a>
-<span class="sourceLineNo">1042</span>          t.checkAndPut(TEST_ROW, TEST_FAMILY, TEST_QUALIFIER,<a name="line.1042"></a>
-<span class="sourceLineNo">1043</span>              Bytes.toBytes("test_value"), p);<a name="line.1043"></a>
-<span class="sourceLineNo">1044</span>        }<a name="line.1044"></a>
-<span class="sourceLineNo">1045</span>        return null;<a name="line.1045"></a>
-<span class="sourceLineNo">1046</span>      }<a name="line.1046"></a>
-<span class="sourceLineNo">1047</span>    };<a name="line.1047"></a>
-<span class="sourceLineNo">1048</span>    verifyReadWrite(checkAndPut);<a name="line.1048"></a>
-<span class="sourceLineNo">1049</span>  }<a name="line.1049"></a>
-<span class="sourceLineNo">1050</span><a name="line.1050"></a>
-<span class="sourceLineNo">1051</span>  @Test (timeout=180000)<a name="line.1051"></a>
-<span class="sourceLineNo">1052</span>  public void testBulkLoad() throws Exception {<a name="line.1052"></a>
-<span class="sourceLineNo">1053</span>    try {<a name="line.1053"></a>
-<span class="sourceLineNo">1054</span>      FileSystem fs = TEST_UTIL.getTestFileSystem();<a name="line.1054"></a>
-<span class="sourceLineNo">1055</span>      final Path dir = TEST_UTIL.getDataTestDirOnTestFS("testBulkLoad");<a name="line.1055"></a>
-<span class="sourceLineNo">1056</span>      fs.mkdirs(dir);<a name="line.1056"></a>
-<span class="sourceLineNo">1057</span>      // need to make it globally writable<a name="line.1057"></a>
-<span class="sourceLineNo">1058</span>      // so users creating HFiles have write permissions<a name="line.1058"></a>
-<span class="sourceLineNo">1059</span>      fs.setPermission(dir, FsPermission.valueOf("-rwxrwxrwx"));<a name="line.1059"></a>
-<span class="sourceLineNo">1060</span><a name="line.1060"></a>
-<span class="sourceLineNo">1061</span>      AccessTestAction bulkLoadAction = new AccessTestAction() {<a name="line.1061"></a>
-<span class="sourceLineNo">1062</span>        @Override<a name="line.1062"></a>
-<span class="sourceLineNo">1063</span>        public Object run() throws Exception {<a name="line.1063"></a>
-<span class="sourceLineNo">1064</span>          int numRows = 3;<a name="line.1064"></a>
-<span class="sourceLineNo">1065</span><a name="line.1065"></a>
-<span class="sourceLineNo">1066</span>          // Making the assumption that the test table won't split between the range<a name="line.1066"></a>
-<span class="sourceLineNo">1067</span>          byte[][][] hfileRanges = { { { (byte) 0 }, { (byte) 9 } } };<a name="line.1067"></a>
-<span class="sourceLineNo">1068</span><a name="line.1068"></a>
-<span class="sourceLineNo">1069</span>          Path bulkLoadBasePath = new Path(dir, new Path(User.getCurrent().getName()));<a name="line.1069"></a>
-<span class="sourceLineNo">1070</span>          new BulkLoadHelper(bulkLoadBasePath).bulkLoadHFile(TEST_TABLE, TEST_FAMILY,<a name="line.1070"></a>
-<span class="sourceLineNo">1071</span>            TEST_QUALIFIER, hfileRanges, numRows);<a name="line.1071"></a>
-<span class="sourceLineNo">1072</span><a name="line.1072"></a>
-<span class="sourceLineNo">1073</span>          return null;<a name="line.1073"></a>
-<span class="sourceLineNo">1074</span>        }<a name="line.1074"></a>
-<span class="sourceLineNo">1075</span>      };<a name="line.1075"></a>
+<span class="sourceLineNo">860</span>  public void testFlush() throws Exception {<a name="line.860"></a>
+<span class="sourceLineNo">861</span>    AccessTestAction action = new AccessTestAction() {<a name="line.861"></a>
+<span class="sourceLineNo">862</span>      @Override<a name="line.862"></a>
+<span class="sourceLineNo">863</span>      public Object run() throws Exception {<a name="line.863"></a>
+<span class="sourceLineNo">864</span>        ACCESS_CONTROLLER.preFlush(ObserverContext.createAndPrepare(RCP_ENV, null));<a name="line.864"></a>
+<span class="sourceLineNo">865</span>        return null;<a name="line.865"></a>
+<span class="sourceLineNo">866</span>      }<a name="line.866"></a>
+<span class="sourceLineNo">867</span>    };<a name="line.867"></a>
+<span class="sourceLineNo">868</span><a name="line.868"></a>
+<span class="sourceLineNo">869</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_GROUP_CREATE,<a name="line.869"></a>
+<span class="sourceLineNo">870</span>      USER_GROUP_ADMIN);<a name="line.870"></a>
+<span class="sourceLineNo">871</span>    verifyDenied(action, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE);<a name="line.871"></a>
+<span class="sourceLineNo">872</span>  }<a name="line.872"></a>
+<span class="sourceLineNo">873</span><a name="line.873"></a>
+<span class="sourceLineNo">874</span>  @Test (timeout=180000)<a name="line.874"></a>
+<span class="sourceLineNo">875</span>  public void testCompact() throws Exception {<a name="line.875"></a>
+<span class="sourceLineNo">876</span>    AccessTestAction action = new AccessTestAction() {<a name="line.876"></a>
+<span class="sourceLineNo">877</span>      @Override<a name="line.877"></a>
+<span class="sourceLineNo">878</span>      public Object run() throws Exception {<a name="line.878"></a>
+<span class="sourceLineNo">879</span>        ACCESS_CONTROLLER.preCompact(ObserverContext.createAndPrepare(RCP_ENV, null), null, null,<a name="line.879"></a>
+<span class="sourceLineNo">880</span>          ScanType.COMPACT_RETAIN_DELETES, null);<a name="line.880"></a>
+<span class="sourceLineNo">881</span>        return null;<a name="line.881"></a>
+<span class="sourceLineNo">882</span>      }<a name="line.882"></a>
+<span class="sourceLineNo">883</span>    };<a name="line.883"></a>
+<span class="sourceLineNo">884</span><a name="line.884"></a>
+<span class="sourceLineNo">885</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_GROUP_CREATE,<a name="line.885"></a>
+<span class="sourceLineNo">886</span>      USER_GROUP_ADMIN);<a name="line.886"></a>
+<span class="sourceLineNo">887</span>    verifyDenied(action, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE);<a name="line.887"></a>
+<span class="sourceLineNo">888</span>  }<a name="line.888"></a>
+<span class="sourceLineNo">889</span><a name="line.889"></a>
+<span class="sourceLineNo">890</span>  private void verifyRead(AccessTestAction action) throws Exception {<a name="line.890"></a>
+<span class="sourceLineNo">891</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW, USER_RO,<a name="line.891"></a>
+<span class="sourceLineNo">892</span>      USER_GROUP_READ);<a name="line.892"></a>
+<span class="sourceLineNo">893</span>    verifyDenied(action, USER_NONE, USER_GROUP_CREATE, USER_GROUP_ADMIN, USER_GROUP_WRITE);<a name="line.893"></a>
+<span class="sourceLineNo">894</span>  }<a name="line.894"></a>
+<span class="sourceLineNo">895</span><a name="line.895"></a>
+<span class="sourceLineNo">896</span>  private void verifyReadWrite(AccessTestAction action) throws Exception {<a name="line.896"></a>
+<span class="sourceLineNo">897</span>    verifyAllowed(action, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW);<a name="line.897"></a>
+<span class="sourceLineNo">898</span>    verifyDenied(action, USER_NONE, USER_RO, USER_GROUP_ADMIN, USER_GROUP_CREATE, USER_GROUP_READ,<a name="line.898"></a>
+<span class="sourceLineNo">899</span>        USER_GROUP_WRITE);<a name="line.899"></a>
+<span class="sourceLineNo">900</span>  }<a name="line.900"></a>
+<span class="sourceLineNo">901</span><a name="line.901"></a>
+<span class="sourceLineNo">902</span>  @Test (timeout=180000)<a name="line.902"></a>
+<span class="sourceLineNo">903</span>  public void testRead() throws Exception {<a name="line.903"></a>
+<span class="sourceLineNo">904</span>    // get action<a name="line.904"></a>
+<span class="sourceLineNo">905</span>    AccessTestAction getAction = new AccessTestAction() {<a name="line.905"></a>
+<span class="sourceLineNo">906</span>      @Override<a name="line.906"></a>
+<span class="sourceLineNo">907</span>      public Object run() throws Exception {<a name="line.907"></a>
+<span class="sourceLineNo">908</span>        Get g = new Get(TEST_ROW);<a name="line.908"></a>
+<span class="sourceLineNo">909</span>        g.addFamily(TEST_FAMILY);<a name="line.909"></a>
+<span class="sourceLineNo">910</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.910"></a>
+<span class="sourceLineNo">911</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.911"></a>
+<span class="sourceLineNo">912</span>          t.get(g);<a name="line.912"></a>
+<span class="sourceLineNo">913</span>        }<a name="line.913"></a>
+<span class="sourceLineNo">914</span>        return null;<a name="line.914"></a>
+<span class="sourceLineNo">915</span>      }<a name="line.915"></a>
+<span class="sourceLineNo">916</span>    };<a name="line.916"></a>
+<span class="sourceLineNo">917</span>    verifyRead(getAction);<a name="line.917"></a>
+<span class="sourceLineNo">918</span><a name="line.918"></a>
+<span class="sourceLineNo">919</span>    // action for scanning<a name="line.919"></a>
+<span class="sourceLineNo">920</span>    AccessTestAction scanAction = new AccessTestAction() {<a name="line.920"></a>
+<span class="sourceLineNo">921</span>      @Override<a name="line.921"></a>
+<span class="sourceLineNo">922</span>      public Object run() throws Exception {<a name="line.922"></a>
+<span class="sourceLineNo">923</span>        Scan s = new Scan();<a name="line.923"></a>
+<span class="sourceLineNo">924</span>        s.addFamily(TEST_FAMILY);<a name="line.924"></a>
+<span class="sourceLineNo">925</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.925"></a>
+<span class="sourceLineNo">926</span>            Table table = conn.getTable(TEST_TABLE)) {<a name="line.926"></a>
+<span class="sourceLineNo">927</span>          ResultScanner scanner = table.getScanner(s);<a name="line.927"></a>
+<span class="sourceLineNo">928</span>          try {<a name="line.928"></a>
+<span class="sourceLineNo">929</span>            for (Result r = scanner.next(); r != null; r = scanner.next()) {<a name="line.929"></a>
+<span class="sourceLineNo">930</span>              // do nothing<a name="line.930"></a>
+<span class="sourceLineNo">931</span>            }<a name="line.931"></a>
+<span class="sourceLineNo">932</span>          } finally {<a name="line.932"></a>
+<span class="sourceLineNo">933</span>            scanner.close();<a name="line.933"></a>
+<span class="sourceLineNo">934</span>          }<a name="line.934"></a>
+<span class="sourceLineNo">935</span>        }<a name="line.935"></a>
+<span class="sourceLineNo">936</span>        return null;<a name="line.936"></a>
+<span class="sourceLineNo">937</span>      }<a name="line.937"></a>
+<span class="sourceLineNo">938</span>    };<a name="line.938"></a>
+<span class="sourceLineNo">939</span>    verifyRead(scanAction);<a name="line.939"></a>
+<span class="sourceLineNo">940</span>  }<a name="line.940"></a>
+<span class="sourceLineNo">941</span><a name="line.941"></a>
+<span class="sourceLineNo">942</span>  @Test (timeout=180000)<a name="line.942"></a>
+<span class="sourceLineNo">943</span>  // test put, delete, increment<a name="line.943"></a>
+<span class="sourceLineNo">944</span>  public void testWrite() throws Exception {<a name="line.944"></a>
+<span class="sourceLineNo">945</span>    // put action<a name="line.945"></a>
+<span class="sourceLineNo">946</span>    AccessTestAction putAction = new AccessTestAction() {<a name="line.946"></a>
+<span class="sourceLineNo">947</span>      @Override<a name="line.947"></a>
+<span class="sourceLineNo">948</span>      public Object run() throws Exception {<a name="line.948"></a>
+<span class="sourceLineNo">949</span>        Put p = new Put(TEST_ROW);<a name="line.949"></a>
+<span class="sourceLineNo">950</span>        p.addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(1));<a name="line.950"></a>
+<span class="sourceLineNo">951</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.951"></a>
+<span class="sourceLineNo">952</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.952"></a>
+<span class="sourceLineNo">953</span>          t.put(p);<a name="line.953"></a>
+<span class="sourceLineNo">954</span>        }<a name="line.954"></a>
+<span class="sourceLineNo">955</span>        return null;<a name="line.955"></a>
+<span class="sourceLineNo">956</span>      }<a name="line.956"></a>
+<span class="sourceLineNo">957</span>    };<a name="line.957"></a>
+<span class="sourceLineNo">958</span>    verifyWrite(putAction);<a name="line.958"></a>
+<span class="sourceLineNo">959</span><a name="line.959"></a>
+<span class="sourceLineNo">960</span>    // delete action<a name="line.960"></a>
+<span class="sourceLineNo">961</span>    AccessTestAction deleteAction = new AccessTestAction() {<a name="line.961"></a>
+<span class="sourceLineNo">962</span>      @Override<a name="line.962"></a>
+<span class="sourceLineNo">963</span>      public Object run() throws Exception {<a name="line.963"></a>
+<span class="sourceLineNo">964</span>        Delete d = new Delete(TEST_ROW);<a name="line.964"></a>
+<span class="sourceLineNo">965</span>        d.addFamily(TEST_FAMILY);<a name="line.965"></a>
+<span class="sourceLineNo">966</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.966"></a>
+<span class="sourceLineNo">967</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.967"></a>
+<span class="sourceLineNo">968</span>          t.delete(d);<a name="line.968"></a>
+<span class="sourceLineNo">969</span>        }<a name="line.969"></a>
+<span class="sourceLineNo">970</span>        return null;<a name="line.970"></a>
+<span class="sourceLineNo">971</span>      }<a name="line.971"></a>
+<span class="sourceLineNo">972</span>    };<a name="line.972"></a>
+<span class="sourceLineNo">973</span>    verifyWrite(deleteAction);<a name="line.973"></a>
+<span class="sourceLineNo">974</span><a name="line.974"></a>
+<span class="sourceLineNo">975</span>    // increment action<a name="line.975"></a>
+<span class="sourceLineNo">976</span>    AccessTestAction incrementAction = new AccessTestAction() {<a name="line.976"></a>
+<span class="sourceLineNo">977</span>      @Override<a name="line.977"></a>
+<span class="sourceLineNo">978</span>      public Object run() throws Exception {<a name="line.978"></a>
+<span class="sourceLineNo">979</span>        Increment inc = new Increment(TEST_ROW);<a name="line.979"></a>
+<span class="sourceLineNo">980</span>        inc.addColumn(TEST_FAMILY, TEST_QUALIFIER, 1);<a name="line.980"></a>
+<span class="sourceLineNo">981</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.981"></a>
+<span class="sourceLineNo">982</span>            Table t = conn.getTable(TEST_TABLE);) {<a name="line.982"></a>
+<span class="sourceLineNo">983</span>          t.increment(inc);<a name="line.983"></a>
+<span class="sourceLineNo">984</span>        }<a name="line.984"></a>
+<span class="sourceLineNo">985</span>        return null;<a name="line.985"></a>
+<span class="sourceLineNo">986</span>      }<a name="line.986"></a>
+<span class="sourceLineNo">987</span>    };<a name="line.987"></a>
+<span class="sourceLineNo">988</span>    verifyWrite(incrementAction);<a name="line.988"></a>
+<span class="sourceLineNo">989</span>  }<a name="line.989"></a>
+<span class="sourceLineNo">990</span><a name="line.990"></a>
+<span class="sourceLineNo">991</span>  @Test (timeout=180000)<a name="line.991"></a>
+<span class="sourceLineNo">992</span>  public void testReadWrite() throws Exception {<a name="line.992"></a>
+<span class="sourceLineNo">993</span>    // action for checkAndDelete<a name="line.993"></a>
+<span class="sourceLineNo">994</span>    AccessTestAction checkAndDeleteAction = new AccessTestAction() {<a name="line.994"></a>
+<span class="sourceLineNo">995</span>      @Override<a name="line.995"></a>
+<span class="sourceLineNo">996</span>      public Object run() throws Exception {<a name="line.996"></a>
+<span class="sourceLineNo">997</span>        Delete d = new Delete(TEST_ROW);<a name="line.997"></a>
+<span class="sourceLineNo">998</span>        d.addFamily(TEST_FAMILY);<a name="line.998"></a>
+<span class="sourceLineNo">999</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.999"></a>
+<span class="sourceLineNo">1000</span>            Table t = conn.getTable(TEST_TABLE);) {<a name="line.1000"></a>
+<span class="sourceLineNo">1001</span>          t.checkAndDelete(TEST_ROW, TEST_FAMILY, TEST_QUALIFIER,<a name="line.1001"></a>
+<span class="sourceLineNo">1002</span>              Bytes.toBytes("test_value"), d);<a name="line.1002"></a>
+<span class="sourceLineNo">1003</span>        }<a name="line.1003"></a>
+<span class="sourceLineNo">1004</span>        return null;<a name="line.1004"></a>
+<span class="sourceLineNo">1005</span>      }<a name="line.1005"></a>
+<span class="sourceLineNo">1006</span>    };<a name="line.1006"></a>
+<span class="sourceLineNo">1007</span>    verifyReadWrite(checkAndDeleteAction);<a name="line.1007"></a>
+<span class="sourceLineNo">1008</span><a name="line.1008"></a>
+<span class="sourceLineNo">1009</span>    // action for checkAndPut()<a name="line.1009"></a>
+<span class="sourceLineNo">1010</span>    AccessTestAction checkAndPut = new AccessTestAction() {<a name="line.1010"></a>
+<span class="sourceLineNo">1011</span>      @Override<a name="line.1011"></a>
+<span class="sourceLineNo">1012</span>      public Object run() throws Exception {<a name="line.1012"></a>
+<span class="sourceLineNo">1013</span>        Put p = new Put(TEST_ROW);<a name="line.1013"></a>
+<span class="sourceLineNo">1014</span>        p.addColumn(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(1));<a name="line.1014"></a>
+<span class="sourceLineNo">1015</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1015"></a>
+<span class="sourceLineNo">1016</span>            Table t = conn.getTable(TEST_TABLE);) {<a name="line.1016"></a>
+<span class="sourceLineNo">1017</span>          t.checkAndPut(TEST_ROW, TEST_FAMILY, TEST_QUALIFIER,<a name="line.1017"></a>
+<span class="sourceLineNo">1018</span>              Bytes.toBytes("test_value"), p);<a name="line.1018"></a>
+<span class="sourceLineNo">1019</span>        }<a name="line.1019"></a>
+<span class="sourceLineNo">1020</span>        return null;<a name="line.1020"></a>
+<span class="sourceLineNo">1021</span>      }<a name="line.1021"></a>
+<span class="sourceLineNo">1022</span>    };<a name="line.1022"></a>
+<span class="sourceLineNo">1023</span>    verifyReadWrite(checkAndPut);<a name="line.1023"></a>
+<span class="sourceLineNo">1024</span>  }<a name="line.1024"></a>
+<span class="sourceLineNo">1025</span><a name="line.1025"></a>
+<span class="sourceLineNo">1026</span>  @Test (timeout=180000)<a name="line.1026"></a>
+<span class="sourceLineNo">1027</span>  public void testBulkLoad() throws Exception {<a name="line.1027"></a>
+<span class="sourceLineNo">1028</span>    try {<a name="line.1028"></a>
+<span class="sourceLineNo">1029</span>      FileSystem fs = TEST_UTIL.getTestFileSystem();<a name="line.1029"></a>
+<span class="sourceLineNo">1030</span>      final Path dir = TEST_UTIL.getDataTestDirOnTestFS("testBulkLoad");<a name="line.1030"></a>
+<span class="sourceLineNo">1031</span>      fs.mkdirs(dir);<a name="line.1031"></a>
+<span class="sourceLineNo">1032</span>      // need to make it globally writable<a name="line.1032"></a>
+<span class="sourceLineNo">1033</span>      // so users creating HFiles have write permissions<a name="line.1033"></a>
+<span class="sourceLineNo">1034</span>      fs.setPermission(dir, FsPermission.valueOf("-rwxrwxrwx"));<a name="line.1034"></a>
+<span class="sourceLineNo">1035</span><a name="line.1035"></a>
+<span class="sourceLineNo">1036</span>      AccessTestAction bulkLoadAction = new AccessTestAction() {<a name="line.1036"></a>
+<span class="sourceLineNo">1037</span>        @Override<a name="line.1037"></a>
+<span class="sourceLineNo">1038</span>        public Object run() throws Exception {<a name="line.1038"></a>
+<span class="sourceLineNo">1039</span>          int numRows = 3;<a name="line.1039"></a>
+<span class="sourceLineNo">1040</span><a name="line.1040"></a>
+<span class="sourceLineNo">1041</span>          // Making the assumption that the test table won't split between the range<a name="line.1041"></a>
+<span class="sourceLineNo">1042</span>          byte[][][] hfileRanges = { { { (byte) 0 }, { (byte) 9 } } };<a name="line.1042"></a>
+<span class="sourceLineNo">1043</span><a name="line.1043"></a>
+<span class="sourceLineNo">1044</span>          Path bulkLoadBasePath = new Path(dir, new Path(User.getCurrent().getName()));<a name="line.1044"></a>
+<span class="sourceLineNo">1045</span>          new BulkLoadHelper(bulkLoadBasePath).bulkLoadHFile(TEST_TABLE, TEST_FAMILY,<a name="line.1045"></a>
+<span class="sourceLineNo">1046</span>            TEST_QUALIFIER, hfileRanges, numRows);<a name="line.1046"></a>
+<span class="sourceLineNo">1047</span><a name="line.1047"></a>
+<span class="sourceLineNo">1048</span>          return null;<a name="line.1048"></a>
+<span class="sourceLineNo">1049</span>        }<a name="line.1049"></a>
+<span class="sourceLineNo">1050</span>      };<a name="line.1050"></a>
+<span class="sourceLineNo">1051</span><a name="line.1051"></a>
+<span class="sourceLineNo">1052</span>      // User performing bulk loads must have privilege to read table metadata<a name="line.1052"></a>
+<span class="sourceLineNo">1053</span>      // (ADMIN or CREATE)<a name="line.1053"></a>
+<span class="sourceLineNo">1054</span>      verifyAllowed(bulkLoadAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE,<a name="line.1054"></a>
+<span class="sourceLineNo">1055</span>        USER_GROUP_CREATE);<a name="line.1055"></a>
+<span class="sourceLineNo">1056</span>      verifyDenied(bulkLoadAction, USER_RW, USER_NONE, USER_RO, USER_GROUP_READ, USER_GROUP_WRITE,<a name="line.1056"></a>
+<span class="sourceLineNo">1057</span>        USER_GROUP_ADMIN);<a name="line.1057"></a>
+<span class="sourceLineNo">1058</span>    } finally {<a name="line.1058"></a>
+<span class="sourceLineNo">1059</span>      // Reinit after the bulk upload<a name="line.1059"></a>
+<span class="sourceLineNo">1060</span>      TEST_UTIL.getAdmin().disableTable(TEST_TABLE);<a name="line.1060"></a>
+<span class="sourceLineNo">1061</span>      TEST_UTIL.getAdmin().enableTable(TEST_TABLE);<a name="line.1061"></a>
+<span class="sourceLineNo">1062</span>    }<a name="line.1062"></a>
+<span class="sourceLineNo">1063</span>  }<a name="line.1063"></a>
+<span class="sourceLineNo">1064</span><a name="line.1064"></a>
+<span class="sourceLineNo">1065</span>  public class BulkLoadHelper {<a name="line.1065"></a>
+<span class="sourceLineNo">1066</span>    private final FileSystem fs;<a name="line.1066"></a>
+<span class="sourceLineNo">1067</span>    private final Path loadPath;<a name="line.1067"></a>
+<span class="sourceLineNo">1068</span>    private final Configuration conf;<a name="line.1068"></a>
+<span class="sourceLineNo">1069</span><a name="line.1069"></a>
+<span class="sourceLineNo">1070</span>    public BulkLoadHelper(Path loadPath) throws IOException {<a name="line.1070"></a>
+<span class="sourceLineNo">1071</span>      fs = TEST_UTIL.getTestFileSystem();<a name="line.1071"></a>
+<span class="sourceLineNo">1072</span>      conf = TEST_UTIL.getConfiguration();<a name="line.1072"></a>
+<span class="sourceLineNo">1073</span>      loadPath = loadPath.makeQualified(fs);<a name="line.1073"></a>
+<span class="sourceLineNo">1074</span>      this.loadPath = loadPath;<a name="line.1074"></a>
+<span class="sourceLineNo">1075</span>    }<a name="line.1075"></a>
 <span class="sourceLineNo">1076</span><a name="line.1076"></a>
-<span class="sourceLineNo">1077</span>      // User performing bulk loads must have privilege to read table metadata<a name="line.1077"></a>
-<span class="sourceLineNo">1078</span>      // (ADMIN or CREATE)<a name="line.1078"></a>
-<span class="sourceLineNo">1079</span>      verifyAllowed(bulkLoadAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE,<a name="line.1079"></a>
-<span class="sourceLineNo">1080</span>        USER_GROUP_CREATE);<a name="line.1080"></a>
-<span class="sourceLineNo">1081</span>      verifyDenied(bulkLoadAction, USER_RW, USER_NONE, USER_RO, USER_GROUP_READ, USER_GROUP_WRITE,<a name="line.1081"></a>
-<span class="sourceLineNo">1082</span>        USER_GROUP_ADMIN);<a name="line.1082"></a>
-<span class="sourceLineNo">1083</span>    } finally {<a name="line.1083"></a>
-<span class="sourceLineNo">1084</span>      // Reinit after the bulk upload<a name="line.1084"></a>
-<span class="sourceLineNo">1085</span>      TEST_UTIL.getAdmin().disableTable(TEST_TABLE);<a name="line.1085"></a>
-<span class="sourceLineNo">1086</span>      TEST_UTIL.getAdmin().enableTable(TEST_TABLE);<a name="line.1086"></a>
-<span class="sourceLineNo">1087</span>    }<a name="line.1087"></a>
-<span class="sourceLineNo">1088</span>  }<a name="line.1088"></a>
-<span class="sourceLineNo">1089</span><a name="line.1089"></a>
-<span class="sourceLineNo">1090</span>  public class BulkLoadHelper {<a name="line.1090"></a>
-<span class="sourceLineNo">1091</span>    private final FileSystem fs;<a name="line.1091"></a>
-<span class="sourceLineNo">1092</span>    private final Path loadPath;<a name="line.1092"></a>
-<span class="sourceLineNo">1093</span>    private final Configuration conf;<a name="line.1093"></a>
-<span class="sourceLineNo">1094</span><a name="line.1094"></a>
-<span class="sourceLineNo">1095</span>    public BulkLoadHelper(Path loadPath) throws IOException {<a name="line.1095"></a>
-<span class="sourceLineNo">1096</span>      fs = TEST_UTIL.getTestFileSystem();<a name="line.1096"></a>
-<span class="sourceLineNo">1097</span>      conf = TEST_UTIL.getConfiguration();<a name="line.1097"></a>
-<span class="sourceLineNo">1098</span>      loadPath = loadPath.makeQualified(fs);<a name="line.1098"></a>
-<span class="sourceLineNo">1099</span>      this.loadPath = loadPath;<a name="line.1099"></a>
-<span class="sourceLineNo">1100</span>    }<a name="line.1100"></a>
-<span class="sourceLineNo">1101</span><a name="line.1101"></a>
-<span class="sourceLineNo">1102</span>    private void createHFile(Path path,<a name="line.1102"></a>
-<span class="sourceLineNo">1103</span>        byte[] family, byte[] qualifier,<a name="line.1103"></a>
-<span class="sourceLineNo">1104</span>        byte[] startKey, byte[] endKey, int numRows) throws IOException {<a name="line.1104"></a>
-<span class="sourceLineNo">1105</span><a name="line.1105"></a>
-<span class="sourceLineNo">1106</span>      HFile.Writer writer = null;<a name="line.1106"></a>
-<span class="sourceLineNo">1107</span>      long now = System.currentTimeMillis();<a name="line.1107"></a>
-<span class="sourceLineNo">1108</span>      try {<a name="line.1108"></a>
-<span class="sourceLineNo">1109</span>        HFileContext context = new HFileContextBuilder().build();<a name="line.1109"></a>
-<span class="sourceLineNo">1110</span>        writer = HFile.getWriterFactory(conf, new CacheConfig(conf))<a name="line.1110"></a>
-<span class="sourceLineNo">1111</span>            .withPath(fs, path)<a name="line.1111"></a>
-<span class="sourceLineNo">1112</span>            .withFileContext(context)<a name="line.1112"></a>
-<span class="sourceLineNo">1113</span>            .create();<a name="line.1113"></a>
-<span class="sourceLineNo">1114</span>        // subtract 2 since numRows doesn't include boundary keys<a name="line.1114"></a>
-<span class="sourceLineNo">1115</span>        for (byte[] key : Bytes.iterateOnSplits(startKey, endKey, true, numRows-2)) {<a name="line.1115"></a>
-<span class="sourceLineNo">1116</span>          KeyValue kv = new KeyValue(key, family, qualifier, now, key);<a name="line.1116"></a>
-<span class="sourceLineNo">1117</span>          writer.append(kv);<a name="line.1117"></a>
-<span class="sourceLineNo">1118</span>        }<a name="line.1118"></a>
-<span class="sourceLineNo">1119</span>      } finally {<a name="line.1119"></a>
-<span class="sourceLineNo">1120</span>        if(writer != null)<a name="line.1120"></a>
-<span class="sourceLineNo">1121</span>          writer.close();<a name="line.1121"></a>
-<span class="sourceLineNo">1122</span>      }<a name="line.1122"></a>
-<span class="sourceLineNo">1123</span>    }<a name="line.1123"></a>
-<span class="sourceLineNo">1124</span><a name="line.1124"></a>
-<span class="sourceLineNo">1125</span>    private void bulkLoadHFile(<a name="line.1125"></a>
-<span class="sourceLineNo">1126</span>        TableName tableName,<a name="line.1126"></a>
-<span class="sourceLineNo">1127</span>        byte[] family,<a name="line.1127"></a>
-<span class="sourceLineNo">1128</span>        byte[] qualifier,<a name="line.1128"></a>
-<span class="sourceLineNo">1129</span>        byte[][][] hfileRanges,<a name="line.1129"></a>
-<span class="sourceLineNo">1130</span>        int numRowsPerRange) throws Exception {<a name="line.1130"></a>
-<span class="sourceLineNo">1131</span><a name="line.1131"></a>
-<span class="sourceLineNo">1132</span>      Path familyDir = new Path(loadPath, Bytes.toString(family));<a name="line.1132"></a>
-<span class="sourceLineNo">1133</span>      fs.mkdirs(familyDir);<a name="line.1133"></a>
-<span class="sourceLineNo">1134</span>      int hfileIdx = 0;<a name="line.1134"></a>
-<span class="sourceLineNo">1135</span>      for (byte[][] range : hfileRanges) {<a name="line.1135"></a>
-<span class="sourceLineNo">1136</span>        byte[] from = range[0];<a name="line.1136"></a>
-<span class="sourceLineNo">1137</span>        byte[] to = range[1];<a name="line.1137"></a>
-<span class="sourceLineNo">1138</span>        createHFile(new Path(familyDir, "hfile_"+(hfileIdx++)),<a name="line.1138"></a>
-<span class="sourceLineNo">1139</span>            family, qualifier, from, to, numRowsPerRange);<a name="line.1139"></a>
-<span class="sourceLineNo">1140</span>      }<a name="line.1140"></a>
-<span class="sourceLineNo">1141</span>      //set global read so RegionServer can move it<a name="line.1141"></a>
-<span class="sourceLineNo">1142</span>      setPermission(loadPath, FsPermission.valueOf("-rwxrwxrwx"));<a name="line.1142"></a>
-<span class="sourceLineNo">1143</span><a name="line.1143"></a>
-<span class="sourceLineNo">1144</span><a name="line.1144"></a>
-<span class="sourceLineNo">1145</span>      try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1145"></a>
-<span class="sourceLineNo">1146</span>           Admin admin = conn.getAdmin();<a name="line.1146"></a>
-<span class="sourceLineNo">1147</span>           RegionLocator locator = conn.getRegionLocator(tableName);<a name="line.1147"></a>
-<span class="sourceLineNo">1148</span>           Table table = conn.getTable(tableName)) {<a name="line.1148"></a>
-<span class="sourceLineNo">1149</span>        TEST_UTIL.waitUntilAllRegionsAssigned(tableName);<a name="line.1149"></a>
-<span class="sourceLineNo">1150</span>        LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf);<a name="line.1150"></a>
-<span class="sourceLineNo">1151</span>        loader.doBulkLoad(loadPath, admin, table, locator);<a name="line.1151"></a>
-<span class="sourceLineNo">1152</span>      }<a name="line.1152"></a>
-<span class="sourceLineNo">1153</span>    }<a name="line.1153"></a>
-<span class="sourceLineNo">1154</span><a name="line.1154"></a>
-<span class="sourceLineNo">1155</span>    public void setPermission(Path dir, FsPermission perm) throws IOException {<a name="line.1155"></a>
-<span class="sourceLineNo">1156</span>      if(!fs.getFileStatus(dir).isDirectory()) {<a name="line.1156"></a>
-<span class="sourceLineNo">1157</span>        fs.setPermission(dir,perm);<a name="line.1157"></a>
-<span class="sourceLineNo">1158</span>      }<a name="line.1158"></a>
-<span class="sourceLineNo">1159</span>      else {<a name="line.1159"></a>
-<span class="sourceLineNo">1160</span>        for(FileStatus el : fs.listStatus(dir)) {<a name="line.1160"></a>
-<span class="sourceLineNo">1161</span>          fs.setPermission(el.getPath(), perm);<a name="line.1161"></a>
-<span class="sourceLineNo">1162</span>          setPermission(el.getPath() , perm);<a name="line.1162"></a>
-<span class="sourceLineNo">1163</span>        }<a name="line.1163"></a>
-<span class="sourceLineNo">1164</span>      }<a name="line.1164"></a>
-<span class="sourceLineNo">1165</span>    }<a name="line.1165"></a>
-<span class="sourceLineNo">1166</span>  }<a name="line.1166"></a>
-<span class="sourceLineNo">1167</span><a name="line.1167"></a>
-<span class="sourceLineNo">1168</span>  @Test (timeout=180000)<a name="line.1168"></a>
-<span class="sourceLineNo">1169</span>  public void testAppend() throws Exception {<a name="line.1169"></a>
-<span class="sourceLineNo">1170</span><a name="line.1170"></a>
-<span class="sourceLineNo">1171</span>    AccessTestAction appendAction = new AccessTestAction() {<a name="line.1171"></a>
-<span class="sourceLineNo">1172</span>      @Override<a name="line.1172"></a>
-<span class="sourceLineNo">1173</span>      public Object run() throws Exception {<a name="line.1173"></a>
-<span class="sourceLineNo">1174</span>        byte[] row = TEST_ROW;<a name="line.1174"></a>
-<span class="sourceLineNo">1175</span>        byte[] qualifier = TEST_QUALIFIER;<a name="line.1175"></a>
-<span class="sourceLineNo">1176</span>        Put put = new Put(row);<a name="line.1176"></a>
-<span class="sourceLineNo">1177</span>        put.addColumn(TEST_FAMILY, qualifier, Bytes.toBytes(1));<a name="line.1177"></a>
-<span class="sourceLineNo">1178</span>        Append append = new Append(row);<a name="line.1178"></a>
-<span class="sourceLineNo">1179</span>        append.addColumn(TEST_FAMILY, qualifier, Bytes.toBytes(2));<a name="line.1179"></a>
-<span class="sourceLineNo">1180</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1180"></a>
-<span class="sourceLineNo">1181</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.1181"></a>
-<span class="sourceLineNo">1182</span>          t.put(put);<a name="line.1182"></a>
-<span class="sourceLineNo">1183</span>          t.append(append);<a name="line.1183"></a>
-<span class="sourceLineNo">1184</span>        }<a name="line.1184"></a>
-<span class="sourceLineNo">1185</span>        return null;<a name="line.1185"></a>
-<span class="sourceLineNo">1186</span>      }<a name="line.1186"></a>
-<span class="sourceLineNo">1187</span>    };<a name="line.1187"></a>
-<span class="sourceLineNo">1188</span><a name="line.1188"></a>
-<span class="sourceLineNo">1189</span>    verifyAllowed(appendAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW,<a name="line.1189"></a>
-<span class="sourceLineNo">1190</span>      USER_GROUP_WRITE);<a name="line.1190"></a>
-<span class="sourceLineNo">1191</span>    verifyDenied(appendAction, USER_RO, USER_NONE, USER_GROUP_CREATE, USER_GROUP_READ,<a name="line.1191"></a>
-<span class="sourceLineNo">1192</span>      USER_GROUP_ADMIN);<a name="line.1192"></a>
-<span class="sourceLineNo">1193</span>  }<a name="line.1193"></a>
-<span class="sourceLineNo">1194</span><a name="line.1194"></a>
-<span class="sourceLineNo">1195</span>  @Test (timeout=180000)<a name="line.1195"></a>
-<span class="sourceLineNo">1196</span>  public void testGrantRevoke() throws Exception {<a name="line.1196"></a>
-<span class="sourceLineNo">1197</span>    AccessTestAction grantAction = new AccessTestAction() {<a name="line.1197"></a>
-<span class="sourceLineNo">1198</span>      @Override<a name="line.1198"></a>
-<span class="sourceLineNo">1199</span>      public Object run() throws Exception {<a name="line.1199"></a>
-<span class="sourceLineNo">1200</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1200"></a>
-<span class="sourceLineNo">1201</span>            Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)) {<a name="line.1201"></a>
-<span class="sourceLineNo">1202</span>          BlockingRpcChannel service = acl.coprocessorService(TEST_TABLE.getName());<a name="line.1202"></a>
-<span class="sourceLineNo">1203</span>          AccessControlService.BlockingInterface protocol =<a name="line.1203"></a>
-<span class="sourceLineNo">1204</span>            AccessControlService.newBlockingStub(service);<a name="line.1204"></a>
-<span class="sourceLineNo">1205</span>          AccessControlUtil.grant(null, protocol, USER_RO.getShortName(), TEST_TABLE, TEST_FAMILY,<a name="line.1205"></a>
-<span class="sourceLineNo">1206</span>              null, false, Action.READ);<a name="line.1206"></a>
-<span class="sourceLineNo">1207</span>        }<a name="line.1207"></a>
-<span class="sourceLineNo">1208</span>        return null;<a name="line.1208"></a>
-<span class="sourceLineNo">1209</span>      }<a name="line.1209"></a>
-<span class="sourceLineNo">1210</span>    };<a name="line.1210"></a>
-<span class="sourceLineNo">1211</span><a name="line.1211"></a>
-<span class="sourceLineNo">1212</span>    AccessTestAction revokeAction = new AccessTestAction() {<a name="line.1212"></a>
-<span class="sourceLineNo">1213</span>      @Override<a name="line.1213"></a>
-<span class="sourceLineNo">1214</span>      public Object run() throws Exception {<a name="line.1214"></a>
-<span class="sourceLineNo">1215</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1215"></a>
-<span class="sourceLineNo">1216</span>            Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)) {<a name="line.1216"></a>
-<span class="sourceLineNo">1217</span>          BlockingRpcChannel service = acl.coprocessorService(TEST_TABLE.getName());<a name="line.1217"></a>
-<span class="sourceLineNo">1218</span>          AccessControlService.BlockingInterface protocol =<a name="line.1218"></a>
-<span class="sourceLineNo">1219</span>            AccessControlService.newBlockingStub(service);<a name="line.1219"></a>
-<span class="sourceLineNo">1220</span>          AccessControlUtil.revoke(null, protocol, USER_RO.getShortName(), TEST_TABLE, TEST_FAMILY, null,<a name="line.1220"></a>
-<span class="sourceLineNo">1221</span>            Action.READ);<a name="line.1221"></a>
-<span class="sourceLineNo">1222</span>        }<a name="line.1222"></a>
-<span class="sourceLineNo">1223</span>        return null;<a name="line.1223"></a>
-<span class="sourceLineNo">1224</span>      }<a name="line.1224"></a>
-<span class="sourceLineNo">1225</span>    };<a name="line.1225"></a>
-<span class="sourceLineNo">1226</span><a name="line.1226"></a>
-<span class="sourceLineNo">1227</span>    AccessTestAction getTablePermissionsAction = new AccessTestAction() {<a name="line.1227"></a>
-<span class="sourceLineNo">1228</span>      @Override<a name="line.1228"></a>
-<span class="sourceLineNo">1229</span>      public Object run() throws Exception {<a name="line.1229"></a>
-<span class="sourceLineNo">1230</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1230"></a>
-<span class="sourceLineNo">1231</span>            Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)){<a name="line.1231"></a>
-<span class="sourceLineNo">1232</span>          BlockingRpcChannel service = acl.coprocessorService(TEST_TABLE.getName());<a name="line.1232"></a>
-<span class="sourceLineNo">1233</span>          AccessControlService.BlockingInterface protocol =<a name="line.1233"></a>
-<span class="sourceLineNo">1234</span>              AccessControlService.newBlockingStub(service);<a name="line.1234"></a>
-<span class="sourceLineNo">1235</span>          AccessControlUtil.getUserPermissions(null, protocol, TEST_TABLE);<a name="line.1235"></a>
-<span class="sourceLineNo">1236</span>        }<a name="line.1236"></a>
-<span class="sourceLineNo">1237</span>        return null;<a name="line.1237"></a>
-<span class="sourceLineNo">1238</span>      }<a name="line.1238"></a>
-<span class="sourceLineNo">1239</span>    };<a name="line.1239"></a>
-<span class="sourceLineNo">1240</span><a name="line.1240"></a>
-<span class="sourceLineNo">1241</span>    AccessTestAction getGlobalPermissionsAction = new AccessTestAction() {<a name="line.1241"></a>
-<span class="sourceLineNo">1242</span>      @Override<a name="line.1242"></a>
-<span class="sourceLineNo">1243</span>      public Object run() throws Exception {<a name="line.1243"></a>
-<span class="sourceLineNo">1244</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1244"></a>
-<span class="sourceLineNo">1245</span>            Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME);) {<a name="line.1245"></a>
-<span class="sourceLineNo">1246</span>          BlockingRpcChannel service = acl.coprocessorService(HConstants.EMPTY_START_ROW);<a name="line.1246"></a>
-<span class="sourceLineNo">1247</span>          AccessControlService.BlockingInterface protocol =<a name="line.1247"></a>
-<span class="sourceLineNo">1248</span>            AccessControlService.newBlockingStub(service);<a name="line.1248"></a>
-<span class="sourceLineNo">1249</span>          AccessControlUtil.getUserPermissions(null, protocol);<a name="line.1249"></a>
-<span class="sourceLineNo">1250</span>        }<a name="line.1250"></a>
-<span class="sourceLineNo">1251</span>        return null;<a name="line.1251"></a>
-<span class="sourceLineNo">1252</span>      }<a name="line.1252"></a>
-<span class="sourceLineNo">1253</span>    };<a name="line.1253"></a>
-<span class="sourceLineNo">1254</span><a name="line.1254"></a>
-<span class="sourceLineNo">1255</span>    verifyAllowed(grantAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_GROUP_ADMIN);<a name="line.1255"></a>
-<span class="sourceLineNo">1256</span>    verifyDenied(grantAction, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ,<a name="line.1256"></a>
-<span class="sourceLineNo">1257</span>        USER_GROUP_WRITE, USER_GROUP_CREATE);<a name="line.1257"></a>
-<span class="sourceLineNo">1258</span>    try {<a name="line.1258"></a>
-<span class="sourceLineNo">1259</span>      verifyAllowed(revokeAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_GROUP_ADMIN);<a name="line.1259"></a>
-<span class="sourceLineNo">1260</span>      verifyDenied(revokeAction, USER_CREATE, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ,<a name="line.1260"></a>
-<span class="sourceLineNo">1261</span>        USER_GROUP_WRITE, USER_GROUP_CREATE);<a name="line.1261"></a>
-<span class="sourceLineNo">1262</span><a name="line.1262"></a>
-<span class="sourceLineNo">1263</span>      verifyAllowed(getTablePermissionsAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_GROUP_ADMIN);<a name="line.1263"></a>
-<span class="sourceLineNo">1264</span>      verifyDenied(getTablePermissionsAction, USER_CREATE, USER_RW, USER_RO, USER_NONE,<a name="line.1264"></a>
-<span class="sourceLineNo">1265</span>        USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE);<a name="line.1265"></a>
-<span class="sourceLineNo">1266</span><a name="line.1266"></a>
-<span class="sourceLineNo">1267</span>      verifyAllowed(getGlobalPermissionsAction, SUPERUSER, USER_ADMIN, USER_GROUP_ADMIN);<a name="line.1267"></a>
-<span class="sourceLineNo">1268</span>      verifyDenied(getGlobalPermissionsAction, USER_CREATE, USER_OWNER, USER_RW, USER_RO,<a name="line.1268"></a>
-<span class="sourceLineNo">1269</span>        USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE);<a name="line.1269"></a>
-<span class="sourceLineNo">1270</span>    } finally {<a name="line.1270"></a>
-<span class="sourceLineNo">1271</span>      // Cleanup, Grant the revoked permission back to the user<a name="line.1271"></a>
-<span class="sourceLineNo">1272</span>      grantOnTable(TEST_UTIL, USER_RO.getShortName(), TEST_TABLE, TEST_FAMILY, null,<a name="line.1272"></a>
-<span class="sourceLineNo">1273</span>        Permission.Action.READ);<a name="line.1273"></a>
-<span class="sourceLineNo">1274</span>    }<a name="line.1274"></a>
-<span class="sourceLineNo">1275</span>  }<a name="line.1275"></a>
-<span class="sourceLineNo">1276</span><a name="line.1276"></a>
-<span class="sourceLineNo">1277</span>  @Test (timeout=180000)<a name="line.1277"></a>
-<span class="sourceLineNo">1278</span>  public void testPostGrantRevoke() throws Exception {<a name="line.1278"></a>
-<span class="sourceLineNo">1279</span>    final TableName tableName =<a name="line.1279"></a>
-<span class="sourceLineNo">1280</span>        TableName.valueOf("TempTable");<a name="line.1280"></a>
-<span class="sourceLineNo">1281</span>    final byte[] family1 = Bytes.toBytes("f1");<a name="line.1281"></a>
-<span class="sourceLineNo">1282</span>    final byte[] family2 = Bytes.toBytes("f2");<a name="line.1282"></a>
-<span class="sourceLineNo">1283</span>    final byte[] qualifier = Bytes.toBytes("q");<a name="line.1283"></a>
-<span class="sourceLineNo">1284</span><a name="line.1284"></a>
-<span class="sourceLineNo">1285</span>    // create table<a name="line.1285"></a>
-<span class="sourceLineNo">1286</span>    Admin admin = TEST_UTIL.getAdmin();<a name="line.1286"></a>
-<span class="sourceLineNo">1287</span>    if (admin.tableExists(tableName)) {<a name="line.1287"></a>
-<span class="sourceLineNo">1288</span>      deleteTable(TEST_UTIL, tableName);<a name="line.1288"></a>
-<span class="sourceLineNo">1289</span>    }<a name="line.1289"></a>
-<span class="sourceLineNo">1290</span>    HTableDescriptor htd = new HTableDescriptor(tableName);<a name="line.1290"></a>
-<span class="sourceLineNo">1291</span>    htd.addFamily(new HColumnDescriptor(family1));<a name="line.1291"></a>
-<span class="sourceLineNo">1292</span>    htd.addFamily(new HColumnDescriptor(family2));<a name="line.1292"></a>
-<span class="sourceLineNo">1293</span>    createTable(TEST_UTIL, htd);<a name="line.1293"></a>
-<span class="sourceLineNo">1294</span>    try {<a name="line.1294"></a>
-<span class="sourceLineNo">1295</span>      // create temp users<a name="line.1295"></a>
-<span class="sourceLineNo">1296</span>      User tblUser =<a name="line.1296"></a>
-<span class="sourceLineNo">1297</span>          User.createUserForTesting(TEST_UTIL.getConfiguration(), "tbluser", new String[0]);<a name="line.1297"></a>
-<span class="sourceLineNo">1298</span>      User gblUser =<a name="line.1298"></a>
-<span class="sourceLineNo">1299</span>          User.createUserForTesting(TEST_UTIL.getConfiguration(), "gbluser", new String[0]);<a name="line.1299"></a>
-<span class="sourceLineNo">1300</span><a name="line.1300"></a>
-<span class="sourceLineNo">1301</span>      // prepare actions:<a name="line.1301"></a>
-<span class="sourceLineNo">1302</span>      AccessTestAction putActionAll = new AccessTestAction() {<a name="line.1302"></a>
-<span class="sourceLineNo">1303</span>        @Override<a name="line.1303"></a>
-<span class="sourceLineNo">1304</span>        public Object run() throws Exception {<a name="line.1304"></a>
-<span class="sourceLineNo">1305</span>          Put p = new Put(Bytes.toBytes("a"));<a name="line.1305"></a>
-<span class="sourceLineNo">1306</span>          p.addColumn(family1, qualifier, Bytes.toBytes("v1"));<a name="line.1306"></a>
-<span class="sourceLineNo">1307</span>          p.addColumn(family2, qualifier, Bytes.toBytes("v2"));<a name="line.1307"></a>
-<span class="sourceLineNo">1308</span><a name="line.1308"></a>
-<span class="sourceLineNo">1309</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1309"></a>
-<span class="sourceLineNo">1310</span>              Table t = conn.getTable(tableName);) {<a name="line.1310"></a>
-<span class="sourceLineNo">1311</span>            t.put(p);<a name="line.1311"></a>
-<span class="sourceLineNo">1312</span>          }<a name="line.1312"></a>
-<span class="sourceLineNo">1313</span>          return null;<a name="line.1313"></a>
-<span class="sourceLineNo">1314</span>        }<a name="line.1314"></a>
-<span class="sourceLineNo">1315</span>      };<a name="line.1315"></a>
-<span class="sourceLineNo">1316</span><a name="line.1316"></a>
-<span class="sourceLineNo">1317</span>      AccessTestAction putAction1 = new AccessTestAction() {<a name="line.1317"></a>
-<span class="sourceLineNo">1318</span>        @Override<a name="line.1318"></a>
-<span class="sourceLineNo">1319</span>        public Object run() throws Exception {<a name="line.1319"></a>
-<span class="sourceLineNo">1320</span>          Put p = new Put(Bytes.toBytes("a"));<a name="line.1320"></a>
-<span class="sourceLineNo">1321</span>          p.addColumn(family1, qualifier, Bytes.toBytes("v1"));<a name="line.1321"></a>
-<span class="sourceLineNo">1322</span><a name="line.1322"></a>
-<span class="sourceLineNo">1323</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1323"></a>
-<span class="sourceLineNo">1324</span>              Table t = conn.getTable(tableName)) {<a name="line.1324"></a>
-<span class="sourceLineNo">1325</span>            t.put(p);<a name="line.1325"></a>
-<span class="sourceLineNo">1326</span>          }<a name="line.1326"></a>
-<span class="sourceLineNo">1327</span>          return null;<a name="line.1327"></a>
-<span class="sourceLineNo">1328</span>        }<a name="line.1328"></a>
-<span class="sourceLineNo">1329</span>      };<a name="line.1329"></a>
-<span class="sourceLineNo">1330</span><a name="line.1330"></a>
-<span class="sourceLineNo">1331</span>      AccessTestAction putAction2 = new AccessTestAction() {<a name="line.1331"></a>
-<span class="sourceLineNo">1332</span>        @Override<a name="line.1332"></a>
-<span class="sourceLineNo">1333</span>        public Object run() throws Exception {<a name="line.1333"></a>
-<span class="sourceLineNo">1334</span>          Put p = new Put(Bytes.toBytes("a"));<a name="line.1334"></a>
-<span class="sourceLineNo">1335</span>          p.addColumn(family2, qualifier, Bytes.toBytes("v2"));<a name="line.1335"></a>
-<span class="sourceLineNo">1336</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1336"></a>
-<span class="sourceLineNo">1337</span>              Table t = conn.getTable(tableName);) {<a name="line.1337"></a>
-<span class="sourceLineNo">1338</span>            t.put(p);<a name="line.1338"></a>
-<span class="sourceLineNo">1339</span>          }<a name="line.1339"></a>
-<span class="sourceLineNo">1340</span>          return null;<a name="line.1340"></a>
-<span class="sourceLineNo">1341</span>        }<a name="line.1341"></a>
-<span class="sourceLineNo">1342</span>      };<a name="line.1342"></a>
-<span class="sourceLineNo">1343</span><a name="line.1343"></a>
-<span class="sourceLineNo">1344</span>      AccessTestAction getActionAll = new AccessTestAction() {<a name="line.1344"></a>
-<span class="sourceLineNo">1345</span>        @Override<a name="line.1345"></a>
-<span class="sourceLineNo">1346</span>        public Object run() throws Exception {<a name="line.1346"></a>
-<span class="sourceLineNo">1347</span>          Get g = new Get(TEST_ROW);<a name="line.1347"></a>
-<span class="sourceLineNo">1348</span>          g.addFamily(family1);<a name="line.1348"></a>
-<span class="sourceLineNo">1349</span>          g.addFamily(family2);<a name="line.1349"></a>
-<span class="sourceLineNo">1350</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1350"></a>
-<span class="sourceLineNo">1351</span>              Table t = conn.getTable(tableName);) {<a name="line.1351"></a>
-<span class="sourceLineNo">1352</span>            t.get(g);<a name="line.1352"></a>
-<span class="sourceLineNo">1353</span>          }<a name="line.1353"></a>
-<span class="sourceLineNo">1354</span>          return null;<a name="line.1354"></a>
-<span class="sourceLineNo">1355</span>        }<a name="line.1355"></a>
-<span class="sourceLineNo">1356</span>      };<a name="line.1356"></a>
-<span class="sourceLineNo">1357</span><a name="line.1357"></a>
-<span class="sourceLineNo">1358</span>      AccessTestAction getAction1 = new AccessTestAction() {<a name="line.1358"></a>
-<span class="sourceLineNo">1359</span>        @Override<a name="line.1359"></a>
-<span class="sourceLineNo">1360</span>        public Object run() throws Exception {<a name="line.1360"></a>
-<span class="sourceLineNo">1361</span>          Get g = new Get(TEST_ROW);<a name="line.1361"></a>
-<span class="sourceLineNo">1362</span>          g.addFamily(family1);<a name="line.1362"></a>
-<span class="sourceLineNo">1363</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1363"></a>
-<span class="sourceLineNo">1364</span>              Table t = conn.getTable(tableName)) {<a name="line.1364"></a>
-<span class="sourceLineNo">1365</span>            t.get(g);<a name="line.1365"></a>
-<span class="sourceLineNo">1366</span>          }<a name="line.1366"></a>
-<span class="sourceLineNo">1367</span>          return null;<a name="line.1367"></a>
-<span class="sourceLineNo">1368</span>        }<a name="line.1368"></a>
-<span class="sourceLineNo">1369</span>      };<a name="line.1369"></a>
-<span class="sourceLineNo">1370</span><a name="line.1370"></a>
-<span class="sourceLineNo">1371</span>      AccessTestAction getAction2 = new AccessTestAction() {<a name="line.1371"></a>
-<span class="sourceLineNo">1372</span>        @Override<a name="line.1372"></a>
-<span class="sourceLineNo">1373</span>        public Object run() throws Exception {<a name="line.1373"></a>
-<span class="sourceLineNo">1374</span>          Get g = new Get(TEST_ROW);<a name="line.1374"></a>
-<span class="sourceLineNo">1375</span>          g.addFamily(family2);<a name="line.1375"></a>
-<span class="sourceLineNo">1376</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1376"></a>
-<span class="sourceLineNo">1377</span>              Table t = conn.getTable(tableName)) {<a name="line.1377"></a>
-<span class="sourceLineNo">1378</span>            t.get(g);<a name="line.1378"></a>
-<span class="sourceLineNo">1379</span>          }<a name="line.1379"></a>
-<span class="sourceLineNo">1380</span>          return null;<a name="line.1380"></a>
-<span class="sourceLineNo">1381</span>        }<a name="line.1381"></a>
-<span class="sourceLineNo">1382</span>      };<a name="line.1382"></a>
-<span class="sourceLineNo">1383</span><a name="line.1383"></a>
-<span class="sourceLineNo">1384</span>      AccessTestAction deleteActionAll = new AccessTestAction() {<a name="line.1384"></a>
-<span class="sourceLineNo">1385</span>        @Override<a name="line.1385"></a>
-<span class="sourceLineNo">1386</span>        public Object run() throws Exception {<a name="line.1386"></a>
-<span class="sourceLineNo">1387</span>          Delete d = new Delete(TEST_ROW);<a name="line.1387"></a>
-<span class="sourceLineNo">1388</span>          d.addFamily(family1);<a name="line.1388"></a>
-<span class="sourceLineNo">1389</span>          d.addFamily(family2);<a name="line.1389"></a>
-<span class="sourceLineNo">1390</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1390"></a>
-<span class="sourceLineNo">1391</span>              Table t = conn.getTable(tableName)) {<a name="line.1391"></a>
-<span class="sourceLineNo">1392</span>            t.delete(d);<a name="line.1392"></a>
-<span class="sourceLineNo">1393</span>          }<a name="line.1393"></a>
-<span class="sourceLineNo">1394</span>          return null;<a name="line.1394"></a>
-<span class="sourceLineNo">1395</span>        }<a name="line.1395"></a>
-<span class="sourceLineNo">1396</span>      };<a name="line.1396"></a>
-<span class="sourceLineNo">1397</span><a name="line.1397"></a>
-<span class="sourceLineNo">1398</span>      AccessTestAction deleteAction1 = new AccessTestAction() {<a name="line.1398"></a>
-<span class="sourceLineNo">1399</span>        @Override<a name="line.1399"></a>
-<span class="sourceLineNo">1400</span>        public Object run() throws Exception {<a name="line.1400"></a>
-<span class="sourceLineNo">1401</span>          Delete d = new Delete(TEST_ROW);<a name="line.1401"></a>
-<span class="sourceLineNo">1402</span>          d.addFamily(family1);<a name="line.1402"></a>
-<span class="sourceLineNo">1403</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1403"></a>
-<span class="sourceLineNo">1404</span>              Table t = conn.getTable(tableName)) {<a name="line.1404"></a>
-<span class="sourceLineNo">1405</span>            t.delete(d);<a name="line.1405"></a>
-<span class="sourceLineNo">1406</span>          }<a name="line.1406"></a>
-<span class="sourceLineNo">1407</span>          return null;<a name="line.1407"></a>
-<span class="sourceLineNo">1408</span>        }<a name="line.1408"></a>
-<span class="sourceLineNo">1409</span>      };<a name="line.1409"></a>
-<span class="sourceLineNo">1410</span><a name="line.1410"></a>
-<span class="sourceLineNo">1411</span>      AccessTestAction deleteAction2 = new AccessTestAction() {<a name="line.1411"></a>
-<span class="sourceLineNo">1412</span>        @Override<a name="line.1412"></a>
-<span class="sourceLineNo">1413</span>        public Object run() throws Exception {<a name="line.1413"></a>
-<span class="sourceLineNo">1414</span>          Delete d = new Delete(TEST_ROW);<a name="line.1414"></a>
-<span class="sourceLineNo">1415</span>          d.addFamily(family2);<a name="line.1415"></a>
-<span class="sourceLineNo">1416</span>          try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1416"></a>
-<span class="sourceLineNo">1417</span>              Table t = conn.getTable(tableName)) {<a name="line.1417"></a>
-<span class="sourceLineNo">1418</span>            t.delete(d);<a name="line.1418"></a>
-<span class="sourceLineNo">1419</span>          }<a name="line.1419"></a>
-<span class="sourceLineNo">1420</span>          return null;<a name="line.1420"></a>
-<span class="sourceLineNo">1421</span>        }<a name="line.1421"></a>
-<span class="sourceLineNo">1422</span>      };<a name="line.1422"></a>
-<span class="sourceLineNo">1423</span><a name="line.1423"></a>
-<span class="sourceLineNo">1424</span>      // initial check:<a name="line.1424"></a>
-<span class="sourceLineNo">1425</span>      verifyDenied(tblUser, getActionAll, getAction1, getAction2);<a name="line.1425"></a>
-<span class="sourceLineNo">1426</span>      verifyDenied(tblUser, putActionAll, putAction1, putAction2);<a name="line.1426"></a>
-<span class="sourceLineNo">1427</span>      verifyDenied(tblUser, deleteActionAll, deleteAction1, deleteAction2);<a name="line.1427"></a>
-<span class="sourceLineNo">1428</span><a name="line.1428"></a>
-<span class="sourceLineNo">1429</span>      verifyDenied(gblUser, getActionAll, getAction1, getAction2);<a name="line.1429"></a>
-<span class="sourceLineNo">1430</span>      verifyDenied(gblUser, putActionAll, putAction1, putAction2);<a name="line.1430"></a>
-<span class="sourceLineNo">1431</span>      verifyDenied(gblUser, deleteActionAll, deleteAction1, deleteAction2);<a name="line.1431"></a>
-<span class="sourceLineNo">1432</span><a name="line.1432"></a>
-<span class="sourceLineNo">1433</span>      // grant table read permission<a name="line.1433"></a>
-<span class="sourceLineNo">1434</span>      grantGlobal(TEST_UTIL, gblUser.getShortName(), Permission.Action.READ);<a name="line.1434"></a>
-<span class="sourceLineNo">1435</span>      grantOnTable(TEST_UTIL, tblUser.getShortName(), tableName, null, null, Permission.Action.READ);<a name="line.1435"></a>
-<span class="sourceLineNo">1436</span><a name="line.1436"></a>
-<span class="sourceLineNo">1437</span>      // check<a name="line.1437"></a>
-<span class="sourceLineNo">1438</span>      verifyAllowed(tblUser, getActionAll, getAction1, getAction2);<a name="line.1438"></a>
+<span class="sourceLineNo">1077</span>    private void createHFile(Path path,<a name="line.1077"></a>
+<span class="sourceLineNo">1078</span>        byte[] family, byte[] qualifier,<a name="line.1078"></a>
+<span class="sourceLineNo">1079</span>        byte[] startKey, byte[] endKey, int numRows) throws IOException {<a name="line.1079"></a>
+<span class="sourceLineNo">1080</span><a name="line.1080"></a>
+<span class="sourceLineNo">1081</span>      HFile.Writer writer = null;<a name="line.1081"></a>
+<span class="sourceLineNo">1082</span>      long now = System.currentTimeMillis();<a name="line.1082"></a>
+<span class="sourceLineNo">1083</span>      try {<a name="line.1083"></a>
+<span class="sourceLineNo">1084</span>        HFileContext context = new HFileContextBuilder().build();<a name="line.1084"></a>
+<span class="sourceLineNo">1085</span>        writer = HFile.getWriterFactory(conf, new CacheConfig(conf))<a name="line.1085"></a>
+<span class="sourceLineNo">1086</span>            .withPath(fs, path)<a name="line.1086"></a>
+<span class="sourceLineNo">1087</span>            .withFileContext(context)<a name="line.1087"></a>
+<span class="sourceLineNo">1088</span>            .create();<a name="line.1088"></a>
+<span class="sourceLineNo">1089</span>        // subtract 2 since numRows doesn't include boundary keys<a name="line.1089"></a>
+<span class="sourceLineNo">1090</span>        for (byte[] key : Bytes.iterateOnSplits(startKey, endKey, true, numRows-2)) {<a name="line.1090"></a>
+<span class="sourceLineNo">1091</span>          KeyValue kv = new KeyValue(key, family, qualifier, now, key);<a name="line.1091"></a>
+<span class="sourceLineNo">1092</span>          writer.append(kv);<a name="line.1092"></a>
+<span class="sourceLineNo">1093</span>        }<a name="line.1093"></a>
+<span class="sourceLineNo">1094</span>      } finally {<a name="line.1094"></a>
+<span class="sourceLineNo">1095</span>        if(writer != null)<a name="line.1095"></a>
+<span class="sourceLineNo">1096</span>          writer.close();<a name="line.1096"></a>
+<span class="sourceLineNo">1097</span>      }<a name="line.1097"></a>
+<span class="sourceLineNo">1098</span>    }<a name="line.1098"></a>
+<span class="sourceLineNo">1099</span><a name="line.1099"></a>
+<span class="sourceLineNo">1100</span>    private void bulkLoadHFile(<a name="line.1100"></a>
+<span class="sourceLineNo">1101</span>        TableName tableName,<a name="line.1101"></a>
+<span class="sourceLineNo">1102</span>        byte[] family,<a name="line.1102"></a>
+<span class="sourceLineNo">1103</span>        byte[] qualifier,<a name="line.1103"></a>
+<span class="sourceLineNo">1104</span>        byte[][][] hfileRanges,<a name="line.1104"></a>
+<span class="sourceLineNo">1105</span>        int numRowsPerRange) throws Exception {<a name="line.1105"></a>
+<span class="sourceLineNo">1106</span><a name="line.1106"></a>
+<span class="sourceLineNo">1107</span>      Path familyDir = new Path(loadPath, Bytes.toString(family));<a name="line.1107"></a>
+<span class="sourceLineNo">1108</span>      fs.mkdirs(familyDir);<a name="line.1108"></a>
+<span class="sourceLineNo">1109</span>      int hfileIdx = 0;<a name="line.1109"></a>
+<span class="sourceLineNo">1110</span>      for (byte[][] range : hfileRanges) {<a name="line.1110"></a>
+<span class="sourceLineNo">1111</span>        byte[] from = range[0];<a name="line.1111"></a>
+<span class="sourceLineNo">1112</span>        byte[] to = range[1];<a name="line.1112"></a>
+<span class="sourceLineNo">1113</span>        createHFile(new Path(familyDir, "hfile_"+(hfileIdx++)),<a name="line.1113"></a>
+<span class="sourceLineNo">1114</span>            family, qualifier, from, to, numRowsPerRange);<a name="line.1114"></a>
+<span class="sourceLineNo">1115</span>      }<a name="line.1115"></a>
+<span class="sourceLineNo">1116</span>      //set global read so RegionServer can move it<a name="line.1116"></a>
+<span class="sourceLineNo">1117</span>      setPermission(loadPath, FsPermission.valueOf("-rwxrwxrwx"));<a name="line.1117"></a>
+<span class="sourceLineNo">1118</span><a name="line.1118"></a>
+<span class="sourceLineNo">1119</span><a name="line.1119"></a>
+<span class="sourceLineNo">1120</span>      try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1120"></a>
+<span class="sourceLineNo">1121</span>           Admin admin = conn.getAdmin();<a name="line.1121"></a>
+<span class="sourceLineNo">1122</span>           RegionLocator locator = conn.getRegionLocator(tableName);<a name="line.1122"></a>
+<span class="sourceLineNo">1123</span>           Table table = conn.getTable(tableName)) {<a name="line.1123"></a>
+<span class="sourceLineNo">1124</span>        TEST_UTIL.waitUntilAllRegionsAssigned(tableName);<a name="line.1124"></a>
+<span class="sourceLineNo">1125</span>        LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf);<a name="line.1125"></a>
+<span class="sourceLineNo">1126</span>        loader.doBulkLoad(loadPath, admin, table, locator);<a name="line.1126"></a>
+<span class="sourceLineNo">1127</span>      }<a name="line.1127"></a>
+<span class="sourceLineNo">1128</span>    }<a name="line.1128"></a>
+<span class="sourceLineNo">1129</span><a name="line.1129"></a>
+<span class="sourceLineNo">1130</span>    public void setPermission(Path dir, FsPermission perm) throws IOException {<a name="line.1130"></a>
+<span class="sourceLineNo">1131</span>      if(!fs.getFileStatus(dir).isDirectory()) {<a name="line.1131"></a>
+<span class="sourceLineNo">1132</span>        fs.setPermission(dir,perm);<a name="line.1132"></a>
+<span class="sourceLineNo">1133</span>      }<a name="line.1133"></a>
+<span class="sourceLineNo">1134</span>      else {<a name="line.1134"></a>
+<span class="sourceLineNo">1135</span>        for(FileStatus el : fs.listStatus(dir)) {<a name="line.1135"></a>
+<span class="sourceLineNo">1136</span>          fs.setPermission(el.getPath(), perm);<a name="line.1136"></a>
+<span class="sourceLineNo">1137</span>          setPermission(el.getPath() , perm);<a name="line.1137"></a>
+<span class="sourceLineNo">1138</span>        }<a name="line.1138"></a>
+<span class="sourceLineNo">1139</span>      }<a name="line.1139"></a>
+<span class="sourceLineNo">1140</span>    }<a name="line.1140"></a>
+<span class="sourceLineNo">1141</span>  }<a name="line.1141"></a>
+<span class="sourceLineNo">1142</span><a name="line.1142"></a>
+<span class="sourceLineNo">1143</span>  @Test (timeout=180000)<a name="line.1143"></a>
+<span class="sourceLineNo">1144</span>  public void testAppend() throws Exception {<a name="line.1144"></a>
+<span class="sourceLineNo">1145</span><a name="line.1145"></a>
+<span class="sourceLineNo">1146</span>    AccessTestAction appendAction = new AccessTestAction() {<a name="line.1146"></a>
+<span class="sourceLineNo">1147</span>      @Override<a name="line.1147"></a>
+<span class="sourceLineNo">1148</span>      public Object run() throws Exception {<a name="line.1148"></a>
+<span class="sourceLineNo">1149</span>        byte[] row = TEST_ROW;<a name="line.1149"></a>
+<span class="sourceLineNo">1150</span>        byte[] qualifier = TEST_QUALIFIER;<a name="line.1150"></a>
+<span class="sourceLineNo">1151</span>        Put put = new Put(row);<a name="line.1151"></a>
+<span class="sourceLineNo">1152</span>        put.addColumn(TEST_FAMILY, qualifier, Bytes.toBytes(1));<a name="line.1152"></a>
+<span class="sourceLineNo">1153</span>        Append append = new Append(row);<a name="line.1153"></a>
+<span class="sourceLineNo">1154</span>        append.addColumn(TEST_FAMILY, qualifier, Bytes.toBytes(2));<a name="line.1154"></a>
+<span class="sourceLineNo">1155</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1155"></a>
+<span class="sourceLineNo">1156</span>            Table t = conn.getTable(TEST_TABLE)) {<a name="line.1156"></a>
+<span class="sourceLineNo">1157</span>          t.put(put);<a name="line.1157"></a>
+<span class="sourceLineNo">1158</span>          t.append(append);<a name="line.1158"></a>
+<span class="sourceLineNo">1159</span>        }<a name="line.1159"></a>
+<span class="sourceLineNo">1160</span>        return null;<a name="line.1160"></a>
+<span class="sourceLineNo">1161</span>      }<a name="line.1161"></a>
+<span class="sourceLineNo">1162</span>    };<a name="line.1162"></a>
+<span class="sourceLineNo">1163</span><a name="line.1163"></a>
+<span class="sourceLineNo">1164</span>    verifyAllowed(appendAction, SUPERUSER, USER_ADMIN, USER_OWNER, USER_CREATE, USER_RW,<a name="line.1164"></a>
+<span class="sourceLineNo">1165</span>      USER_GROUP_WRITE);<a name="line.1165"></a>
+<span class="sourceLineNo">1166</span>    verifyDenied(appendAction, USER_RO, USER_NONE, USER_GROUP_CREATE, USER_GROUP_READ,<a name="line.1166"></a>
+<span class="sourceLineNo">1167</span>      USER_GROUP_ADMIN);<a name="line.1167"></a>
+<span class="sourceLineNo">1168</span>  }<a name="line.1168"></a>
+<span class="sourceLineNo">1169</span><a name="line.1169"></a>
+<span class="sourceLineNo">1170</span>  @Test (timeout=180000)<a name="line.1170"></a>
+<span class="sourceLineNo">1171</span>  public void testGrantRevoke() throws Exception {<a name="line.1171"></a>
+<span class="sourceLineNo">1172</span>    AccessTestAction grantAction = new AccessTestAction() {<a name="line.1172"></a>
+<span class="sourceLineNo">1173</span>      @Override<a name="line.1173"></a>
+<span class="sourceLineNo">1174</span>      public Object run() throws Exception {<a name="line.1174"></a>
+<span class="sourceLineNo">1175</span>        try(Connection conn = ConnectionFactory.createConnection(conf);<a name="line.1175"></a>
+<span class="sourceLineNo">1176</span>            Table acl = conn.getTable(AccessControlLists.ACL_TABLE_NAME)) {<a name="line.1176"></a>
+<span class="sourceLineNo">1177</span>          BlockingRpcChannel service = acl.coprocessorService(TEST_TABLE.getName());<a name="line.1177"></a>
+<span class="sourceLineNo">1178</span>          AccessControlService.BlockingInterface protocol =<a name="line.1178"></a>
+<span class="sourceLineNo">1179</span>            AccessControlService.newBlockingStub(service);<a name="line.1179"></a>
+<span class="sourceLineNo">1180</span>          AccessControlUtil.grant(null, protocol, USER_RO.getShortName(), TEST_TABLE, TEST_FAMILY,<a name="line.1180"></a>
+<span class="sourceLineNo">1181</span>              null, false, Action.READ);<a name="line.1181"></a>
+<span class="sourceLineNo">1182</span>        }<a name="line.1182"></a>
+<span class="sourceLineNo">1183</span>        return null;<a name="line.1183"></a>
+<span class="sourceLineNo">1184<

<TRUNCATED>

Mime
View raw message