CrynetLogistics commented on a change in pull request #17345:
URL: https://github.com/apache/flink/pull/17345#discussion_r740379927



##########
File path: 
flink-connectors/flink-connector-aws/src/test/java/org/apache/flink/streaming/connectors/kinesis/async/KinesisDataStreamsSinkITCase.java
##########
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.streaming.connectors.kinesis.async;
+
+import org.apache.flink.connector.base.sink.writer.ElementConverter;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import 
org.apache.flink.streaming.connectors.kinesis.async.testutils.ExampleSource;
+import 
org.apache.flink.streaming.connectors.kinesis.async.testutils.KinesaliteContainer;
+import org.apache.flink.util.DockerImageVersions;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.testcontainers.utility.DockerImageName;
+import software.amazon.awssdk.core.SdkBytes;
+import software.amazon.awssdk.core.SdkSystemSetting;
+import software.amazon.awssdk.services.kinesis.KinesisAsyncClient;
+import software.amazon.awssdk.services.kinesis.model.CreateStreamRequest;
+import software.amazon.awssdk.services.kinesis.model.DescribeStreamRequest;
+import software.amazon.awssdk.services.kinesis.model.DescribeStreamResponse;
+import software.amazon.awssdk.services.kinesis.model.GetRecordsRequest;
+import software.amazon.awssdk.services.kinesis.model.GetShardIteratorRequest;
+import software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry;
+import software.amazon.awssdk.services.kinesis.model.ShardIteratorType;
+import software.amazon.awssdk.services.kinesis.model.StreamStatus;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.concurrent.ExecutionException;
+
+import static org.junit.Assert.assertEquals;
+
+/** IT cases for using Kinesis Data Streams Sink based on Kinesalite. */
+public class KinesisDataStreamsSinkITCase extends TestLogger {
+
+    private static final String DEFAULT_FIRST_SHARD_NAME = 
"shardId-000000000000";
+    private static final String AWS_REGION_SYSTEM_PROP_NAME = "aws.region";
+    private static final int TIME_MARGIN_OF_ERROR_MS = 1000;
+
+    private final ElementConverter<String, PutRecordsRequestEntry> 
elementConverter =
+            (element, context) ->
+                    PutRecordsRequestEntry.builder()
+                            .data(SdkBytes.fromUtf8String(element))
+                            .partitionKey(String.valueOf(element.hashCode()))
+                            .build();
+
+    @ClassRule
+    public static KinesaliteContainer kinesalite =
+            new 
KinesaliteContainer(DockerImageName.parse(DockerImageVersions.KINESALITE));
+
+    private StreamExecutionEnvironment env;
+    private KinesisAsyncClient kinesisClient;
+
+    @Before
+    public void setUp() throws Exception {
+        System.setProperty(SdkSystemSetting.CBOR_ENABLED.property(), "false");
+        System.setProperty(AWS_REGION_SYSTEM_PROP_NAME, 
kinesalite.getRegion().toString());
+
+        env = StreamExecutionEnvironment.getExecutionEnvironment();
+        env.setParallelism(1);
+
+        kinesisClient = kinesalite.getNewClient();
+        setFinalStatic(
+                KinesisDataStreamsSinkWriter.class.getDeclaredField("client"), 
kinesisClient);

Review comment:
       Now not a problem anymore since we have a new constructor for the Sink!




-- 
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]


Reply via email to