Airblader commented on a change in pull request #17384:
URL: https://github.com/apache/flink/pull/17384#discussion_r719256769



##########
File path: 
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/module/ModuleITCase.java
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.planner.runtime.stream.module;
+
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.table.api.Schema;
+import org.apache.flink.table.api.Table;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.factories.DynamicTableSourceFactory;
+import org.apache.flink.table.factories.Factory;
+import org.apache.flink.table.module.Module;
+import org.apache.flink.table.planner.factories.TableFactoryHarness;
+import org.apache.flink.table.planner.runtime.utils.StreamingTestBase;
+
+import org.junit.Test;
+
+import java.util.Optional;
+import java.util.Set;
+
+import static org.apache.flink.core.testutils.CommonTestUtils.assertThrows;
+
+/** Tests for modules. */
+public class ModuleITCase extends StreamingTestBase {
+
+    @Test
+    public void testTableSourceFactory() {
+        tEnv().createTemporaryTable(
+                        "T",
+                        TableFactoryHarness.newBuilder()
+                                .schema(Schema.newBuilder().build())
+                                .source(
+                                        new 
TableFactoryHarness.ScanSourceBase() {
+                                            @Override
+                                            public ScanRuntimeProvider 
getScanRuntimeProvider(
+                                                    ScanContext 
runtimeProviderContext) {
+                                                throw new 
UnsupportedOperationException(
+                                                        "Discovered factory 
should not be used");
+                                            }
+                                        })
+                                .build());
+
+        final Table table = tEnv().from("T");
+
+        // Sanity check: without our module loaded, the factory discovery 
process is used.
+        assertThrows(
+                "Discovered factory should not be used",
+                UnsupportedOperationException.class,
+                () -> table.execute().collect());

Review comment:
       It does, I had even used it before, but changed it when it didn't work 
for the sink at first due to another issue. As discussed offline, leaving the 
test base, though.




-- 
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]


Reply via email to