From a41b35e3d6991d942dbbcf45d12f4f346c92c963 Mon Sep 17 00:00:00 2001 From: E046899 Date: Wed, 4 Oct 2023 13:29:59 +0200 Subject: [PATCH] Manage Confluent tags --- .../services/executors/TopicAsyncExecutorTest.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/michelin/ns4kafka/services/executors/TopicAsyncExecutorTest.java b/src/test/java/com/michelin/ns4kafka/services/executors/TopicAsyncExecutorTest.java index a95907fd..ec8baa93 100644 --- a/src/test/java/com/michelin/ns4kafka/services/executors/TopicAsyncExecutorTest.java +++ b/src/test/java/com/michelin/ns4kafka/services/executors/TopicAsyncExecutorTest.java @@ -19,6 +19,7 @@ import com.michelin.ns4kafka.services.clients.schema.entities.TagSpecs; import com.michelin.ns4kafka.services.clients.schema.entities.TagTopicInfo; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -53,11 +54,11 @@ void createTagsShouldAddTags() { Properties properties = new Properties(); properties.put(CLUSTER_ID, CLUSTER_ID_TEST); managedClusterProperties.setConfig(properties); - managedClusterProperties.setProvider(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD); when(schemaRegistryClient.addTags(anyString(), anyList())).thenReturn(Mono.just(new ArrayList<>())); when(managedClusterProperties.getConfig()).thenReturn(properties); when(managedClusterProperties.getName()).thenReturn(LOCAL_CLUSTER); + when(managedClusterProperties.getProvider()).thenReturn(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD); List ns4kafkaTopics = new ArrayList<>(); Topic ns4kafkaTopic = Topic.builder() @@ -72,7 +73,7 @@ void createTagsShouldAddTags() { .metadata(ObjectMeta.builder() .name(TOPIC_NAME).build()) .spec(Topic.TopicSpec.builder() - .tags(List.of(TAG2)).build()).build(); + .tags(Collections.emptyList()).build()).build(); brokerTopics.put(TOPIC_NAME, brokerTopic); topicAsyncExecutor.manageTags(ns4kafkaTopics, brokerTopics); @@ -91,7 +92,6 @@ void createTagsShouldNotAddTags() { Properties properties = new Properties(); properties.put(CLUSTER_ID, CLUSTER_ID_TEST); managedClusterProperties.setConfig(properties); - managedClusterProperties.setProvider(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD); List ns4kafkaTopics = new ArrayList<>(); Topic ns4kafkaTopic = Topic.builder() @@ -119,7 +119,6 @@ void deleteTagsShouldDeleteTags() { Properties properties = new Properties(); properties.put(CLUSTER_ID, CLUSTER_ID_TEST); managedClusterProperties.setConfig(properties); - managedClusterProperties.setProvider(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD); when(schemaRegistryClient.deleteTag(anyString(), anyString(), anyString())) .thenReturn(Mono.just(new HttpResponseMock())); @@ -153,7 +152,6 @@ void deleteTagsShouldNotDeleteTags() { Properties properties = new Properties(); properties.put(CLUSTER_ID, CLUSTER_ID_TEST); managedClusterProperties.setConfig(properties); - managedClusterProperties.setProvider(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD); List ns4kafkaTopics = new ArrayList<>(); Topic ns4kafkaTopic = Topic.builder() @@ -181,7 +179,6 @@ void completeWithTagsShouldComplete() { Properties properties = new Properties(); properties.put(CLUSTER_ID, CLUSTER_ID_TEST); managedClusterProperties.setConfig(properties); - managedClusterProperties.setProvider(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD); TagTopicInfo tagTopicInfo = TagTopicInfo.builder().typeName(TAG1).build(); @@ -208,7 +205,6 @@ void completeWithTagsShouldNotComplete() { Properties properties = new Properties(); properties.put(CLUSTER_ID, CLUSTER_ID_TEST); managedClusterProperties.setConfig(properties); - managedClusterProperties.setProvider(ManagedClusterProperties.KafkaProvider.CONFLUENT_CLOUD); when(managedClusterProperties.getProvider()).thenReturn(ManagedClusterProperties.KafkaProvider.SELF_MANAGED);