sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject sqoop git commit: SQOOP-2159: Sqoop2: Use BeforeSuite/AfterSuite for startHadoop/stopHadoop in integration tests
Date Tue, 03 Mar 2015 02:20:29 GMT
Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 337266b9f -> 68595856f


SQOOP-2159: Sqoop2: Use BeforeSuite/AfterSuite for startHadoop/stopHadoop in integration tests

(Jarek Jarcec Cecho via Abraham Elmahrek)


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

Branch: refs/heads/sqoop2
Commit: 68595856f6f9e51cc176510aff55dbaf18e36163
Parents: 337266b
Author: Abraham Elmahrek <abe@apache.org>
Authored: Mon Mar 2 18:19:58 2015 -0800
Committer: Abraham Elmahrek <abe@apache.org>
Committed: Mon Mar 2 18:19:58 2015 -0800

----------------------------------------------------------------------
 .../apache/sqoop/test/testcases/ConnectorTestCase.java |  3 ++-
 .../apache/sqoop/test/testcases/TomcatTestCase.java    | 13 ++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/68595856/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java b/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
index 1c5eb10..3230ed5 100644
--- a/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
+++ b/test/src/main/java/org/apache/sqoop/test/testcases/ConnectorTestCase.java
@@ -44,6 +44,7 @@ import org.apache.sqoop.test.hadoop.HadoopRunnerFactory;
 import org.apache.sqoop.validation.Status;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeSuite;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -80,7 +81,7 @@ abstract public class ConnectorTestCase extends TomcatTestCase {
     }
   };
 
-  @BeforeClass(alwaysRun = true)
+  @BeforeSuite(alwaysRun = true)
   public static void startHadoop() throws Exception {
     // Start Hadoop Clusters
     hadoopCluster = HadoopRunnerFactory.getHadoopCluster(System.getProperties(), HadoopMiniClusterRunner.class);

http://git-wip-us.apache.org/repos/asf/sqoop/blob/68595856/test/src/main/java/org/apache/sqoop/test/testcases/TomcatTestCase.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/testcases/TomcatTestCase.java b/test/src/main/java/org/apache/sqoop/test/testcases/TomcatTestCase.java
index db88294..2ef971d 100644
--- a/test/src/main/java/org/apache/sqoop/test/testcases/TomcatTestCase.java
+++ b/test/src/main/java/org/apache/sqoop/test/testcases/TomcatTestCase.java
@@ -32,10 +32,13 @@ import org.apache.sqoop.test.hadoop.HadoopRunnerFactory;
 import org.apache.sqoop.test.hadoop.HadoopLocalRunner;
 import org.apache.sqoop.test.minicluster.TomcatSqoopMiniCluster;
 import org.apache.sqoop.test.utils.HdfsUtils;
+import org.testng.ITest;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeSuite;
 
 /**
  * Basic test case that will bootstrap Sqoop server running in external Tomcat
@@ -88,7 +91,7 @@ abstract public class TomcatTestCase {
    */
   private SqoopClient client;
 
-  @BeforeClass(alwaysRun = true)
+  @BeforeSuite(alwaysRun = true)
   public static void startHadoop() throws Exception {
     // Start Hadoop Clusters
     hadoopCluster = HadoopRunnerFactory.getHadoopCluster(System.getProperties(), HadoopLocalRunner.class);
@@ -103,7 +106,11 @@ abstract public class TomcatTestCase {
 
   @BeforeMethod(alwaysRun = true)
   public void findMethodName(Method method) {
-    name = method.getName();
+    if(this instanceof ITest) {
+      name = ((ITest)this).getTestName();
+    } else {
+      name = method.getName();
+    }
   }
 
   @BeforeMethod(alwaysRun = true)
@@ -127,7 +134,7 @@ abstract public class TomcatTestCase {
     cluster.stop();
   }
 
-  @AfterClass(alwaysRun = true)
+  @AfterSuite(alwaysRun = true)
   public static void stopHadoop() throws Exception {
     hadoopCluster.stop();
   }


Mime
View raw message