Repository: incubator-ranger
Updated Branches:
  refs/heads/master bf3f09542 -> ac5a03667


RANGER-1153 : Ranger HivePluginUnitTest improvements to avoid build failure


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

Branch: refs/heads/master
Commit: ac5a03667cf167eb7a1d83d2c9aae8c2ab946494
Parents: bf3f095
Author: rmani <[email protected]>
Authored: Fri Aug 19 15:03:25 2016 -0700
Committer: rmani <[email protected]>
Committed: Fri Aug 19 15:03:25 2016 -0700

----------------------------------------------------------------------
 .../services/hive/HIVERangerAuthorizerTest.java     | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/ac5a0366/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
----------------------------------------------------------------------
diff --git 
a/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
 
b/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
index d3d67d9..959310e 100644
--- 
a/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
+++ 
b/hive-agent/src/test/java/org/apache/ranger/services/hive/HIVERangerAuthorizerTest.java
@@ -96,7 +96,7 @@ public class HIVERangerAuthorizerTest {
         Connection connection = DriverManager.getConnection(initialUrl, 
"admin", "admin");
         Statement statement = connection.createStatement();
         
-        statement.execute("CREATE DATABASE rangerauthz");
+        statement.execute("CREATE DATABASE IF NOT EXISTS rangerauthz");
         
         statement.close();
         connection.close();
@@ -106,7 +106,7 @@ public class HIVERangerAuthorizerTest {
         connection = DriverManager.getConnection(url, "admin", "admin");
         statement = connection.createStatement();
         // statement.execute("CREATE TABLE WORDS (word STRING, count INT)");
-        statement.execute("create table words (word STRING, count INT) row 
format delimited fields terminated by '\t' stored as textfile");
+        statement.execute("create table if not exists words (word STRING, 
count INT) row format delimited fields terminated by '\t' stored as textfile");
         
         // Copy "wordcount.txt" to "target" to avoid overwriting it during load
         java.io.File inputFile = new 
java.io.File(HIVERangerAuthorizerTest.class.getResource("../../../../../wordcount.txt").toURI());
@@ -311,7 +311,7 @@ public class HIVERangerAuthorizerTest {
         Connection connection = DriverManager.getConnection(url, "bob", "bob");
         Statement statement = connection.createStatement();
 
-        statement.execute("CREATE DATABASE bobtemp");
+        statement.execute("CREATE DATABASE if not exists bobtemp");
 
         statement.close();
         connection.close();
@@ -321,7 +321,7 @@ public class HIVERangerAuthorizerTest {
         statement = connection.createStatement();
 
         try {
-            statement.execute("CREATE DATABASE alicetemp");
+            statement.execute("CREATE DATABASE if not exists alicetemp");
             Assert.fail("Failure expected on an unauthorized call");
         } catch (SQLException ex) {
             // expected
@@ -357,7 +357,7 @@ public class HIVERangerAuthorizerTest {
         Connection connection = DriverManager.getConnection(url, "admin", 
"admin");
         Statement statement = connection.createStatement();
 
-        statement.execute("CREATE DATABASE admintemp");
+        statement.execute("CREATE DATABASE if not exists admintemp");
 
         statement.close();
         connection.close();
@@ -366,7 +366,7 @@ public class HIVERangerAuthorizerTest {
         url = "jdbc:hive2://localhost:" + port + "/admintemp";
         connection = DriverManager.getConnection(url, "admin", "admin");
         statement = connection.createStatement();
-        statement.execute("CREATE TABLE WORDS (word STRING, count INT)");
+        statement.execute("CREATE TABLE if not exists  WORDS (word STRING, 
count INT)");
         
         statement.close();
         connection.close();
@@ -403,7 +403,7 @@ public class HIVERangerAuthorizerTest {
         String url = "jdbc:hive2://localhost:" + port + "/rangerauthz";
         Connection connection = DriverManager.getConnection(url, "admin", 
"admin");
         Statement statement = connection.createStatement();
-        statement.execute("CREATE TABLE WORDS2 (word STRING, count INT)");
+        statement.execute("CREATE TABLE if not exists WORDS2 (word STRING, 
count INT)");
         
         statement.close();
         connection.close();
@@ -440,7 +440,7 @@ public class HIVERangerAuthorizerTest {
         // Create a new table as admin
         Connection connection = DriverManager.getConnection(url, "admin", 
"admin");
         Statement statement = connection.createStatement();
-        statement.execute("CREATE TABLE WORDS2 (word STRING, count INT)");
+        statement.execute("CREATE TABLE IF NOT EXISTS WORDS2 (word STRING, 
count INT)");
         
         statement.close();
         connection.close();

Reply via email to