This commit is contained in:
shiziyuan9527 2020-07-14 17:29:40 +08:00
commit ccaf3db2a6
6 changed files with 17 additions and 0 deletions

View File

@ -110,6 +110,8 @@ public class EngineFactory {
try (ByteArrayInputStream source = new ByteArrayInputStream(fileContent.getFile())) { try (ByteArrayInputStream source = new ByteArrayInputStream(fileContent.getFile())) {
String content = engineSourceParser.parse(engineContext, source); String content = engineSourceParser.parse(engineContext, source);
engineContext.setContent(content); engineContext.setContent(content);
} catch (MSException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
MSException.throwException(e); MSException.throwException(e);
} }

View File

@ -66,6 +66,8 @@ public class DockerTestEngine extends AbstractEngine {
EngineContext context = null; EngineContext context = null;
try { try {
context = EngineFactory.createContext(loadTest, resource.getId(), realThreadNum, this.getStartTime(), this.getReportId(), resourceIndex); context = EngineFactory.createContext(loadTest, resource.getId(), realThreadNum, this.getStartTime(), this.getReportId(), resourceIndex);
} catch (MSException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
MSException.throwException(e); MSException.throwException(e);
} }

View File

@ -2,8 +2,10 @@ package io.metersphere.performance.parse.xml.reader.jmx;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.config.KafkaProperties; import io.metersphere.config.KafkaProperties;
import io.metersphere.i18n.Translator;
import io.metersphere.performance.engine.EngineContext; import io.metersphere.performance.engine.EngineContext;
import io.metersphere.performance.parse.xml.reader.DocumentParser; import io.metersphere.performance.parse.xml.reader.DocumentParser;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -709,6 +711,14 @@ public class JmeterDocumentParser implements DocumentParser {
} }
private void processThreadGroup(Element threadGroup) { private void processThreadGroup(Element threadGroup) {
// 检查 threadgroup 后面的hashtree是否为空
Node hashTree = threadGroup.getNextSibling();
while (!(hashTree instanceof Element)) {
hashTree = hashTree.getNextSibling();
}
if (!hashTree.hasChildNodes()) {
MSException.throwException(Translator.get("jmx_content_valid"));
}
// 重命名 tagName // 重命名 tagName
Document document = threadGroup.getOwnerDocument(); Document document = threadGroup.getOwnerDocument();
document.renameNode(threadGroup, threadGroup.getNamespaceURI(), CONCURRENCY_THREAD_GROUP); document.renameNode(threadGroup, threadGroup.getNamespaceURI(), CONCURRENCY_THREAD_GROUP);

View File

@ -45,6 +45,7 @@ duplicate_node_ip=Duplicate IPs
max_thread_insufficient=The number of concurrent users exceeds max_thread_insufficient=The number of concurrent users exceeds
related_case_del_fail_prefix=Connected to related_case_del_fail_prefix=Connected to
related_case_del_fail_suffix=TestCase, please disassociate first related_case_del_fail_suffix=TestCase, please disassociate first
jmx_content_valid=JMX content is invalid
#workspace #workspace
workspace_name_is_null=Workspace name cannot be null workspace_name_is_null=Workspace name cannot be null
workspace_name_already_exists=The workspace name already exists workspace_name_already_exists=The workspace name already exists

View File

@ -45,6 +45,7 @@ duplicate_node_ip=节点 IP 重复
max_thread_insufficient=并发用户数超额 max_thread_insufficient=并发用户数超额
related_case_del_fail_prefix=已关联到 related_case_del_fail_prefix=已关联到
related_case_del_fail_suffix=测试用例,请先解除关联 related_case_del_fail_suffix=测试用例,请先解除关联
jmx_content_valid=JMX 内容无效,请检查
#workspace #workspace
workspace_name_is_null=工作空间名不能为空 workspace_name_is_null=工作空间名不能为空
workspace_name_already_exists=工作空间名已存在 workspace_name_already_exists=工作空间名已存在

View File

@ -45,6 +45,7 @@ duplicate_node_ip=節點 IP 重復
max_thread_insufficient=並發用戶數超額 max_thread_insufficient=並發用戶數超額
related_case_del_fail_prefix=已關聯到 related_case_del_fail_prefix=已關聯到
related_case_del_fail_suffix=測試用例,請先解除關聯 related_case_del_fail_suffix=測試用例,請先解除關聯
jmx_content_valid=JMX 內容無效,請檢查
#workspace #workspace
workspace_name_is_null=工作空間名不能為空 workspace_name_is_null=工作空間名不能為空
workspace_name_already_exists=工作空間名已存在 workspace_name_already_exists=工作空間名已存在