[ 
https://issues.apache.org/jira/browse/LENS-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jaideep Dhok updated LENS-191:
------------------------------
    Attachment: LENS-191.1.patch.txt

Creating a patch. It's a very small change, so not creating review request.

Here's the diff 
{noformat}
diff --git 
lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java 
lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java
index ce62b65..f86e5b9 100644
--- 
lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java
+++ 
lens-driver-jdbc/src/test/java/org/apache/lens/driver/jdbc/TestJdbcDriver.java
@@ -30,6 +30,8 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;

 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hive.service.cli.ColumnDescriptor;
 import org.apache.lens.api.LensException;
 import org.apache.lens.api.query.QueryHandle;
@@ -46,9 +48,7 @@ import 
org.apache.lens.server.api.driver.DriverQueryStatus.DriverQueryState;
 import org.apache.lens.server.api.query.PreparedQueryContext;
 import org.apache.lens.server.api.query.QueryContext;
 import org.testng.Assert;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
+import org.testng.annotations.*;

 import static org.testng.Assert.*;

@@ -103,6 +103,13 @@ public class TestJdbcDriver {
     driver.close();
   }

+  @BeforeMethod
+  public void beforeMethod() throws Exception {
+    if (SessionState.get() == null) {
+      SessionState.start(new HiveConf(baseConf, TestJdbcDriver.class));
+    }
+  }
+
   private QueryContext createQueryContext(final String query) throws 
LensException {
     QueryContext context = new QueryContext(query, "SA", baseConf, drivers);
     context.getDriverContext().setDriverQueriesAndPlans(new 
HashMap<LensDriver, String>() {
{noformat}

> TestJdbcDriver failing in isolation
> -----------------------------------
>
>                 Key: LENS-191
>                 URL: https://issues.apache.org/jira/browse/LENS-191
>             Project: Apache Lens
>          Issue Type: Bug
>          Components: driver-jdbc
>    Affects Versions: 2.0
>            Reporter: Jaideep Dhok
>         Attachments: LENS-191.1.patch.txt
>
>
> mvn test -Dtest=TestJdbcDriver fails with NPE in lot of test cases. Same test 
> passes when tests of whole JDBC module are run together.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to