You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/06/01 05:33:48 UTC

[GitHub] [incubator-seatunnel] ruanwenjun commented on a diff in pull request #1979: [Core] [Fix] add plugin mapping ignore case

ruanwenjun commented on code in PR #1979:
URL: https://github.com/apache/incubator-seatunnel/pull/1979#discussion_r886332279


##########
seatunnel-core/seatunnel-core-base/src/test/java/org/apache/seatunnel/core/base/config/PluginFactoryTest.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.seatunnel.core.base.config;
+
+import org.apache.seatunnel.common.config.Common;
+import org.apache.seatunnel.spark.SparkEnvironment;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+import org.apache.seatunnel.shade.com.typesafe.config.ConfigFactory;
+import org.apache.seatunnel.shade.com.typesafe.config.ConfigResolveOptions;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.nio.file.Paths;
+import java.util.Objects;
+
+public class PluginFactoryTest {
+
+    @Test
+    public void getPluginMappingValueTest() throws Exception {
+
+        Common.setDeployMode("cluster");
+        Config config = new ConfigBuilder<>(Paths.get(Objects.requireNonNull(PluginFactoryTest.class.getResource("/flink.batch" +
+                ".conf")).getPath()), EngineType.SPARK).getConfig();
+
+        Config pluginMapping = ConfigFactory
+                .parseFile(new File(Objects.requireNonNull(PluginFactoryTest.class.getResource("/plugin-mapping.properties")).getPath()))
+                .resolve(ConfigResolveOptions.defaults().setAllowUnresolved(true))
+                .resolveWith(ConfigFactory.systemProperties(),
+                        ConfigResolveOptions.defaults().setAllowUnresolved(true));
+
+        PluginFactory<SparkEnvironment> factory = new PluginFactory<>(config, EngineType.SPARK);
+
+        Method method = factory.getClass().getDeclaredMethod("getPluginMappingValue", Config.class,

Review Comment:
   You can remove the private of `getPluginMappingValue`, then you don't need to use reflect in UT.



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org