14
14
15
15
import com .michelin .ns4kafka .model .Metadata ;
16
16
import com .michelin .ns4kafka .model .Topic ;
17
+ import com .michelin .ns4kafka .property .ConfluentCloudProperties ;
18
+ import com .michelin .ns4kafka .property .ConfluentCloudProperties .StreamCatalogProperties ;
17
19
import com .michelin .ns4kafka .property .ManagedClusterProperties ;
18
20
import com .michelin .ns4kafka .repository .TopicRepository ;
19
21
import com .michelin .ns4kafka .service .client .schema .SchemaRegistryClient ;
@@ -59,6 +61,12 @@ class TopicAsyncExecutorTest {
59
61
@ Mock
60
62
ManagedClusterProperties managedClusterProperties ;
61
63
64
+ @ Mock
65
+ ConfluentCloudProperties confluentCloudProperties ;
66
+
67
+ @ Mock
68
+ StreamCatalogProperties streamCatalogProperties ;
69
+
62
70
@ Mock
63
71
TopicRepository topicRepository ;
64
72
@@ -428,6 +436,10 @@ void shouldNotEnrichWithCatalogInfoWhenNotConfluentCloud() {
428
436
void shouldEnrichWithCatalogInfoWhenConfluentCloud () {
429
437
when (managedClusterProperties .isConfluentCloud ()).thenReturn (true );
430
438
when (managedClusterProperties .getName ()).thenReturn (LOCAL_CLUSTER );
439
+ when (confluentCloudProperties .getStreamCatalog ()).thenReturn (streamCatalogProperties );
440
+ when (streamCatalogProperties .getPageSize ()).thenReturn (500 );
441
+
442
+ int limit = 500 ;
431
443
432
444
TopicEntity entity = TopicEntity .builder ()
433
445
.classificationNames (List .of (TAG1 ))
@@ -439,9 +451,9 @@ void shouldEnrichWithCatalogInfoWhenConfluentCloud() {
439
451
TopicListResponse response1 = TopicListResponse .builder ().entities (List .of (entity )).build ();
440
452
TopicListResponse response2 = TopicListResponse .builder ().entities (List .of ()).build ();
441
453
442
- when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , 5000 , 0 ))
454
+ when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , limit , 0 ))
443
455
.thenReturn (Mono .just (response1 ));
444
- when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , 5000 , 5000 ))
456
+ when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , limit , limit ))
445
457
.thenReturn (Mono .just (response2 ));
446
458
447
459
Map <String , Topic > brokerTopics = Map .of (
@@ -463,6 +475,10 @@ void shouldEnrichWithCatalogInfoWhenConfluentCloud() {
463
475
void shouldEnrichWithCatalogInfoForMultipleTopics () {
464
476
when (managedClusterProperties .isConfluentCloud ()).thenReturn (true );
465
477
when (managedClusterProperties .getName ()).thenReturn (LOCAL_CLUSTER );
478
+ when (confluentCloudProperties .getStreamCatalog ()).thenReturn (streamCatalogProperties );
479
+ when (streamCatalogProperties .getPageSize ()).thenReturn (500 );
480
+
481
+ int limit = 500 ;
466
482
467
483
TopicEntity entity1 = TopicEntity .builder ()
468
484
.classificationNames (List .of ())
@@ -500,9 +516,9 @@ void shouldEnrichWithCatalogInfoForMultipleTopics() {
500
516
.entities (List .of (entity1 , entity2 , entity3 , entity4 )).build ();
501
517
TopicListResponse response2 = TopicListResponse .builder ().entities (List .of ()).build ();
502
518
503
- when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , 5000 , 0 ))
519
+ when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , limit , 0 ))
504
520
.thenReturn (Mono .just (response1 ));
505
- when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , 5000 , 5000 ))
521
+ when (schemaRegistryClient .getTopicWithCatalogInfo (LOCAL_CLUSTER , limit , limit ))
506
522
.thenReturn (Mono .just (response2 ));
507
523
508
524
Map <String , Topic > brokerTopics = Map .of (
@@ -553,6 +569,8 @@ void shouldEnrichWithCatalogInfoForMultipleTopics() {
553
569
void shouldEnrichWithCatalogInfoWhenConfluentCloudAndResponseIsNull () {
554
570
when (managedClusterProperties .isConfluentCloud ()).thenReturn (true );
555
571
when (managedClusterProperties .getName ()).thenReturn (LOCAL_CLUSTER );
572
+ when (confluentCloudProperties .getStreamCatalog ()).thenReturn (streamCatalogProperties );
573
+ when (streamCatalogProperties .getPageSize ()).thenReturn (500 );
556
574
when (schemaRegistryClient .getTopicWithCatalogInfo (anyString (), any (Integer .class ), any (Integer .class )))
557
575
.thenReturn (Mono .empty ());
558
576
0 commit comments