use of org.easymock.EasyMock.expect in project kafka by apache.
the class StreamsPartitionAssignorTest method shouldRequestCommittedOffsetsForPreexistingSourceChangelogs.
@Test
public void shouldRequestCommittedOffsetsForPreexistingSourceChangelogs() {
final Set<TopicPartition> changelogs = mkSet(new TopicPartition("topic1", 0), new TopicPartition("topic1", 1), new TopicPartition("topic1", 2));
final StreamsBuilder streamsBuilder = new StreamsBuilder();
streamsBuilder.table("topic1", Materialized.as("store"));
final Properties props = new Properties();
props.putAll(configProps());
props.put(StreamsConfig.TOPOLOGY_OPTIMIZATION_CONFIG, StreamsConfig.OPTIMIZE);
builder = TopologyWrapper.getInternalTopologyBuilder(streamsBuilder.build(props));
topologyMetadata = new TopologyMetadata(builder, new StreamsConfig(props));
subscriptions.put("consumer10", new Subscription(singletonList("topic1"), defaultSubscriptionInfo.encode()));
createDefaultMockTaskManager();
configurePartitionAssignorWith(singletonMap(StreamsConfig.TOPOLOGY_OPTIMIZATION_CONFIG, StreamsConfig.OPTIMIZE));
overwriteInternalTopicManagerWithMock(false);
final Consumer<byte[], byte[]> consumerClient = referenceContainer.mainConsumer;
EasyMock.expect(consumerClient.committed(EasyMock.eq(changelogs))).andReturn(changelogs.stream().collect(Collectors.toMap(tp -> tp, tp -> new OffsetAndMetadata(Long.MAX_VALUE)))).once();
EasyMock.replay(consumerClient);
partitionAssignor.assign(metadata, new GroupSubscription(subscriptions));
EasyMock.verify(consumerClient);
}
Aggregations