AHeise commented on a change in pull request #16590: URL: https://github.com/apache/flink/pull/16590#discussion_r685803188
########## File path: flink-test-utils-parent/flink-connector-testing-framework/src/main/java/org/apache/flink/connectors/test/common/testsuites/TestSuiteBase.java ########## @@ -0,0 +1,430 @@ +/* + * 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.connectors.test.common.testsuites; + +import org.apache.flink.api.common.JobStatus; +import org.apache.flink.api.common.eventtime.WatermarkStrategy; +import org.apache.flink.api.common.typeutils.TypeSerializer; +import org.apache.flink.api.connector.source.Boundedness; +import org.apache.flink.connectors.test.common.environment.ClusterControllable; +import org.apache.flink.connectors.test.common.environment.TestEnvironment; +import org.apache.flink.connectors.test.common.external.ExternalContext; +import org.apache.flink.connectors.test.common.external.SourceSplitDataWriter; +import org.apache.flink.connectors.test.common.junit.annotations.Case; +import org.apache.flink.connectors.test.common.junit.extensions.TestLoggerExtension; +import org.apache.flink.connectors.test.common.junit.extensions.TestingFrameworkExtension; +import org.apache.flink.connectors.test.common.utils.JobStatusUtils; +import org.apache.flink.core.execution.JobClient; +import org.apache.flink.streaming.api.datastream.DataStreamSource; +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.apache.flink.streaming.api.operators.collect.CollectResultIterator; +import org.apache.flink.streaming.api.operators.collect.CollectSinkOperator; +import org.apache.flink.streaming.api.operators.collect.CollectSinkOperatorFactory; +import org.apache.flink.streaming.api.operators.collect.CollectStreamSink; +import org.apache.flink.util.CloseableIterator; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtendWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +/** + * Base class for all test suites. + * + * <p>All cases should have well-descriptive JavaDoc, including: + * + * <ul> + * <li>What's the purpose of this case + * <li>Simple description of how this case works + * <li>Condition to fulfill in order to pass this case + * <li>Requirement of running this case + * </ul> + */ +@ExtendWith({TestingFrameworkExtension.class, TestLoggerExtension.class}) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public abstract class TestSuiteBase<T> { + + private static final Logger LOG = LoggerFactory.getLogger(TestSuiteBase.class); + + // ----------------------------- Basic test cases --------------------------------- + + /** + * Test connector source with only one split in the external system. + * + * <p>This test will create one split in the external system, write test data into it, and + * consume back via a Flink job with 1 parallelism. + * + * <p>The number and order of records consumed by Flink need to be identical to the test data + * written to the external system in order to pass this test. + * + * <p>A bounded source is required for this test. + */ + @Case Review comment: Okay I'm not deep enough in JUnit5 yet to propose an alternative. I had assumed that we could but the `@ExtendWith` at the class and then just use `@TestTemplate`. -- 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]
