hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1340158 - in /hive/trunk/hbase-handler/src/test: queries/negative/ queries/negative/cascade_dbdrop.q results/negative/ results/negative/cascade_dbdrop.q.out templates/TestHBaseNegativeCliDriver.vm
Date Fri, 18 May 2012 16:25:12 GMT
Author: hashutosh
Date: Fri May 18 16:25:12 2012
New Revision: 1340158

URL: http://svn.apache.org/viewvc?rev=1340158&view=rev
Log:
HIVE-2542 : Forgot to do svn add for new  files in previous patch. 

Added:
    hive/trunk/hbase-handler/src/test/queries/negative/
    hive/trunk/hbase-handler/src/test/queries/negative/cascade_dbdrop.q
    hive/trunk/hbase-handler/src/test/results/negative/
    hive/trunk/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out
    hive/trunk/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm

Added: hive/trunk/hbase-handler/src/test/queries/negative/cascade_dbdrop.q
URL: http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/test/queries/negative/cascade_dbdrop.q?rev=1340158&view=auto
==============================================================================
--- hive/trunk/hbase-handler/src/test/queries/negative/cascade_dbdrop.q (added)
+++ hive/trunk/hbase-handler/src/test/queries/negative/cascade_dbdrop.q Fri May 18 16:25:12
2012
@@ -0,0 +1,19 @@
+
+CREATE DATABASE hbaseDB;
+
+CREATE TABLE hbaseDB.hbase_table_0(key int, value string)
+STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
+WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string")
+TBLPROPERTIES ("hbase.table.name" = "hbase_table_0");
+
+dfs -ls ../build/ql/tmp/hbase/hbase_table_0;
+
+DROP DATABASE IF EXISTS hbaseDB CASCADE;
+
+dfs -ls ../build/ql/tmp/hbase/hbase_table_0;
+
+
+
+
+
+

Added: hive/trunk/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out?rev=1340158&view=auto
==============================================================================
--- hive/trunk/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out (added)
+++ hive/trunk/hbase-handler/src/test/results/negative/cascade_dbdrop.q.out Fri May 18 16:25:12
2012
@@ -0,0 +1,22 @@
+PREHOOK: query: CREATE DATABASE hbaseDB
+PREHOOK: type: CREATEDATABASE
+POSTHOOK: query: CREATE DATABASE hbaseDB
+POSTHOOK: type: CREATEDATABASE
+PREHOOK: query: CREATE TABLE hbaseDB.hbase_table_0(key int, value string)
+STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
+WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string")
+TBLPROPERTIES ("hbase.table.name" = "hbase_table_0")
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: CREATE TABLE hbaseDB.hbase_table_0(key int, value string)
+STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
+WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:string")
+TBLPROPERTIES ("hbase.table.name" = "hbase_table_0")
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: hbaseDB@hbase_table_0
+Found 3 items
+#### A masked pattern was here ####
+PREHOOK: query: DROP DATABASE IF EXISTS hbaseDB CASCADE
+PREHOOK: type: DROPDATABASE
+POSTHOOK: query: DROP DATABASE IF EXISTS hbaseDB CASCADE
+POSTHOOK: type: DROPDATABASE
+Command failed with exit code = -1

Added: hive/trunk/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm
URL: http://svn.apache.org/viewvc/hive/trunk/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm?rev=1340158&view=auto
==============================================================================
--- hive/trunk/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm (added)
+++ hive/trunk/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm Fri May 18 16:25:12
2012
@@ -0,0 +1,119 @@
+package org.apache.hadoop.hive.cli;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.hadoop.hive.hbase.HBaseQTestUtil;
+import org.apache.hadoop.hive.hbase.HBaseTestSetup;
+import org.apache.hadoop.hive.ql.exec.Task;
+import org.apache.hadoop.hive.ql.history.HiveHistoryViewer;
+import org.apache.hadoop.hive.ql.history.HiveHistory.QueryInfo;
+import org.apache.hadoop.hive.ql.history.HiveHistory.Keys;
+import org.apache.hadoop.hive.ql.history.HiveHistory.TaskInfo;
+import org.apache.hadoop.hive.ql.session.SessionState;
+
+
+
+import org.antlr.runtime.*;
+import org.antlr.runtime.tree.*;
+
+public class $className extends TestCase {
+
+  private HBaseQTestUtil qt;
+  private HBaseTestSetup setup;
+
+  public $className(String name, HBaseTestSetup setup) {
+    super(name);
+    qt = null;
+    this.setup = setup;
+  }
+
+  @Override
+  protected void setUp() {
+    try {
+      boolean miniMR = false;
+      if ("$clusterMode".equals("miniMR")) {
+        miniMR = true;
+      }
+
+      qt = new HBaseQTestUtil(
+        "$resultsDir.getCanonicalPath()",
+        "$logDir.getCanonicalPath()", miniMR, setup);
+
+#foreach ($qf in $qfiles)
+      qt.addFile("$qf.getCanonicalPath()");
+#end
+    } catch (Exception e) {
+      System.out.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.out.flush();
+      fail("Unexpected exception in setup");
+    }
+  }
+
+  @Override
+  protected void tearDown() {
+    try {
+      qt.shutdown();
+    }
+    catch (Exception e) {
+      System.out.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.out.flush();
+      fail("Unexpected exception in tearDown");
+    }
+  }
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    HBaseTestSetup setup = new HBaseTestSetup(suite);
+#foreach ($qf in $qfiles)
+  #set ($fname = $qf.getName())
+  #set ($eidx = $fname.indexOf('.'))
+  #set ($tname = $fname.substring(0, $eidx))
+    suite.addTest(new $className("testCliDriver_$tname", setup));
+#end
+    return setup;
+  }
+
+#foreach ($qf in $qfiles)
+  #set ($fname = $qf.getName())
+  #set ($eidx = $fname.indexOf('.'))
+  #set ($tname = $fname.substring(0, $eidx))
+  public void testCliDriver_$tname() throws Exception {
+    long startTime = System.currentTimeMillis();
+    try {
+      System.out.println("Begin query: " + "$fname");
+      qt.cliInit("$fname");
+      qt.clearTestSideEffects();
+      int ecode = qt.executeClient("$fname");
+      if (ecode == 0) {
+        fail("Client Execution failed with error code = " + ecode);
+      }
+
+      ecode = qt.checkCliDriverResults("$fname");
+      if (ecode != 0) {
+        fail("Client execution results failed with error code = " + ecode);
+      }
+      qt.clearPostTestEffects();
+
+    } catch (Throwable e) {
+      System.out.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.out.println("Failed query: " + "$fname");
+      System.out.flush();
+      fail("Unexpected exception");
+    }
+
+    long elapsedTime = System.currentTimeMillis() - startTime;
+    System.out.println("Done query: " + "$fname" + " elapsedTime=" + elapsedTime/1000 + "s");
+    assertTrue("Test passed", true);
+  }
+
+#end
+}
+



Mime
View raw message