Search in sources :

Example 1 with ListTables

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{}"));
}
Also used : Statement(io.confluent.ksql.parser.tree.Statement) ListTables(io.confluent.ksql.parser.tree.ListTables) Test(org.junit.Test)

Example 2 with 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));
}
Also used : KsqlTable(io.confluent.ksql.metastore.KsqlTable) SourceInfo(io.confluent.ksql.rest.entity.SourceInfo) ListTables(io.confluent.ksql.parser.tree.ListTables) TablesList(io.confluent.ksql.rest.entity.TablesList) Test(org.junit.Test)

Aggregations

ListTables (io.confluent.ksql.parser.tree.ListTables)2 Test (org.junit.Test)2 KsqlTable (io.confluent.ksql.metastore.KsqlTable)1 Statement (io.confluent.ksql.parser.tree.Statement)1 SourceInfo (io.confluent.ksql.rest.entity.SourceInfo)1 TablesList (io.confluent.ksql.rest.entity.TablesList)1