Search in sources :

Example 1 with ListStreams

use of io.confluent.ksql.parser.tree.ListStreams in project ksql by confluentinc.

the class KsqlParserTest method testShowStreams.

@Test
public void testShowStreams() throws Exception {
    String simpleQuery = "SHOW STREAMS;";
    Statement statement = KSQL_PARSER.buildAst(simpleQuery, metaStore).get(0);
    Assert.assertTrue(statement instanceof ListStreams);
    ListStreams listStreams = (ListStreams) statement;
    Assert.assertTrue(listStreams.toString().equalsIgnoreCase("ListStreams{}"));
}
Also used : ListStreams(io.confluent.ksql.parser.tree.ListStreams) Statement(io.confluent.ksql.parser.tree.Statement) Test(org.junit.Test)

Example 2 with ListStreams

use of io.confluent.ksql.parser.tree.ListStreams 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)

Aggregations

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