refactor(接口测试): 优化获取协议页面脚本接口

This commit is contained in:
AgAngle 2024-02-07 17:23:21 +08:00 committed by Craftsman
parent 50139a84ac
commit 31c9897746
2 changed files with 5 additions and 1 deletions

View File

@ -63,7 +63,7 @@ public class ApiTestService {
PluginWrapper pluginWrapper = pluginLoadService.getPluginWrapper(pluginId); PluginWrapper pluginWrapper = pluginLoadService.getPluginWrapper(pluginId);
checkResourceExist(pluginWrapper); checkResourceExist(pluginWrapper);
if (pluginWrapper.getPlugin() instanceof AbstractProtocolPlugin protocolPlugin) { if (pluginWrapper.getPlugin() instanceof AbstractProtocolPlugin protocolPlugin) {
return pluginLoadService.getPluginScriptContent(pluginId, protocolPlugin.getApiProtocolScriptId()); return pluginLoadService.getPluginScript(pluginId, protocolPlugin.getApiProtocolScriptId());
} else { } else {
// 插件不存在或者非接口插件抛出异常 // 插件不存在或者非接口插件抛出异常
return checkResourceExist(null); return checkResourceExist(null);

View File

@ -259,6 +259,10 @@ public class PluginLoadService {
return getPluginScriptConfig(pluginId, scriptId).get("script"); return getPluginScriptConfig(pluginId, scriptId).get("script");
} }
public Object getPluginScript(String pluginId, String scriptId) {
return getPluginScriptConfig(pluginId, scriptId);
}
public PluginWrapper getPluginWrapper(String id) { public PluginWrapper getPluginWrapper(String id) {
return msPluginManager.getPlugin(id); return msPluginManager.getPlugin(id);
} }