|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.eigenbase.test.SqlValidatorTestCase org.eigenbase.sql.test.SqlAdvisorTest
public class SqlAdvisorTest
Concrete child class of SqlValidatorTestCase
, containing unit tests
for SqlAdvisor.
Nested Class Summary | |
---|---|
class |
SqlAdvisorTest.AdvisorTestImpl
|
static interface |
SqlAdvisorTest.Tester
|
Nested classes/interfaces inherited from class org.eigenbase.test.SqlValidatorTestCase |
---|
SqlValidatorTestCase.TesterImpl |
Field Summary | |
---|---|
private static List<String> |
A_TABLE
|
private static List<String> |
AB_TABLES
|
protected static List<String> |
AGG_KEYWORDS
|
private static List<String> |
DEPT_COLUMNS
|
private static List<String> |
EMP_COLUMNS
|
private static List<String> |
EMP_TABLE
|
protected static List<String> |
EXPR_KEYWORDS
|
protected static List<String> |
FROM_KEYWORDS
|
protected static List<String> |
JOIN_KEYWORDS
|
Logger |
logger
|
private static List<String> |
ORDER_KEYWORDS
|
protected static List<String> |
PREDICATE_KEYWORDS
|
protected static List<String> |
SALES_TABLES
|
private static List<String> |
SCHEMAS
|
protected static List<String> |
SELECT_KEYWORDS
|
private static List<String> |
STAR_KEYWORD
|
private static List<String> |
WHERE_KEYWORDS
|
Fields inherited from class org.eigenbase.test.SqlValidatorTestCase |
---|
NL, tester |
Constructor Summary | |
---|---|
SqlAdvisorTest(String name)
|
Method Summary | ||
---|---|---|
protected void |
assertComplete(String sql,
List<String>... expectedResults)
|
|
protected void |
assertComplete(String sql,
String expectedResults,
String expectedWord)
Tests that a given SQL which may be invalid or incomplete simplifies itself and yields the salesTables set of completion hints. |
|
protected void |
assertEquals(String[] actualResults,
List<String>... expectedResults)
|
|
protected void |
assertHint(String sql,
List<String>... expectedLists)
|
|
protected void |
assertHint(String sql,
String expectedResults)
Checks that a given SQL statement yields the expected set of completion hints. |
|
protected void |
assertSimplify(String sql,
String expected)
Tests that a given SQL statement simplifies to the salesTables result. |
|
private void |
assertTokenizesTo(String sql,
String expected)
|
|
private String |
convertCompletionHints(List<SqlMoniker> hints)
|
|
protected List<String> |
getFromKeywords()
|
|
protected List<String> |
getJoinKeywords()
|
|
protected List<String> |
getSalesTables()
Returns a list of the tables in the SALES schema. |
|
protected List<String> |
getSelectKeywords()
|
|
SqlAdvisorTest.Tester |
getTester(SqlConformance conformance)
Returns a tester. |
|
protected static
|
plus(List<T>... lists)
Concatenates several lists of the same type into a single list. |
|
void |
testFrom()
|
|
void |
testFromComplete()
|
|
void |
testFromWhere()
|
|
void |
testGroup()
|
|
void |
testInsert()
|
|
void |
testJoin()
|
|
void |
testJoinKeywords()
|
|
void |
testOnCondition()
|
|
void |
testOrderByList()
|
|
void |
testPartialIdentifier()
|
|
void |
testSelectList()
|
|
void |
testSimpleParser()
|
|
void |
testSimpleParserQuotedId()
|
|
void |
testSimpleParserTokenizer()
|
|
void |
testSubQuery()
|
|
void |
testSubQueryInWhere()
|
|
void |
testUnion()
|
|
void |
testWhereList()
|
|
private static
|
toString(List<T> list)
Converts a list to a string, one item per line. |
Methods inherited from class org.eigenbase.test.SqlValidatorTestCase |
---|
assertExceptionIsThrown, check, checkCharset, checkCollation, checkColumnType, checkEx, checkExp, checkExpFails, checkExpType, checkFails, checkIntervalConv, checkResultType, checkWholeExpFails |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final List<String> STAR_KEYWORD
protected static final List<String> FROM_KEYWORDS
protected static final List<String> AGG_KEYWORDS
protected static final List<String> SALES_TABLES
private static final List<String> SCHEMAS
private static final List<String> AB_TABLES
private static final List<String> EMP_TABLE
protected static final List<String> EXPR_KEYWORDS
protected static final List<String> SELECT_KEYWORDS
private static final List<String> ORDER_KEYWORDS
private static final List<String> EMP_COLUMNS
private static final List<String> DEPT_COLUMNS
protected static final List<String> PREDICATE_KEYWORDS
private static final List<String> WHERE_KEYWORDS
private static final List<String> A_TABLE
protected static final List<String> JOIN_KEYWORDS
public final Logger logger
Constructor Detail |
---|
public SqlAdvisorTest(String name)
Method Detail |
---|
protected List<String> getFromKeywords()
protected List<String> getSelectKeywords()
protected List<String> getSalesTables()
protected List<String> getJoinKeywords()
private void assertTokenizesTo(String sql, String expected)
protected void assertHint(String sql, List<String>... expectedLists) throws Exception
Exception
protected void assertHint(String sql, String expectedResults) throws Exception
sql
- SQL statementexpectedResults
- Expected list of hints
Exception
- on errorprotected void assertSimplify(String sql, String expected)
sql
- SQL statement to simplify. The SQL statement must contain
precisely one caret '^', which marks the location where completion is to
occur.expected
- Expected result after simplification.protected void assertComplete(String sql, List<String>... expectedResults)
protected void assertComplete(String sql, String expectedResults, String expectedWord)
assertHint(java.lang.String, java.util.List...)
and assertSimplify(java.lang.String, java.lang.String)
.
sql
- SQL statementexpectedResults
- Expected list of hintsexpectedWord
- Word that we expect to be replaced, or null if we
don't careprotected void assertEquals(String[] actualResults, List<String>... expectedResults) throws Exception
Exception
private String convertCompletionHints(List<SqlMoniker> hints)
private static <T> String toString(List<T> list)
list
- List
public SqlAdvisorTest.Tester getTester(SqlConformance conformance)
SqlValidatorTestCase
getTester
in class SqlValidatorTestCase
conformance
- Language version tests should check compatibility withprotected static <T> List<T> plus(List<T>... lists)
lists
- Lists to concatenate
public void testFrom() throws Exception
Exception
public void testFromComplete()
public void testGroup()
public void testJoin() throws Exception
Exception
public void testJoinKeywords()
public void testOnCondition() throws Exception
Exception
public void testFromWhere() throws Exception
Exception
public void testWhereList() throws Exception
Exception
public void testSelectList() throws Exception
Exception
public void testOrderByList() throws Exception
Exception
public void testSubQuery() throws Exception
Exception
public void testSubQueryInWhere()
public void testSimpleParserTokenizer()
public void testSimpleParser()
public void testSimpleParserQuotedId()
public void testPartialIdentifier()
public void testInsert() throws Exception
Exception
public void testUnion() throws Exception
Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |