fapaul commented on code in PR #19405:
URL: https://github.com/apache/flink/pull/19405#discussion_r856141131


##########
flink-end-to-end-tests/flink-end-to-end-tests-elasticsearch7/pom.xml:
##########
@@ -30,10 +30,14 @@ under the License.
                <relativePath>..</relativePath>
        </parent>
 
-       <artifactId>flink-elasticsearch7-test</artifactId>
-       <name>Flink : E2E Tests : Elasticsearch 7</name>
+       <artifactId>flink-end-to-end-tests-elasticsearch7</artifactId>
+       <name>Flink : E2E Tests : Elasticsearch 7 Java</name>

Review Comment:
   Is `Java` really important here?



##########
flink-end-to-end-tests/flink-end-to-end-tests-common-elasticsearch/pom.xml:
##########
@@ -43,50 +43,52 @@ under the License.
                </dependency>
                <dependency>
                        <groupId>org.apache.flink</groupId>
-                       <artifactId>flink-connector-elasticsearch6</artifactId>
+                       <artifactId>flink-connector-test-utils</artifactId>
                        <version>${project.version}</version>
+                       <scope>compile</scope>
                </dependency>
+               <dependency>
+                       <groupId>org.apache.flink</groupId>
+                       
<artifactId>flink-connector-elasticsearch-base</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.testcontainers</groupId>
+                       <artifactId>elasticsearch</artifactId>
+                       <version>${testcontainers.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.flink</groupId>
+                       <artifactId>flink-end-to-end-tests-common</artifactId>
+                       <version>${project.version}</version>
+                       <scope>test</scope></dependency>
        </dependencies>
 
+       <dependencyManagement>
+          <dependencies>
+                 <dependency>
+                        <groupId>org.apache.httpcomponents</groupId>
+                        <artifactId>httpcore-nio</artifactId>
+                        <version>4.4.12</version>
+                 </dependency>
+          </dependencies>
+       </dependencyManagement>
+
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-shade-plugin</artifactId>
+                               <artifactId>maven-jar-plugin</artifactId>
                                <executions>
                                        <execution>
-                                               
<id>Elasticsearch6SinkExample</id>
+                                               <id>Jar Package</id>
                                                <phase>package</phase>
                                                <goals>
-                                                       <goal>shade</goal>
+                                                       <goal>test-jar</goal>

Review Comment:
   Can you avoid introducing more test jars and maybe move the common utilities 
to the main package?



##########
flink-end-to-end-tests/flink-end-to-end-tests-common-elasticsearch/src/test/java/org/apache/flink/streaming/tests/ElasticsearchSinkE2ECaseBase.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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.tests;
+
+import 
org.apache.flink.connector.testframe.external.DefaultContainerizedExternalSystem;
+import org.apache.flink.connector.testframe.external.ExternalSystemDataReader;
+import org.apache.flink.connector.testframe.junit.annotations.TestEnv;
+import 
org.apache.flink.connector.testframe.junit.annotations.TestExternalSystem;
+import org.apache.flink.connector.testframe.junit.annotations.TestSemantics;
+import org.apache.flink.connector.testframe.testsuites.SinkTestSuiteBase;
+import org.apache.flink.streaming.api.CheckpointingMode;
+import org.apache.flink.tests.util.flink.FlinkContainerTestEnvironment;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.elasticsearch.ElasticsearchContainer;
+import org.testcontainers.utility.DockerImageName;
+
+import java.time.Duration;
+import java.util.Collections;
+import java.util.List;
+
+import static 
org.apache.flink.connector.testframe.utils.CollectIteratorAssertions.assertThat;
+import static 
org.apache.flink.runtime.testutils.CommonTestUtils.waitUntilCondition;
+
+/** Base classs for end to end ElasticsearchSink tests based on connector 
testing framework. */
+@SuppressWarnings("unused")
+public abstract class ElasticsearchSinkE2ECaseBase<T extends Comparable<T>>
+        extends SinkTestSuiteBase<T> {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(ElasticsearchSinkE2ECaseBase.class);
+    private static final int READER_RETRY_ATTEMPTS = 10;
+    private static final int READER_TIMEOUT = 10;
+
+    protected static final String ELASTICSEARCH_HOSTNAME = "elasticsearch";
+
+    @TestSemantics
+    CheckpointingMode[] semantics = new CheckpointingMode[] 
{CheckpointingMode.EXACTLY_ONCE};
+
+    // Defines TestEnvironment
+    @TestEnv
+    protected FlinkContainerTestEnvironment flink = new 
FlinkContainerTestEnvironment(1, 6);
+
+    // Defines ConnectorExternalSystem
+    @TestExternalSystem
+    DefaultContainerizedExternalSystem<ElasticsearchContainer> elasticsearch =
+            DefaultContainerizedExternalSystem.builder()
+                    .fromContainer(
+                            new ElasticsearchContainer(
+                                            
DockerImageName.parse(getElasticsearchContainerName()))
+                                    
.withNetworkAliases(ELASTICSEARCH_HOSTNAME))
+                    
.bindWithFlinkContainer(flink.getFlinkContainers().getJobManager())
+                    .build();
+
+    @Override
+    protected void checkResultWithSemantic(

Review Comment:
   Can you explain this in more detail? Isn't this only checking that any 
record was written to elasticsearch?



##########
flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testframe/testsuites/SinkTestSuiteBase.java:
##########
@@ -540,7 +540,7 @@ private boolean compareSinkMetrics(
     }
 
     /** Sort the list. */
-    private List<T> sort(List<T> list) {
+    protected List<T> sort(List<T> list) {

Review Comment:
   Not sure it makes much sense to make this method visible.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to