zentol commented on code in PR #19715: URL: https://github.com/apache/flink/pull/19715#discussion_r893238394
########## flink-end-to-end-tests/flink-end-to-end-tests-sql/src/test/java/org/apache/flink/table/sql/codegen/PlannerScalaFreeITCase.java: ########## @@ -0,0 +1,207 @@ +/* + * 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.table.sql.codegen; + +import org.apache.flink.api.common.time.Deadline; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.tests.util.TestUtils; +import org.apache.flink.tests.util.cache.DownloadCache; +import org.apache.flink.tests.util.flink.ClusterController; +import org.apache.flink.tests.util.flink.FlinkResource; +import org.apache.flink.tests.util.flink.FlinkResourceSetup; +import org.apache.flink.tests.util.flink.LocalStandaloneFlinkResourceFactory; +import org.apache.flink.tests.util.flink.SQLJobSubmission; +import org.apache.flink.util.TestLogger; + +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.hamcrest.Matchers.arrayContainingInAnyOrder; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +/** + * End to End tests for table planner scala-free since 1.15. Due to scala-free of table planner + * introduced, the class in table planner is not visible in distribution runtime, if we use these + * class in execution time, ClassNotFound exception will be thrown. ITCase in table planner can not + * cover it, so we should add E2E test for these case. + */ +@RunWith(Parameterized.class) +public class PlannerScalaFreeITCase extends TestLogger { + + private static final Logger LOG = LoggerFactory.getLogger(PlannerScalaFreeITCase.class); + + private static final String SCALA_FREE_E2E_SQL = "scala_free_e2e.sql"; + + @Parameterized.Parameters(name = "executionMode") + public static Collection<String> data() { + return Arrays.asList("streaming", "batch"); + } + + private static Configuration getConfiguration() { + // we have to enable checkpoint to trigger flushing for filesystem sink + final Configuration flinkConfig = new Configuration(); + flinkConfig.setString("execution.checkpointing.interval", "5s"); + return flinkConfig; + } + + @Rule + public final FlinkResource flink = + new LocalStandaloneFlinkResourceFactory() + .create( + FlinkResourceSetup.builder() + .addConfiguration(getConfiguration()) + .build()); + + @Rule public final TemporaryFolder tmp = new TemporaryFolder(); + + private final String executionMode; + private Path result; + + @ClassRule public static final DownloadCache DOWNLOAD_CACHE = DownloadCache.get(); + + private static final Path sqlToolBoxJar = TestUtils.getResource(".*SqlToolbox.jar"); + + public PlannerScalaFreeITCase(String executionMode) { + this.executionMode = executionMode; + } + + @Before + public void before() throws Exception { + DOWNLOAD_CACHE.before(); Review Comment: this is unnecessary -- 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]
