16
16
*/
17
17
package org .apache .kafka .coordinator .group .streams ;
18
18
19
- import org .apache .kafka .common .TopicPartition ;
20
19
import org .apache .kafka .common .Uuid ;
21
20
import org .apache .kafka .common .errors .GroupNotEmptyException ;
22
21
import org .apache .kafka .common .errors .StaleMemberEpochException ;
43
42
import org .apache .kafka .coordinator .group .generated .StreamsGroupTargetAssignmentMetadataKey ;
44
43
import org .apache .kafka .coordinator .group .generated .StreamsGroupTopologyKey ;
45
44
import org .apache .kafka .coordinator .group .generated .StreamsGroupTopologyValue ;
46
- import org .apache .kafka .coordinator .group .metrics .GroupCoordinatorMetricsShard ;
47
45
import org .apache .kafka .coordinator .group .streams .StreamsGroup .StreamsGroupState ;
48
46
import org .apache .kafka .coordinator .group .streams .TaskAssignmentTestUtil .TaskRole ;
49
47
import org .apache .kafka .coordinator .group .streams .topics .ConfiguredTopology ;
@@ -90,8 +88,7 @@ private StreamsGroup createStreamsGroup(String groupId) {
90
88
return new StreamsGroup (
91
89
LOG_CONTEXT ,
92
90
snapshotRegistry ,
93
- groupId ,
94
- mock (GroupCoordinatorMetricsShard .class )
91
+ groupId
95
92
);
96
93
}
97
94
@@ -693,8 +690,7 @@ public void testAsListedGroup() {
693
690
StreamsGroup group = new StreamsGroup (
694
691
LOG_CONTEXT ,
695
692
snapshotRegistry ,
696
- "group-foo" ,
697
- mock (GroupCoordinatorMetricsShard .class )
693
+ "group-foo"
698
694
);
699
695
group .setGroupEpoch (1 );
700
696
group .setTopology (new StreamsTopology (1 , Map .of ()));
@@ -719,8 +715,7 @@ public void testValidateOffsetFetch() {
719
715
StreamsGroup group = new StreamsGroup (
720
716
LOG_CONTEXT ,
721
717
snapshotRegistry ,
722
- "group-foo" ,
723
- mock (GroupCoordinatorMetricsShard .class )
718
+ "group-foo"
724
719
);
725
720
726
721
// Simulate a call from the admin client without member ID and member epoch.
@@ -790,7 +785,7 @@ public void testOffsetExpirationCondition() {
790
785
long commitTimestamp = 20000L ;
791
786
long offsetsRetentionMs = 10000L ;
792
787
OffsetAndMetadata offsetAndMetadata = new OffsetAndMetadata (15000L , OptionalInt .empty (), "" , commitTimestamp , OptionalLong .empty (), Uuid .ZERO_UUID );
793
- StreamsGroup group = new StreamsGroup (LOG_CONTEXT , new SnapshotRegistry (LOG_CONTEXT ), "group-id" , mock ( GroupCoordinatorMetricsShard . class ) );
788
+ StreamsGroup group = new StreamsGroup (LOG_CONTEXT , new SnapshotRegistry (LOG_CONTEXT ), "group-id" );
794
789
795
790
Optional <OffsetExpirationCondition > offsetExpirationCondition = group .offsetExpirationCondition ();
796
791
assertTrue (offsetExpirationCondition .isPresent ());
@@ -803,7 +798,7 @@ public void testOffsetExpirationCondition() {
803
798
@ Test
804
799
public void testAsDescribedGroup () {
805
800
SnapshotRegistry snapshotRegistry = new SnapshotRegistry (new LogContext ());
806
- StreamsGroup group = new StreamsGroup (LOG_CONTEXT , snapshotRegistry , "group-id-1" , mock ( GroupCoordinatorMetricsShard . class ) );
801
+ StreamsGroup group = new StreamsGroup (LOG_CONTEXT , snapshotRegistry , "group-id-1" );
807
802
snapshotRegistry .idempotentCreateSnapshot (0 );
808
803
assertEquals (StreamsGroup .StreamsGroupState .EMPTY .toString (), group .stateAsString (0 ));
809
804
@@ -887,12 +882,7 @@ public void testAsDescribedGroup() {
887
882
@ Test
888
883
public void testIsInStatesCaseInsensitiveAndUnderscored () {
889
884
SnapshotRegistry snapshotRegistry = new SnapshotRegistry (LOG_CONTEXT );
890
- GroupCoordinatorMetricsShard metricsShard = new GroupCoordinatorMetricsShard (
891
- snapshotRegistry ,
892
- Map .of (),
893
- new TopicPartition ("__consumer_offsets" , 0 )
894
- );
895
- StreamsGroup group = new StreamsGroup (LOG_CONTEXT , snapshotRegistry , "group-foo" , metricsShard );
885
+ StreamsGroup group = new StreamsGroup (LOG_CONTEXT , snapshotRegistry , "group-foo" );
896
886
snapshotRegistry .idempotentCreateSnapshot (0 );
897
887
assertTrue (group .isInStates (Set .of ("empty" ), 0 ));
898
888
assertFalse (group .isInStates (Set .of ("Empty" ), 0 ));
@@ -911,8 +901,7 @@ public void testComputeMetadataHash() {
911
901
StreamsGroup streamsGroup = new StreamsGroup (
912
902
LOG_CONTEXT ,
913
903
snapshotRegistry ,
914
- "group-foo" ,
915
- mock (GroupCoordinatorMetricsShard .class )
904
+ "group-foo"
916
905
);
917
906
918
907
MetadataImage metadataImage = new MetadataImageBuilder ()
@@ -933,8 +922,7 @@ void testCreateGroupTombstoneRecords() {
933
922
StreamsGroup streamsGroup = new StreamsGroup (
934
923
LOG_CONTEXT ,
935
924
snapshotRegistry ,
936
- "test-group" ,
937
- mock (GroupCoordinatorMetricsShard .class )
925
+ "test-group"
938
926
);
939
927
streamsGroup .updateMember (new StreamsGroupMember .Builder ("member1" )
940
928
.setMemberEpoch (1 )
@@ -961,8 +949,7 @@ void testCreateGroupTombstoneRecords() {
961
949
public void testIsSubscribedToTopic () {
962
950
LogContext logContext = new LogContext ();
963
951
SnapshotRegistry snapshotRegistry = new SnapshotRegistry (logContext );
964
- GroupCoordinatorMetricsShard metricsShard = mock (GroupCoordinatorMetricsShard .class );
965
- StreamsGroup streamsGroup = new StreamsGroup (logContext , snapshotRegistry , "test-group" , metricsShard );
952
+ StreamsGroup streamsGroup = new StreamsGroup (logContext , snapshotRegistry , "test-group" );
966
953
967
954
assertFalse (streamsGroup .isSubscribedToTopic ("test-topic1" ));
968
955
assertFalse (streamsGroup .isSubscribedToTopic ("test-topic2" ));
@@ -1008,8 +995,7 @@ public void testShutdownRequestedMethods() {
1008
995
String memberId2 = "test-member-id2" ;
1009
996
LogContext logContext = new LogContext ();
1010
997
SnapshotRegistry snapshotRegistry = new SnapshotRegistry (logContext );
1011
- GroupCoordinatorMetricsShard metricsShard = mock (GroupCoordinatorMetricsShard .class );
1012
- StreamsGroup streamsGroup = new StreamsGroup (logContext , snapshotRegistry , "test-group" , metricsShard );
998
+ StreamsGroup streamsGroup = new StreamsGroup (logContext , snapshotRegistry , "test-group" );
1013
999
1014
1000
streamsGroup .updateMember (streamsGroup .getOrCreateDefaultMember (memberId1 ));
1015
1001
streamsGroup .updateMember (streamsGroup .getOrCreateDefaultMember (memberId2 ));
0 commit comments