morazow commented on code in PR #132:
URL:
https://github.com/apache/flink-connector-aws/pull/132#discussion_r1528436913
##########
flink-connector-aws/flink-connector-aws-kinesis-streams/src/main/java/org/apache/flink/connector/kinesis/table/util/KinesisStreamsConnectorOptionsUtils.java:
##########
@@ -148,13 +149,13 @@ public static class KinesisProducerOptionsMapper {
public KinesisProducerOptionsMapper(
ReadableConfig tableOptions, Map<String, String>
resolvedOptions) {
this.tableOptions = tableOptions;
- this.resolvedOptions = resolvedOptions;
+ this.resolvedOptions = new HashMap<>(resolvedOptions);
}
@VisibleForTesting
public KinesisProducerOptionsMapper(Map<String, String> allOptions) {
Review Comment:
Change parameter `allOptions` to `resolvedOptions` to make it consistent?
##########
flink-connector-aws/flink-connector-aws-kinesis-streams/src/test/java/org/apache/flink/connector/kinesis/table/util/KinesisProducerOptionsMapperTest.java:
##########
@@ -76,4 +77,19 @@ void testProducerEndpointAndPortExtraction() {
Assertions.assertThat(actualMappedProperties).isEqualTo(expectedOptions);
}
+
+ @Test
+ void testProducerOptionsMapperDoesNotModifyOptionsInstance() {
+ Map<String, String> deprecatedOptions = new HashMap<>();
+ deprecatedOptions.put("sink.producer.kinesis-endpoint",
"some-end-point.kinesis");
+ deprecatedOptions.put("sink.producer.kinesis-port", "1234");
+
+ Map<String, String> deprecatedOptionsImmutable =
+ Collections.unmodifiableMap(deprecatedOptions);
+ Assertions.assertThatNoException()
+ .isThrownBy(
+ () ->
+ new
KinesisProducerOptionsMapper(deprecatedOptionsImmutable)
+ .mapDeprecatedClientOptions());
+ }
Review Comment:
Maybe add similar test for other constructor case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]