fix(性能测试): 修改license校验方法名修改之后的遗留问题

This commit is contained in:
CaptainB 2022-05-23 15:25:53 +08:00 committed by 刘瑞斌
parent aabb8f426c
commit 09df456c1d
1 changed files with 2 additions and 16 deletions

View File

@ -557,7 +557,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
private void processBackendListener(Element backendListener) {
String resourcePoolId = context.getResourcePoolId();
TestResourcePool resourcePool = CommonBeanFactory.getBean(TestResourcePoolService.class).getResourcePool(resourcePoolId);
if (checkLicense() && !BooleanUtils.toBoolean(resourcePool.getBackendListener())) {
if (!BooleanUtils.toBoolean(resourcePool.getBackendListener())) {
return;
}
KafkaProperties kafkaProperties = CommonBeanFactory.getBean(KafkaProperties.class);
@ -617,7 +617,7 @@ public class JmeterDocumentParser implements EngineSourceParser {
private void processCheckoutBackendListener(Element element) {
String resourcePoolId = context.getResourcePoolId();
TestResourcePool resourcePool = CommonBeanFactory.getBean(TestResourcePoolService.class).getResourcePool(resourcePoolId);
if (checkLicense() && !BooleanUtils.toBoolean(resourcePool.getBackendListener())) {
if (!BooleanUtils.toBoolean(resourcePool.getBackendListener())) {
return;
}
// 已经添加过不再重复添加
@ -648,20 +648,6 @@ public class JmeterDocumentParser implements EngineSourceParser {
context.setCheckBackendListener(true);
}
private boolean checkLicense() {
try {
ClassUtils.getClass("io.metersphere.xpack.license.service.LicenseService");
Object licenseService = CommonBeanFactory.getBean("licenseService");
Object result = MethodUtils.invokeMethod(licenseService, "valid");
Object status = MethodUtils.invokeMethod(result, "getStatus");
if (StringUtils.equalsIgnoreCase("VALID", status.toString())) {
return true;
}
} catch (Exception ignored) {
}
return false;
}
private void processThreadGroup(Element threadGroup) {
// 检查 threadgroup 后面的hashtree是否为空
Element hashTree = getNextSibling(threadGroup);