Search in sources :

Example 1 with SourceInfo

use of io.confluent.ksql.rest.entity.SourceInfo in project ksql by confluentinc.

the class KsqlResourceTest method testListStreamsStatement.

@Test
public void testListStreamsStatement() throws Exception {
    KsqlResource testResource = TestKsqlResourceUtil.get(ksqlEngine, ksqlRestConfig);
    final String ksqlString = "LIST STREAMS;";
    final ListStreams ksqlStatement = new ListStreams(Optional.empty());
    StreamsList streamsList = makeSingleRequest(testResource, ksqlString, ksqlStatement, Collections.emptyMap(), StreamsList.class);
    List<SourceInfo.Stream> testStreams = streamsList.getStreams();
    assertEquals(1, testStreams.size());
    SourceInfo expectedStream = new SourceInfo.Stream((KsqlStream) testResource.getKsqlEngine().getMetaStore().getSource("TEST_STREAM"));
    assertEquals(expectedStream, testStreams.get(0));
}
Also used : ListStreams(io.confluent.ksql.parser.tree.ListStreams) StreamsList(io.confluent.ksql.rest.entity.StreamsList) SourceInfo(io.confluent.ksql.rest.entity.SourceInfo) KsqlStream(io.confluent.ksql.metastore.KsqlStream) Test(org.junit.Test)

Example 2 with SourceInfo

use of io.confluent.ksql.rest.entity.SourceInfo 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

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