@Override public int hashCode() { return Objects.hash(getSourceDescription()); } }
@Test public void shouldPrintTopicDescribeExtended() throws IOException { final KsqlEntityList entityList = new KsqlEntityList(ImmutableList.of( new SourceDescriptionEntity( "e", new SourceDescription( "TestSource", Collections.emptyList(), Collections.emptyList(), buildTestSchema(2), DataSource.DataSourceType.KTABLE.getKqlType(), "key", "2000-01-01", "stats", "errors", true, "avro", "kadka-topic", 2, 1)))); console.printKsqlEntityList(entityList); final String output = terminal.getOutputString(); if (console.getOutputFormat() == OutputFormat.JSON) { assertThat(output, containsString("\"topic\" : \"kadka-topic\"")); } else { assertThat(output, containsString("Kafka topic : kadka-topic (partitions: 2, replication: 1)")); } }
private KsqlEntity showColumns(final PreparedStatement<ShowColumns> statement) { final ShowColumns showColumns = statement.getStatement(); if (showColumns.isTopic()) { return describeTopic(statement.getStatementText(), showColumns.getTable().getSuffix()); } return new SourceDescriptionEntity( statement.getStatementText(), describeSource(showColumns.getTable().getSuffix(), showColumns.isExtended()) ); }
new PropertiesList("e", properties, Collections.emptyList(), Collections.emptyList()), new Queries("e", queries), new SourceDescriptionEntity( "e", new SourceDescription(
@Test public void shouldDescribeStatement() { // Given: final List<RunningQuery> queries = createRunningQueries( "CREATE STREAM described_stream AS SELECT * FROM test_stream;" + "CREATE STREAM down_stream AS SELECT * FROM described_stream;", Collections.emptyMap()); // When: final SourceDescriptionEntity description = makeSingleRequest( "DESCRIBE DESCRIBED_STREAM;", SourceDescriptionEntity.class); // Then: final SourceDescription expectedDescription = new SourceDescription( ksqlEngine.getMetaStore().getSource("DESCRIBED_STREAM"), false, "JSON", Collections.singletonList(queries.get(1)), Collections.singletonList(queries.get(0)), null); assertThat(description.getSourceDescription(), is(expectedDescription)); }