This is an automated email from the ASF dual-hosted git repository. tmarquardt pushed a commit to branch branch-3.3 in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit 27b20f96893e00223c90b87ccb643d3cb6fb3941 Author: Sneha Vijayarajan <sneha.vijayara...@gmail.com> AuthorDate: Tue May 26 15:26:28 2020 -0700 HADOOP-17054. ABFS: Fix test AbfsClient authentication instance Contributed by Sneha Vijayarajan --- .../fs/azurebfs/services/TestAbfsClient.java | 42 +++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java index ce9c032..0fd65fb 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsClient.java @@ -246,21 +246,29 @@ public final class TestAbfsClient { AbfsClient baseAbfsClientInstance, AbfsConfiguration abfsConfig) throws AzureBlobFileSystemException { - AbfsPerfTracker tracker = new AbfsPerfTracker("test", - abfsConfig.getAccountName(), - abfsConfig); - - // Create test AbfsClient - AbfsClient testClient = new AbfsClient( - baseAbfsClientInstance.getBaseUrl(), - new SharedKeyCredentials(abfsConfig.getAccountName().substring(0, - abfsConfig.getAccountName().indexOf(DOT)), - abfsConfig.getStorageAccountKey()), - abfsConfig, - new ExponentialRetryPolicy(abfsConfig.getMaxIoRetries()), - abfsConfig.getTokenProvider(), - tracker); - - return testClient; - } + AuthType currentAuthType = abfsConfig.getAuthType( + abfsConfig.getAccountName()); + + AbfsPerfTracker tracker = new AbfsPerfTracker("test", + abfsConfig.getAccountName(), + abfsConfig); + + // Create test AbfsClient + AbfsClient testClient = new AbfsClient( + baseAbfsClientInstance.getBaseUrl(), + (currentAuthType == AuthType.SharedKey + ? new SharedKeyCredentials( + abfsConfig.getAccountName().substring(0, + abfsConfig.getAccountName().indexOf(DOT)), + abfsConfig.getStorageAccountKey()) + : null), + abfsConfig, + new ExponentialRetryPolicy(abfsConfig.getMaxIoRetries()), + (currentAuthType == AuthType.OAuth + ? abfsConfig.getTokenProvider() + : null), + tracker); + + return testClient; + } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org