Search in sources :

Example 1 with InternalTopologyBuilder

use of org.apache.kafka.streams.processor.internals.InternalTopologyBuilder in project apache-kafka-on-k8s by banzaicloud.

the class InternalStreamsBuilderTest method testNewStoreName.

@Test
public void testNewStoreName() {
    assertEquals("X-STATE-STORE-0000000000", builder.newStoreName("X-"));
    assertEquals("Y-STATE-STORE-0000000001", builder.newStoreName("Y-"));
    assertEquals("Z-STATE-STORE-0000000002", builder.newStoreName("Z-"));
    final InternalStreamsBuilder newBuilder = new InternalStreamsBuilder(new InternalTopologyBuilder());
    assertEquals("X-STATE-STORE-0000000000", newBuilder.newStoreName("X-"));
    assertEquals("Y-STATE-STORE-0000000001", newBuilder.newStoreName("Y-"));
    assertEquals("Z-STATE-STORE-0000000002", newBuilder.newStoreName("Z-"));
}
Also used : InternalTopologyBuilder(org.apache.kafka.streams.processor.internals.InternalTopologyBuilder) Test(org.junit.Test)

Example 2 with InternalTopologyBuilder

use of org.apache.kafka.streams.processor.internals.InternalTopologyBuilder in project apache-kafka-on-k8s by banzaicloud.

the class InternalStreamsBuilderTest method testNewName.

@Test
public void testNewName() {
    assertEquals("X-0000000000", builder.newProcessorName("X-"));
    assertEquals("Y-0000000001", builder.newProcessorName("Y-"));
    assertEquals("Z-0000000002", builder.newProcessorName("Z-"));
    final InternalStreamsBuilder newBuilder = new InternalStreamsBuilder(new InternalTopologyBuilder());
    assertEquals("X-0000000000", newBuilder.newProcessorName("X-"));
    assertEquals("Y-0000000001", newBuilder.newProcessorName("Y-"));
    assertEquals("Z-0000000002", newBuilder.newProcessorName("Z-"));
}
Also used : InternalTopologyBuilder(org.apache.kafka.streams.processor.internals.InternalTopologyBuilder) Test(org.junit.Test)

Example 3 with InternalTopologyBuilder

use of org.apache.kafka.streams.processor.internals.InternalTopologyBuilder in project kafka by apache.

the class InternalStreamsBuilderTest method testNewStoreName.

@Test
public void testNewStoreName() {
    assertEquals("X-STATE-STORE-0000000000", builder.newStoreName("X-"));
    assertEquals("Y-STATE-STORE-0000000001", builder.newStoreName("Y-"));
    assertEquals("Z-STATE-STORE-0000000002", builder.newStoreName("Z-"));
    final InternalStreamsBuilder newBuilder = new InternalStreamsBuilder(new InternalTopologyBuilder());
    assertEquals("X-STATE-STORE-0000000000", newBuilder.newStoreName("X-"));
    assertEquals("Y-STATE-STORE-0000000001", newBuilder.newStoreName("Y-"));
    assertEquals("Z-STATE-STORE-0000000002", newBuilder.newStoreName("Z-"));
}
Also used : InternalTopologyBuilder(org.apache.kafka.streams.processor.internals.InternalTopologyBuilder) Test(org.junit.Test)

Example 4 with InternalTopologyBuilder

use of org.apache.kafka.streams.processor.internals.InternalTopologyBuilder in project kafka by apache.

the class InternalStreamsBuilderTest method testNewName.

@Test
public void testNewName() {
    assertEquals("X-0000000000", builder.newProcessorName("X-"));
    assertEquals("Y-0000000001", builder.newProcessorName("Y-"));
    assertEquals("Z-0000000002", builder.newProcessorName("Z-"));
    final InternalStreamsBuilder newBuilder = new InternalStreamsBuilder(new InternalTopologyBuilder());
    assertEquals("X-0000000000", newBuilder.newProcessorName("X-"));
    assertEquals("Y-0000000001", newBuilder.newProcessorName("Y-"));
    assertEquals("Z-0000000002", newBuilder.newProcessorName("Z-"));
}
Also used : InternalTopologyBuilder(org.apache.kafka.streams.processor.internals.InternalTopologyBuilder) Test(org.junit.Test)

Example 5 with InternalTopologyBuilder

use of org.apache.kafka.streams.processor.internals.InternalTopologyBuilder in project kafka by apache.

the class StreamsBuilderTest method shouldNotReuseRepartitionTopicAsChangelogs.

@Test
public void shouldNotReuseRepartitionTopicAsChangelogs() {
    final String topic = "topic";
    builder.<Long, String>stream(topic).repartition().toTable(Materialized.as("store"));
    final Properties props = StreamsTestUtils.getStreamsConfig("appId");
    props.put(StreamsConfig.TOPOLOGY_OPTIMIZATION_CONFIG, StreamsConfig.OPTIMIZE);
    final Topology topology = builder.build(props);
    final InternalTopologyBuilder internalTopologyBuilder = TopologyWrapper.getInternalTopologyBuilder(topology);
    internalTopologyBuilder.rewriteTopology(new StreamsConfig(props));
    assertThat(internalTopologyBuilder.buildTopology().storeToChangelogTopic(), equalTo(Collections.singletonMap("store", "appId-store-changelog")));
    assertThat(internalTopologyBuilder.stateStores().keySet(), equalTo(Collections.singleton("store")));
    assertThat(internalTopologyBuilder.stateStores().get("store").loggingEnabled(), equalTo(true));
    assertThat(internalTopologyBuilder.subtopologyToTopicsInfo().get(SUBTOPOLOGY_1).stateChangelogTopics.keySet(), equalTo(Collections.singleton("appId-store-changelog")));
}
Also used : ProcessorTopology(org.apache.kafka.streams.processor.internals.ProcessorTopology) Properties(java.util.Properties) InternalTopologyBuilder(org.apache.kafka.streams.processor.internals.InternalTopologyBuilder) Test(org.junit.Test)

Aggregations

InternalTopologyBuilder (org.apache.kafka.streams.processor.internals.InternalTopologyBuilder)14 Test (org.junit.Test)10 Topology (org.apache.kafka.streams.Topology)5 Properties (java.util.Properties)3 StringSerializer (org.apache.kafka.common.serialization.StringSerializer)3 StreamsBuilder (org.apache.kafka.streams.StreamsBuilder)3 TopologyTestDriverWrapper (org.apache.kafka.streams.TopologyTestDriverWrapper)3 ProcessorTopology (org.apache.kafka.streams.processor.internals.ProcessorTopology)3 Bytes (org.apache.kafka.common.utils.Bytes)2 JoinWindows (org.apache.kafka.streams.kstream.JoinWindows)2 Metrics (org.apache.kafka.common.metrics.Metrics)1 IntegerSerializer (org.apache.kafka.common.serialization.IntegerSerializer)1 MockTime (org.apache.kafka.common.utils.MockTime)1 StreamsConfig (org.apache.kafka.streams.StreamsConfig)1 TopologyWrapper (org.apache.kafka.streams.TopologyWrapper)1 TaskId (org.apache.kafka.streams.processor.TaskId)1 InternalTopicConfig (org.apache.kafka.streams.processor.internals.InternalTopicConfig)1 MockStreamsMetrics (org.apache.kafka.streams.processor.internals.MockStreamsMetrics)1 ProcessorRecordContext (org.apache.kafka.streams.processor.internals.ProcessorRecordContext)1 StateDirectory (org.apache.kafka.streams.processor.internals.StateDirectory)1