Search in sources :

Example 1 with SourceDescriptionList

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

the class KsqlResourceTest method shouldDescribeStreamsExtended.

@Test
public void shouldDescribeStreamsExtended() {
    // Given:
    final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
    givenSource(DataSourceType.KSTREAM, "new_stream", "new_topic", schema);
    // When:
    final SourceDescriptionList descriptionList = makeSingleRequest("DESCRIBE STREAMS EXTENDED;", SourceDescriptionList.class);
    // Then:
    assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_STREAM")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_2")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_stream")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
Also used : SourceDescriptionList(io.confluent.ksql.rest.entity.SourceDescriptionList) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Example 2 with SourceDescriptionList

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

the class KsqlResourceTest method shouldDescribeTablesExtended.

@Test
public void shouldDescribeTablesExtended() {
    // Given:
    final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
    givenSource(DataSourceType.KTABLE, "new_table", "new_topic", schema, ImmutableSet.of(SourceName.of("TEST_TABLE")));
    // When:
    final SourceDescriptionList descriptionList = makeSingleRequest("DESCRIBE TABLES EXTENDED;", SourceDescriptionList.class);
    // Then:
    assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_TABLE")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_1")), Collections.emptyList(), ImmutableList.of("new_table"), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_table")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
Also used : SourceDescriptionList(io.confluent.ksql.rest.entity.SourceDescriptionList) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Example 3 with SourceDescriptionList

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

the class KsqlResourceTest method shouldShowTablesExtended.

@Test
public void shouldShowTablesExtended() {
    // Given:
    final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
    givenSource(DataSourceType.KTABLE, "new_table", "new_topic", schema, ImmutableSet.of(SourceName.of("TEST_TABLE")));
    // When:
    final SourceDescriptionList descriptionList = makeSingleRequest("SHOW TABLES EXTENDED;", SourceDescriptionList.class);
    // Then:
    assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_TABLE")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_1")), Collections.emptyList(), ImmutableList.of("new_table"), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_table")), true, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
Also used : SourceDescriptionList(io.confluent.ksql.rest.entity.SourceDescriptionList) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Example 4 with SourceDescriptionList

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

the class KsqlResourceTest method shouldDescribeTables.

@Test
public void shouldDescribeTables() {
    // Given:
    final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
    givenSource(DataSourceType.KTABLE, "new_table", "new_topic", schema, ImmutableSet.of(SourceName.of("TEST_TABLE")));
    // When:
    final SourceDescriptionList descriptionList = makeSingleRequest("DESCRIBE TABLES;", SourceDescriptionList.class);
    // Then:
    assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_TABLE")), false, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_1")), Collections.emptyList(), ImmutableList.of("new_table"), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_table")), false, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
Also used : SourceDescriptionList(io.confluent.ksql.rest.entity.SourceDescriptionList) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Example 5 with SourceDescriptionList

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

the class KsqlResourceTest method shouldDescribeStreams.

@Test
public void shouldDescribeStreams() {
    // Given:
    final LogicalSchema schema = LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, SqlTypes.STRING).valueColumn(ColumnName.of("FIELD1"), SqlTypes.BOOLEAN).valueColumn(ColumnName.of("FIELD2"), SqlTypes.STRING).build();
    givenSource(DataSourceType.KSTREAM, "new_stream", "new_topic", schema);
    // When:
    final SourceDescriptionList descriptionList = makeSingleRequest("DESCRIBE STREAMS;", SourceDescriptionList.class);
    // Then:
    assertThat(descriptionList.getSourceDescriptions(), containsInAnyOrder(SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("TEST_STREAM")), false, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("KAFKA_TOPIC_2")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors()), SourceDescriptionFactory.create(ksqlEngine.getMetaStore().getSource(SourceName.of("new_stream")), false, Collections.emptyList(), Collections.emptyList(), Optional.of(kafkaTopicClient.describeTopic("new_topic")), Collections.emptyList(), Collections.emptyList(), new MetricCollectors())));
}
Also used : SourceDescriptionList(io.confluent.ksql.rest.entity.SourceDescriptionList) MetricCollectors(io.confluent.ksql.metrics.MetricCollectors) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Aggregations

SourceDescriptionList (io.confluent.ksql.rest.entity.SourceDescriptionList)13 Test (org.junit.Test)12 MetricCollectors (io.confluent.ksql.metrics.MetricCollectors)11 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)7 ConfiguredStatement (io.confluent.ksql.statement.ConfiguredStatement)6 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 DataSource (io.confluent.ksql.metastore.model.DataSource)2 KsqlStream (io.confluent.ksql.metastore.model.KsqlStream)2 KsqlTable (io.confluent.ksql.metastore.model.KsqlTable)2 SourceName (io.confluent.ksql.name.SourceName)2 DescribeStreams (io.confluent.ksql.parser.tree.DescribeStreams)2 DescribeTables (io.confluent.ksql.parser.tree.DescribeTables)2 ListStreams (io.confluent.ksql.parser.tree.ListStreams)2 ListTables (io.confluent.ksql.parser.tree.ListTables)2 ShowColumns (io.confluent.ksql.parser.tree.ShowColumns)2 SessionProperties (io.confluent.ksql.rest.SessionProperties)2 KsqlEntity (io.confluent.ksql.rest.entity.KsqlEntity)2 KsqlWarning (io.confluent.ksql.rest.entity.KsqlWarning)2 QueryStatusCount (io.confluent.ksql.rest.entity.QueryStatusCount)2