refactor(系统设置): 完善插件测试用例
This commit is contained in:
parent
848d817e60
commit
abbb7fc4d8
|
@ -185,6 +185,7 @@ plugin.exist=插件名称或文件名已存在
|
|||
plugin.type.exist=插件类型已存在
|
||||
plugin.script.exist=脚本id重复
|
||||
plugin.script.format=脚本格式错误
|
||||
plugin.parse.error=插件解析失败
|
||||
# serviceIntegration
|
||||
service_integration.id.not_blank=ID不能为空
|
||||
service_integration.id.length_range=ID长度必须在{min}和{max}之间
|
||||
|
|
|
@ -188,6 +188,7 @@ plugin.exist=plugin name or filename already exists
|
|||
plugin.type.exist=plugin type already exists
|
||||
plugin.script.exist=duplicate script id
|
||||
plugin.script.format=malformed script
|
||||
plugin.parse.error=plugin parsing failed
|
||||
# serviceIntegration
|
||||
service_integration.id.not_blank=id cannot be empty
|
||||
service_integration.id.length_range=id length must be between {min} and {max}
|
||||
|
|
|
@ -187,6 +187,7 @@ plugin.exist=插件名称或文件名已存在
|
|||
plugin.type.exist=插件类型已存在
|
||||
plugin.script.exist=脚本id重复
|
||||
plugin.script.format=脚本格式错误
|
||||
plugin.parse.error=插件解析失败
|
||||
# serviceIntegration
|
||||
service_integration.id.not_blank=ID不能为空
|
||||
service_integration.id.length_range=ID长度必须在{min}和{max}之间
|
||||
|
|
|
@ -187,6 +187,7 @@ plugin.exist=插件名稱或文件名已存在
|
|||
plugin.type.exist=插件類型已存在
|
||||
plugin.script.exist=腳本id重複
|
||||
plugin.script.format=腳本格式錯誤
|
||||
plugin.parse.error=插件解析失敗
|
||||
# serviceIntegration
|
||||
service_integration.id.not_blank=ID不能為空
|
||||
service_integration.id.length_range=ID長度必須在{min}和{max}之間
|
||||
|
|
|
@ -27,7 +27,8 @@ public enum SystemResultCode implements IResultCode {
|
|||
PLUGIN_SCRIPT_EXIST(101010, "plugin.script.exist"),
|
||||
PLUGIN_SCRIPT_FORMAT(101011, "plugin.script.format"),
|
||||
NO_PROJECT_USER_ROLE_PERMISSION(101012, "project_user_role_permission_error"),
|
||||
NO_GLOBAL_USER_ROLE_PERMISSION(101013, "no_global_user_role_permission_error");
|
||||
NO_GLOBAL_USER_ROLE_PERMISSION(101013, "no_global_user_role_permission_error"),
|
||||
PLUGIN_PARSE_ERROR(101014, "plugin.parse.error");
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.sql.Driver;
|
|||
import java.util.*;
|
||||
|
||||
import static io.metersphere.system.controller.result.SystemResultCode.PLUGIN_EXIST;
|
||||
import static io.metersphere.system.controller.result.SystemResultCode.PLUGIN_PARSE_ERROR;
|
||||
|
||||
/**
|
||||
* @author jianxing
|
||||
|
@ -142,7 +143,10 @@ public class PluginService {
|
|||
// 删除插件
|
||||
pluginLoadService.unloadPlugin(id);
|
||||
pluginLoadService.deletePluginFile(file.getOriginalFilename());
|
||||
throw e;
|
||||
if (e instanceof MSException) {
|
||||
throw e;
|
||||
}
|
||||
throw new MSException(PLUGIN_PARSE_ERROR, e);
|
||||
}
|
||||
return plugin;
|
||||
}
|
||||
|
|
|
@ -287,8 +287,7 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
|
|||
List<CustomField> refFields = organizationCustomFieldService.getByRefId(customField.getId());
|
||||
List<Project> orgProjects = getProjectByOrgId(customField.getScopeId());
|
||||
// 校验所有项目下是否都有同步变更
|
||||
/* Assertions.assertEquals(getCustomFieldByScopeId(customField.getScopeId()).size(),
|
||||
getCustomFieldByScopeId(orgProjects.get(0).getId()).size() * orgProjects.size());*/
|
||||
Assertions.assertEquals(refFields.size(), orgProjects.size());
|
||||
refFields.forEach(refField -> {
|
||||
Assertions.assertEquals(refField.getScene(), customField.getScene());
|
||||
Assertions.assertEquals(refField.getRemark(), customField.getRemark());
|
||||
|
@ -306,12 +305,6 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
|
|||
return projectMapper.selectByExample(projectExample);
|
||||
}
|
||||
|
||||
private List<CustomField> getCustomFieldByScopeId(String scopeId) {
|
||||
CustomFieldExample example = new CustomFieldExample();
|
||||
example.createCriteria().andScopeIdEqualTo(scopeId);
|
||||
return customFieldMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
private void changeOrgTemplateEnable(boolean enable) {
|
||||
if (enable) {
|
||||
organizationParameterMapper.deleteByPrimaryKey(DEFAULT_ORGANIZATION_ID, OrganizationParameterConstants.ORGANIZATION_FUNCTIONAL_TEMPLATE_ENABLE_KEY);
|
||||
|
|
|
@ -149,22 +149,20 @@ public class PluginControllerTests extends BaseTest {
|
|||
|
||||
|
||||
// @@校验插件脚本解析失败
|
||||
// TODO 缺少有效jar包
|
||||
/* File scriptParseFile = new File(
|
||||
File scriptParseFile = new File(
|
||||
this.getClass().getClassLoader().getResource("file/metersphere-plugin-script-parse-error.jar")
|
||||
.getPath()
|
||||
);
|
||||
assertErrorCode(this.requestMultipart(DEFAULT_ADD,
|
||||
getDefaultMultiPartParam(request, scriptParseFile)), PLUGIN_SCRIPT_FORMAT);*/
|
||||
getDefaultMultiPartParam(request, scriptParseFile)), PLUGIN_SCRIPT_FORMAT);
|
||||
|
||||
// @@校验插件脚本ID重复
|
||||
// TODO 缺少有效jar包
|
||||
/* File scriptIdRepeatFile = new File(
|
||||
File scriptIdRepeatFile = new File(
|
||||
this.getClass().getClassLoader().getResource("file/metersphere-plugin-script-id-repeat-error.jar")
|
||||
.getPath()
|
||||
);
|
||||
assertErrorCode(this.requestMultipart(DEFAULT_ADD,
|
||||
getDefaultMultiPartParam(request, scriptIdRepeatFile)), PLUGIN_SCRIPT_EXIST); // @@校验插件脚本ID重复*/
|
||||
getDefaultMultiPartParam(request, scriptIdRepeatFile)), PLUGIN_SCRIPT_EXIST); // @@校验插件脚本ID重复
|
||||
|
||||
// @@校验日志
|
||||
checkLog(this.addPlugin.getId(), OperationLogType.ADD);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue