Skip to content

Commit

Permalink
fix api review comment (#29710)
Browse files Browse the repository at this point in the history
  • Loading branch information
hui1110 authored Jun 30, 2022
1 parent 7717ca5 commit a68b1eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static Map<String, CloudType> 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));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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()));
}
Expand All @@ -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()));
}
Expand Down

0 comments on commit a68b1eb

Please sign in to comment.