This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push: new d37dfa6b6 [INLONG-5712][Sort] Fix class not found in Elasticsearch 6 connector for producting (#5717) d37dfa6b6 is described below commit d37dfa6b63799d3671c36249bbeff1812a842c41 Author: Oneal65 <liush...@foxmail.com> AuthorDate: Mon Aug 29 14:19:09 2022 +0800 [INLONG-5712][Sort] Fix class not found in Elasticsearch 6 connector for producting (#5717) --- .../sort-connectors/elasticsearch-6/pom.xml | 2 +- .../sort-connectors/elasticsearch-7/pom.xml | 1 + inlong-sort/sort-connectors/hbase/pom.xml | 1 + inlong-sort/sort-core/pom.xml | 6 ++++ .../sort/parser/Elasticsearch6SqlParseTest.java | 32 ++++++++++++++++++++++ .../sort/parser/Elasticsearch7SqlParseTest.java | 31 +++++++++++++++++++++ .../sort/parser/ElasticsearchSqlParseTest.java | 18 +++++++----- pom.xml | 1 + 8 files changed, 84 insertions(+), 8 deletions(-) diff --git a/inlong-sort/sort-connectors/elasticsearch-6/pom.xml b/inlong-sort/sort-connectors/elasticsearch-6/pom.xml index 2b07e680f..9e7844df3 100644 --- a/inlong-sort/sort-connectors/elasticsearch-6/pom.xml +++ b/inlong-sort/sort-connectors/elasticsearch-6/pom.xml @@ -158,6 +158,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> + <version>${plugin.shade.version}</version> <executions> <execution> <id>shade-flink</id> @@ -173,7 +174,6 @@ </includes> <excludes> <!-- These dependencies are not required. --> - <exclude>com.carrotsearch:hppc</exclude> <exclude>com.tdunning:t-digest</exclude> <exclude>joda-time:joda-time</exclude> <exclude>net.sf.jopt-simple:jopt-simple</exclude> diff --git a/inlong-sort/sort-connectors/elasticsearch-7/pom.xml b/inlong-sort/sort-connectors/elasticsearch-7/pom.xml index 3a5c1e135..211535c7a 100644 --- a/inlong-sort/sort-connectors/elasticsearch-7/pom.xml +++ b/inlong-sort/sort-connectors/elasticsearch-7/pom.xml @@ -147,6 +147,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> + <version>${plugin.shade.version}</version> <executions> <execution> <id>shade-flink</id> diff --git a/inlong-sort/sort-connectors/hbase/pom.xml b/inlong-sort/sort-connectors/hbase/pom.xml index 27b7a3e4d..21d4f59c4 100644 --- a/inlong-sort/sort-connectors/hbase/pom.xml +++ b/inlong-sort/sort-connectors/hbase/pom.xml @@ -74,6 +74,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> + <version>${plugin.shade.version}</version> <executions> <execution> <id>shade-flink</id> diff --git a/inlong-sort/sort-core/pom.xml b/inlong-sort/sort-core/pom.xml index 0ff4cd883..dccdc2f29 100644 --- a/inlong-sort/sort-core/pom.xml +++ b/inlong-sort/sort-core/pom.xml @@ -112,6 +112,12 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.inlong</groupId> + <artifactId>sort-connector-elasticsearch6</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> <dependency> <groupId>org.apache.inlong</groupId> <artifactId>sort-connector-elasticsearch7</artifactId> diff --git a/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/Elasticsearch6SqlParseTest.java b/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/Elasticsearch6SqlParseTest.java new file mode 100644 index 000000000..b34a6d129 --- /dev/null +++ b/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/Elasticsearch6SqlParseTest.java @@ -0,0 +1,32 @@ +/* + * 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.inlong.sort.parser; + +import org.apache.inlong.sort.protocol.node.Node; +import org.junit.Test; + +public class Elasticsearch6SqlParseTest extends ElasticsearchSqlParseTest { + + @Test + public void testMysqlToElasticsearch6() throws Exception { + Node outputNode = this.buildElasticsearchLoadNode(6); + this.testMysqlToElasticsearch(outputNode); + } + +} diff --git a/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/Elasticsearch7SqlParseTest.java b/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/Elasticsearch7SqlParseTest.java new file mode 100644 index 000000000..190f9e114 --- /dev/null +++ b/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/Elasticsearch7SqlParseTest.java @@ -0,0 +1,31 @@ +/* + * 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.inlong.sort.parser; + +import org.apache.inlong.sort.protocol.node.Node; +import org.junit.Test; + +public class Elasticsearch7SqlParseTest extends ElasticsearchSqlParseTest { + + @Test + public void testMysqlToElasticsearch7() throws Exception { + Node outputNode = this.buildElasticsearchLoadNode(7); + this.testMysqlToElasticsearch(outputNode); + } +} diff --git a/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/ElasticsearchSqlParseTest.java b/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/ElasticsearchSqlParseTest.java index 4ed00fb72..c7e6251e9 100644 --- a/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/ElasticsearchSqlParseTest.java +++ b/inlong-sort/sort-core/src/test/java/org/apache/inlong/sort/parser/ElasticsearchSqlParseTest.java @@ -41,12 +41,11 @@ import org.apache.inlong.sort.protocol.node.load.ElasticsearchLoadNode; import org.apache.inlong.sort.protocol.transformation.FieldRelation; import org.apache.inlong.sort.protocol.transformation.relation.NodeRelation; import org.junit.Assert; -import org.junit.Test; /** * test elastic search sql parse */ -public class ElasticsearchSqlParseTest extends AbstractTestBase { +public abstract class ElasticsearchSqlParseTest extends AbstractTestBase { private MySqlExtractNode buildMysqlExtractNode() { List<FieldInfo> fields = Arrays.asList(new FieldInfo("age", new StringFormatInfo()), @@ -59,7 +58,13 @@ public class ElasticsearchSqlParseTest extends AbstractTestBase { true, null); } - private ElasticsearchLoadNode buildElasticsearchLoadNode() { + /** + * Build elasticsearch node + * + * @param version version number + * @return ElasticsearchLoadNode + */ + ElasticsearchLoadNode buildElasticsearchLoadNode(int version) { List<FieldInfo> fields = Arrays.asList(new FieldInfo("age", new StringFormatInfo()), new FieldInfo("name", new StringFormatInfo())); List<FieldRelation> relations = Arrays @@ -72,7 +77,7 @@ public class ElasticsearchSqlParseTest extends AbstractTestBase { return new ElasticsearchLoadNode("2", "kafka_output", fields, relations, null, null, 2, null, "test", "http://localhost:9200", - "elastic", "my_password", null, "age", 7); + "elastic", "my_password", null, "age", version); } private NodeRelation buildNodeRelation(List<Node> inputs, List<Node> outputs) { @@ -86,8 +91,7 @@ public class ElasticsearchSqlParseTest extends AbstractTestBase { * * @throws Exception The exception may throws when execute the case */ - @Test - public void testMysqlToElasticsearch() throws Exception { + public void testMysqlToElasticsearch(Node node) throws Exception { EnvironmentSettings settings = EnvironmentSettings .newInstance() .useBlinkPlanner() @@ -98,7 +102,7 @@ public class ElasticsearchSqlParseTest extends AbstractTestBase { env.enableCheckpointing(10000); StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env, settings); Node inputNode = buildMysqlExtractNode(); - Node outputNode = buildElasticsearchLoadNode(); + Node outputNode = node; StreamInfo streamInfo = new StreamInfo("1", Arrays.asList(inputNode, outputNode), Collections.singletonList(buildNodeRelation(Collections.singletonList(inputNode), Collections.singletonList(outputNode)))); diff --git a/pom.xml b/pom.xml index 41aedb503..0e9020aee 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,7 @@ <plugin.failsafe.version>3.0.0-M7</plugin.failsafe.version> <plugin.shade.version>3.2.4</plugin.shade.version> <plugin.maven.source>3.0.1</plugin.maven.source> + <plugin.maven.jar.version>3.2.0</plugin.maven.jar.version> <exec.maven.version>1.6.0</exec.maven.version> <build.helper.maven.version>3.0.0</build.helper.maven.version>