You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by sd...@apache.org on 2015/08/14 09:28:55 UTC

[21/50] [abbrv] incubator-sentry git commit: SENTRY-741: Add a test case for hive query which creates dummy partition (Sravya Tirukkovalur, Reviewed by: Lenni Kuff)

SENTRY-741: Add a test case for hive query which creates dummy partition (Sravya Tirukkovalur, Reviewed by: Lenni Kuff)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/58a8358c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/58a8358c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/58a8358c

Branch: refs/heads/hive_plugin_v2
Commit: 58a8358ca626877a2f7bd24d07274ee5eeaa0a1a
Parents: 412eea3
Author: Sravya Tirukkovalur <sr...@clouera.com>
Authored: Tue Jul 21 13:48:25 2015 -0700
Committer: Sravya Tirukkovalur <sr...@clouera.com>
Committed: Tue Jul 21 13:48:25 2015 -0700

----------------------------------------------------------------------
 .../e2e/hive/TestPrivilegesAtTableScope.java    | 29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/58a8358c/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtTableScope.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtTableScope.java b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtTableScope.java
index 69073e0..46c6cbb 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtTableScope.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtTableScope.java
@@ -530,4 +530,33 @@ public class TestPrivilegesAtTableScope extends AbstractTestWithStaticConfigurat
     rs1.close();
     return hasResults;
   }
+
+  @Test
+  public void testDummyPartition() throws Exception {
+
+    policyFile
+        .addRolesToGroup(USERGROUP1, "select_tab1", "select_tab2")
+        .addPermissionsToRole("select_tab1", "server=server1->db=DB_1->table=TAB_1->action=select")
+        .addPermissionsToRole("select_tab2", "server=server1->db=DB_1->table=TAB_3->action=insert")
+        .setUserGroupMapping(StaticUserGroup.getStaticMapping());
+    writePolicyFile(policyFile);
+
+    // setup db objects needed by the test
+    Connection connection = context.createConnection(ADMIN1);
+    Statement statement = context.createStatement(connection);
+
+    statement.execute("USE " + DB1);
+    statement.execute("CREATE table TAB_3 (a2 int) PARTITIONED BY (b2 string, c2 string)");
+    statement.close();
+    connection.close();
+
+    connection = context.createConnection(USER1_1);
+    statement = context.createStatement(connection);
+
+    statement.execute("USE " + DB1);
+    statement.execute("INSERT OVERWRITE TABLE TAB_3 PARTITION(b2='abc', c2) select a, b as c2 from TAB_1");
+    statement.close();
+    connection.close();
+
+  }
 }