From 8d6297c2b1b3279af386e7d855e9df110c8cb894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Strong=20Liu=28=E5=88=98=E5=B0=91=E5=A3=AE=29?= Date: Sun, 26 Sep 2021 18:00:04 +0800 Subject: [PATCH] prefer api from project-reactor instead of creating our own wheel --- .../DefaultEventHubProvisioner.java | 8 +-- .../DefaultServiceBusQueueProvisioner.java | 4 +- .../DefaultServiceBusTopicProvisioner.java | 7 +-- sdk/spring/azure-spring-cloud-core/pom.xml | 6 ++ .../com/azure/spring/core/util/Memoizer.java | 10 +-- .../com/azure/spring/core/util/Triple.java | 61 ------------------- .../com/azure/spring/core/util/Tuple.java | 52 ---------------- .../cloud/context/core/MemoizerTest.java | 4 +- .../crud/EventHubConsumerGroupCrud.java | 25 ++++---- .../implementation/crud/EventHubCrud.java | 20 +++--- .../crud/ServiceBusQueueCrud.java | 20 +++--- .../crud/ServiceBusTopicCrud.java | 20 +++--- .../crud/ServiceBusTopicSubscriptionCrud.java | 22 +++---- .../core/DefaultEventHubClientFactory.java | 13 ++-- .../eventhubs/core/EventHubRxTemplate.java | 7 ++- .../eventhubs/core/EventHubTemplate.java | 9 +-- .../support/RxEventHubTestOperation.java | 7 ++- .../DefaultServiceBusTopicClientFactory.java | 11 ++-- .../core/topic/ServiceBusTopicTemplate.java | 9 +-- 19 files changed, 108 insertions(+), 207 deletions(-) delete mode 100644 sdk/spring/azure-spring-cloud-core/src/main/java/com/azure/spring/core/util/Triple.java delete mode 100644 sdk/spring/azure-spring-cloud-core/src/main/java/com/azure/spring/core/util/Tuple.java diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhub/resourcemanager/DefaultEventHubProvisioner.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhub/resourcemanager/DefaultEventHubProvisioner.java index e1ec79bc031de..284786cf70622 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhub/resourcemanager/DefaultEventHubProvisioner.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/eventhub/resourcemanager/DefaultEventHubProvisioner.java @@ -8,9 +8,9 @@ import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubCrud; import com.azure.spring.cloud.resourcemanager.implementation.crud.EventHubNamespaceCrud; import com.azure.spring.core.properties.resource.AzureResourceMetadata; -import com.azure.spring.core.util.Triple; -import com.azure.spring.core.util.Tuple; import com.azure.spring.eventhubs.core.EventHubProvisioner; +import reactor.util.function.Tuple2; +import reactor.util.function.Tuples; /** * Default implementation to provision an Event Hub. @@ -35,12 +35,12 @@ public void provisionNamespace(String namespace) { @Override public void provisionEventHub(String namespace, String eventHub) { - this.eventHubCrud.getOrCreate(Tuple.of(namespace, eventHub)); + this.eventHubCrud.getOrCreate(Tuples.of(namespace, eventHub)); } @Override public void provisionConsumerGroup(String namespace, String eventHub, String consumerGroup) { - this.consumerGroupCrud.getOrCreate(Triple.of(namespace, eventHub, consumerGroup)); + this.consumerGroupCrud.getOrCreate(Tuples.of(namespace, eventHub, consumerGroup)); } } diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusQueueProvisioner.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusQueueProvisioner.java index 4ae0e24518d6b..d90f888ed96e9 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusQueueProvisioner.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusQueueProvisioner.java @@ -6,8 +6,8 @@ import com.azure.resourcemanager.AzureResourceManager; import com.azure.spring.cloud.resourcemanager.implementation.crud.ServiceBusQueueCrud; import com.azure.spring.core.properties.resource.AzureResourceMetadata; -import com.azure.spring.core.util.Tuple; import com.azure.spring.servicebus.core.ServiceBusQueueProvisioner; +import reactor.util.function.Tuples; /** * A default implementation to provision Service Bus Queue. @@ -23,7 +23,7 @@ public DefaultServiceBusQueueProvisioner(AzureResourceManager azureResourceManag @Override public void provisionQueue(String namespace, String queue) { - this.serviceBusQueueCrud.getOrCreate(Tuple.of(namespace, queue)); + this.serviceBusQueueCrud.getOrCreate(Tuples.of(namespace, queue)); } } diff --git a/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusTopicProvisioner.java b/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusTopicProvisioner.java index 2363e7b409b20..dce1e972209c0 100644 --- a/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusTopicProvisioner.java +++ b/sdk/spring/azure-spring-cloud-autoconfigure/src/main/java/com/azure/spring/cloud/autoconfigure/servicebus/resourcemanager/DefaultServiceBusTopicProvisioner.java @@ -7,9 +7,8 @@ import com.azure.spring.cloud.resourcemanager.implementation.crud.ServiceBusTopicCrud; import com.azure.spring.cloud.resourcemanager.implementation.crud.ServiceBusTopicSubscriptionCrud; import com.azure.spring.core.properties.resource.AzureResourceMetadata; -import com.azure.spring.core.util.Triple; -import com.azure.spring.core.util.Tuple; import com.azure.spring.servicebus.core.ServiceBusTopicProvisioner; +import reactor.util.function.Tuples; /** * A default implementation to provision Service Bus Topic. @@ -27,11 +26,11 @@ public DefaultServiceBusTopicProvisioner(AzureResourceManager azureResourceManag @Override public void provisionTopic(String namespace, String topic) { - this.topicCrud.getOrCreate(Tuple.of(namespace, topic)); + this.topicCrud.getOrCreate(Tuples.of(namespace, topic)); } @Override public void provisionSubscription(String namespace, String topic, String subscription) { - this.subscriptionCrud.getOrCreate(Triple.of(namespace, topic, subscription)); + this.subscriptionCrud.getOrCreate(Tuples.of(namespace, topic, subscription)); } } diff --git a/sdk/spring/azure-spring-cloud-core/pom.xml b/sdk/spring/azure-spring-cloud-core/pom.xml index 955b33ed0220b..fdcf5dc9a1ddf 100644 --- a/sdk/spring/azure-spring-cloud-core/pom.xml +++ b/sdk/spring/azure-spring-cloud-core/pom.xml @@ -64,6 +64,12 @@ 5.7.2 test + + org.springframework + spring-test + 5.3.9 + test +