@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof StreamsList)) { return false; } final StreamsList that = (StreamsList) o; return Objects.equals(getStreams(), that.getStreams()); }
private KsqlEntity listStreams(final PreparedStatement<ListStreams> statement) { final List<KsqlStream> ksqlStreams = getSpecificSources(KsqlStream.class); if (statement.getStatement().getShowExtended()) { return new SourceDescriptionList( statement.getStatementText(), ksqlStreams.stream() .map(s -> describeSource(s.getName(), true)) .collect(Collectors.toList())); } return new StreamsList( statement.getStatementText(), ksqlStreams.stream() .map(SourceInfo.Stream::new) .collect(Collectors.toList())); }
"errors", false, "avro", "kadka-topic", 1, 1)), new TopicDescription("e", "TestTopic", "TestKafkaTopic", "AVRO", "schemaString"), new StreamsList("e", ImmutableList.of(new SourceInfo.Stream("TestStream", "TestTopic", "AVRO"))), new TablesList("e", ImmutableList.of(new SourceInfo.Table("TestTable", "TestTopic", "JSON", false))), new KsqlTopicsList("e", ImmutableList.of(new KsqlTopicInfo("TestTopic", "TestKafkaTopic", DataSource.DataSourceSerDe.JSON))),
@Override public int hashCode() { return Objects.hash(getStreams()); } }
@Override public Table buildTable(final StreamsList entity) { final Stream<List<String>> rows = entity.getStreams().stream() .map(s -> ImmutableList.of(s.getName(), s.getTopic(), s.getFormat())); return new Builder() .withColumnHeaders(HEADERS) .withRows(rows) .build(); } }
@Test public void shouldListStreamsStatement() { // When: final StreamsList streamsList = makeSingleRequest("LIST STREAMS;", StreamsList.class); // Then: assertThat(streamsList.getStreams(), contains(sourceStream("TEST_STREAM"))); }