use of io.confluent.ksql.metastore.model.DataSource in project ksql by confluentinc.
the class ReplaceIntTest method assertForSource.
private void assertForSource(final String sourceName, final String topic, final Map<GenericKey, GenericRow> expected) {
DataSource source = ksqlContext.getMetaStore().getSource(SourceName.of(sourceName));
PhysicalSchema resultSchema = PhysicalSchema.from(source.getSchema(), source.getKsqlTopic().getKeyFormat().getFeatures(), source.getKsqlTopic().getValueFormat().getFeatures());
assertThat(TEST_HARNESS.verifyAvailableUniqueRows(topic, expected.size(), FormatFactory.KAFKA, FormatFactory.JSON, resultSchema), is(expected));
}
use of io.confluent.ksql.metastore.model.DataSource in project ksql by confluentinc.
the class ReplaceIntTest method shouldReplaceDDL.
@Test
public void shouldReplaceDDL() {
// When:
ksqlContext.sql(String.format("CREATE OR REPLACE STREAM source (%s) WITH (kafka_topic='%s', value_format='JSON');", Provider.SQL + ", col3 BIGINT", inputTopic));
// Then:
DataSource source = ksqlContext.getMetaStore().getSource(SourceName.of("SOURCE"));
assertThat(source.getSchema().value().size(), is(3));
assertThat(source.getSchema().value().get(2), is(Column.of(ColumnName.of("COL3"), SqlTypes.BIGINT, Namespace.VALUE, 2)));
}
use of io.confluent.ksql.metastore.model.DataSource in project ksql by confluentinc.
the class WindowingIntTest method assertTableCanBeUsedAsSource.
private <K> void assertTableCanBeUsedAsSource(final Map<K, GenericRow> expected, final Matcher<? super Map<K, GenericRow>> tableRowMatcher) {
ksqlContext.sql("CREATE TABLE " + resultStream1 + " AS SELECT * FROM " + resultStream0 + ";");
final DataSource source = ksqlContext.getMetaStore().getSource(SourceName.of(resultStream1));
resultSchema = PhysicalSchema.from(source.getSchema(), source.getKsqlTopic().getKeyFormat().getFeatures(), source.getKsqlTopic().getValueFormat().getFeatures());
assertOutputOf(resultStream1, expected, tableRowMatcher);
}
use of io.confluent.ksql.metastore.model.DataSource in project ksql by confluentinc.
the class ReplaceWithSharedRuntimesIntTest method assertForSource.
private void assertForSource(final String sourceName, final String topic, final Map<GenericKey, GenericRow> expected) {
DataSource source = ksqlContext.getMetaStore().getSource(SourceName.of(sourceName));
PhysicalSchema resultSchema = PhysicalSchema.from(source.getSchema(), source.getKsqlTopic().getKeyFormat().getFeatures(), source.getKsqlTopic().getValueFormat().getFeatures());
assertThat(TEST_HARNESS.verifyAvailableUniqueRows(topic, expected.size(), FormatFactory.KAFKA, FormatFactory.JSON, resultSchema), is(expected));
}
use of io.confluent.ksql.metastore.model.DataSource in project ksql by confluentinc.
the class ReplaceWithSharedRuntimesIntTest method shouldReplaceDDL.
@Test
public void shouldReplaceDDL() {
// When:
ksqlContext.sql(String.format("CREATE OR REPLACE STREAM source (%s) WITH (kafka_topic='%s', value_format='JSON');", Provider.SQL + ", col3 BIGINT", inputTopic));
// Then:
DataSource source = ksqlContext.getMetaStore().getSource(SourceName.of("SOURCE"));
assertThat(source.getSchema().value().size(), is(3));
assertThat(source.getSchema().value().get(2), is(Column.of(ColumnName.of("COL3"), SqlTypes.BIGINT, Namespace.VALUE, 2)));
}
Aggregations