16
16
*/
17
17
package org .apache .kafka .connect .mirror ;
18
18
19
- import org .apache .kafka .clients .admin .ConsumerGroupListing ;
19
+ import org .apache .kafka .clients .admin .GroupListing ;
20
20
import org .apache .kafka .clients .consumer .OffsetAndMetadata ;
21
+ import org .apache .kafka .clients .consumer .internals .ConsumerProtocol ;
22
+ import org .apache .kafka .common .GroupType ;
21
23
import org .apache .kafka .common .TopicPartition ;
22
24
import org .apache .kafka .connect .errors .ConnectException ;
23
25
import org .apache .kafka .connect .errors .RetriableException ;
31
33
import java .util .HashSet ;
32
34
import java .util .List ;
33
35
import java .util .Map ;
36
+ import java .util .Optional ;
34
37
import java .util .Set ;
35
38
import java .util .function .Function ;
36
39
import java .util .stream .Collectors ;
@@ -144,9 +147,9 @@ public void testFindConsumerGroups() throws Exception {
144
147
MirrorCheckpointConnector connector = new MirrorCheckpointConnector (Collections .emptySet (), config );
145
148
connector = spy (connector );
146
149
147
- Collection <ConsumerGroupListing > groups = Arrays .asList (
148
- new ConsumerGroupListing ("g1" , true ),
149
- new ConsumerGroupListing ("g2" , false ));
150
+ Collection <GroupListing > groups = Arrays .asList (
151
+ new GroupListing ("g1" , Optional . of ( GroupType . CLASSIC ), "" , Optional . empty () ),
152
+ new GroupListing ("g2" , Optional . of ( GroupType . CLASSIC ), ConsumerProtocol . PROTOCOL_TYPE , Optional . empty () ));
150
153
Map <TopicPartition , OffsetAndMetadata > offsets = new HashMap <>();
151
154
offsets .put (new TopicPartition ("t1" , 0 ), new OffsetAndMetadata (0 ));
152
155
doReturn (groups ).when (connector ).listConsumerGroups ();
@@ -159,7 +162,7 @@ public void testFindConsumerGroups() throws Exception {
159
162
doReturn (groupToOffsets ).when (connector ).listConsumerGroupOffsets (anyList ());
160
163
Set <String > groupFound = connector .findConsumerGroups ();
161
164
162
- Set <String > expectedGroups = groups .stream ().map (ConsumerGroupListing ::groupId ).collect (Collectors .toSet ());
165
+ Set <String > expectedGroups = groups .stream ().map (GroupListing ::groupId ).collect (Collectors .toSet ());
163
166
assertEquals (expectedGroups , groupFound ,
164
167
"Expected groups are not the same as findConsumerGroups" );
165
168
@@ -174,11 +177,11 @@ public void testFindConsumerGroupsInCommonScenarios() throws Exception {
174
177
MirrorCheckpointConnector connector = new MirrorCheckpointConnector (Collections .emptySet (), config );
175
178
connector = spy (connector );
176
179
177
- Collection <ConsumerGroupListing > groups = Arrays .asList (
178
- new ConsumerGroupListing ("g1" , true ),
179
- new ConsumerGroupListing ("g2" , false ),
180
- new ConsumerGroupListing ("g3" , false ),
181
- new ConsumerGroupListing ("g4" , false ));
180
+ Collection <GroupListing > groups = Arrays .asList (
181
+ new GroupListing ("g1" , Optional . of ( GroupType . CLASSIC ), "" , Optional . empty () ),
182
+ new GroupListing ("g2" , Optional . of ( GroupType . CLASSIC ), ConsumerProtocol . PROTOCOL_TYPE , Optional . empty () ),
183
+ new GroupListing ("g3" , Optional . of ( GroupType . CLASSIC ), ConsumerProtocol . PROTOCOL_TYPE , Optional . empty () ),
184
+ new GroupListing ("g4" , Optional . of ( GroupType . CLASSIC ), ConsumerProtocol . PROTOCOL_TYPE , Optional . empty () ));
182
185
Map <TopicPartition , OffsetAndMetadata > offsetsForGroup1 = new HashMap <>();
183
186
Map <TopicPartition , OffsetAndMetadata > offsetsForGroup2 = new HashMap <>();
184
187
Map <TopicPartition , OffsetAndMetadata > offsetsForGroup3 = new HashMap <>();
0 commit comments