AHeise commented on a change in pull request #16590: URL: https://github.com/apache/flink/pull/16590#discussion_r688009385
########## File path: flink-end-to-end-tests/flink-end-to-end-tests-common-kafka/src/test/java/org/apache/flink/tests/util/kafka/KafkaSourceE2ECase.java ########## @@ -0,0 +1,73 @@ +/* + * 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.tests.util.kafka; + +import org.apache.flink.connector.kafka.source.testutils.KafkaContainerizedExternalSystem; +import org.apache.flink.connector.kafka.source.testutils.KafkaMultipleTopicExternalContext; +import org.apache.flink.connector.kafka.source.testutils.KafkaSingleTopicExternalContext; +import org.apache.flink.connectors.test.common.junit.annotations.WithExternalContextFactory; +import org.apache.flink.connectors.test.common.junit.annotations.WithExternalSystem; +import org.apache.flink.connectors.test.common.junit.annotations.WithTestEnvironment; +import org.apache.flink.connectors.test.common.testsuites.SourceTestSuiteBase; +import org.apache.flink.tests.util.TestUtils; +import org.apache.flink.tests.util.flink.FlinkContainerTestEnvironment; + +/** Kafka E2E test based on connector testing framework. */ +public class KafkaSourceE2ECase extends SourceTestSuiteBase<String> { + + // Defines TestEnvironment + @WithTestEnvironment public FlinkContainerTestEnvironment flink; + + // Defines ExternalSystem + @WithExternalSystem public KafkaContainerizedExternalSystem kafka; + + // Defines 2 External context Factories, so test cases will be invoked twice using these two + // kinds of external contexts. + @WithExternalContextFactory public KafkaSingleTopicExternalContext.Factory singleTopic; + @WithExternalContextFactory public KafkaMultipleTopicExternalContext.Factory multipleTopic; + + /** Instantiate and preparing test resources. */ + public KafkaSourceE2ECase() { Review comment: You have a fair point, but now I know exactly why this looks very confusing to me: usually rules etc are initialized directly on the fields. And indeed no values are injected such that all initialization could already happen on the fields which I would very much prefer. That we need to initialize these things manually in a certain order indicates to me that we still have not abstracted correctly. Test resources, rules, and contexts should be defined decoratively but now we have to resort to procedural definition again. I'll add annotations to the specific points. -- 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]
