You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2014/04/08 20:40:55 UTC
svn commit: r1585814 - in
/hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache:
hadoop/hive/jdbc/TestJdbcDriver.java hive/jdbc/TestJdbcDriver2.java
Author: hashutosh
Date: Tue Apr 8 18:40:55 2014
New Revision: 1585814
URL: http://svn.apache.org/r1585814
Log:
HIVE-6845 : TestJdbcDriver.testShowRoleGrant can fail if TestJdbcDriver/TestJdbcDriver2 run together (Jason Dere via Thejas Nair)
Modified:
hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java
hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java
Modified: hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java?rev=1585814&r1=1585813&r2=1585814&view=diff
==============================================================================
--- hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java (original)
+++ hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hadoop/hive/jdbc/TestJdbcDriver.java Tue Apr 8 18:40:55 2014
@@ -40,6 +40,8 @@ import java.util.Set;
import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.conf.HiveConf;
@@ -48,6 +50,7 @@ import org.apache.hadoop.hive.conf.HiveC
*
*/
public class TestJdbcDriver extends TestCase {
+ private static final Log LOG = LogFactory.getLog(TestJdbcDriver.class);
private static final String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
private static final String tableName = "testHiveJdbcDriver_Table";
private static final String tableComment = "Simple table";
@@ -1165,6 +1168,14 @@ public class TestJdbcDriver extends Test
public void testShowRoleGrant() throws SQLException {
Statement stmt = con.createStatement();
+
+ // drop role. ignore error.
+ try {
+ stmt.execute("drop role role1");
+ } catch (Exception ex) {
+ LOG.warn("Ignoring error during drop role: " + ex);
+ }
+
stmt.execute("create role role1");
stmt.execute("grant role role1 to user hive_test_user");
stmt.execute("show role grant user hive_test_user");
Modified: hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java?rev=1585814&r1=1585813&r2=1585814&view=diff
==============================================================================
--- hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java (original)
+++ hive/branches/branch-0.13/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java Tue Apr 8 18:40:55 2014
@@ -46,6 +46,8 @@ import java.util.Properties;
import java.util.Set;
import java.util.regex.Pattern;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.TableType;
@@ -70,6 +72,7 @@ import org.junit.Test;
*
*/
public class TestJdbcDriver2 {
+ private static final Log LOG = LogFactory.getLog(TestJdbcDriver2.class);
private static final String driverName = "org.apache.hive.jdbc.HiveDriver";
private static final String tableName = "testHiveJdbcDriver_Table";
private static final String tableComment = "Simple table";
@@ -1997,6 +2000,14 @@ public class TestJdbcDriver2 {
@Test
public void testShowRoleGrant() throws SQLException {
Statement stmt = con.createStatement();
+
+ // drop role. ignore error.
+ try {
+ stmt.execute("drop role role1");
+ } catch (Exception ex) {
+ LOG.warn("Ignoring error during drop role: " + ex);
+ }
+
stmt.execute("create role role1");
stmt.execute("grant role role1 to user hive_test_user");
stmt.execute("show role grant user hive_test_user");