use of org.apache.kafka.streams.processor.internals.testutil.DummyStreamsConfig in project kafka by apache.
the class TaskManagerTest method setUpTaskManager.
private void setUpTaskManager(final StreamsConfigUtils.ProcessingMode processingMode) {
taskManager = new TaskManager(time, changeLogReader, UUID.randomUUID(), "taskManagerTest", new StreamsMetricsImpl(new Metrics(), "clientId", StreamsConfig.METRICS_LATEST, time), activeTaskCreator, standbyTaskCreator, new TopologyMetadata(topologyBuilder, new DummyStreamsConfig(processingMode)), adminClient, stateDirectory);
taskManager.setMainConsumer(consumer);
reset(topologyBuilder);
expect(topologyBuilder.hasNamedTopology()).andStubReturn(false);
activeTaskCreator.removeRevokedUnknownTasks(anyObject());
expectLastCall().asStub();
standbyTaskCreator.removeRevokedUnknownTasks(anyObject());
expectLastCall().asStub();
}
use of org.apache.kafka.streams.processor.internals.testutil.DummyStreamsConfig in project kafka by apache.
the class StreamsMetadataStateTest method before.
@Before
public void before() {
builder = new StreamsBuilder();
final KStream<Object, Object> one = builder.stream("topic-one");
one.groupByKey().count(Materialized.as("table-one"));
final KStream<Object, Object> two = builder.stream("topic-two");
two.groupByKey().count(Materialized.as("table-two"));
builder.stream("topic-three").groupByKey().count(Materialized.as("table-three"));
one.merge(two).groupByKey().count(Materialized.as("merged-table"));
builder.stream("topic-four").mapValues(value -> value);
builder.globalTable("global-topic", Consumed.with(null, null), Materialized.as(globalTable));
TopologyWrapper.getInternalTopologyBuilder(builder.build()).setApplicationId("appId");
topic1P0 = new TopicPartition("topic-one", 0);
topic1P1 = new TopicPartition("topic-one", 1);
topic2P0 = new TopicPartition("topic-two", 0);
topic2P1 = new TopicPartition("topic-two", 1);
topic3P0 = new TopicPartition("topic-three", 0);
topic4P0 = new TopicPartition("topic-four", 0);
hostOne = new HostInfo("host-one", 8080);
hostTwo = new HostInfo("host-two", 9090);
hostThree = new HostInfo("host-three", 7070);
hostToActivePartitions = new HashMap<>();
hostToActivePartitions.put(hostOne, mkSet(topic1P0, topic2P1, topic4P0));
hostToActivePartitions.put(hostTwo, mkSet(topic2P0, topic1P1));
hostToActivePartitions.put(hostThree, Collections.singleton(topic3P0));
hostToStandbyPartitions = new HashMap<>();
hostToStandbyPartitions.put(hostThree, mkSet(topic1P0, topic2P1, topic4P0));
hostToStandbyPartitions.put(hostOne, mkSet(topic2P0, topic1P1));
hostToStandbyPartitions.put(hostTwo, Collections.singleton(topic3P0));
final List<PartitionInfo> partitionInfos = Arrays.asList(new PartitionInfo("topic-one", 0, null, null, null), new PartitionInfo("topic-one", 1, null, null, null), new PartitionInfo("topic-two", 0, null, null, null), new PartitionInfo("topic-two", 1, null, null, null), new PartitionInfo("topic-three", 0, null, null, null), new PartitionInfo("topic-four", 0, null, null, null));
cluster = new Cluster(null, Collections.<Node>emptyList(), partitionInfos, Collections.<String>emptySet(), Collections.<String>emptySet());
final TopologyMetadata topologyMetadata = new TopologyMetadata(TopologyWrapper.getInternalTopologyBuilder(builder.build()), new DummyStreamsConfig());
topologyMetadata.buildAndRewriteTopology();
metadataState = new StreamsMetadataState(topologyMetadata, hostOne, logContext);
metadataState.onChange(hostToActivePartitions, hostToStandbyPartitions, cluster);
partitioner = (topic, key, value, numPartitions) -> 1;
storeNames = mkSet("table-one", "table-two", "merged-table", globalTable);
}
use of org.apache.kafka.streams.processor.internals.testutil.DummyStreamsConfig in project kafka by apache.
the class StreamsMetadataStateTest method shouldNotThrowExceptionWhenOnChangeNotCalled.
@Test
public void shouldNotThrowExceptionWhenOnChangeNotCalled() {
final Collection<StreamsMetadata> metadata = new StreamsMetadataState(new TopologyMetadata(TopologyWrapper.getInternalTopologyBuilder(builder.build()), new DummyStreamsConfig()), hostOne, logContext).getAllMetadataForStore("store");
assertEquals(0, metadata.size());
}
Aggregations