This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch release-1.0.0 in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git
commit e934aa19bebef8c263b8a4dd1c8fd08ef1bd67f0 Author: healchow <[email protected]> AuthorDate: Wed Feb 9 14:57:35 2022 +0800 [INLONG-2414][Manager] Exclude test jar file during the apache-rat-plugin check (#2415) * [INLONG-2414][Manager] Exclude test jar file during the apache-rat-plugin check * [INLONG-2414][Manager] Update manager plugin test case, fix code warning --- inlong-manager/manager-plugin-examples/pom.xml | 2 +- .../manager/service/core/plugin/PluginService.java | 4 ++-- .../manager/service/core/plugin/PluginServiceTest.java | 6 ++++-- .../test/resources/plugins/inlong-manager-plugin.jar | Bin 12277 -> 0 bytes .../test/resources/plugins/manager-plugin-examples.jar | Bin 0 -> 12254 bytes pom.xml | 2 ++ 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/inlong-manager/manager-plugin-examples/pom.xml b/inlong-manager/manager-plugin-examples/pom.xml index 601db4b..5659edf 100644 --- a/inlong-manager/manager-plugin-examples/pom.xml +++ b/inlong-manager/manager-plugin-examples/pom.xml @@ -26,7 +26,7 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>inlong-manager-plugin</artifactId> + <artifactId>manager-plugin-examples</artifactId> <dependencies> <dependency> diff --git a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/plugin/PluginService.java b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/plugin/PluginService.java index 7c364e2..3324a48 100644 --- a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/plugin/PluginService.java +++ b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/plugin/PluginService.java @@ -50,7 +50,7 @@ public class PluginService { private List<PluginBinder> pluginBinders; @Getter - private List<Plugin> plugins = new ArrayList<>(); + private final List<Plugin> plugins = new ArrayList<>(); public PluginService() { if (StringUtils.isBlank(pluginLoc)) { @@ -77,7 +77,7 @@ public class PluginService { for (PluginDefinition pluginDefinition : pluginDefinitions.values()) { String pluginClassName = pluginDefinition.getPluginClass(); try { - Class pluginClass = pluginLoader.loadClass(pluginClassName); + Class<?> pluginClass = pluginLoader.loadClass(pluginClassName); Object plugin = pluginClass.getDeclaredConstructor().newInstance(); plugins.add((Plugin) plugin); } catch (Throwable e) { diff --git a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/plugin/PluginServiceTest.java b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/plugin/PluginServiceTest.java index 3ce65fc..756b09e 100644 --- a/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/plugin/PluginServiceTest.java +++ b/inlong-manager/manager-service/src/test/java/org/apache/inlong/manager/service/core/plugin/PluginServiceTest.java @@ -18,6 +18,8 @@ package org.apache.inlong.manager.service.core.plugin; import java.util.List; +import java.util.Objects; + import org.apache.inlong.manager.common.plugin.Plugin; import org.apache.inlong.manager.common.plugin.ProcessPlugin; import org.apache.inlong.manager.service.BaseTest; @@ -32,11 +34,11 @@ public class PluginServiceTest extends BaseTest { @Test public void testReloadPlugin() { - String path = this.getClass().getClassLoader().getResource("").getPath(); + String path = Objects.requireNonNull(this.getClass().getClassLoader().getResource("")).getPath(); pluginService.setPluginLoc(path + "plugins"); pluginService.pluginReload(); List<Plugin> pluginList = pluginService.getPlugins(); - Assert.assertTrue(pluginList.size() == 1); + Assert.assertTrue(pluginList.size() > 0); Assert.assertTrue(pluginList.get(0) instanceof ProcessPlugin); } } diff --git a/inlong-manager/manager-service/src/test/resources/plugins/inlong-manager-plugin.jar b/inlong-manager/manager-service/src/test/resources/plugins/inlong-manager-plugin.jar deleted file mode 100644 index 2e52e83..0000000 Binary files a/inlong-manager/manager-service/src/test/resources/plugins/inlong-manager-plugin.jar and /dev/null differ diff --git a/inlong-manager/manager-service/src/test/resources/plugins/manager-plugin-examples.jar b/inlong-manager/manager-service/src/test/resources/plugins/manager-plugin-examples.jar new file mode 100644 index 0000000..9eca165 Binary files /dev/null and b/inlong-manager/manager-service/src/test/resources/plugins/manager-plugin-examples.jar differ diff --git a/pom.xml b/pom.xml index 7451709..d77dbe5 100644 --- a/pom.xml +++ b/pom.xml @@ -250,6 +250,8 @@ <exclude>**/tubemq-core/src/test/resources/*.keystore</exclude> <!-- Test case : temporary data for test cases --> <exclude>**/AgentBaseTestsHelper/**</exclude> + <!-- Test case : example jar for test cases --> + <exclude>**/manager-service/src/test/resources/plugins/manager-plugin-examples.jar</exclude> <!-- Referenced 3rd codes --> <exclude>**/resources/assets/lib/**</exclude>
