From 0588184d19e8f3b29413fcc6f37933e4fa357663 Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Fri, 6 Sep 2024 23:15:17 +0800 Subject: [PATCH 1/8] fix aws credentials Signed-off-by: Smith Cruise --- .../credential/aws/AWSCloudCredential.java | 2 +- .../aws/AWSDefaultCredentialsProvider.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSDefaultCredentialsProvider.java diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java index 51fbb61a7f7d9..6caeaf0d182ee 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java @@ -82,7 +82,7 @@ public class AWSCloudCredential implements CloudCredential { private static final Logger LOG = LoggerFactory.getLogger(AWSCloudCredential.class); - private static final String DEFAULT_CREDENTIAL_PROVIDER = DefaultCredentialsProvider.class.getName(); + private static final String DEFAULT_CREDENTIAL_PROVIDER = AWSDefaultCredentialsProvider.class.getName(); private static final String IAM_CREDENTIAL_PROVIDER = IAMInstanceCredentialsProvider.class.getName(); private static final String ASSUME_ROLE_CREDENTIAL_PROVIDER = AssumedRoleCredentialProvider.class.getName(); private static final String SIMPLE_CREDENTIAL_PROVIDER = SimpleAWSCredentialsProvider.class.getName(); diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSDefaultCredentialsProvider.java b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSDefaultCredentialsProvider.java new file mode 100644 index 0000000000000..c33299ff61fa2 --- /dev/null +++ b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSDefaultCredentialsProvider.java @@ -0,0 +1,30 @@ +// Copyright 2021-present StarRocks, Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.starrocks.credential.aws; + +import software.amazon.awssdk.auth.credentials.AwsCredentials; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; + +public class AWSDefaultCredentialsProvider implements AwsCredentialsProvider { + public static DefaultCredentialsProvider create() { + return DefaultCredentialsProvider.builder().build(); + } + + @Override + public AwsCredentials resolveCredentials() { + return null; + } +} From 885d7b61c3ef1331d8623b606119d4b13df86148 Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Tue, 10 Sep 2024 14:26:31 +0800 Subject: [PATCH 2/8] add ut Signed-off-by: Smith Cruise --- .../credential/aws/AWSCloudCredential.java | 1 + .../AWSDefaultCredentialsProvider.java | 11 ++++++++- .../credential/AWSCloudConfigurationTest.java | 24 ++++++++++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) rename fe/fe-core/src/main/java/com/starrocks/credential/{aws => provider}/AWSDefaultCredentialsProvider.java (59%) diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java index 6caeaf0d182ee..9c149612b5ebd 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java @@ -25,6 +25,7 @@ import com.staros.proto.S3FileStoreInfo; import com.starrocks.connector.share.credential.CloudConfigurationConstants; import com.starrocks.credential.CloudCredential; +import com.starrocks.credential.provider.AWSDefaultCredentialsProvider; import com.starrocks.credential.provider.AssumedRoleCredentialProvider; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.s3a.Constants; diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSDefaultCredentialsProvider.java b/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java similarity index 59% rename from fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSDefaultCredentialsProvider.java rename to fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java index c33299ff61fa2..d8d48cb387548 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSDefaultCredentialsProvider.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java @@ -12,12 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.starrocks.credential.aws; +package com.starrocks.credential.provider; import software.amazon.awssdk.auth.credentials.AwsCredentials; import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; +// We have to implement DefaultCredentialsProvider by ourselves, +// otherwise we may face "java.lang.IllegalStateException: Connection pool shut down" error. +// +// Hadoop S3AFileSystem will call `static AwsCredentialsProvider::create()` to create CredentialsProvider +// But in DefaultCredentialsProvider::create(), it will only return a global static variable +// If we close S3AFileSystem, it will also close CredentialsProvider. +// For the next time we create a new S3AFileSystem, it will reuse previous closed CredentialsProvider, then error will be thrown +// You can check details in link: +// https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/troubleshooting.html#faq-connection-pool-shutdown-exception public class AWSDefaultCredentialsProvider implements AwsCredentialsProvider { public static DefaultCredentialsProvider create() { return DefaultCredentialsProvider.builder().build(); diff --git a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java index d8544bbe7362a..479b9c833d94e 100644 --- a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java @@ -18,17 +18,23 @@ import com.starrocks.credential.aws.AWSCloudConfiguration; import com.starrocks.credential.aws.AWSCloudCredential; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.s3a.AWSCredentialProviderList; +import org.apache.hadoop.fs.s3a.S3AFileSystem; import org.apache.hadoop.hive.conf.HiveConf; import org.junit.Assert; import org.junit.Test; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; public class AWSCloudConfigurationTest { @Test - public void testUseAWSSDKDefaultBehavior() { + public void testUseAWSSDKDefaultBehavior() throws Exception { // Test hadoop configuration Map properties = new HashMap<>(); properties.put("aws.s3.use_aws_sdk_default_behavior", "true"); @@ -36,8 +42,20 @@ public void testUseAWSSDKDefaultBehavior() { Assert.assertNotNull(cloudConfiguration); Configuration configuration = new Configuration(); cloudConfiguration.applyToConfiguration(configuration); - Assert.assertEquals("software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider", + Assert.assertEquals("com.starrocks.credential.provider.AWSDefaultCredentialsProvider", configuration.get("fs.s3a.aws.credentials.provider")); + S3AFileSystem fs = (S3AFileSystem) FileSystem.get(new URI("s3://hi/a.parquet"), configuration); + AWSCredentialProviderList list = fs.shareCredentials("ut"); + int previousHashCode = list.getProviders().get(0).hashCode(); + fs.close(); + + fs = (S3AFileSystem) FileSystem.get(new URI("s3://hi/a.parquet"), configuration); + list = fs.shareCredentials("ut"); + int currentHashCode = list.getProviders().get(0).hashCode(); + fs.close(); + + // Make sure two DefaultCredentialsProviders are different instances + Assert.assertTrue(previousHashCode != currentHashCode); } @Test @@ -50,7 +68,7 @@ public void testUseAWSSDKDefaultBehaviorPlusAssumeRole() { Assert.assertNotNull(cloudConfiguration); Configuration configuration = new Configuration(); cloudConfiguration.applyToConfiguration(configuration); - Assert.assertEquals("software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider", + Assert.assertEquals("com.starrocks.credential.provider.AWSDefaultCredentialsProvider", configuration.get("fs.s3a.assumed.role.credentials.provider")); Assert.assertEquals("com.starrocks.credential.provider.AssumedRoleCredentialProvider", configuration.get("fs.s3a.aws.credentials.provider")); From d99c0b32f4015ad270448365eabd64bb6e19f4cf Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Tue, 10 Sep 2024 14:28:55 +0800 Subject: [PATCH 3/8] add ut Signed-off-by: Smith Cruise --- .../com/starrocks/credential/AWSCloudConfigurationTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java index 479b9c833d94e..976937fe68f24 100644 --- a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java @@ -25,9 +25,7 @@ import org.junit.Assert; import org.junit.Test; -import java.io.IOException; import java.net.URI; -import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; From c16fc9bbd43a2535b4bfb778e1bad20db1a277be Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Tue, 10 Sep 2024 14:33:24 +0800 Subject: [PATCH 4/8] format Signed-off-by: Smith Cruise --- .../credential/provider/AWSDefaultCredentialsProvider.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java b/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java index d8d48cb387548..b00396306cc61 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java @@ -21,8 +21,8 @@ // We have to implement DefaultCredentialsProvider by ourselves, // otherwise we may face "java.lang.IllegalStateException: Connection pool shut down" error. // -// Hadoop S3AFileSystem will call `static AwsCredentialsProvider::create()` to create CredentialsProvider -// But in DefaultCredentialsProvider::create(), it will only return a global static variable +// Hadoop S3AFileSystem will call `static AwsCredentialsProvider::create()` to create CredentialsProvider. +// But in DefaultCredentialsProvider::create(), it will only return a global static variable. // If we close S3AFileSystem, it will also close CredentialsProvider. // For the next time we create a new S3AFileSystem, it will reuse previous closed CredentialsProvider, then error will be thrown // You can check details in link: From 022865d08bfc587b314d8ad1e070d17ff5d4cfd1 Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Mon, 23 Sep 2024 10:55:40 +0800 Subject: [PATCH 5/8] add ut Signed-off-by: Smith Cruise --- .../starrocks/credential/AWSCloudConfigurationTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java index 976937fe68f24..fe7adb876af7b 100644 --- a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java @@ -17,6 +17,7 @@ import com.staros.proto.FileStoreInfo; import com.starrocks.credential.aws.AWSCloudConfiguration; import com.starrocks.credential.aws.AWSCloudCredential; +import com.starrocks.credential.provider.AWSDefaultCredentialsProvider; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.s3a.AWSCredentialProviderList; @@ -56,6 +57,12 @@ public void testUseAWSSDKDefaultBehavior() throws Exception { Assert.assertTrue(previousHashCode != currentHashCode); } + @Test + public void testAWSDefaultCredentialsProvider() { + AWSDefaultCredentialsProvider provider = new AWSDefaultCredentialsProvider(); + Assert.assertNull(provider.resolveCredentials()); + } + @Test public void testUseAWSSDKDefaultBehaviorPlusAssumeRole() { // Test hadoop configuration From 0159e76cb6f23df046776d06ce85654780e8b7bb Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Mon, 23 Sep 2024 12:47:23 +0800 Subject: [PATCH 6/8] add ut Signed-off-by: Smith Cruise --- .../credential/aws/AWSCloudCredential.java | 4 ++-- ... OverwriteAwsDefaultCredentialsProvider.java} | 16 ++++++++++++++-- .../credential/AWSCloudConfigurationTest.java | 13 ++++++++----- 3 files changed, 24 insertions(+), 9 deletions(-) rename fe/fe-core/src/main/java/com/starrocks/credential/provider/{AWSDefaultCredentialsProvider.java => OverwriteAwsDefaultCredentialsProvider.java} (78%) diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java index 9c149612b5ebd..afeed9b77af56 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java @@ -25,8 +25,8 @@ import com.staros.proto.S3FileStoreInfo; import com.starrocks.connector.share.credential.CloudConfigurationConstants; import com.starrocks.credential.CloudCredential; -import com.starrocks.credential.provider.AWSDefaultCredentialsProvider; import com.starrocks.credential.provider.AssumedRoleCredentialProvider; +import com.starrocks.credential.provider.OverwriteAwsDefaultCredentialsProvider; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.s3a.Constants; import org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider; @@ -83,7 +83,7 @@ public class AWSCloudCredential implements CloudCredential { private static final Logger LOG = LoggerFactory.getLogger(AWSCloudCredential.class); - private static final String DEFAULT_CREDENTIAL_PROVIDER = AWSDefaultCredentialsProvider.class.getName(); + private static final String DEFAULT_CREDENTIAL_PROVIDER = OverwriteAwsDefaultCredentialsProvider.class.getName(); private static final String IAM_CREDENTIAL_PROVIDER = IAMInstanceCredentialsProvider.class.getName(); private static final String ASSUME_ROLE_CREDENTIAL_PROVIDER = AssumedRoleCredentialProvider.class.getName(); private static final String SIMPLE_CREDENTIAL_PROVIDER = SimpleAWSCredentialsProvider.class.getName(); diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java b/fe/fe-core/src/main/java/com/starrocks/credential/provider/OverwriteAwsDefaultCredentialsProvider.java similarity index 78% rename from fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java rename to fe/fe-core/src/main/java/com/starrocks/credential/provider/OverwriteAwsDefaultCredentialsProvider.java index b00396306cc61..ba69d522d2cb5 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/provider/AWSDefaultCredentialsProvider.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/provider/OverwriteAwsDefaultCredentialsProvider.java @@ -27,13 +27,25 @@ // For the next time we create a new S3AFileSystem, it will reuse previous closed CredentialsProvider, then error will be thrown // You can check details in link: // https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/troubleshooting.html#faq-connection-pool-shutdown-exception -public class AWSDefaultCredentialsProvider implements AwsCredentialsProvider { +public class OverwriteAwsDefaultCredentialsProvider implements AwsCredentialsProvider { public static DefaultCredentialsProvider create() { return DefaultCredentialsProvider.builder().build(); } + // We should not call this function, here will return an anonymous credentials @Override public AwsCredentials resolveCredentials() { - return null; + // Defense code, return anonymous credentials + return new AwsCredentials() { + @Override + public String accessKeyId() { + return null; + } + + @Override + public String secretAccessKey() { + return null; + } + }; } } diff --git a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java index fe7adb876af7b..28a131bcebae6 100644 --- a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java @@ -17,7 +17,7 @@ import com.staros.proto.FileStoreInfo; import com.starrocks.credential.aws.AWSCloudConfiguration; import com.starrocks.credential.aws.AWSCloudCredential; -import com.starrocks.credential.provider.AWSDefaultCredentialsProvider; +import com.starrocks.credential.provider.OverwriteAwsDefaultCredentialsProvider; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.s3a.AWSCredentialProviderList; @@ -25,6 +25,7 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.junit.Assert; import org.junit.Test; +import software.amazon.awssdk.auth.credentials.AwsCredentials; import java.net.URI; import java.util.HashMap; @@ -41,7 +42,7 @@ public void testUseAWSSDKDefaultBehavior() throws Exception { Assert.assertNotNull(cloudConfiguration); Configuration configuration = new Configuration(); cloudConfiguration.applyToConfiguration(configuration); - Assert.assertEquals("com.starrocks.credential.provider.AWSDefaultCredentialsProvider", + Assert.assertEquals(OverwriteAwsDefaultCredentialsProvider.class.getName(), configuration.get("fs.s3a.aws.credentials.provider")); S3AFileSystem fs = (S3AFileSystem) FileSystem.get(new URI("s3://hi/a.parquet"), configuration); AWSCredentialProviderList list = fs.shareCredentials("ut"); @@ -59,8 +60,10 @@ public void testUseAWSSDKDefaultBehavior() throws Exception { @Test public void testAWSDefaultCredentialsProvider() { - AWSDefaultCredentialsProvider provider = new AWSDefaultCredentialsProvider(); - Assert.assertNull(provider.resolveCredentials()); + OverwriteAwsDefaultCredentialsProvider provider = new OverwriteAwsDefaultCredentialsProvider(); + AwsCredentials credentials = provider.resolveCredentials(); + Assert.assertNull(credentials.accessKeyId()); + Assert.assertNull(credentials.secretAccessKey()); } @Test @@ -73,7 +76,7 @@ public void testUseAWSSDKDefaultBehaviorPlusAssumeRole() { Assert.assertNotNull(cloudConfiguration); Configuration configuration = new Configuration(); cloudConfiguration.applyToConfiguration(configuration); - Assert.assertEquals("com.starrocks.credential.provider.AWSDefaultCredentialsProvider", + Assert.assertEquals(OverwriteAwsDefaultCredentialsProvider.class.getName(), configuration.get("fs.s3a.assumed.role.credentials.provider")); Assert.assertEquals("com.starrocks.credential.provider.AssumedRoleCredentialProvider", configuration.get("fs.s3a.aws.credentials.provider")); From 22c6ef3e8677e28dd954681c87f6d540737e80dc Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Mon, 23 Sep 2024 12:55:21 +0800 Subject: [PATCH 7/8] fix Signed-off-by: Smith Cruise --- .../com/starrocks/credential/AWSCloudConfigurationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java index 28a131bcebae6..6739aff517dc2 100644 --- a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java @@ -55,7 +55,7 @@ public void testUseAWSSDKDefaultBehavior() throws Exception { fs.close(); // Make sure two DefaultCredentialsProviders are different instances - Assert.assertTrue(previousHashCode != currentHashCode); + Assert.assertNotEquals(previousHashCode, currentHashCode); } @Test From 4b631f89c7c3637718c3f40c6ec50ccfa29d1574 Mon Sep 17 00:00:00 2001 From: Smith Cruise Date: Mon, 23 Sep 2024 13:24:57 +0800 Subject: [PATCH 8/8] improve Signed-off-by: Smith Cruise --- .../glue/metastore/AWSGlueClientFactory.java | 4 +-- .../connector/paimon/PaimonConnector.java | 8 ++--- .../credential/CloudConfigurationFactory.java | 14 ++++---- ...ration.java => AwsCloudConfiguration.java} | 8 ++--- ...ava => AwsCloudConfigurationProvider.java} | 10 +++--- ...redential.java => AwsCloudCredential.java} | 6 ++-- ...st.java => AwsCloudConfigurationTest.java} | 33 +++++++++++-------- .../CloudConfigurationFactoryTest.java | 4 +-- .../SharedDataStorageVolumeMgrTest.java | 10 +++--- .../SharedNothingStorageVolumeMgrTest.java | 10 +++--- .../storagevolume/StorageVolumeTest.java | 18 +++++----- 11 files changed, 66 insertions(+), 59 deletions(-) rename fe/fe-core/src/main/java/com/starrocks/credential/aws/{AWSCloudConfiguration.java => AwsCloudConfiguration.java} (96%) rename fe/fe-core/src/main/java/com/starrocks/credential/aws/{AWSCloudConfigurationProvider.java => AwsCloudConfigurationProvider.java} (94%) rename fe/fe-core/src/main/java/com/starrocks/credential/aws/{AWSCloudCredential.java => AwsCloudCredential.java} (98%) rename fe/fe-core/src/test/java/com/starrocks/credential/{AWSCloudConfigurationTest.java => AwsCloudConfigurationTest.java} (88%) diff --git a/fe/fe-core/src/main/java/com/starrocks/connector/hive/glue/metastore/AWSGlueClientFactory.java b/fe/fe-core/src/main/java/com/starrocks/connector/hive/glue/metastore/AWSGlueClientFactory.java index 59f8ffc478b06..54c52ac673968 100644 --- a/fe/fe-core/src/main/java/com/starrocks/connector/hive/glue/metastore/AWSGlueClientFactory.java +++ b/fe/fe-core/src/main/java/com/starrocks/connector/hive/glue/metastore/AWSGlueClientFactory.java @@ -16,7 +16,7 @@ import com.google.common.base.Preconditions; import com.starrocks.credential.CloudConfigurationFactory; -import com.starrocks.credential.aws.AWSCloudCredential; +import com.starrocks.credential.aws.AwsCloudCredential; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.logging.log4j.LogManager; @@ -40,7 +40,7 @@ public AWSGlueClientFactory(HiveConf conf) { @Override public GlueClient newClient() throws MetaException { - AWSCloudCredential glueCloudCredential = CloudConfigurationFactory.buildGlueCloudCredential(conf); + AwsCloudCredential glueCloudCredential = CloudConfigurationFactory.buildGlueCloudCredential(conf); try { GlueClientBuilder glueClientBuilder = GlueClient.builder(); if (glueCloudCredential != null) { diff --git a/fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonConnector.java b/fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonConnector.java index 565024aa8d85d..14cbfb93781bb 100644 --- a/fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonConnector.java +++ b/fe/fe-core/src/main/java/com/starrocks/connector/paimon/PaimonConnector.java @@ -25,8 +25,8 @@ import com.starrocks.credential.CloudType; import com.starrocks.credential.aliyun.AliyunCloudConfiguration; import com.starrocks.credential.aliyun.AliyunCloudCredential; -import com.starrocks.credential.aws.AWSCloudConfiguration; -import com.starrocks.credential.aws.AWSCloudCredential; +import com.starrocks.credential.aws.AwsCloudConfiguration; +import com.starrocks.credential.aws.AwsCloudCredential; import org.apache.hadoop.conf.Configuration; import org.apache.paimon.catalog.Catalog; import org.apache.paimon.catalog.CatalogContext; @@ -95,10 +95,10 @@ public PaimonConnector(ConnectorContext context) { public void initFsOption(CloudConfiguration cloudConfiguration) { if (cloudConfiguration.getCloudType() == CloudType.AWS) { - AWSCloudConfiguration awsCloudConfiguration = (AWSCloudConfiguration) cloudConfiguration; + AwsCloudConfiguration awsCloudConfiguration = (AwsCloudConfiguration) cloudConfiguration; paimonOptions.set("s3.connection.ssl.enabled", String.valueOf(awsCloudConfiguration.getEnableSSL())); paimonOptions.set("s3.path.style.access", String.valueOf(awsCloudConfiguration.getEnablePathStyleAccess())); - AWSCloudCredential awsCloudCredential = awsCloudConfiguration.getAWSCloudCredential(); + AwsCloudCredential awsCloudCredential = awsCloudConfiguration.getAwsCloudCredential(); if (!awsCloudCredential.getEndpoint().isEmpty()) { paimonOptions.set("s3.endpoint", awsCloudCredential.getEndpoint()); } diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/CloudConfigurationFactory.java b/fe/fe-core/src/main/java/com/starrocks/credential/CloudConfigurationFactory.java index 3ac10ae42e0f7..911e457b0ecf6 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/CloudConfigurationFactory.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/CloudConfigurationFactory.java @@ -17,8 +17,8 @@ import com.google.common.collect.ImmutableList; import com.starrocks.connector.share.credential.CloudConfigurationConstants; import com.starrocks.credential.aliyun.AliyunCloudConfigurationProvider; -import com.starrocks.credential.aws.AWSCloudConfigurationProvider; -import com.starrocks.credential.aws.AWSCloudCredential; +import com.starrocks.credential.aws.AwsCloudConfigurationProvider; +import com.starrocks.credential.aws.AwsCloudCredential; import com.starrocks.credential.azure.AzureCloudConfigurationProvider; import com.starrocks.credential.gcp.GCPCloudConfigurationProvoder; import com.starrocks.credential.hdfs.HDFSCloudConfigurationProvider; @@ -34,7 +34,7 @@ public class CloudConfigurationFactory { static ImmutableList cloudConfigurationFactoryChain = ImmutableList.of( - new AWSCloudConfigurationProvider(), + new AwsCloudConfigurationProvider(), new AzureCloudConfigurationProvider(), new GCPCloudConfigurationProvoder(), new AliyunCloudConfigurationProvider(), @@ -43,7 +43,7 @@ public class CloudConfigurationFactory { (Map properties) -> new CloudConfiguration()); static ImmutableList strictCloudConfigurationFactoryChain = ImmutableList.of( - new AWSCloudConfigurationProvider(), + new AwsCloudConfigurationProvider(), new AzureCloudConfigurationProvider(), new GCPCloudConfigurationProvoder(), new AliyunCloudConfigurationProvider(), @@ -72,10 +72,10 @@ public static CloudConfiguration buildCloudConfigurationForStorage(Map properties) { Preconditions.checkNotNull(properties); - AWSCloudCredential awsCloudCredential = new AWSCloudCredential( + AwsCloudCredential awsCloudCredential = new AwsCloudCredential( Boolean.parseBoolean(properties.getOrDefault(AWS_S3_USE_AWS_SDK_DEFAULT_BEHAVIOR, "false")), Boolean.parseBoolean(properties.getOrDefault(AWS_S3_USE_INSTANCE_PROFILE, "false")), properties.getOrDefault(AWS_S3_ACCESS_KEY, ""), @@ -90,7 +90,7 @@ public CloudConfiguration build(Map properties) { return null; } - AWSCloudConfiguration awsCloudConfiguration = new AWSCloudConfiguration(awsCloudCredential); + AwsCloudConfiguration awsCloudConfiguration = new AwsCloudConfiguration(awsCloudCredential); // put cloud configuration if (properties.containsKey(AWS_S3_ENABLE_PATH_STYLE_ACCESS)) { awsCloudConfiguration.setEnablePathStyleAccess( diff --git a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AwsCloudCredential.java similarity index 98% rename from fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java rename to fe/fe-core/src/main/java/com/starrocks/credential/aws/AwsCloudCredential.java index afeed9b77af56..201e78f585b1b 100644 --- a/fe/fe-core/src/main/java/com/starrocks/credential/aws/AWSCloudCredential.java +++ b/fe/fe-core/src/main/java/com/starrocks/credential/aws/AwsCloudCredential.java @@ -79,9 +79,9 @@ * // If user want to use anonymous credentials, they just don't set cloud credential directly. * } */ -public class AWSCloudCredential implements CloudCredential { +public class AwsCloudCredential implements CloudCredential { - private static final Logger LOG = LoggerFactory.getLogger(AWSCloudCredential.class); + private static final Logger LOG = LoggerFactory.getLogger(AwsCloudCredential.class); private static final String DEFAULT_CREDENTIAL_PROVIDER = OverwriteAwsDefaultCredentialsProvider.class.getName(); private static final String IAM_CREDENTIAL_PROVIDER = IAMInstanceCredentialsProvider.class.getName(); @@ -111,7 +111,7 @@ public class AWSCloudCredential implements CloudCredential { private final String endpoint; - protected AWSCloudCredential(boolean useAWSSDKDefaultBehavior, boolean useInstanceProfile, String accessKey, + protected AwsCloudCredential(boolean useAWSSDKDefaultBehavior, boolean useInstanceProfile, String accessKey, String secretKey, String sessionToken, String iamRoleArn, String stsRegion, String stsEndpoint, String externalId, String region, String endpoint) { diff --git a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java b/fe/fe-core/src/test/java/com/starrocks/credential/AwsCloudConfigurationTest.java similarity index 88% rename from fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java rename to fe/fe-core/src/test/java/com/starrocks/credential/AwsCloudConfigurationTest.java index 6739aff517dc2..ccdcbd39a9c6d 100644 --- a/fe/fe-core/src/test/java/com/starrocks/credential/AWSCloudConfigurationTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/credential/AwsCloudConfigurationTest.java @@ -15,8 +15,8 @@ package com.starrocks.credential; import com.staros.proto.FileStoreInfo; -import com.starrocks.credential.aws.AWSCloudConfiguration; -import com.starrocks.credential.aws.AWSCloudCredential; +import com.starrocks.credential.aws.AwsCloudConfiguration; +import com.starrocks.credential.aws.AwsCloudCredential; import com.starrocks.credential.provider.OverwriteAwsDefaultCredentialsProvider; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; @@ -26,15 +26,16 @@ import org.junit.Assert; import org.junit.Test; import software.amazon.awssdk.auth.credentials.AwsCredentials; +import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; import java.net.URI; import java.util.HashMap; import java.util.Map; -public class AWSCloudConfigurationTest { +public class AwsCloudConfigurationTest { @Test - public void testUseAWSSDKDefaultBehavior() throws Exception { + public void testUseAwsSDKDefaultBehavior() throws Exception { // Test hadoop configuration Map properties = new HashMap<>(); properties.put("aws.s3.use_aws_sdk_default_behavior", "true"); @@ -46,20 +47,26 @@ public void testUseAWSSDKDefaultBehavior() throws Exception { configuration.get("fs.s3a.aws.credentials.provider")); S3AFileSystem fs = (S3AFileSystem) FileSystem.get(new URI("s3://hi/a.parquet"), configuration); AWSCredentialProviderList list = fs.shareCredentials("ut"); + String previousProviderName = list.getProviders().get(0).getClass().getName(); int previousHashCode = list.getProviders().get(0).hashCode(); fs.close(); fs = (S3AFileSystem) FileSystem.get(new URI("s3://hi/a.parquet"), configuration); list = fs.shareCredentials("ut"); + String currentProviderName = list.getProviders().get(0).getClass().getName(); int currentHashCode = list.getProviders().get(0).hashCode(); fs.close(); + // Make sure two DefaultCredentialsProviders are the same class + Assert.assertEquals(previousProviderName, currentProviderName); + // Make sure the provider is DefaultCredentialsProvider + Assert.assertEquals(DefaultCredentialsProvider.class.getName(), previousProviderName); // Make sure two DefaultCredentialsProviders are different instances Assert.assertNotEquals(previousHashCode, currentHashCode); } @Test - public void testAWSDefaultCredentialsProvider() { + public void testAwsDefaultCredentialsProvider() { OverwriteAwsDefaultCredentialsProvider provider = new OverwriteAwsDefaultCredentialsProvider(); AwsCredentials credentials = provider.resolveCredentials(); Assert.assertNull(credentials.accessKeyId()); @@ -67,7 +74,7 @@ public void testAWSDefaultCredentialsProvider() { } @Test - public void testUseAWSSDKDefaultBehaviorPlusAssumeRole() { + public void testUseAwsSDKDefaultBehaviorPlusAssumeRole() { // Test hadoop configuration Map properties = new HashMap<>(); properties.put("aws.s3.use_aws_sdk_default_behavior", "true"); @@ -89,7 +96,7 @@ public void testBuildGlueCloudCredential() { hiveConf.set("aws.glue.access_key", "ak"); hiveConf.set("aws.glue.secret_key", "sk"); hiveConf.set("aws.glue.region", "us-west-1"); - AWSCloudCredential awsCloudCredential = CloudConfigurationFactory.buildGlueCloudCredential(hiveConf); + AwsCloudCredential awsCloudCredential = CloudConfigurationFactory.buildGlueCloudCredential(hiveConf); Assert.assertNotNull(awsCloudCredential); Assert.assertEquals("AWSCloudCredential{useAWSSDKDefaultBehavior=false, " + "useInstanceProfile=false, accessKey='ak', secretKey='sk', sessionToken='', iamRoleArn='', " + @@ -102,7 +109,7 @@ public void testBuildGlueCloudCredential() { } @Test - public void testForAWSRegion() { + public void testForAwsRegion() { Map properties = new HashMap<>(); properties.put("aws.s3.access_key", "ak"); properties.put("aws.s3.secret_key", "sk"); @@ -150,14 +157,14 @@ public void testGlueAssumeRoleRegionEndpoint() { hiveConf.set("aws.glue.iam_role_arn", "arn"); hiveConf.set("aws.glue.sts.endpoint", "endpoint"); { - AWSCloudCredential credential = CloudConfigurationFactory.buildGlueCloudCredential(hiveConf); + AwsCloudCredential credential = CloudConfigurationFactory.buildGlueCloudCredential(hiveConf); Assert.assertNotNull(credential); Assert.assertThrows(NullPointerException.class, credential::generateAWSCredentialsProvider); } hiveConf.set("aws.glue.sts.region", "region"); { - AWSCloudCredential credential = CloudConfigurationFactory.buildGlueCloudCredential(hiveConf); + AwsCloudCredential credential = CloudConfigurationFactory.buildGlueCloudCredential(hiveConf); Assert.assertNotNull(credential); } } @@ -174,7 +181,7 @@ public void testEnablePartitionedPrefixConfiguration() { CloudConfiguration cloudConfiguration = CloudConfigurationFactory.buildCloudConfigurationForStorage(properties, true); Assert.assertNotNull(cloudConfiguration); - Assert.assertTrue(cloudConfiguration instanceof AWSCloudConfiguration); + Assert.assertTrue(cloudConfiguration instanceof AwsCloudConfiguration); FileStoreInfo fsInfo = cloudConfiguration.toFileStoreInfo(); Assert.assertFalse(fsInfo.getS3FsInfo().getPartitionedPrefixEnabled()); Assert.assertEquals(0, fsInfo.getS3FsInfo().getNumPartitionedPrefix()); @@ -184,7 +191,7 @@ public void testEnablePartitionedPrefixConfiguration() { { CloudConfiguration cloudConfiguration = CloudConfigurationFactory.buildCloudConfigurationForStorage(properties); - Assert.assertTrue(cloudConfiguration instanceof AWSCloudConfiguration); + Assert.assertTrue(cloudConfiguration instanceof AwsCloudConfiguration); FileStoreInfo fsInfo = cloudConfiguration.toFileStoreInfo(); Assert.assertTrue(fsInfo.getS3FsInfo().getPartitionedPrefixEnabled()); // set default to 256 @@ -208,7 +215,7 @@ public void testEnablePartitionedPrefixConfiguration() { { CloudConfiguration cloudConfiguration = CloudConfigurationFactory.buildCloudConfigurationForStorage(properties); - Assert.assertTrue(cloudConfiguration instanceof AWSCloudConfiguration); + Assert.assertTrue(cloudConfiguration instanceof AwsCloudConfiguration); FileStoreInfo fsInfo = cloudConfiguration.toFileStoreInfo(); Assert.assertTrue(fsInfo.getS3FsInfo().getPartitionedPrefixEnabled()); Assert.assertEquals(1024, fsInfo.getS3FsInfo().getNumPartitionedPrefix()); diff --git a/fe/fe-core/src/test/java/com/starrocks/credential/CloudConfigurationFactoryTest.java b/fe/fe-core/src/test/java/com/starrocks/credential/CloudConfigurationFactoryTest.java index f6c7511f9da02..75bc4424d0e66 100644 --- a/fe/fe-core/src/test/java/com/starrocks/credential/CloudConfigurationFactoryTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/credential/CloudConfigurationFactoryTest.java @@ -15,7 +15,7 @@ package com.starrocks.credential; import com.starrocks.connector.share.credential.CloudConfigurationConstants; -import com.starrocks.credential.aws.AWSCloudCredential; +import com.starrocks.credential.aws.AwsCloudCredential; import com.starrocks.thrift.TCloudConfiguration; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.conf.HiveConf; @@ -306,7 +306,7 @@ public void testDefaultCloudConfiguration() { public void testGlueCredential() { HiveConf conf = new HiveConf(); conf.set(CloudConfigurationConstants.AWS_GLUE_USE_AWS_SDK_DEFAULT_BEHAVIOR, "true"); - AWSCloudCredential cred = CloudConfigurationFactory.buildGlueCloudCredential(conf); + AwsCloudCredential cred = CloudConfigurationFactory.buildGlueCloudCredential(conf); Assert.assertNotNull(cred); Assert.assertEquals("AWSCloudCredential{useAWSSDKDefaultBehavior=true, useInstanceProfile=false, " + "accessKey='', secretKey='', sessionToken='', iamRoleArn='', stsRegion='', " + diff --git a/fe/fe-core/src/test/java/com/starrocks/server/SharedDataStorageVolumeMgrTest.java b/fe/fe-core/src/test/java/com/starrocks/server/SharedDataStorageVolumeMgrTest.java index e7a8497bd98e1..e300f7f75cc4c 100644 --- a/fe/fe-core/src/test/java/com/starrocks/server/SharedDataStorageVolumeMgrTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/server/SharedDataStorageVolumeMgrTest.java @@ -40,7 +40,7 @@ import com.starrocks.common.jmockit.Deencapsulation; import com.starrocks.connector.share.credential.CloudConfigurationConstants; import com.starrocks.credential.CloudConfiguration; -import com.starrocks.credential.aws.AWSCloudConfiguration; +import com.starrocks.credential.aws.AwsCloudConfiguration; import com.starrocks.lake.LakeTable; import com.starrocks.lake.LakeTablet; import com.starrocks.lake.StarOSAgent; @@ -197,9 +197,9 @@ public void testStorageVolumeCRUD() throws AlreadyExistsException, DdlException, Assert.assertEquals(svName, svm.getStorageVolumeName(svKey)); StorageVolume sv = svm.getStorageVolumeByName(svName); CloudConfiguration cloudConfiguration = sv.getCloudConfiguration(); - Assert.assertEquals("region", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); StorageVolume sv1 = svm.getStorageVolume(sv.getId()); Assert.assertEquals(sv1.getId(), sv.getId()); @@ -228,9 +228,9 @@ public void testStorageVolumeCRUD() throws AlreadyExistsException, DdlException, svm.updateStorageVolume(svName, storageParams, Optional.of(true), "test update"); sv = svm.getStorageVolumeByName(svName); cloudConfiguration = sv.getCloudConfiguration(); - Assert.assertEquals("region1", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region1", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint1", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint1", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); Assert.assertEquals("test update", sv.getComment()); Assert.assertEquals(true, sv.getEnabled()); diff --git a/fe/fe-core/src/test/java/com/starrocks/server/SharedNothingStorageVolumeMgrTest.java b/fe/fe-core/src/test/java/com/starrocks/server/SharedNothingStorageVolumeMgrTest.java index cb1cc62980e6d..c452c4bad9c42 100644 --- a/fe/fe-core/src/test/java/com/starrocks/server/SharedNothingStorageVolumeMgrTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/server/SharedNothingStorageVolumeMgrTest.java @@ -18,7 +18,7 @@ import com.starrocks.common.DdlException; import com.starrocks.common.MetaNotFoundException; import com.starrocks.credential.CloudConfiguration; -import com.starrocks.credential.aws.AWSCloudConfiguration; +import com.starrocks.credential.aws.AwsCloudConfiguration; import com.starrocks.persist.DropStorageVolumeLog; import com.starrocks.persist.EditLog; import com.starrocks.persist.SetDefaultStorageVolumeLog; @@ -82,9 +82,9 @@ public EditLog getEditLog() { StorageVolume sv = svm.getStorageVolumeByName(svName); Assert.assertEquals(sv.getId(), svm.getStorageVolume(storageVolumeId).getId()); CloudConfiguration cloudConfiguration = sv.getCloudConfiguration(); - Assert.assertEquals("region", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); try { svm.createStorageVolume(svName, "S3", locations, storageParams, Optional.empty(), ""); @@ -110,9 +110,9 @@ public EditLog getEditLog() { svm.updateStorageVolume(svName, storageParams, Optional.of(true), "test update"); sv = svm.getStorageVolumeByName(svName); cloudConfiguration = sv.getCloudConfiguration(); - Assert.assertEquals("region1", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region1", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint1", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint1", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); Assert.assertEquals("test update", sv.getComment()); Assert.assertEquals(true, sv.getEnabled()); diff --git a/fe/fe-core/src/test/java/com/starrocks/storagevolume/StorageVolumeTest.java b/fe/fe-core/src/test/java/com/starrocks/storagevolume/StorageVolumeTest.java index d06bae0a35173..452896c461d71 100644 --- a/fe/fe-core/src/test/java/com/starrocks/storagevolume/StorageVolumeTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/storagevolume/StorageVolumeTest.java @@ -33,7 +33,7 @@ import com.starrocks.connector.share.credential.CloudConfigurationConstants; import com.starrocks.credential.CloudConfiguration; import com.starrocks.credential.CloudType; -import com.starrocks.credential.aws.AWSCloudConfiguration; +import com.starrocks.credential.aws.AwsCloudConfiguration; import com.starrocks.credential.hdfs.HDFSCloudConfiguration; import com.starrocks.credential.hdfs.HDFSCloudCredential; import com.starrocks.qe.ConnectContext; @@ -100,9 +100,9 @@ public void testAWSDefaultCredential() throws AnalysisException, DdlException { Assert.assertTrue(fileStore.hasS3FsInfo()); S3FileStoreInfo s3FileStoreInfo = fileStore.getS3FsInfo(); Assert.assertTrue(s3FileStoreInfo.getCredential().hasDefaultCredential()); - Assert.assertEquals("region", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); } @@ -127,9 +127,9 @@ public void testAWSSimpleCredential() throws AnalysisException, DdlException { AwsSimpleCredentialInfo simpleCredentialInfo = s3FileStoreInfo.getCredential().getSimpleCredential(); Assert.assertEquals("access_key", simpleCredentialInfo.getAccessKey()); Assert.assertEquals("secret_key", simpleCredentialInfo.getAccessKeySecret()); - Assert.assertEquals("region", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); } @@ -150,9 +150,9 @@ public void testAWSInstanceProfile() throws AnalysisException, DdlException { Assert.assertTrue(fileStore.hasS3FsInfo()); S3FileStoreInfo s3FileStoreInfo = fileStore.getS3FsInfo(); Assert.assertTrue(s3FileStoreInfo.getCredential().hasProfileCredential()); - Assert.assertEquals("region", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); } @@ -179,9 +179,9 @@ public void testAWSAssumeIamRole() throws AnalysisException, DdlException { .getAssumeRoleCredential(); Assert.assertEquals("iam_role_arn", assumeIamRoleCredentialInfo.getIamRoleArn()); Assert.assertEquals("iam_role_arn", assumeIamRoleCredentialInfo.getIamRoleArn()); - Assert.assertEquals("region", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("region", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getRegion()); - Assert.assertEquals("endpoint", ((AWSCloudConfiguration) cloudConfiguration).getAWSCloudCredential() + Assert.assertEquals("endpoint", ((AwsCloudConfiguration) cloudConfiguration).getAwsCloudCredential() .getEndpoint()); }