From 71285e245e24efd132c833c9c2dd0c25d0b6926a Mon Sep 17 00:00:00 2001 From: hui Date: Thu, 30 Jun 2022 09:43:15 +0800 Subject: [PATCH] fix api review comment --- .../cloud/core/provider/AzureProfileOptionsProvider.java | 2 +- .../implementation/kafka/AzureKafkaPropertiesUtils.java | 2 +- .../implementation/kafka/AzureKafkaPropertiesUtilsTest.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java index 959c5c9a76eed..118da9aa1ff16 100644 --- a/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java +++ b/sdk/spring/spring-cloud-azure-core/src/main/java/com/azure/spring/cloud/core/provider/AzureProfileOptionsProvider.java @@ -95,7 +95,7 @@ private static Map initMap() { * @param cloudType the cloud type string value * @return the {@link CloudType} */ - public static CloudType get(String cloudType) { + public static CloudType fromString(String cloudType) { return CLOUD_TYPE_MAP.get(cloudType.toUpperCase(Locale.ROOT)); } } diff --git a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtils.java b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtils.java index 93149a8ab4818..71ece517e01ac 100644 --- a/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtils.java +++ b/sdk/spring/spring-cloud-azure-service/src/main/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtils.java @@ -69,7 +69,7 @@ enum Mapping { (p, s) -> p.getCredential().setUsername(s)), cloudType(PROFILE_PREFIX + "cloud-type", p -> p.getProfile().getCloudType().name(), - (p, s) -> p.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.get(s))), + (p, s) -> p.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.fromString(s))), activeDirectoryEndpoint(ENVIRONMENT_PREFIX + "active-directory-endpoint", p -> p.getProfile().getEnvironment().getActiveDirectoryEndpoint(), diff --git a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtilsTest.java b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtilsTest.java index e7406b8a70814..73cec1abdf3c5 100644 --- a/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtilsTest.java +++ b/sdk/spring/spring-cloud-azure-service/src/test/java/com/azure/spring/cloud/service/implementation/kafka/AzureKafkaPropertiesUtilsTest.java @@ -37,7 +37,7 @@ void testConvertConfigMapToAzureProperties() { assertTrue(Boolean.valueOf(mapping.getter().apply(properties))); } else if (mapping == AzureKafkaPropertiesUtils.Mapping.cloudType) { assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_CHINA, - AzureProfileOptionsProvider.CloudType.get(mapping.getter().apply(properties))); + AzureProfileOptionsProvider.CloudType.fromString(mapping.getter().apply(properties))); } else { assertEquals(mapping.propertyKey() + ".test", mapping.getter().apply(properties)); } @@ -61,7 +61,7 @@ void testConvertAzurePropertiesToConfigMapWithCustomValues() { assertFalse(Boolean.valueOf(customKafkaConfigs.get(mapping.propertyKey()))); } else if (mapping == AzureKafkaPropertiesUtils.Mapping.cloudType) { assertEquals(AzureProfileOptionsProvider.CloudType.AZURE, - AzureProfileOptionsProvider.CloudType.get(customKafkaConfigs.get(mapping.propertyKey()))); + AzureProfileOptionsProvider.CloudType.fromString(customKafkaConfigs.get(mapping.propertyKey()))); } else { assertEquals(mapping.propertyKey() + ".override", customKafkaConfigs.get(mapping.propertyKey())); } @@ -81,7 +81,7 @@ void testConvertAzurePropertiesToConfigMapWithoutCustomValues() { assertTrue(Boolean.valueOf(customKafkaConfigs.get(mapping.propertyKey()))); } else if (mapping == AzureKafkaPropertiesUtils.Mapping.cloudType) { assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_CHINA, - AzureProfileOptionsProvider.CloudType.get(customKafkaConfigs.get(mapping.propertyKey()))); + AzureProfileOptionsProvider.CloudType.fromString(customKafkaConfigs.get(mapping.propertyKey()))); } else { assertEquals(mapping.propertyKey() + ".test", customKafkaConfigs.get(mapping.propertyKey())); }