This is an automated email from the ASF dual-hosted git repository. jqin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit ecf0a10f7df5b8576c4652ec595aaabca69dcb93 Author: Jiangjie (Becket) Qin <jiangjie...@alibaba-inc.com> AuthorDate: Sat Oct 10 00:30:53 2020 +0800 [hotfix][connector/common] Move SourceReaderTestBase to a separate module of flink-connector-test-utils in flink-test-utils-parent. --- flink-connectors/flink-connector-base/pom.xml | 7 +++++ .../base/source/reader/SourceReaderBaseTest.java | 1 + .../flink-connector-test-utils}/pom.xml | 25 +++++++--------- .../source/reader/SourceReaderTestBase.java | 34 +++++++++++----------- .../src/main/resources/log4j2-test.properties | 28 ++++++++++++++++++ flink-test-utils-parent/pom.xml | 1 + 6 files changed, 65 insertions(+), 31 deletions(-) diff --git a/flink-connectors/flink-connector-base/pom.xml b/flink-connectors/flink-connector-base/pom.xml index 700b907..80f3acb 100644 --- a/flink-connectors/flink-connector-base/pom.xml +++ b/flink-connectors/flink-connector-base/pom.xml @@ -57,5 +57,12 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.apache.flink</groupId> + <artifactId>flink-connector-test-utils</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/SourceReaderBaseTest.java b/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/SourceReaderBaseTest.java index f14ddb1..ab4f24c 100644 --- a/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/SourceReaderBaseTest.java +++ b/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/SourceReaderBaseTest.java @@ -33,6 +33,7 @@ import org.apache.flink.connector.base.source.reader.mocks.TestingSplitReader; import org.apache.flink.connector.base.source.reader.splitreader.SplitReader; import org.apache.flink.connector.base.source.reader.splitreader.SplitsChange; import org.apache.flink.connector.base.source.reader.synchronization.FutureCompletingBlockingQueue; +import org.apache.flink.connector.testutils.source.reader.SourceReaderTestBase; import org.junit.Rule; import org.junit.Test; diff --git a/flink-connectors/flink-connector-base/pom.xml b/flink-test-utils-parent/flink-connector-test-utils/pom.xml similarity index 75% copy from flink-connectors/flink-connector-base/pom.xml copy to flink-test-utils-parent/flink-connector-test-utils/pom.xml index 700b907..f8a029e 100644 --- a/flink-connectors/flink-connector-base/pom.xml +++ b/flink-test-utils-parent/flink-connector-test-utils/pom.xml @@ -24,17 +24,16 @@ <parent> <groupId>org.apache.flink</groupId> - <artifactId>flink-connectors</artifactId> + <artifactId>flink-test-utils-parent</artifactId> <version>1.12-SNAPSHOT</version> <relativePath>..</relativePath> </parent> - <artifactId>flink-connector-base</artifactId> - <name>Flink : Connectors : Base</name> + <!-- This module is the test module separated from flink-connector-base to avoid introducing + Scala version bindings to the flink-connector-base. --> + <artifactId>flink-connector-test-utils</artifactId> + <name>Flink : Connectors : Base-Test</name> - <packaging>jar</packaging> - - <!-- Allow users to pass custom connector versions --> <dependencies> <dependency> <groupId>org.apache.flink</groupId> @@ -42,20 +41,18 @@ <version>${project.version}</version> </dependency> - <!-- test dependency --> <dependency> <groupId>org.apache.flink</groupId> - <artifactId>flink-core</artifactId> + <artifactId>flink-test-utils-junit</artifactId> <version>${project.version}</version> - <scope>test</scope> - <type>test-jar</type> + <scope>compile</scope> </dependency> <dependency> - <groupId>org.apache.flink</groupId> - <artifactId>flink-test-utils_${scala.binary.version}</artifactId> - <version>${project.version}</version> - <scope>test</scope> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>compile</scope> </dependency> </dependencies> </project> diff --git a/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/SourceReaderTestBase.java b/flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testutils/source/reader/SourceReaderTestBase.java similarity index 87% rename from flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/SourceReaderTestBase.java rename to flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testutils/source/reader/SourceReaderTestBase.java index 015cd89..b61258d 100644 --- a/flink-connectors/flink-connector-base/src/test/java/org/apache/flink/connector/base/source/reader/SourceReaderTestBase.java +++ b/flink-test-utils-parent/flink-connector-test-utils/src/main/java/org/apache/flink/connector/testutils/source/reader/SourceReaderTestBase.java @@ -1,22 +1,22 @@ /* - * 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. + 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.connector.base.source.reader; +package org.apache.flink.connector.testutils.source.reader; import org.apache.flink.api.common.eventtime.Watermark; import org.apache.flink.api.connector.source.Boundedness; @@ -170,7 +170,7 @@ public abstract class SourceReaderTestBase<SplitT extends SourceSplit> extends T /** * A source output that validates the output. */ - protected static class ValidatingSourceOutput implements ReaderOutput<Integer> { + public static class ValidatingSourceOutput implements ReaderOutput<Integer> { private Set<Integer> consumedValues = new HashSet<>(); private int max = Integer.MIN_VALUE; private int min = Integer.MAX_VALUE; diff --git a/flink-test-utils-parent/flink-connector-test-utils/src/main/resources/log4j2-test.properties b/flink-test-utils-parent/flink-connector-test-utils/src/main/resources/log4j2-test.properties new file mode 100644 index 0000000..c4fa187 --- /dev/null +++ b/flink-test-utils-parent/flink-connector-test-utils/src/main/resources/log4j2-test.properties @@ -0,0 +1,28 @@ +# +# 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. +# + +# Set root logger level to OFF to not flood build logs +# set manually to INFO for debugging purposes +rootLogger.level = OFF +rootLogger.appenderRef.test.ref = TestLogger + +appender.testlogger.name = TestLogger +appender.testlogger.type = CONSOLE +appender.testlogger.target = SYSTEM_ERR +appender.testlogger.layout.type = PatternLayout +appender.testlogger.layout.pattern = %-4r [%t] %-5p %c %x - %m%n diff --git a/flink-test-utils-parent/pom.xml b/flink-test-utils-parent/pom.xml index 50a5d8d..e2da750 100644 --- a/flink-test-utils-parent/pom.xml +++ b/flink-test-utils-parent/pom.xml @@ -38,6 +38,7 @@ under the License. <modules> <module>flink-test-utils-junit</module> <module>flink-test-utils</module> + <module>flink-connector-test-utils</module> </modules> </project>