You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2014/06/16 23:31:17 UTC
[08/32] git commit: DRILL-735: Refactor Hive storage testcases into a
separate test class
DRILL-735: Refactor Hive storage testcases into a separate test class
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/c3dfe379
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/c3dfe379
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/c3dfe379
Branch: refs/heads/master
Commit: c3dfe379e58a9dab5341cbd3a25267eed5ac9bc0
Parents: e31ef07
Author: vkorukanti <ve...@gmail.com>
Authored: Fri Jun 13 11:35:56 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Mon Jun 16 07:53:13 2014 -0700
----------------------------------------------------------------------
.../drill/jdbc/test/JdbcTestQueryBase.java | 12 -----
.../apache/drill/jdbc/test/TestHiveStorage.java | 49 ++++++++++++++++++++
.../apache/drill/jdbc/test/TestJdbcQuery.java | 24 ++--------
.../apache/drill/jdbc/test/TestMetadataDDL.java | 9 ++++
.../org/apache/drill/jdbc/test/TestViews.java | 16 +++++++
5 files changed, 78 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c3dfe379/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
index 259fa8c..33a25b7 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcTestQueryBase.java
@@ -48,18 +48,6 @@ public class JdbcTestQueryBase extends JdbcTest {
}
- @BeforeClass
- public static void generateHive() throws Exception{
- new HiveTestDataGenerator().generateTestData();
-
- // delete tmp workspace directory
- File f = new File("/tmp/drilltest");
- if(f.exists()){
- FileUtils.cleanDirectory(f);
- FileUtils.forceDelete(f);
- }
- }
-
protected void testQuery(String sql) throws Exception{
boolean success = false;
try (Connection c = DriverManager.getConnection("jdbc:drill:zk=local", null);) {
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c3dfe379/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveStorage.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveStorage.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveStorage.java
new file mode 100644
index 0000000..e4ef332
--- /dev/null
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestHiveStorage.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.jdbc.test;
+
+import org.apache.drill.exec.store.hive.HiveTestDataGenerator;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestHiveStorage extends JdbcTestQueryBase{
+
+ @BeforeClass
+ public static void generateHive() throws Exception{
+ new HiveTestDataGenerator().generateTestData();
+ }
+
+ @Test
+ public void testHiveReadWithDb() throws Exception{
+ testQuery("select * from hive.`default`.kv");
+ testQuery("select key from hive.`default`.kv group by key");
+ testQuery("select * from hive.`default`.allreadsupportedhivedatatypes");
+ }
+
+ @Test
+ public void testHiveWithDate() throws Exception {
+ testQuery("select * from hive.`default`.foodate");
+ testQuery("select date_add(a, time '12:23:33'), b from hive.`default`.foodate");
+ }
+
+ @Test
+ public void testQueryEmptyHiveTable() throws Exception {
+ testQuery("SELECT * FROM hive.`default`.empty_table");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c3dfe379/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
index 44cba3d..e48897f 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
@@ -17,8 +17,8 @@
*/
package org.apache.drill.jdbc.test;
-import static org.junit.Assert.assertEquals;
-
+import java.lang.Exception;
+import java.lang.RuntimeException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@@ -29,28 +29,12 @@ import org.junit.Test;
import com.google.common.base.Function;
+import static org.junit.Assert.assertEquals;
+
public class TestJdbcQuery extends JdbcTestQueryBase{
static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestJdbcQuery.class);
@Test
- public void testHiveReadWithDb() throws Exception{
- testQuery("select * from hive.`default`.kv");
- testQuery("select key from hive.`default`.kv group by key");
- testQuery("select * from hive.`default`.allreadsupportedhivedatatypes");
- }
-
- @Test
- public void testHiveWithDate() throws Exception {
- testQuery("select * from hive.`default`.foodate");
- testQuery("select date_add(a, time '12:23:33'), b from hive.`default`.foodate");
- }
-
- @Test
- public void testQueryEmptyHiveTable() throws Exception {
- testQuery("SELECT * FROM hive.`default`.empty_table");
- }
-
- @Test
@Ignore
public void testJsonQuery() throws Exception{
testQuery("select * from cp.`employee.json`");
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c3dfe379/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
index bb50e40..228bf84 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestMetadataDDL.java
@@ -18,8 +18,12 @@
package org.apache.drill.jdbc.test;
import com.google.common.base.Function;
+import org.apache.commons.io.FileUtils;
+import org.apache.drill.exec.store.hive.HiveTestDataGenerator;
+import org.junit.BeforeClass;
import org.junit.Test;
+import java.io.File;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@@ -35,6 +39,11 @@ import static org.junit.Assert.assertTrue;
*/
public class TestMetadataDDL extends JdbcTestQueryBase {
+ @BeforeClass
+ public static void generateHive() throws Exception{
+ new HiveTestDataGenerator().generateTestData();
+ }
+
@Test
public void testInfoSchema() throws Exception{
testQuery("select * from INFORMATION_SCHEMA.SCHEMATA");
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c3dfe379/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java
index 976c5fa..6f595af 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestViews.java
@@ -18,9 +18,13 @@
package org.apache.drill.jdbc.test;
import com.google.common.base.Function;
+import org.apache.commons.io.FileUtils;
+import org.apache.drill.exec.store.hive.HiveTestDataGenerator;
+import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
+import java.io.File;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
@@ -32,6 +36,18 @@ public class TestViews extends JdbcTestQueryBase {
private final static String NEW_LINE = System.getProperty("line.separator");
+ @BeforeClass
+ public static void generateHive() throws Exception{
+ new HiveTestDataGenerator().generateTestData();
+
+ // delete tmp workspace directory
+ File f = new File("/tmp/drilltest");
+ if(f.exists()){
+ FileUtils.cleanDirectory(f);
+ FileUtils.forceDelete(f);
+ }
+ }
+
/** Helper test method for view tests */
private void testViewHelper(final String viewCreate, final String viewName,
final String viewQuery, final String queryResult) throws Exception{