Skip to content

Commit 4a182ac

Browse files
committed
passing yetus checks
1 parent 8c4413e commit 4a182ac

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ public class AbfsConfiguration{
452452
* Constructor for AbfsConfiguration for specified service type.
453453
* @param rawConfig used to initialize the configuration.
454454
* @param accountName the name of the azure storage account.
455+
* @param fsName the name of the file system (container name).
455456
* @param fsConfiguredServiceType service type configured for the file system.
456457
* @throws IllegalAccessException if the field is not accessible.
457458
* @throws IOException if an I/O error occurs.
@@ -666,7 +667,7 @@ public int getInt(String key, int defaultValue) {
666667
*/
667668
public String getPasswordString(String key) throws IOException {
668669
char[] passchars = rawConfig.getPassword(containerConf(key));
669-
if (passchars == null) {
670+
if(passchars == null) {
670671
passchars = rawConfig.getPassword(accountConf(key));
671672
if(passchars == null){
672673
passchars = rawConfig.getPassword(key);

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/ConfigurationKeys.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ public static String accountProperty(String property, String account) {
322322
return property + "." + account;
323323
}
324324

325-
public static String containerProperty(String property, String FsName, String account) {
326-
return property + "." + FsName + "." + account;
325+
public static String containerProperty(String property, String fsName, String account) {
326+
return property + "." + fsName + "." + account;
327327
}
328328

329329
public static final String FS_AZURE_ENABLE_DELEGATION_TOKEN = "fs.azure.enable.delegation.token";

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ public void testBothProviderFixedTokenConfigured() throws Exception {
146146
}
147147
}
148148

149+
/**
150+
* Helper method to get the Fixed SAS token value
151+
*/
152+
private String getFixedSASToken(AbfsConfiguration config) throws Exception {
153+
return config.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(), "read");
154+
}
155+
149156
/**
150157
* Tests the implementation sequence if all fixed SAS configs are set.
151158
* The expected sequence is Container Specific Fixed SAS, Account Specific Fixed SAS, Account Agnostic Fixed SAS.
@@ -161,21 +168,18 @@ public void testFixedTokenPreference() throws Exception {
161168
testAbfsConfig.set(containerProperty(FS_AZURE_SAS_FIXED_TOKEN, this.getFileSystemName(), this.getAccountName()), containerSAS);
162169
testAbfsConfig.set(accountProperty(FS_AZURE_SAS_FIXED_TOKEN, this.getAccountName()), accountSAS);
163170
testAbfsConfig.set(FS_AZURE_SAS_FIXED_TOKEN, accountSAS);
164-
String ContainerSASExpected = testAbfsConfig.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(), "read");
165171

166172
// Assert that Container Specific Fixed SAS is used
167-
Assertions.assertThat(ContainerSASExpected).contains("sr=c");
173+
Assertions.assertThat(getFixedSASToken(testAbfsConfig)).contains("sr=c");
168174

169175
// Assert that Account Specific Fixed SAS is used if container SAS isn't set
170176
testAbfsConfig.unset(containerProperty(FS_AZURE_SAS_FIXED_TOKEN, this.getFileSystemName(), this.getAccountName()));
171-
String AccountSASExpected = testAbfsConfig.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(), "read");
172-
Assertions.assertThat(AccountSASExpected).contains("ss=bf");
177+
Assertions.assertThat(getFixedSASToken(testAbfsConfig)).contains("ss=bf");
173178

174179
//Assert that Account-Agnostic fixed SAS is used if no other fixed SAS configs are set.
175180
// The token is the same as the Account Specific Fixed SAS.
176-
testAbfsConfig.unset(FS_AZURE_SAS_FIXED_TOKEN);
177-
String AccountAgnosticSASExpected = testAbfsConfig.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(), "read");
178-
Assertions.assertThat(AccountAgnosticSASExpected).contains("ss=bf");
181+
testAbfsConfig.unset(accountProperty(FS_AZURE_SAS_FIXED_TOKEN, this.getAccountName()));
182+
Assertions.assertThat(getFixedSASToken(testAbfsConfig)).contains("ss=bf");
179183
}
180184

181185
/**

0 commit comments

Comments
 (0)