use of io.confluent.ksql.parser.tree.ListTables in project ksql by confluentinc.
the class KsqlParserTest method testShowTables.
@Test
public void testShowTables() throws Exception {
String simpleQuery = "SHOW TABLES;";
Statement statement = KSQL_PARSER.buildAst(simpleQuery, metaStore).get(0);
Assert.assertTrue(statement instanceof ListTables);
ListTables listTables = (ListTables) statement;
Assert.assertTrue(listTables.toString().equalsIgnoreCase("ListTables{}"));
}
use of io.confluent.ksql.parser.tree.ListTables in project ksql by confluentinc.
the class KsqlResourceTest method testListTablesStatement.
@Test
public void testListTablesStatement() throws Exception {
KsqlResource testResource = TestKsqlResourceUtil.get(ksqlEngine, ksqlRestConfig);
final String ksqlString = "LIST TABLES;";
final ListTables ksqlStatement = new ListTables(Optional.empty());
TablesList tablesList = makeSingleRequest(testResource, ksqlString, ksqlStatement, Collections.emptyMap(), TablesList.class);
List<SourceInfo.Table> testTables = tablesList.getTables();
assertEquals(1, testTables.size());
SourceInfo expectedTable = new SourceInfo.Table((KsqlTable) testResource.getKsqlEngine().getMetaStore().getSource("TEST_TABLE"));
assertEquals(expectedTable, testTables.get(0));
}
Aggregations