Package org.apache.calcite.test
Class SqlLineTest
- java.lang.Object
-
- org.apache.calcite.test.SqlLineTest
-
public class SqlLineTest extends java.lang.Object
Tests that we can invoke SqlLine on a Calcite connection.
-
-
Constructor Summary
Constructors Constructor Description SqlLineTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkScriptFile(java.lang.String scriptText, boolean flag, org.hamcrest.Matcher<sqlline.SqlLine.Status> statusMatcher, org.hamcrest.Matcher<java.lang.String> outputMatcher)
Attempts to execute a simple script file with the -f option to SqlLine.private static org.apache.calcite.util.Pair<sqlline.SqlLine.Status,java.lang.String>
run(java.lang.String... args)
Execute a script with "sqlline -f".private static org.apache.calcite.util.Pair<sqlline.SqlLine.Status,java.lang.String>
runScript(java.io.File scriptFile, boolean flag)
void
testSqlLine()
-
-
-
Method Detail
-
run
private static org.apache.calcite.util.Pair<sqlline.SqlLine.Status,java.lang.String> run(java.lang.String... args) throws java.lang.Throwable
Execute a script with "sqlline -f".- Parameters:
args
- Script arguments- Returns:
- The stderr and stdout from running the script
- Throws:
java.lang.Throwable
- On error
-
runScript
private static org.apache.calcite.util.Pair<sqlline.SqlLine.Status,java.lang.String> runScript(java.io.File scriptFile, boolean flag) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
checkScriptFile
private void checkScriptFile(java.lang.String scriptText, boolean flag, org.hamcrest.Matcher<sqlline.SqlLine.Status> statusMatcher, org.hamcrest.Matcher<java.lang.String> outputMatcher) throws java.lang.Throwable
Attempts to execute a simple script file with the -f option to SqlLine. Tests for presence of an expected pattern in the output (stdout or stderr).- Parameters:
scriptText
- Script textflag
- Command flag (--run or -f)statusMatcher
- Checks whether status is as expectedoutputMatcher
- Checks whether output is as expected- Throws:
java.lang.Exception
- on command execution errorjava.lang.Throwable
-
testSqlLine
public void testSqlLine() throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
-