HIVE-14444 Upgrade qtest execution framework to junit4 - migrate most of them (Zoltan Haindrich via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1f7e10c0 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1f7e10c0 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1f7e10c0 Branch: refs/heads/master Commit: 1f7e10c031cb63b80d9de950004108d70cd57afc Parents: bfdc74f Author: Zoltan Haindrich <[email protected]> Authored: Fri Aug 12 17:12:03 2016 -0700 Committer: Ashutosh Chauhan <[email protected]> Committed: Fri Aug 12 17:12:03 2016 -0700 ---------------------------------------------------------------------- .../apache/hadoop/hive/ant/QTestGenTask.java | 585 ------------------- ant/src/org/apache/hadoop/hive/ant/antlib.xml | 2 - .../src/test/templates/TestHBaseCliDriver.vm | 144 ----- .../templates/TestHBaseNegativeCliDriver.vm | 119 ---- itests/qtest-accumulo/pom.xml | 5 +- itests/qtest-spark/pom.xml | 54 -- .../hive/cli/TestMiniSparkOnYarnCliDriver.java | 45 ++ .../hadoop/hive/cli/TestSparkCliDriver.java | 45 ++ .../hive/cli/TestSparkNegativeCliDriver.java | 45 ++ itests/qtest/pom.xml | 267 +-------- .../hive/cli/ContribNegativeCliDriver.java | 62 ++ .../hive/cli/DisabledTestBeeLineDriver.java | 62 ++ .../apache/hadoop/hive/cli/DummyCliDriver.java | 62 ++ .../apache/hadoop/hive/cli/TestCliDriver.java | 62 ++ .../hadoop/hive/cli/TestCompareCliDriver.java | 62 ++ .../hadoop/hive/cli/TestContribCliDriver.java | 62 ++ .../hive/cli/TestContribNegativeCliDriver.java | 62 ++ .../hive/cli/TestEncryptedHDFSCliDriver.java | 62 ++ .../hadoop/hive/cli/TestHBaseCliDriver.java | 62 ++ .../hive/cli/TestHBaseMinimrCliDriver.java | 62 ++ .../hive/cli/TestHBaseNegativeCliDriver.java | 62 ++ .../hadoop/hive/cli/TestMiniLlapCliDriver.java | 62 ++ .../hadoop/hive/cli/TestMiniTezCliDriver.java | 62 ++ .../hadoop/hive/cli/TestMinimrCliDriver.java | 62 ++ .../hadoop/hive/cli/TestNegativeCliDriver.java | 62 ++ .../hive/cli/TestNegativeMinimrCliDriver.java | 62 ++ .../hadoop/hive/cli/TestPerfCliDriver.java | 62 ++ .../hive/ql/parse/TestParseNegativeDriver.java | 62 ++ .../hive/cli/control/AbstractCliConfig.java | 417 +++++++++++++ .../hadoop/hive/cli/control/CliAdapter.java | 107 ++++ .../hadoop/hive/cli/control/CliConfigs.java | 503 ++++++++++++++++ .../hive/cli/control/CoreBeeLineDriver.java | 171 ++++++ .../hadoop/hive/cli/control/CoreCliDriver.java | 137 +++++ .../hive/cli/control/CoreCompareCliDriver.java | 158 +++++ .../hadoop/hive/cli/control/CoreDummy.java | 57 ++ .../hive/cli/control/CoreHBaseCliDriver.java | 137 +++++ .../cli/control/CoreHBaseNegativeCliDriver.java | 121 ++++ .../hive/cli/control/CoreNegativeCliDriver.java | 139 +++++ .../hive/cli/control/CorePerfCliDriver.java | 138 +++++ .../org/apache/hadoop/hive/ql/QTestUtil.java | 24 +- .../hadoop/hive/ql/parse/CoreParseNegative.java | 132 +++++ pom.xml | 5 + ql/src/test/templates/TestBeeLineDriver.vm | 160 ----- ql/src/test/templates/TestCliDriver.vm | 143 ----- ql/src/test/templates/TestCompareCliDriver.vm | 162 ----- ql/src/test/templates/TestNegativeCliDriver.vm | 147 ----- ql/src/test/templates/TestParseNegative.vm | 127 ---- ql/src/test/templates/TestPerfCliDriver.vm | 177 ------ 48 files changed, 3492 insertions(+), 2097 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java ---------------------------------------------------------------------- diff --git a/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java b/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java deleted file mode 100644 index f372d7c..0000000 --- a/ant/src/org/apache/hadoop/hive/ant/QTestGenTask.java +++ /dev/null @@ -1,585 +0,0 @@ -/** - * 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.hadoop.hive.ant; - - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileFilter; -import java.io.FileWriter; -import java.io.IOException; -import java.util.HashSet; -import java.util.Set; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.ArrayList; -import java.util.regex.Pattern; -import java.util.HashMap; - -import com.google.common.base.Splitter; -import com.google.common.collect.Sets; - -import org.apache.commons.lang.StringUtils; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; -import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.exception.MethodInvocationException; -import org.apache.velocity.exception.ParseErrorException; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.runtime.RuntimeConstants; - -public class QTestGenTask extends Task { - private static final Splitter TEST_SPLITTER = Splitter.onPattern("[, ]") - .trimResults() - .omitEmptyStrings(); - - public class IncludeFilter implements FileFilter { - - Set<String> includeOnly; - public IncludeFilter(Set<String> includeOnly) { - this.includeOnly = includeOnly; - } - - public boolean accept(File fpath) { - return includeOnly == null || includeOnly.contains(fpath.getName()); - } - } - - public class QFileFilter extends IncludeFilter { - - public QFileFilter(Set<String> includeOnly) { - super(includeOnly); - } - - public boolean accept(File fpath) { - if (!super.accept(fpath)) { - return false; - } - if (fpath.isDirectory() || - !fpath.getName().endsWith(".q")) { - return false; - } - return true; - } - } - - public class DisabledQFileFilter extends IncludeFilter { - public DisabledQFileFilter(Set<String> includeOnly) { - super(includeOnly); - } - - public boolean accept(File fpath) { - if (!super.accept(fpath)) { - return false; - } - return !fpath.isDirectory() && fpath.getName().endsWith(".q.disabled"); - } - } - - public class QFileRegexFilter implements FileFilter { - Pattern filterPattern; - public QFileRegexFilter(String filter) { - filterPattern = Pattern.compile(filter); - } - - public boolean accept(File filePath) { - if (filePath.isDirectory() || - !filePath.getName().endsWith(".q")) { - return false; - } - String testName = StringUtils.chomp(filePath.getName(), ".q"); - return filterPattern.matcher(testName).matches(); - } - } - - private List<String> templatePaths = new ArrayList<String>(); - - private String hiveRootDirectory; - - private String outputDirectory; - - private String queryDirectory; - - private String queryFile; - - private String includeQueryFile; - - private String excludeQueryFile; - - private String queryFileRegex; - - private String resultsDirectory; - - private String logDirectory; - - private String tezDirectory; - - private String template; - - private String className; - - private String logFile; - - private String clusterMode; - - private String hiveConfDir; - - private String runDisabled; - - private String hadoopVersion; - - private String initScript; - - private String cleanupScript; - - private String useHBaseMetastore; - - public void setHadoopVersion(String ver) { - this.hadoopVersion = ver; - } - - public String getHadoopVersion() { - return hadoopVersion; - } - - public void setHiveConfDir(String hiveConfDir) { - this.hiveConfDir = hiveConfDir; - } - - public String getHiveConfDir() { - return hiveConfDir; - } - - public void setClusterMode(String clusterMode) { - this.clusterMode = clusterMode; - } - - public String getClusterMode() { - return clusterMode; - } - - public void setRunDisabled(String runDisabled) { - this.runDisabled = runDisabled; - } - - public String getRunDisabled() { - return runDisabled; - } - - public void setLogFile(String logFile) { - this.logFile = logFile; - } - - public String getLogFile() { - return logFile; - } - - public void setClassName(String className) { - this.className = className; - } - - public String getClassName() { - return className; - } - - public void setTemplate(String template) { - this.template = template; - } - - public String getTemplate() { - return template; - } - - public String getInitScript() { - return initScript; - } - - public void setInitScript(String initScript) { - this.initScript = initScript; - } - - public String getCleanupScript() { - return cleanupScript; - } - - public void setCleanupScript(String cleanupScript) { - this.cleanupScript = cleanupScript; - } - - public String getUseHBaseMetastore() { - return useHBaseMetastore; - } - - public void setUseHBaseMetastore(String useHBaseMetastore) { - this.useHBaseMetastore = useHBaseMetastore; - } - - public void setHiveRootDirectory(File hiveRootDirectory) { - try { - this.hiveRootDirectory = hiveRootDirectory.getCanonicalPath(); - } catch (IOException ioe) { - throw new BuildException(ioe); - } - } - - public String getHiveRootDirectory() { - return hiveRootDirectory; - } - - public void setTemplatePath(String templatePath) throws Exception { - templatePaths.clear(); - for (String relativePath : TEST_SPLITTER.split(templatePath)) { - templatePaths.add(project.resolveFile(relativePath).getCanonicalPath()); - } - System.out.println("Template Path:" + getTemplatePath()); - } - - public String getTemplatePath() { - return StringUtils.join(templatePaths, ","); - } - - public void setOutputDirectory(File outputDirectory) { - try { - this.outputDirectory = outputDirectory.getCanonicalPath(); - } catch (IOException ioe) { - throw new BuildException(ioe); - } - } - - public String getOutputDirectory() { - return outputDirectory; - } - - public void setLogDirectory(String logDirectory) { - this.logDirectory = logDirectory; - } - - public String getLogDirectory() { - return logDirectory; - } - - public void setResultsDirectory(String resultsDirectory) { - this.resultsDirectory = resultsDirectory; - } - - public String getResultsDirectory() { - return resultsDirectory; - } - - public void setQueryDirectory(String queryDirectory) { - this.queryDirectory = queryDirectory; - } - - public String getQueryDirectory() { - return queryDirectory; - } - - public void setQueryFile(String queryFile) { - this.queryFile = queryFile; - } - - public String getQueryFile() { - return queryFile; - } - - public String getIncludeQueryFile() { - return includeQueryFile; - } - - public void setIncludeQueryFile(String includeQueryFile) { - this.includeQueryFile = includeQueryFile; - } - - public void setExcludeQueryFile(String excludeQueryFile) { - this.excludeQueryFile = excludeQueryFile; - } - - public String getExcludeQueryFile() { - return excludeQueryFile; - } - - public void setQueryFileRegex(String queryFileRegex) { - this.queryFileRegex = queryFileRegex; - } - - public String getQueryFileRegex() { - return queryFileRegex; - } - - private String createAlternativeFile(File file) throws Exception { - String fileParentDir = file.getParent(); - String fileName = file.getName(); - int dotIndex = fileName.lastIndexOf('.'); - String fileNameWithoutExtension = dotIndex == -1 ? fileName : fileName.substring(0, dotIndex); - String fileNameExtension = dotIndex == -1 ? "" : fileName.substring(dotIndex); - - // If prefix length is < 3, File.createTempFile() will throw an IllegalArgumentException. - // We need to avoid this case. - if (fileNameWithoutExtension.length() < 3) { - fileNameWithoutExtension = fileNameWithoutExtension + "_tmp"; - } - File alternativeFile = File.createTempFile(fileNameWithoutExtension, fileNameExtension, - new File(fileParentDir)); - return alternativeFile.getCanonicalPath(); - } - - public void execute() throws BuildException { - if (getTemplatePath().equals("")) { - throw new BuildException("No templatePath attribute specified"); - } - - if (template == null) { - throw new BuildException("No template attribute specified"); - } - - if (outputDirectory == null) { - throw new BuildException("No outputDirectory specified"); - } - - if (queryDirectory == null && queryFile == null ) { - throw new BuildException("No queryDirectory or queryFile specified"); - } - - if (logDirectory == null) { - throw new BuildException("No logDirectory specified"); - } - - if (className == null) { - throw new BuildException("No className specified"); - } - - Set<String> includeOnly = null; - if (includeQueryFile != null && !includeQueryFile.isEmpty()) { - includeOnly = Sets.<String>newHashSet(TEST_SPLITTER.split(includeQueryFile)); - } - - List<File> qFiles; - HashMap<String, String> qFilesMap = new HashMap<String, String>(); - File hiveRootDir = null; - File queryDir = null; - File outDir = null; - File resultsDir = null; - File logDir = null; - - try { - - System.out.println("Starting Generation of: " + className); - System.out.println("Include Files: " + includeQueryFile); - System.out.println("Excluded Files: " + excludeQueryFile); - System.out.println("Query Files: " + queryFile); - System.out.println("Query Files Regex: " + queryFileRegex); - - // queryDirectory should not be null - queryDir = new File(queryDirectory); - - // dedup file list - Set<File> testFiles = new HashSet<File>(); - if (queryFile != null && !queryFile.equals("")) { - // The user may have passed a list of files - comma separated - for (String qFile : TEST_SPLITTER.split(queryFile)) { - if (null != queryDir) { - testFiles.add(new File(queryDir, qFile)); - } else { - testFiles.add(new File(qFile)); - } - } - } else if (queryFileRegex != null && !queryFileRegex.equals("")) { - for (String regex : TEST_SPLITTER.split(queryFileRegex)) { - testFiles.addAll(Arrays.asList(queryDir.listFiles( - new QFileRegexFilter(regex)))); - } - } else if (runDisabled != null && runDisabled.equals("true")) { - testFiles.addAll(Arrays.asList(queryDir.listFiles(new DisabledQFileFilter(includeOnly)))); - } else { - testFiles.addAll(Arrays.asList(queryDir.listFiles(new QFileFilter(includeOnly)))); - } - - if (excludeQueryFile != null && !excludeQueryFile.equals("")) { - // Exclude specified query files, comma separated - for (String qFile : TEST_SPLITTER.split(excludeQueryFile)) { - if (null != queryDir) { - testFiles.remove(new File(queryDir, qFile)); - } else { - testFiles.remove(new File(qFile)); - } - } - } - - hiveRootDir = new File(hiveRootDirectory); - if (!hiveRootDir.exists()) { - throw new BuildException("Hive Root Directory " - + hiveRootDir.getCanonicalPath() + " does not exist"); - } - - qFiles = new ArrayList<File>(testFiles); - Collections.sort(qFiles); - for (File qFile : qFiles) { - qFilesMap.put(qFile.getName(), relativePath(hiveRootDir, qFile)); - } - - // Make sure the output directory exists, if it doesn't then create it. - outDir = new File(outputDirectory); - if (!outDir.exists()) { - outDir.mkdirs(); - } - - logDir = new File(logDirectory); - if (!logDir.exists()) { - throw new BuildException("Log Directory " + logDir.getCanonicalPath() + " does not exist"); - } - - if (resultsDirectory != null) { - resultsDir = new File(resultsDirectory); - if (!resultsDir.exists()) { - throw new BuildException("Results Directory " - + resultsDir.getCanonicalPath() + " does not exist"); - } - } - } catch (Exception e) { - e.printStackTrace(); - throw new BuildException(e); - } - - VelocityEngine ve = new VelocityEngine(); - - try { - ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, getTemplatePath()); - if (logFile != null) { - File lf = new File(logFile); - if (lf.exists()) { - System.out.println("Log file already exists: " + lf.getCanonicalPath()); - if (!lf.delete()) { - System.out.println("Could not delete log file " + lf.getCanonicalPath()); - logFile = createAlternativeFile(lf); - } - } - - ve.setProperty(RuntimeConstants.RUNTIME_LOG, logFile); - } - - ve.init(); - Template t = ve.getTemplate(template); - - if (clusterMode == null) { - clusterMode = ""; - } - if (hadoopVersion == null) { - hadoopVersion = ""; - } - - File qFileNames = new File(outputDirectory, className + "QFileNames.txt"); - String qFileNamesFile = qFileNames.toURI().getPath(); - - if (qFileNames.exists()) { - System.out.println("Query file names containing file already exists: " + qFileNamesFile); - if (!qFileNames.delete()) { - System.out.println("Could not delete query file names containing file " + - qFileNames.getCanonicalPath()); - qFileNamesFile = createAlternativeFile(qFileNames); - } else if (!qFileNames.createNewFile()) { - System.out.println("Could not create query file names containing file " + - qFileNamesFile); - qFileNamesFile = createAlternativeFile(qFileNames); - } - } - FileWriter fw = new FileWriter(qFileNames.getCanonicalFile()); - BufferedWriter bw = new BufferedWriter(fw); - - for (File qFile: qFiles) { - bw.write(qFile.getName()); - bw.newLine(); - } - bw.close(); - - // For each of the qFiles generate the test - System.out.println("hiveRootDir = " + hiveRootDir); - VelocityContext ctx = new VelocityContext(); - ctx.put("className", className); - ctx.put("hiveRootDir", escapePath(hiveRootDir.getCanonicalPath())); - System.out.println("hiveRootDir = " + hiveRootDir); - System.out.println("queryDir = " + queryDir); - String strQueryDir = relativePath(hiveRootDir, queryDir); - System.out.println("queryDir = " + strQueryDir); - ctx.put("queryDir", strQueryDir); - ctx.put("qfiles", qFiles); - ctx.put("qFileNamesFile", qFileNamesFile); - ctx.put("qfilesMap", qFilesMap); - if (resultsDir != null) { - ctx.put("resultsDir", relativePath(hiveRootDir, resultsDir)); - } - ctx.put("logDir", relativePath(hiveRootDir, logDir)); - ctx.put("clusterMode", clusterMode); - if (hiveConfDir == null || hiveConfDir.isEmpty()) { - ctx.put("hiveConfDir", ""); - } else { - System.out.println("hiveConfDir = " + hiveConfDir); - hiveConfDir = relativePath(hiveRootDir, new File(hiveConfDir)); - System.out.println("hiveConfDir = " + hiveConfDir); - if (!(new File(hiveRootDir, hiveConfDir)).isDirectory()) { - throw new BuildException("hiveConfDir is not dir " + new File(hiveRootDir, hiveConfDir)); - } - ctx.put("hiveConfDir", hiveConfDir); - } - ctx.put("hadoopVersion", hadoopVersion); - ctx.put("initScript", initScript); - ctx.put("cleanupScript", cleanupScript); - ctx.put("useHBaseMetastore", useHBaseMetastore); - - File outFile = new File(outDir, className + ".java"); - FileWriter writer = new FileWriter(outFile); - t.merge(ctx, writer); - writer.close(); - - System.out.println("Generated " + outFile.getCanonicalPath() + " from template " + template); - } catch(BuildException e) { - throw e; - } catch(MethodInvocationException e) { - throw new BuildException("Exception thrown by '" + e.getReferenceName() + "." + - e.getMethodName() +"'", - e.getWrappedThrowable()); - } catch(ParseErrorException e) { - throw new BuildException("Velocity syntax error", e); - } catch(ResourceNotFoundException e) { - throw new BuildException("Resource not found", e); - } catch(Exception e) { - e.printStackTrace(); - throw new BuildException("Generation failed", e); - } - } - - private String relativePath(File hiveRootDir, File file) { - return escapePath(hiveRootDir.toURI().relativize(file.toURI()).getPath()); - } - - private static String escapePath(String path) { - if (System.getProperty("os.name").toLowerCase().startsWith("win")) { - // Escape the backward slash in CanonicalPath if the unit test runs on windows - // e.g. dir.getCanonicalPath() gets the absolute path of local - // directory. When we embed it directly in the generated java class it results - // in compiler error in windows. Reason : the canonical path contains backward - // slashes "C:\temp\etc\" and it is not a valid string in Java - // unless we escape the backward slashes. - return path.replace("\\", "\\\\"); - } - return path; - } -} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/ant/src/org/apache/hadoop/hive/ant/antlib.xml ---------------------------------------------------------------------- diff --git a/ant/src/org/apache/hadoop/hive/ant/antlib.xml b/ant/src/org/apache/hadoop/hive/ant/antlib.xml index 8f66348..1e42f0c 100644 --- a/ant/src/org/apache/hadoop/hive/ant/antlib.xml +++ b/ant/src/org/apache/hadoop/hive/ant/antlib.xml @@ -19,8 +19,6 @@ <antlib> - <taskdef name="qtestgen" - classname="org.apache.hadoop.hive.ant.QTestGenTask" /> <taskdef name="getversionpref" classname="org.apache.hadoop.hive.ant.GetVersionPref" /> </antlib> http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/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 deleted file mode 100644 index f513f03..0000000 --- a/hbase-handler/src/test/templates/TestHBaseCliDriver.vm +++ /dev/null @@ -1,144 +0,0 @@ -/** - * 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.hadoop.hive.cli; - -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.BeforeClass; -import org.junit.Before; -import org.junit.Test; - -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 static HBaseQTestUtil qt; - private static HBaseTestSetup setup = new HBaseTestSetup(); - - @BeforeClass - public static void systemSetUp() { - MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode"); - String initScript = "$initScript"; - String cleanupScript = "$cleanupScript"; - - try { - qt = new HBaseQTestUtil((HIVE_ROOT + "$resultsDir"), (HIVE_ROOT + "$logDir"), miniMR, - setup, initScript, cleanupScript); - qt.cleanUp(null); - qt.createSources(null); - - } catch (Exception e) { - System.err.println("Exception: " + e.getMessage()); - e.printStackTrace(); - System.err.flush(); - fail("Unexpected exception in static initialization: "+e.getMessage()); - } - - } - - @Before - public void setUp() { - try { - qt.clearTestSideEffects(); - } catch (Exception e) { - System.err.println("Exception: " + e.getMessage()); - e.printStackTrace(); - System.err.flush(); - fail("Unexpected exception in setup"); - } - } - @After - public void tearDown() { - try { - qt.clearPostTestEffects(); - } catch (Exception e) { - System.err.println("Exception: " + e.getMessage()); - e.printStackTrace(); - System.err.flush(); - fail("Unexpected exception in tearDown"); - } - } - - @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"); - } - } - - @AfterClass - public static void closeHBaseConnections() throws Exception { - setup.tearDown(); - } - -#foreach ($qf in $qfiles) - #set ($fname = $qf.getName()) - #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")); - } - -#end - - private void runTest(String tname, String fname, String fpath) throws Exception { - long startTime = System.currentTimeMillis(); - try { - System.err.println("Begin query: " + fname); - - qt.addFile(fpath); - - if (qt.shouldBeSkipped(fname)) { - System.err.println("Test " + fname + " skipped"); - return; - } - - qt.cliInit(fname, false); - - int ecode = qt.executeClient(fname); - if (ecode != 0) { - qt.failed(ecode, fname, null); - } - - ecode = qt.checkCliDriverResults(fname); - if (ecode != 0) { - qt.failedDiff(ecode, fname, null); - } - - } catch (Throwable e) { - qt.failed(e, fname, null); - } - - long elapsedTime = System.currentTimeMillis() - startTime; - System.err.println("Done query: " + fname + " elapsedTime=" + elapsedTime/1000 + "s"); - assertTrue("Test passed", true); - } -} - http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/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 deleted file mode 100644 index 043bd87..0000000 --- a/hbase-handler/src/test/templates/TestHBaseNegativeCliDriver.vm +++ /dev/null @@ -1,119 +0,0 @@ -/** - * 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.hadoop.hive.cli; - -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; - -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 static HBaseTestSetup setup = new HBaseTestSetup(); - - @Before - public void setUp() { - - MiniClusterType miniMR = MiniClusterType.valueForString("$clusterMode"); - String initScript = "$initScript"; - String cleanupScript = "$cleanupScript"; - - try { - qt = new HBaseQTestUtil((HIVE_ROOT + "$resultsDir"), (HIVE_ROOT + "$logDir"), miniMR, - setup, initScript, cleanupScript); - } catch (Exception e) { - System.err.println("Exception: " + e.getMessage()); - e.printStackTrace(); - System.err.flush(); - fail("Unexpected exception in setup"); - } - } - - @After - public void tearDown() { - try { - qt.shutdown(); - } catch (Exception e) { - System.err.println("Exception: " + e.getMessage()); - e.printStackTrace(); - System.err.flush(); - fail("Unexpected exception in tearDown"); - } - } - - @AfterClass - public static void closeHBaseConnections() throws Exception { - setup.tearDown(); - } - -#foreach ($qf in $qfiles) - #set ($fname = $qf.getName()) - #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")); - } - -#end - - private void runTest(String tname, String fname, String fpath) throws Exception { - long startTime = System.currentTimeMillis(); - try { - System.err.println("Begin query: " + fname); - - qt.addFile(fpath); - - if (qt.shouldBeSkipped(fname)) { - System.err.println("Test " + fname + " skipped"); - return; - } - - qt.cliInit(fname); - qt.clearTestSideEffects(); - int ecode = qt.executeClient(fname); - if (ecode == 0) { - qt.failed(fname, null); - } - - ecode = qt.checkCliDriverResults(fname); - if (ecode != 0) { - qt.failedDiff(ecode, fname, null); - } - qt.clearPostTestEffects(); - - } catch (Throwable e) { - qt.failed(e, fname, null); - } - - long elapsedTime = System.currentTimeMillis() - startTime; - System.err.println("Done query: " + fname + " elapsedTime=" + elapsedTime/1000 + "s"); - assertTrue("Test passed", true); - } -} - http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest-accumulo/pom.xml ---------------------------------------------------------------------- diff --git a/itests/qtest-accumulo/pom.xml b/itests/qtest-accumulo/pom.xml index 339c599..a4a5c75 100644 --- a/itests/qtest-accumulo/pom.xml +++ b/itests/qtest-accumulo/pom.xml @@ -431,15 +431,13 @@ <echo message="${test.classpath}"/> <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> - <taskdef name="qtestgen" classname="org.apache.hadoop.hive.ant.QTestGenTask" - classpath="${test.classpath}" /> <!-- Accumulo Positive --> <if> <equals arg1="${skip.accumulo.tests}" arg2="false" /> <then> <mkdir dir="${project.build.directory}/qfile-results/accumulo-handler/positive/" /> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" +<!-- HIVE-14444 <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" templatePath="${basedir}/${hive.path.to.root}/accumulo-handler/src/test/templates/" template="TestAccumuloCliDriver.vm" queryDirectory="${basedir}/${hive.path.to.root}/accumulo-handler/src/test/queries/positive/" @@ -451,6 +449,7 @@ logDirectory="${project.build.directory}/qfile-results/accumulo-handler/positive/" initScript="q_test_init.sql" cleanupScript="q_test_cleanup.sql"/> +--> </then> </if> </target> http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest-spark/pom.xml ---------------------------------------------------------------------- diff --git a/itests/qtest-spark/pom.xml b/itests/qtest-spark/pom.xml index 3bc9e24..1e6c3a2 100644 --- a/itests/qtest-spark/pom.xml +++ b/itests/qtest-spark/pom.xml @@ -374,65 +374,11 @@ <echo message="${test.classpath}"/> <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> - <taskdef name="qtestgen" classname="org.apache.hadoop.hive.ant.QTestGenTask" - classpath="${test.classpath}" /> <mkdir dir="${project.build.directory}/qfile-results/clientpositive/spark" /> <mkdir dir="${project.build.directory}/qfile-results/clientpositive/miniSparkOnYarn" /> <mkdir dir="${project.build.directory}/qfile-results/clientnegative/spark" /> <mkdir dir="${project.build.directory}/qfile-results/clientnegative/miniSparkOnYarn" /> - <!-- Cli with Spark standalone mode --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - queryFileRegex="${qfile_regex}" - clusterMode="spark" - includeQueryFile="${spark.query.files}" - runDisabled="${run_disabled}" - hiveConfDir="${basedir}/${hive.path.to.root}/data/conf/spark/standalone" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/spark" - className="TestSparkCliDriver" - logFile="${project.build.directory}/testsparkclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive/spark" - initScript="q_test_init.sql" - cleanupScript="q_test_cleanup.sql"/> - - <!-- Cli with Spark on YARN --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - queryFileRegex="${qfile_regex}" - clusterMode="miniSparkOnYarn" - includeQueryFile="${miniSparkOnYarn.query.files}" - runDisabled="${run_disabled}" - hiveConfDir="${basedir}/${hive.path.to.root}/data/conf/spark/yarn-client" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/spark" - className="TestMiniSparkOnYarnCliDriver" - logFile="${project.build.directory}/testminisparkonyarnclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive/spark" - initScript="q_test_init.sql" - cleanupScript="q_test_cleanup.sql"/> - - <!-- Negative Cli with Spark standalone mode --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestNegativeCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientnegative/" - queryFile="${qfile}" - queryFileRegex="${qfile_regex}" - clusterMode="spark" - includeQueryFile="${spark.query.negative.files}" - runDisabled="${run_disabled}" - hiveConfDir="${basedir}/${hive.path.to.root}/data/conf/spark/standalone" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientnegative/spark" className="TestSparkNegativeCliDriver" - logFile="${project.build.directory}/testsparknegativeclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientnegative/spark" - initScript="q_test_init.sql" - cleanupScript="q_test_cleanup.sql"/> </target> </configuration> http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestMiniSparkOnYarnCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestMiniSparkOnYarnCliDriver.java b/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestMiniSparkOnYarnCliDriver.java new file mode 100644 index 0000000..e84bfce --- /dev/null +++ b/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestMiniSparkOnYarnCliDriver.java @@ -0,0 +1,45 @@ +package org.apache.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestMiniSparkOnYarnCliDriver { + + static CliAdapter adapter = new CliConfigs.SparkOnYarnCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestMiniSparkOnYarnCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkCliDriver.java b/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkCliDriver.java new file mode 100644 index 0000000..2c8cbee --- /dev/null +++ b/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkCliDriver.java @@ -0,0 +1,45 @@ +package org.apache.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestSparkCliDriver { + + static CliAdapter adapter = new CliConfigs.SparkCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestSparkCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkNegativeCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkNegativeCliDriver.java b/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkNegativeCliDriver.java new file mode 100644 index 0000000..2db83f4 --- /dev/null +++ b/itests/qtest-spark/src/test/java/org/apache/hadoop/hive/cli/TestSparkNegativeCliDriver.java @@ -0,0 +1,45 @@ +package org.apache.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestSparkNegativeCliDriver { + + static CliAdapter adapter = new CliConfigs.SparkNegativeCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestSparkNegativeCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/pom.xml ---------------------------------------------------------------------- diff --git a/itests/qtest/pom.xml b/itests/qtest/pom.xml index 17968e6..ed44bb8 100644 --- a/itests/qtest/pom.xml +++ b/itests/qtest/pom.xml @@ -30,7 +30,7 @@ <properties> <hive.path.to.root>../..</hive.path.to.root> - <initScript>q_test_init.sql</initScript> +<!-- <initScript></initScript>--> <qfile></qfile> <qfile_regex></qfile_regex> <run_disabled>false</run_disabled> @@ -393,8 +393,6 @@ <echo message="${test.classpath}"/> <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> - <taskdef name="qtestgen" classname="org.apache.hadoop.hive.ant.QTestGenTask" - classpath="${test.classpath}" /> <mkdir dir="${project.build.directory}/qfile-results/clientpositive/" /> <mkdir dir="${project.build.directory}/qfile-results/clientpositive/perf" /> <mkdir dir="${project.build.directory}/qfile-results/clientnegative/" /> @@ -410,271 +408,8 @@ <mkdir dir="${project.build.directory}/qfile-results/contribclientpositive"/> <mkdir dir="${project.build.directory}/qfile-results/contribclientnegative"/> - <!-- Negative Parse --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/ql/parse/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestParseNegative.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/negative/" - queryFile="${qfile}" - queryFileRegex="${qfile_regex}" - runDisabled="${run_disabled}" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/compiler/errors/" className="TestParseNegative" - logFile="${project.build.directory}/testparseneggen.log" - hadoopVersion="${hadoop.version}" - logDirectory="${project.build.directory}/qfile-results/negative/" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - <!-- Cli --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - excludeQueryFile="${minillap.query.files},${minimr.query.files},${minitez.query.files},${encrypted.query.files},${spark.only.query.files},${disabled.query.files}" - queryFileRegex="${qfile_regex}" - clusterMode="${clustermode}" - runDisabled="${run_disabled}" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/" className="TestCliDriver" - logFile="${project.build.directory}/testclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive/" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - <!-- PerfCli --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestPerfCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/perf" - queryFile="${qfile}" - excludeQueryFile="${minimr.query.files},${minitez.query.files},${encrypted.query.files}" - queryFileRegex="${qfile_regex}" - clusterMode="tez" - runDisabled="${run_disabled}" - hiveConfDir="${basedir}/${hive.path.to.root}/data/conf/perf-reg" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/perf" className="TestPerfCliDriver" - logFile="${project.build.directory}/testperfclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive" - hadoopVersion="${hadoop.version}" - initScript="q_perf_test_init.sql" - cleanupScript="q_perf_test_cleanup.sql" - useHBaseMetastore="false"/> - - <!-- Negative Cli --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestNegativeCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientnegative/" - queryFile="${qfile}" - excludeQueryFile="${minimr.query.negative.files},authorization_uri_import.q" - queryFileRegex="${qfile_regex}" - clusterMode="${clustermode}" - runDisabled="${run_disabled}" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientnegative/" className="TestNegativeCliDriver" - logFile="${project.build.directory}/testnegativeclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientnegative/" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <!-- Compare Cli --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCompareCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientcompare/" - queryFile="${qfile}" - queryFileRegex="${qfile_regex}" - clusterMode="${clustermode}" - runDisabled="${run_disabled}" - className="TestCompareCliDriver" - logFile="${project.build.directory}/testcompareclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientcompare/" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <!-- Minimr --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - includeQueryFile="${minimr.query.files}" - queryFileRegex="${qfile_regex}" - clusterMode="miniMR" - runDisabled="${run_disabled}" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/" className="TestMinimrCliDriver" - logFile="${project.build.directory}/testminimrclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive/" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - includeQueryFile="${minitez.query.files},${minitez.query.files.shared}" - queryFileRegex="${qfile_regex}" - clusterMode="tez" - runDisabled="${run_disabled}" - hiveConfDir="${basedir}/${hive.path.to.root}/data/conf/tez" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/tez" - className="TestMiniTezCliDriver" - logFile="${project.build.directory}/testminitezclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive/" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql" - useHBaseMetastore="true"/> - - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - includeQueryFile="${minillap.query.files},${minillap.shared.query.files}" - queryFileRegex="${qfile_regex}" - clusterMode="llap" - runDisabled="${run_disabled}" - hiveConfDir="${basedir}/${hive.path.to.root}/data/conf/llap" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/llap" - className="TestMiniLlapCliDriver" - logFile="${project.build.directory}/testminitezclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive/" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - includeQueryFile="${encrypted.query.files}" - queryFileRegex="${qfile_regex}" - clusterMode="encrypted" - runDisabled="${run_disabled}" - hiveConfDir="${basedir}/${hive.path.to.root}/data/conf" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/encrypted" - className="TestEncryptedHDFSCliDriver" - logFile="${project.build.directory}/testencryptedhdfsclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientpositive/" - hadoopVersion="${hadoop.version}" - initScript="q_test_init_for_encryption.sql" - cleanupScript="q_test_cleanup_for_encryption.sql"/> - - - <!-- Negative Minimr --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestNegativeCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientnegative/" - queryFile="${qfile}" - includeQueryFile="${minimr.query.negative.files}" - queryFileRegex="${qfile_regex}" - clusterMode="miniMR" - runDisabled="${run_disabled}" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientnegative/" className="TestNegativeMinimrCliDriver" - logFile="${project.build.directory}/testnegativeminimrclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/clientnegative/" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <!-- HBase Positive --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/hbase-handler/src/test/templates/" template="TestHBaseCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/hbase-handler/src/test/queries/positive/" - queryFile="${qfile}" - runDisabled="${run_disabled}" - clusterMode="${clustermode}" - resultsDirectory="${basedir}/${hive.path.to.root}/hbase-handler/src/test/results/positive/" className="TestHBaseCliDriver" - logFile="${project.build.directory}/testhbaseclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/hbase-handler/positive/" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <!-- HBase Minimr --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/hbase-handler/src/test/templates/" template="TestHBaseCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/hbase-handler/src/test/queries/positive/" - queryFile="hbase_bulk.m" - runDisabled="${run_disabled}" - clusterMode="miniMR" - resultsDirectory="${basedir}/${hive.path.to.root}/hbase-handler/src/test/results/positive/" className="TestHBaseMinimrCliDriver" - logFile="${project.build.directory}/testhbaseminimrclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/hbase-handler/minimrpositive/" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <!-- HBase Negative --> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli/" - templatePath="${basedir}/${hive.path.to.root}/hbase-handler/src/test/templates/" template="TestHBaseNegativeCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/hbase-handler/src/test/queries/negative/" - queryFile="${qfile}" - runDisabled="${run_disabled}" - clusterMode="${clustermode}" - resultsDirectory="${basedir}/${hive.path.to.root}/hbase-handler/src/test/results/negative/" className="TestHBaseNegativeCliDriver" - logFile="${project.build.directory}/testhbasenegativeclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/hbase-handler/negative" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <!-- Beeline --> - <if> - <equals arg1="${execute.beeline.tests}" arg2="true" /> - <then> - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hive/beeline/util/" - templatePath="${ql.test.template.dir}" template="TestBeeLineDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/ql/src/test/queries/clientpositive/" - queryFile="${qfile}" - excludeQueryFile="${beeline.positive.exclude}" - queryFileRegex="${qfile_regex}" - clusterMode="${clustermode}" - runDisabled="${run_disabled}" - resultsDirectory="${basedir}/${hive.path.to.root}/ql/src/test/results/clientpositive/" className="TestBeeLineDriver" - logFile="${project.build.directory}/testbeelinedrivergen.log" - logDirectory="${project.build.directory}/qfile-results/beelinepositive/" - hadoopVersion="${hadoop.version}"/> - </then> - </if> - - - - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/contrib/src/test/queries/clientpositive" - queryFile="${qfile}" - queryFileRegex="${qfile_regex}" - runDisabled="${run_disabled}" - clusterMode="${clustermode}" - resultsDirectory="${basedir}/${hive.path.to.root}/contrib/src/test/results/clientpositive/" className="TestContribCliDriver" - logFile="${project.build.directory}/testcontribclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/contribclientpositive" - hadoopVersion="${hadoop.version}" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> - - <qtestgen hiveRootDirectory="${basedir}/${hive.path.to.root}/" - outputDirectory="${project.build.directory}/generated-test-sources/java/org/apache/hadoop/hive/cli" - templatePath="${basedir}/${hive.path.to.root}/ql/src/test/templates/" template="TestNegativeCliDriver.vm" - queryDirectory="${basedir}/${hive.path.to.root}/contrib/src/test/queries/clientnegative" - queryFile="${qfile}" - queryFileRegex="${qfile_regex}" - runDisabled="${run_disabled}" - resultsDirectory="${basedir}/${hive.path.to.root}/contrib/src/test/results/clientnegative/" className="TestContribNegativeCliDriver" - logFile="${project.build.directory}/testcontribnegclidrivergen.log" - logDirectory="${project.build.directory}/qfile-results/contribclientnegative" - initScript="${initScript}" - cleanupScript="q_test_cleanup.sql"/> </target> </configuration> http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/ContribNegativeCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/ContribNegativeCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/ContribNegativeCliDriver.java new file mode 100644 index 0000000..253cda3 --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/ContribNegativeCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class ContribNegativeCliDriver { + + static CliAdapter adapter = new CliConfigs.ContribNegativeCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public ContribNegativeCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DisabledTestBeeLineDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DisabledTestBeeLineDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DisabledTestBeeLineDriver.java new file mode 100644 index 0000000..cb276e6 --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DisabledTestBeeLineDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class DisabledTestBeeLineDriver { + + static CliAdapter adapter = new CliConfigs.BeeLineConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public DisabledTestBeeLineDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DummyCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DummyCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DummyCliDriver.java new file mode 100644 index 0000000..965d1dc --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/DummyCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class DummyCliDriver { + + static CliAdapter adapter = new CliConfigs.DummyConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public DummyCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCliDriver.java new file mode 100644 index 0000000..c4c4f41 --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestCliDriver { + + static CliAdapter adapter = new CliConfigs.CliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCompareCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCompareCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCompareCliDriver.java new file mode 100644 index 0000000..944cd32 --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestCompareCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestCompareCliDriver { + + static CliAdapter adapter = new CliConfigs.CompareCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestCompareCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribCliDriver.java new file mode 100644 index 0000000..54596f9 --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestContribCliDriver { + + static CliAdapter adapter = new CliConfigs.ContribCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestContribCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribNegativeCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribNegativeCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribNegativeCliDriver.java new file mode 100644 index 0000000..1b39ee7 --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestContribNegativeCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestContribNegativeCliDriver { + + static CliAdapter adapter = new CliConfigs.ContribNegativeCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestContribNegativeCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestEncryptedHDFSCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestEncryptedHDFSCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestEncryptedHDFSCliDriver.java new file mode 100644 index 0000000..8c6807e --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestEncryptedHDFSCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestEncryptedHDFSCliDriver { + + static CliAdapter adapter = new CliConfigs.EncryptedHDFSCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestEncryptedHDFSCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseCliDriver.java new file mode 100644 index 0000000..7b6f76a --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestHBaseCliDriver { + + static CliAdapter adapter = new CliConfigs.HBaseCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestHBaseCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +} http://git-wip-us.apache.org/repos/asf/hive/blob/1f7e10c0/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseMinimrCliDriver.java ---------------------------------------------------------------------- diff --git a/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseMinimrCliDriver.java b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseMinimrCliDriver.java new file mode 100644 index 0000000..934af16 --- /dev/null +++ b/itests/qtest/src/test/java/org/apache/hadoop/hive/cli/TestHBaseMinimrCliDriver.java @@ -0,0 +1,62 @@ +/** + * 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.hadoop.hive.cli; + +import java.io.File; +import java.util.List; + +import org.apache.hadoop.hive.cli.control.CliAdapter; +import org.apache.hadoop.hive.cli.control.CliConfigs; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestRule; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class TestHBaseMinimrCliDriver { + + static CliAdapter adapter = new CliConfigs.HBaseMinimrCliConfig().getCliAdapter(); + + @Parameters(name = "{0}") + public static List<Object[]> getParameters() throws Exception { + return adapter.getParameters(); + } + + @ClassRule + public static TestRule cliClassRule = adapter.buildClassRule(); + + @Rule + public TestRule cliTestRule = adapter.buildTestRule(); + + private String name; + private File qfile; + + public TestHBaseMinimrCliDriver(String name, File qfile) { + this.name = name; + this.qfile = qfile; + } + + @Test + public void testCliDriver() throws Exception { + adapter.runTest(name, qfile); + } + +}
