hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sze...@apache.org
Subject hive git commit: HIVE-12330 : Fix precommit Spark test part2 (Sergio Pena via Szehon)
Date Wed, 09 Dec 2015 00:02:12 GMT
Repository: hive
Updated Branches:
  refs/heads/master c3f4ab44d -> 58adda5d1


HIVE-12330 : Fix precommit Spark test part2 (Sergio Pena via Szehon)


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

Branch: refs/heads/master
Commit: 58adda5d135c56aab31ee10d6669925ba7c948e1
Parents: c3f4ab4
Author: Szehon Ho <szehon@cloudera.com>
Authored: Tue Dec 8 16:00:02 2015 -0800
Committer: Szehon Ho <szehon@cloudera.com>
Committed: Tue Dec 8 16:01:29 2015 -0800

----------------------------------------------------------------------
 .../src/test/templates/TestHBaseCliDriver.vm    | 63 +++++------------
 .../templates/TestHBaseNegativeCliDriver.vm     | 64 +++++------------
 .../hadoop/hive/hbase/HBaseTestSetup.java       |  9 +--
 ql/src/test/templates/TestCliDriver.vm          | 74 ++++++--------------
 ql/src/test/templates/TestCompareCliDriver.vm   | 71 ++++++-------------
 ql/src/test/templates/TestNegativeCliDriver.vm  | 70 +++++++-----------
 ql/src/test/templates/TestParseNegative.vm      | 65 ++++++-----------
 .../ptest2/src/main/resources/batch-exec.vm     |  2 -
 8 files changed, 127 insertions(+), 291 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/templates/TestHBaseCliDriver.vm b/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
index de0be32..6f4a7c1 100644
--- a/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
+++ b/hbase-handler/src/test/templates/TestHBaseCliDriver.vm
@@ -17,38 +17,25 @@
  */
 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.ql.QTestUtil;
 import org.apache.hadoop.hive.ql.QTestUtil.MiniClusterType;
 import org.apache.hadoop.hive.hbase.HBaseQTestUtil;
 import org.apache.hadoop.hive.hbase.HBaseTestSetup;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
 
-public class $className extends TestCase {
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class $className {
 
   private static final String HIVE_ROOT = HBaseQTestUtil.ensurePathEndsInSlash(System.getProperty("hive.root"));
   private HBaseQTestUtil qt;
-  private HBaseTestSetup setup;
+  private static HBaseTestSetup setup = new HBaseTestSetup();
 
-  public static class TestHBaseCliDriverAddTestFromQFiles implements QTestUtil.SuiteAddTestFunctor
{
-    public void addTestToSuite(TestSuite suite, Object setup, String tName) {
-      suite.addTest(new $className("testCliDriver_"+tName, (HBaseTestSetup)setup));
-    }
-  }
-
-  public $className(String name, HBaseTestSetup setup) {
-    super(name);
-    qt = null;
-    this.setup = setup;
-  }
-
-  @Override
-  protected void setUp() {
+  @Before
+  public void setUp() {
 
     MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode");
     String initScript = "$initScript";
@@ -65,12 +52,11 @@ public class $className extends TestCase {
     }
   }
 
-  @Override
-  protected void tearDown() {
+  @After
+  public void tearDown() {
     try {
       qt.shutdown();
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
       System.err.flush();
@@ -78,23 +64,9 @@ public class $className extends TestCase {
     }
   }
 
-  public static Test suite() {
-    Set<String> qFilesToExecute = new HashSet<String>();
-    String qFiles = System.getProperty("qfile", "").trim();
-    if(!qFiles.isEmpty()) {
-      for(String qFile : qFiles.split(",")) {
-        qFile = qFile.trim();
-        if(!qFile.isEmpty()) {
-          qFilesToExecute.add(qFile);
-        }
-      }
-    }
-    TestSuite suite = new TestSuite();
-    HBaseTestSetup setup = new HBaseTestSetup(suite);
-
-    QTestUtil.addTestsToSuiteFromQfileNames("$qFileNamesFile", qFilesToExecute,
-      suite, setup, new TestHBaseCliDriverAddTestFromQFiles());
-    return setup;
+  @AfterClass
+  public static void closeHBaseConnections() throws Exception {
+    setup.tearDown();
   }
 
 #foreach ($qf in $qfiles)
@@ -102,6 +74,7 @@ public class $className extends TestCase {
   #set ($eidx = $fname.indexOf('.'))
   #set ($tname = $fname.substring(0, $eidx))
   #set ($fpath = $qfilesMap.get($fname))
+  @Test
   public void testCliDriver_$tname() throws Exception {
     runTest("$tname", "$fname", (HIVE_ROOT + "$fpath"));
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm b/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm
index b402585..043bd87 100644
--- a/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm
+++ b/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm
@@ -18,38 +18,25 @@
 
 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.ql.QTestUtil;
 import org.apache.hadoop.hive.ql.QTestUtil.MiniClusterType;
 import org.apache.hadoop.hive.hbase.HBaseQTestUtil;
 import org.apache.hadoop.hive.hbase.HBaseTestSetup;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
 
-public class $className extends TestCase {
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class $className {
 
   private static final String HIVE_ROOT = HBaseQTestUtil.ensurePathEndsInSlash(System.getProperty("hive.root"));
   private HBaseQTestUtil qt;
-  private HBaseTestSetup setup;
-
-  public static class TestHBaseNegativeCliDriverAddTestFromQFiles implements QTestUtil.SuiteAddTestFunctor
{
-    public void addTestToSuite(TestSuite suite, Object setup, String tName) {
-      suite.addTest(new $className("testCliDriver_"+tName, (HBaseTestSetup)setup));
-    }
-  }
-
-  public $className(String name, HBaseTestSetup setup) {
-    super(name);
-    qt = null;
-    this.setup = setup;
-  }
+  private static HBaseTestSetup setup = new HBaseTestSetup();
 
-  @Override
-  protected void setUp() {
+  @Before
+  public void setUp() {
 
     MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode");
     String initScript = "$initScript";
@@ -66,12 +53,11 @@ public class $className extends TestCase {
     }
   }
 
-  @Override
-  protected void tearDown() {
+  @After
+  public void tearDown() {
     try {
       qt.shutdown();
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
       System.err.flush();
@@ -79,24 +65,9 @@ public class $className extends TestCase {
     }
   }
 
-  public static Test suite() {
-    Set<String> qFilesToExecute = new HashSet<String>();
-    String qFiles = System.getProperty("qfile", "").trim();
-    if(!qFiles.isEmpty()) {
-      for(String qFile : qFiles.split(",")) {
-        qFile = qFile.trim();
-        if(!qFile.isEmpty()) {
-          qFilesToExecute.add(qFile);
-        }
-      }
-    }
-
-    TestSuite suite = new TestSuite();
-    HBaseTestSetup setup = new HBaseTestSetup(suite);
-
-    QTestUtil.addTestsToSuiteFromQfileNames("$qFileNamesFile", qFilesToExecute,
-      suite, setup, new TestHBaseNegativeCliDriverAddTestFromQFiles());
-    return setup;
+  @AfterClass
+  public static void closeHBaseConnections() throws Exception {
+    setup.tearDown();
   }
 
 #foreach ($qf in $qfiles)
@@ -104,6 +75,7 @@ public class $className extends TestCase {
   #set ($eidx = $fname.indexOf('.'))
   #set ($tname = $fname.substring(0, $eidx))
   #set ($fpath = $qfilesMap.get($fname))
+  @Test
   public void testCliDriver_$tname() throws Exception {
     runTest("$tname", "$fname", (HIVE_ROOT + "$fpath"));
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
----------------------------------------------------------------------
diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseTestSetup.java b/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
index 300f1cf..e6383dc 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/hbase/HBaseTestSetup.java
@@ -45,7 +45,7 @@ import org.apache.zookeeper.Watcher;
  * HBaseTestSetup defines HBase-specific test fixtures which are
  * reused across testcases.
  */
-public class HBaseTestSetup extends TestSetup {
+public class HBaseTestSetup {
 
   private MiniHBaseCluster hbaseCluster;
   private int zooKeeperPort;
@@ -54,10 +54,6 @@ public class HBaseTestSetup extends TestSetup {
 
   private static final int NUM_REGIONSERVERS = 1;
 
-  public HBaseTestSetup(Test test) {
-    super(test);
-  }
-
   public HConnection getConnection() {
     return this.hbaseConn;
   }
@@ -170,8 +166,7 @@ public class HBaseTestSetup extends TestSetup {
     return port;
   }
 
-  @Override
-  protected void tearDown() throws Exception {
+  public void tearDown() throws Exception {
     if (hbaseConn != null) {
       hbaseConn.close();
       hbaseConn = null;

http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/ql/src/test/templates/TestCliDriver.vm
----------------------------------------------------------------------
diff --git a/ql/src/test/templates/TestCliDriver.vm b/ql/src/test/templates/TestCliDriver.vm
index 01745da..fa638ae 100644
--- a/ql/src/test/templates/TestCliDriver.vm
+++ b/ql/src/test/templates/TestCliDriver.vm
@@ -17,28 +17,21 @@
  */
 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.ql.QTestUtil;
 import org.apache.hadoop.hive.ql.QTestUtil.MiniClusterType;
-import org.apache.hadoop.hive.ql.session.SessionState;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-public class $className extends TestCase {
+public class $className {
 
   private static final String HIVE_ROOT = QTestUtil.ensurePathEndsInSlash(System.getProperty("hive.root"));
   private static QTestUtil qt;
 
-  public static class TestCliDriverAddTestFromQFiles implements QTestUtil.SuiteAddTestFunctor
{
-    public void addTestToSuite(TestSuite suite, Object setup, String tName) {
-      suite.addTest(new $className("testCliDriver_"+tName));
-    }
-  }
-
   static {
 
     MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode");
@@ -66,12 +59,8 @@ public class $className extends TestCase {
     }
   }
 
-  public $className(String name) {
-    super(name);
-  }
-
-  @Override
-  protected void setUp() {
+  @Before
+  public void setUp() {
     try {
       qt.clearTestSideEffects();
     } catch (Exception e) {
@@ -82,21 +71,11 @@ public class $className extends TestCase {
     }
   }
 
-  /**
-   * Dummy last test. This is only meant to shutdown qt
-   */
-  public void testCliDriver_shutdown() {
-    System.err.println ("Cleaning up " + "$className");
-  }
-
-  @Override
-  protected void tearDown() {
+  @After
+  public void tearDown() {
     try {
       qt.clearPostTestEffects();
-      if (getName().equals("testCliDriver_shutdown"))
-        qt.shutdown();
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
       System.err.flush();
@@ -104,24 +83,16 @@ public class $className extends TestCase {
     }
   }
 
-  public static Test suite() {
-    Set<String> qFilesToExecute = new HashSet<String>();
-    String qFiles = System.getProperty("qfile", "").trim();
-    if(!qFiles.isEmpty()) {
-      for(String qFile : qFiles.split(",")) {
-        qFile = qFile.trim();
-        if(!qFile.isEmpty()) {
-          qFilesToExecute.add(qFile);
-        }
-      }
+  @AfterClass
+  public static void shutdown() throws Exception {
+    try {
+      qt.shutdown();
+    } catch (Exception e) {
+      System.err.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.err.flush();
+      fail("Unexpected exception in shutdown");
     }
-
-    TestSuite suite = new TestSuite();
-
-    QTestUtil.addTestsToSuiteFromQfileNames("$qFileNamesFile", qFilesToExecute,
-      suite, null, new TestCliDriverAddTestFromQFiles());
-    suite.addTest(new $className("testCliDriver_shutdown"));
-    return suite;
   }
 
   static String debugHint = "\nSee ./ql/target/tmp/log/hive.log or ./itests/qtest/target/tmp/log/hive.log,
"
@@ -132,6 +103,7 @@ public class $className extends TestCase {
   #set ($eidx = $fname.indexOf('.'))
   #set ($tname = $fname.substring(0, $eidx))
   #set ($fpath = $qfilesMap.get($fname))
+  @Test
   public void testCliDriver_$tname() throws Exception {
     runTest("$tname", "$fname", (HIVE_ROOT + "$fpath"));
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/ql/src/test/templates/TestCompareCliDriver.vm
----------------------------------------------------------------------
diff --git a/ql/src/test/templates/TestCompareCliDriver.vm b/ql/src/test/templates/TestCompareCliDriver.vm
index 7f849e0..5e44315 100644
--- a/ql/src/test/templates/TestCompareCliDriver.vm
+++ b/ql/src/test/templates/TestCompareCliDriver.vm
@@ -17,29 +17,23 @@
  */
 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 java.util.Arrays;
 
 import org.apache.hadoop.hive.ql.QTestUtil;
 import org.apache.hadoop.hive.ql.QTestUtil.MiniClusterType;
-import org.apache.hadoop.hive.ql.session.SessionState;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
 
-public class $className extends TestCase {
+public class $className {
 
   private static final String HIVE_ROOT = QTestUtil.ensurePathEndsInSlash(System.getProperty("hive.root"));
   private static QTestUtil qt;
 
-  public static class TestCompareCliDriverAddTestFromQFiles implements QTestUtil.SuiteAddTestFunctor
{
-    public void addTestToSuite(TestSuite suite, Object setup, String tName) {
-      suite.addTest(new $className("testCompareCliDriver_"+tName));
-    }
-  }
-
   static {
 
     MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode");
@@ -66,12 +60,8 @@ public class $className extends TestCase {
     }
   }
 
-  public $className(String name) {
-    super(name);
-  }
-
-  @Override
-  protected void setUp() {
+  @Before
+  public void setUp() {
     try {
       qt.clearTestSideEffects();
     } catch (Exception e) {
@@ -82,21 +72,11 @@ public class $className extends TestCase {
     }
   }
 
-  /**
-   * Dummy last test. This is only meant to shutdown qt
-   */
-  public void testCompareCliDriver_shutdown() {
-    System.err.println ("Cleaning up " + "$className");
-  }
-
-  @Override
-  protected void tearDown() {
+  @After
+  public void tearDown() {
     try {
       qt.clearPostTestEffects();
-      if (getName().equals("testCompareCliDriver_shutdown"))
-        qt.shutdown();
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
       System.err.flush();
@@ -104,24 +84,16 @@ public class $className extends TestCase {
     }
   }
 
-  public static Test suite() {
-    Set<String> qFilesToExecute = new HashSet<String>();
-    String qFiles = System.getProperty("qfile", "").trim();
-    if(!qFiles.isEmpty()) {
-      for(String qFile : qFiles.split(",")) {
-        qFile = qFile.trim();
-        if(!qFile.isEmpty()) {
-          qFilesToExecute.add(qFile);
-        }
-      }
+  @AfterClass
+  public static void shutdown() throws Exception {
+    try {
+      qt.shutdown();
+    } catch (Exception e) {
+      System.err.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.err.flush();
+      fail("Unexpected exception in shutdown");
     }
-
-    TestSuite suite = new TestSuite();
-
-    QTestUtil.addTestsToSuiteFromQfileNames("$qFileNamesFile", qFilesToExecute,
-      suite, null, new TestCompareCliDriverAddTestFromQFiles());
-    suite.addTest(new $className("testCompareCliDriver_shutdown"));
-    return suite;
   }
 
   private Map<String, List<String>> versionFiles = new HashMap<String, List<String>>();
@@ -134,6 +106,7 @@ public class $className extends TestCase {
   #set ($eidx = $fname.indexOf('.'))
   #set ($tname = $fname.substring(0, $eidx))
   #set ($fpath = $qfilesMap.get($fname))
+  @Test
   public void testCompareCliDriver_$tname() throws Exception {
     runTest("$tname", "$fname", (HIVE_ROOT + "$fpath"));
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/ql/src/test/templates/TestNegativeCliDriver.vm
----------------------------------------------------------------------
diff --git a/ql/src/test/templates/TestNegativeCliDriver.vm b/ql/src/test/templates/TestNegativeCliDriver.vm
index 5f8ee8e..85c1e7f 100644
--- a/ql/src/test/templates/TestNegativeCliDriver.vm
+++ b/ql/src/test/templates/TestNegativeCliDriver.vm
@@ -17,28 +17,21 @@
  */
 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.ql.QTestUtil;
 import org.apache.hadoop.hive.ql.QTestUtil.MiniClusterType;
-import org.apache.hadoop.hive.ql.exec.Task;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-public class $className extends TestCase {
+public class $className {
 
   private static final String HIVE_ROOT = QTestUtil.ensurePathEndsInSlash(System.getProperty("hive.root"));
   private static QTestUtil qt;
 
-  public static class TestNegativeCliDriverAddTestFromQFiles implements QTestUtil.SuiteAddTestFunctor
{
-    public void addTestToSuite(TestSuite suite, Object setup, String tName) {
-      suite.addTest(new $className("testNegativeCliDriver_"+tName));
-    }
-  }
-
   static {
     MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode");
     String initScript = "$initScript";
@@ -59,30 +52,22 @@ public class $className extends TestCase {
     }
   }
 
-  public $className(String name) {
-    super(name);
-  }
-
-  @Override
-  protected void setUp() {
+  @Before
+  public void setUp() {
     try {
       qt.clearTestSideEffects();
-    }
-    catch (Throwable e) {
+    } catch (Throwable e) {
       e.printStackTrace();
       System.err.flush();
       fail("Unexpected exception in setup");
     }
   }
 
-  @Override
-  protected void tearDown() {
+  @After
+  public void tearDown() {
     try {
       qt.clearPostTestEffects();
-      if (getName().equals("testNegativeCliDriver_shutdown"))
-        qt.shutdown();
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
       System.err.flush();
@@ -90,24 +75,16 @@ public class $className extends TestCase {
     }
   }
 
-  public static Test suite() {
-    Set<String> qFilesToExecute = new HashSet<String>();
-    String qFiles = System.getProperty("qfile", "").trim();
-    if(!qFiles.isEmpty()) {
-      for(String qFile : qFiles.split(",")) {
-        qFile = qFile.trim();
-        if(!qFile.isEmpty()) {
-          qFilesToExecute.add(qFile);
-        }
-      }
+  @AfterClass
+  public static void shutdown() throws Exception {
+    try {
+      qt.shutdown();
+    } catch (Exception e) {
+      System.err.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.err.flush();
+      fail("Unexpected exception in shutdown");
     }
-
-    TestSuite suite = new TestSuite();
-
-    QTestUtil.addTestsToSuiteFromQfileNames("$qFileNamesFile", qFilesToExecute,
-      suite, null, new TestNegativeCliDriverAddTestFromQFiles());
-    suite.addTest(new $className("testNegativeCliDriver_shutdown"));
-    return suite;
   }
 
   /**
@@ -125,6 +102,7 @@ public class $className extends TestCase {
   #set ($eidx = $fname.indexOf('.'))
   #set ($tname = $fname.substring(0, $eidx))
   #set ($fpath = $qfilesMap.get($fname))
+  @Test
   public void testNegativeCliDriver_$tname() throws Exception {
     runTest("$tname", "$fname", (HIVE_ROOT + "$fpath"));
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/ql/src/test/templates/TestParseNegative.vm
----------------------------------------------------------------------
diff --git a/ql/src/test/templates/TestParseNegative.vm b/ql/src/test/templates/TestParseNegative.vm
index c5e7bdf..a4397f7 100755
--- a/ql/src/test/templates/TestParseNegative.vm
+++ b/ql/src/test/templates/TestParseNegative.vm
@@ -17,27 +17,23 @@
  */
 package org.apache.hadoop.hive.ql.parse;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import java.io.*;
 import java.util.*;
 
 import org.apache.hadoop.hive.ql.QTestUtil;
 import org.apache.hadoop.hive.ql.QTestUtil.MiniClusterType;
 import org.apache.hadoop.hive.ql.exec.Task;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
-public class $className extends TestCase {
+public class $className {
 
   private static final String HIVE_ROOT = QTestUtil.ensurePathEndsInSlash(System.getProperty("hive.root"));
   private static QTestUtil qt;
-
-  public static class TestParseNegativeAddTestFromQFiles implements QTestUtil.SuiteAddTestFunctor
{
-    public void addTestToSuite(TestSuite suite, Object setup, String tName) {
-      suite.addTest(new $className("testParseNegative_"+tName));
-    }
-  }
  
   static {
 
@@ -57,18 +53,11 @@ public class $className extends TestCase {
     }
   }
 
-  public $className(String name) {
-    super(name);
-  }
-
-  @Override
-  protected void tearDown() {
+  @After
+  public void tearDown() {
     try {
       qt.clearPostTestEffects();
-      if (getName().equals("testParseNegative_shutdown"))
-        qt.shutdown();
-    }
-    catch (Exception e) {
+    } catch (Exception e) {
       System.err.println("Exception: " + e.getMessage());
       e.printStackTrace();
       System.err.flush();
@@ -76,31 +65,16 @@ public class $className extends TestCase {
     }
   }
 
-  /**
-   * Dummy last test. This is only meant to shutdown qt
-   */
-  public void testParseNegative_shutdown() {
-    System.err.println ("Cleaning up " + "$className");
-  }
-
-  public static Test suite() {
-    Set<String> qFilesToExecute = new HashSet<String>();
-    String qFiles = System.getProperty("qfile", "").trim();
-    if(!qFiles.isEmpty()) {
-      for(String qFile : qFiles.split(",")) {
-        qFile = qFile.trim();
-        if(!qFile.isEmpty()) {
-          qFilesToExecute.add(qFile);
-        }
-      }
+  @AfterClass
+  public static void shutdown() throws Exception {
+    try {
+      qt.shutdown();
+    } catch (Exception e) {
+      System.err.println("Exception: " + e.getMessage());
+      e.printStackTrace();
+      System.err.flush();
+      fail("Unexpected exception in shutdown");
     }
-
-    TestSuite suite = new TestSuite();
-
-    QTestUtil.addTestsToSuiteFromQfileNames("$qFileNamesFile", qFilesToExecute,
-      suite, null, new TestParseNegativeAddTestFromQFiles());
-    suite.addTest(new $className("testParseNegative_shutdown"));
-    return suite;
   }
 
   static String debugHint = "\nSee ./ql/target/tmp/log/hive.log or ./itests/qtest/target/tmp/log/hive.log,
"
@@ -111,6 +85,7 @@ public class $className extends TestCase {
   #set ($eidx = $fname.indexOf('.'))
   #set ($tname = $fname.substring(0, $eidx))
   #set ($fpath = $qfilesMap.get($fname))
+  @Test
   public void testParseNegative_$tname() throws Exception {
     runTest("$tname", "$fname", (HIVE_ROOT + "$fpath"));
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/58adda5d/testutils/ptest2/src/main/resources/batch-exec.vm
----------------------------------------------------------------------
diff --git a/testutils/ptest2/src/main/resources/batch-exec.vm b/testutils/ptest2/src/main/resources/batch-exec.vm
index c155851..da3e0ac 100644
--- a/testutils/ptest2/src/main/resources/batch-exec.vm
+++ b/testutils/ptest2/src/main/resources/batch-exec.vm
@@ -62,8 +62,6 @@ then
     testModule=./
   fi
   pushd $testModule
-  #clean to force regeneration of class files (maven sometimes skips generation)
-  mvn clean -Dmaven.repo.local=$localDir/$instanceName/maven $mavenArgs
   timeout 2h mvn -B test -Dmaven.repo.local=$localDir/$instanceName/maven \
     $mavenArgs $mavenTestArgs $testArguments 1>$logDir/maven-test.txt 2>&1 </dev/null
&
 #[[


Mime
View raw message