refactor(接口设置): 优化国际化显示

This commit is contained in:
wxg0103 2022-11-28 16:36:17 +08:00 committed by wxg0103
parent 8668715ceb
commit 54a8579595
5 changed files with 19 additions and 11 deletions

View File

@ -17,6 +17,7 @@ import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.WebSocketUtil;
import io.metersphere.dto.BaseCase;
import io.metersphere.dto.MsExecResponseDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.request.ResetOrderRequest;
@ -369,7 +370,7 @@ public class ApiScenarioController {
try {
return apiAutomationService.verifyScenarioEnv(request);
} catch (Exception e) {
MSException.throwException("场景步骤解析错误,检查是否包含插件步骤!");
MSException.throwException(Translator.get("scenario_step_parsing_error_check"));
}
return false;
}
@ -379,7 +380,7 @@ public class ApiScenarioController {
try {
return apiAutomationService.verifyScenarioEnv(scenarioId);
} catch (Exception e) {
MSException.throwException("场景步骤解析错误,检查是否包含插件步骤!");
MSException.throwException(Translator.get("scenario_step_parsing_error_check"));
}
return false;
}

View File

@ -1680,7 +1680,7 @@ public class ApiDefinitionService {
if (StringUtils.isNotBlank(request.getSwaggerUrl())) {
if (!request.getPlatform().equalsIgnoreCase("Swagger2")) {
this.sendFailMessage(request, project);
MSException.throwException("文件格式不符合要求");
MSException.throwException(Translator.get("file_format_does_not_meet_requirements"));
}
try {
UrlTestUtils.testUrl(request.getSwaggerUrl(), 30000);
@ -1773,17 +1773,17 @@ public class ApiDefinitionService {
private void checkFileSuffixName(ApiTestImportRequest request, String suffixName) {
if (suffixName.equalsIgnoreCase("jmx")) {
if (!request.getPlatform().equalsIgnoreCase("JMeter")) {
MSException.throwException("文件格式不符合要求");
MSException.throwException(Translator.get("file_format_does_not_meet_requirements"));
}
}
if (suffixName.equalsIgnoreCase("har")) {
if (!request.getPlatform().equalsIgnoreCase("Har")) {
MSException.throwException("文件格式不符合要求");
MSException.throwException(Translator.get("file_format_does_not_meet_requirements"));
}
}
if (suffixName.equalsIgnoreCase("json")) {
if (request.getPlatform().equalsIgnoreCase("Har") || request.getPlatform().equalsIgnoreCase("Jmeter")) {
MSException.throwException("文件格式不符合要求");
MSException.throwException(Translator.get("file_format_does_not_meet_requirements"));
}
}
}
@ -2203,7 +2203,7 @@ public class ApiDefinitionService {
schedule.setName(new java.net.URL(swaggerUrlProject.getSwaggerUrl()).getHost());
} catch (MalformedURLException e) {
LogUtil.error(e.getMessage(), e);
MSException.throwException("URL 格式不正确!");
MSException.throwException(Translator.get("url_is_not_valid"));
}
schedule.setJob(SwaggerUrlImportJob.class.getName());
schedule.setGroup(ScheduleGroup.SWAGGER_IMPORT.name());
@ -2233,7 +2233,7 @@ public class ApiDefinitionService {
schedule.setName(new java.net.URL(swaggerUrlProject.getSwaggerUrl()).getHost());
} catch (MalformedURLException e) {
LogUtil.error(e.getMessage(), e);
MSException.throwException("URL 格式不正确!");
MSException.throwException(Translator.get("url_is_not_valid"));
}
scheduleService.editSchedule(schedule);
request.setResourceId(swaggerUrlProject.getId());

View File

@ -344,4 +344,6 @@ update_api_case=Updated interface use case
api_case_update_notice=Interface use case update notification
error_xml_struct=Data is not xml
case_name_is_already_exist=Duplicate Case name
delete_check_reference_by_plan=referenced by the test plan
file_format_does_not_meet_requirements=File format does not meet requirements
url_is_not_valid=URL is not valid
scenario_step_parsing_error_check=Scenario step parsing error, check if plugin step is included!

View File

@ -363,4 +363,7 @@ update_api_case=更新了接口用例
api_case_update_notice=接口用例更新通知
error_xml_struct=错误的xml数据
case_name_is_already_exist=用例名称不能重复
delete_check_reference_by_plan=被测试计划引用
file_format_does_not_meet_requirements=文件格式不符合要求
url_is_not_valid=URL 格式不正确!
scenario_step_parsing_error_check=场景步骤解析错误,请检查是否包含插件步骤!

View File

@ -363,4 +363,6 @@ update_api_case=更新了接口用例
api_case_update_notice=接口用例更新通知
error_xml_struct=錯誤的xml數據
case_name_is_already_exist=用例名稱不能重復
delete_check_reference_by_plan=被測試計劃引用
file_format_does_not_meet_requirements=文件格式不符合要求
url_is_not_valid=URL 格式不正确!
scenario_step_parsing_error_check=場景步驟解析錯誤,檢查是否包含插件步驟!