Search in sources :

Example 1 with TopologyDescription

use of org.apache.kafka.streams.TopologyDescription in project ksql by confluentinc.

the class AggregateNodeTest method shouldHaveTwoSubTopologies.

@Test
public void shouldHaveTwoSubTopologies() {
    buildRequireRekey();
    final TopologyDescription description = builder.build().describe();
    assertThat(description.subtopologies().size(), equalTo(2));
}
Also used : TopologyDescription(org.apache.kafka.streams.TopologyDescription) Test(org.junit.Test)

Example 2 with TopologyDescription

use of org.apache.kafka.streams.TopologyDescription in project ksql by confluentinc.

the class PlanTestUtil method getNodeByName.

static TopologyDescription.Node getNodeByName(final Topology topology, final String nodeName) {
    final TopologyDescription description = topology.describe();
    final Set<TopologyDescription.Subtopology> subtopologies = description.subtopologies();
    List<TopologyDescription.Node> nodes = subtopologies.stream().flatMap(subtopology -> subtopology.nodes().stream()).collect(Collectors.toList());
    final Map<String, List<TopologyDescription.Node>> nodesByName = nodes.stream().collect(Collectors.groupingBy(TopologyDescription.Node::name));
    return nodesByName.get(nodeName).get(0);
}
Also used : TopologyDescription(org.apache.kafka.streams.TopologyDescription) List(java.util.List) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) Map(java.util.Map) Set(java.util.Set) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Collectors(java.util.stream.Collectors) Topology(org.apache.kafka.streams.Topology) List(java.util.List) TopologyDescription(org.apache.kafka.streams.TopologyDescription)

Example 3 with TopologyDescription

use of org.apache.kafka.streams.TopologyDescription in project ksql by confluentinc.

the class AggregateNodeTest method shouldHaveOneSubTopologyIfGroupByKey.

@Test
public void shouldHaveOneSubTopologyIfGroupByKey() {
    build();
    final TopologyDescription description = builder.build().describe();
    assertThat(description.subtopologies().size(), equalTo(1));
}
Also used : TopologyDescription(org.apache.kafka.streams.TopologyDescription) Test(org.junit.Test)

Aggregations

TopologyDescription (org.apache.kafka.streams.TopologyDescription)3 Test (org.junit.Test)2 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Topology (org.apache.kafka.streams.Topology)1 CoreMatchers.equalTo (org.hamcrest.CoreMatchers.equalTo)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1