Skip to content

Commit f918d23

Browse files
committed
test + doc changes
1 parent cff702f commit f918d23

File tree

3 files changed

+38
-35
lines changed

3 files changed

+38
-35
lines changed

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestStringUtils.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -519,36 +519,31 @@ public void testStringCollectionSplitByEquals() {
519519
Map<String, String> splitMap =
520520
StringUtils.getTrimmedStringCollectionSplitByEquals("");
521521
Assertions
522-
.assertThat(splitMap.size())
522+
.assertThat(splitMap)
523523
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
524-
.isEqualTo(0);
524+
.hasSize(0);
525525

526526
splitMap = StringUtils.getTrimmedStringCollectionSplitByEquals(null);
527527
Assertions
528-
.assertThat(splitMap.size())
528+
.assertThat(splitMap)
529529
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
530-
.isEqualTo(0);
530+
.hasSize(0);
531531

532532
splitMap = StringUtils.getTrimmedStringCollectionSplitByEquals(
533533
"element.first.key1 = element.first.val1");
534-
Assertions
535-
.assertThat(splitMap.size())
536-
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
537-
.isEqualTo(1);
538534
Assertions
539535
.assertThat(splitMap)
540536
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
537+
.hasSize(1)
541538
.containsEntry("element.first.key1", "element.first.val1");
542539

543540
splitMap = StringUtils.getTrimmedStringCollectionSplitByEquals(
544541
"element.xyz.key1 =element.abc.val1 , element.xyz.key2= element.abc.val2");
545-
Assertions
546-
.assertThat(splitMap.size())
547-
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
548-
.isEqualTo(2);
542+
549543
Assertions
550544
.assertThat(splitMap)
551545
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
546+
.hasSize(2)
552547
.containsEntry("element.xyz.key1", "element.abc.val1")
553548
.containsEntry("element.xyz.key2", "element.abc.val2");
554549

@@ -559,13 +554,11 @@ public void testStringCollectionSplitByEquals() {
559554
+ "element.abc.val5 ,\n \n \n "
560555
+ " element.xyz.key6 = element.abc.val6 \n , \n"
561556
+ "element.xyz.key7=element.abc.val7,\n");
562-
Assertions
563-
.assertThat(splitMap.size())
564-
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
565-
.isEqualTo(7);
557+
566558
Assertions
567559
.assertThat(splitMap)
568560
.describedAs("Map of key value pairs split by equals(=) and comma(,)")
561+
.hasSize(7)
569562
.containsEntry("element.xyz.key1", "element.abc.val1")
570563
.containsEntry("element.xyz.key2", "element.abc.val2")
571564
.containsEntry("element.xyz.key3", "element.abc.val3")

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/aws_sdk_upgrade.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@ The change in interface will mean that custom credential providers will need to
6666
implement `software.amazon.awssdk.auth.credentials.AwsCredentialsProvider` instead of
6767
`com.amazonaws.auth.AWSCredentialsProvider`.
6868

69+
[HADOOP-18980](https://issues.apache.org/jira/browse/HADOOP-18980) introduces extended version of
70+
the credential provider remapping. `fs.s3a.aws.credentials.provider.mapping` can be used to
71+
list comma-separated key-value pairs of mapped credential providers that are separated by
72+
equal operator (=). The key can be used by `fs.s3a.aws.credentials.provider` config, and it
73+
will be translated into the specified value of credential provider class based on the key-value
74+
pair provided by this config.
75+
76+
For example, if `fs.s3a.aws.credentials.provider.mapping` is set with value:
77+
78+
com.amazonaws.auth.AnonymousAWSCredentials=org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider,
79+
com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper=org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider,
80+
com.amazonaws.auth.InstanceProfileCredentialsProvider=org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider
81+
82+
With the above key-value pairs, if `fs.s3a.aws.credentials.provider` specifies
83+
`com.amazonaws.auth.AnonymousAWSCredentials`, it will be remapped to
84+
`org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider` by S3A while preparing
85+
AWS credential provider list.
86+
87+
6988
### Original V1 `AWSCredentialsProvider` interface
7089

7190
Note how the interface begins with the capitalized "AWS" acronym.

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/TestS3AAWSCredentialsProvider.java

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -732,48 +732,42 @@ public void testStringCollectionSplitByEquals() {
732732
S3AUtils.getTrimmedStringCollectionSplitByEquals(
733733
configuration, "custom_key");
734734
Assertions
735-
.assertThat(splitMap.size())
735+
.assertThat(splitMap)
736736
.describedAs(
737737
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
738-
.isEqualTo(0);
738+
.hasSize(0);
739739

740740
splitMap =
741741
S3AUtils.getTrimmedStringCollectionSplitByEquals(
742742
configuration, "not_present");
743743
Assertions
744-
.assertThat(splitMap.size())
744+
.assertThat(splitMap)
745745
.describedAs(
746746
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
747-
.isEqualTo(0);
747+
.hasSize(0);
748748

749749
configuration.set("custom_key", "element.first.key1 = element.first.val1");
750750
splitMap = S3AUtils.getTrimmedStringCollectionSplitByEquals(
751751
configuration, "custom_key");
752-
Assertions
753-
.assertThat(splitMap.size())
754-
.describedAs(
755-
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
756-
.isEqualTo(1);
752+
757753
Assertions
758754
.assertThat(splitMap)
759755
.describedAs(
760756
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
757+
.hasSize(1)
761758
.containsEntry("element.first.key1", "element.first.val1");
762759

763760
configuration.set("custom_key",
764761
"element.xyz.key1 =element.abc.val1 , element.xyz.key2= element.abc.val2");
765762
splitMap =
766763
S3AUtils.getTrimmedStringCollectionSplitByEquals(
767764
configuration, "custom_key");
768-
Assertions
769-
.assertThat(splitMap.size())
770-
.describedAs(
771-
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
772-
.isEqualTo(2);
765+
773766
Assertions
774767
.assertThat(splitMap)
775768
.describedAs(
776769
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
770+
.hasSize(2)
777771
.containsEntry("element.xyz.key1", "element.abc.val1")
778772
.containsEntry("element.xyz.key2", "element.abc.val2");
779773

@@ -786,15 +780,12 @@ public void testStringCollectionSplitByEquals() {
786780
+ "element.xyz.key7=element.abc.val7,\n");
787781
splitMap = S3AUtils.getTrimmedStringCollectionSplitByEquals(
788782
configuration, "custom_key");
789-
Assertions
790-
.assertThat(splitMap.size())
791-
.describedAs(
792-
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
793-
.isEqualTo(7);
783+
794784
Assertions
795785
.assertThat(splitMap)
796786
.describedAs(
797787
"Map of key value pairs derived from config, split by equals(=) and comma(,)")
788+
.hasSize(7)
798789
.containsEntry("element.xyz.key1", "element.abc.val1")
799790
.containsEntry("element.xyz.key2", "element.abc.val2")
800791
.containsEntry("element.xyz.key3", "element.abc.val3")

0 commit comments

Comments
 (0)