fix(接口测试): 引用的公共脚本被删除,获取接口详情报错
This commit is contained in:
parent
f1215eba88
commit
c7c8734ced
|
@ -57,6 +57,10 @@ public abstract class ScriptProcessorConverter extends MsProcessorConverter<Scri
|
||||||
String scriptLanguage = scriptProcessor.getScriptLanguage();
|
String scriptLanguage = scriptProcessor.getScriptLanguage();
|
||||||
String script = scriptProcessor.getScript();
|
String script = scriptProcessor.getScript();
|
||||||
if (scriptProcessor.isEnableCommonScript()) {
|
if (scriptProcessor.isEnableCommonScript()) {
|
||||||
|
if (BooleanUtils.isTrue(scriptProcessor.getCommonScriptInfo().getDeleted())) {
|
||||||
|
// 如果公共脚本被删除则不处理
|
||||||
|
return;
|
||||||
|
}
|
||||||
scriptLanguage = scriptProcessor.getCommonScriptInfo().getScriptLanguage();
|
scriptLanguage = scriptProcessor.getCommonScriptInfo().getScriptLanguage();
|
||||||
script = scriptProcessor.getCommonScriptInfo().getScript();
|
script = scriptProcessor.getCommonScriptInfo().getScript();
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,8 +208,17 @@ public class ApiCommonService {
|
||||||
for (ScriptProcessor processor : scriptsProcessors) {
|
for (ScriptProcessor processor : scriptsProcessors) {
|
||||||
CommonScriptInfo commonScriptInfo = processor.getCommonScriptInfo();
|
CommonScriptInfo commonScriptInfo = processor.getCommonScriptInfo();
|
||||||
CustomFunctionBlob customFunctionBlob = customFunctionBlobMap.get(commonScriptInfo.getId());
|
CustomFunctionBlob customFunctionBlob = customFunctionBlobMap.get(commonScriptInfo.getId());
|
||||||
|
|
||||||
CustomFunction customFunction = customFunctionMap.get(commonScriptInfo.getId());
|
CustomFunction customFunction = customFunctionMap.get(commonScriptInfo.getId());
|
||||||
|
|
||||||
|
if (customFunction == null || customFunctionBlob == null) {
|
||||||
|
if (customFunction == null) {
|
||||||
|
// 公共脚本被删除,就改成非公共脚本
|
||||||
|
processor.getCommonScriptInfo().setDeleted(true);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 设置公共脚本信息
|
// 设置公共脚本信息
|
||||||
Optional.ofNullable(customFunctionBlob.getParams()).ifPresent(paramsBlob -> {
|
Optional.ofNullable(customFunctionBlob.getParams()).ifPresent(paramsBlob -> {
|
||||||
List<KeyValueParam> commonParams = JSON.parseArray(new String(paramsBlob), KeyValueParam.class);
|
List<KeyValueParam> commonParams = JSON.parseArray(new String(paramsBlob), KeyValueParam.class);
|
||||||
|
|
|
@ -18,6 +18,10 @@ public class CommonScriptInfo {
|
||||||
*/
|
*/
|
||||||
@Size(min = 1, max = 50)
|
@Size(min = 1, max = 50)
|
||||||
private String id;
|
private String id;
|
||||||
|
/**
|
||||||
|
* 脚本是否删除
|
||||||
|
*/
|
||||||
|
private Boolean deleted = false;
|
||||||
/**
|
/**
|
||||||
* 公共脚本的名字
|
* 公共脚本的名字
|
||||||
* 页面展示需要
|
* 页面展示需要
|
||||||
|
|
Loading…
Reference in New Issue