HADOOP-17054. ABFS: Fix test AbfsClient authentication instance
Contributed by Sneha Vijayarajan
This commit is contained in:
parent
6c9f75cf16
commit
37b1b4799d
@ -246,21 +246,29 @@ public static AbfsClient createTestClientFromCurrentContext(
|
||||
AbfsClient baseAbfsClientInstance,
|
||||
AbfsConfiguration abfsConfig)
|
||||
throws AzureBlobFileSystemException {
|
||||
AbfsPerfTracker tracker = new AbfsPerfTracker("test",
|
||||
abfsConfig.getAccountName(),
|
||||
abfsConfig);
|
||||
AuthType currentAuthType = abfsConfig.getAuthType(
|
||||
abfsConfig.getAccountName());
|
||||
|
||||
// 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);
|
||||
AbfsPerfTracker tracker = new AbfsPerfTracker("test",
|
||||
abfsConfig.getAccountName(),
|
||||
abfsConfig);
|
||||
|
||||
return testClient;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user