fix: 解决冲突
This commit is contained in:
commit
b46e33a71c
|
@ -73,6 +73,10 @@ public class MsScenario extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && this.getReferenced().equals("Deleted")) {
|
||||
return;
|
||||
} else if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
||||
|
@ -198,6 +202,8 @@ public class MsScenario extends MsTestElement {
|
|||
config.getConfig().get(this.getProjectId()).getCommonConfig().getVariables().stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
||||
);
|
||||
// 清空变量,防止重复添加
|
||||
config.getConfig().get(this.getProjectId()).getCommonConfig().getVariables().clear();
|
||||
}
|
||||
if (arguments.getArguments() != null && arguments.getArguments().size() > 0) {
|
||||
return arguments;
|
||||
|
|
|
@ -27,6 +27,10 @@ public class MsAssertions extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
addAssertions(tree);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ public class MsIfController extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
final HashTree groupTree = tree.add(ifController());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
|
|
@ -44,6 +44,10 @@ public class MsLoopController extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
final HashTree groupTree = controller(tree);
|
||||
if (CollectionUtils.isNotEmpty(config.getVariables())) {
|
||||
this.addCsvDataSet(groupTree, config.getVariables());
|
||||
|
|
|
@ -26,7 +26,8 @@ public class MsDNSCacheManager extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
for (MsTestElement el : hashTree) {
|
||||
|
|
|
@ -30,6 +30,10 @@ public class MsExtract extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
addRequestExtractors(tree);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,10 @@ public class MsJSR223Processor extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
JSR223Sampler processor = new JSR223Sampler();
|
||||
processor.setEnabled(this.isEnable());
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
|
|
|
@ -29,6 +29,10 @@ public class MsJSR223PostProcessor extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
JSR223PostProcessor processor = new JSR223PostProcessor();
|
||||
processor.setEnabled(this.isEnable());
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
|
|
|
@ -30,6 +30,10 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
final HashTree jsr223PreTree = tree.add(getJSR223PreProcessor());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
|
|
@ -60,6 +60,10 @@ public class MsDubboSampler extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && "Deleted".equals(this.getReferenced())) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,10 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
|
@ -315,7 +318,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
headerManager.add(new Header(keyValue.getName(), keyValue.getValue()))
|
||||
);
|
||||
tree.add(headerManager);
|
||||
if (headerManager.getHeaders().size() > 0) {
|
||||
tree.add(headerManager);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isURL(String str) {
|
||||
|
|
|
@ -58,6 +58,10 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
|
|
|
@ -72,6 +72,10 @@ public class MsTCPSampler extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||
this.getRefElement(this);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,10 @@ public class MsConstantTimer extends MsTestElement {
|
|||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
|
||||
// 非导出操作,且不是启用状态则跳过执行
|
||||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
final HashTree groupTree = tree.add(constantTimer());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
|
|
@ -3,6 +3,7 @@ package io.metersphere.api.dto.definition.request.unknown;
|
|||
import com.alibaba.fastjson.annotation.JSONType;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
@ -36,17 +37,22 @@ public class MsJmeterElement extends MsTestElement {
|
|||
Object scriptWrapper = SaveService.loadElement(inputSource);
|
||||
HashTree elementTree = tree;
|
||||
this.setElementType(scriptWrapper.getClass().getName());
|
||||
if (scriptWrapper instanceof TestElement) {
|
||||
((TestElement) scriptWrapper).setName(this.getName());
|
||||
((TestElement) scriptWrapper).setEnabled(this.isEnable());
|
||||
}
|
||||
if (config.isOperating()) {
|
||||
elementTree = tree.add(scriptWrapper);
|
||||
} else if (!(scriptWrapper instanceof TestPlan) && !(scriptWrapper instanceof ThreadGroup)) {
|
||||
elementTree = tree.add(scriptWrapper);
|
||||
}
|
||||
if (scriptWrapper instanceof TestElement) {
|
||||
((TestElement) scriptWrapper).setName(this.getName());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
for (MsTestElement el : hashTree) {
|
||||
el.toHashTree(elementTree, el.getHashTree(), config);
|
||||
if (!config.isOperating() && scriptWrapper instanceof ThreadGroup && !((ThreadGroup) scriptWrapper).isEnabled()) {
|
||||
LogUtil.info(((ThreadGroup) scriptWrapper).getName() + "是被禁用线程组不加入执行");
|
||||
} else {
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
for (MsTestElement el : hashTree) {
|
||||
el.toHashTree(elementTree, el.getHashTree(), config);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,9 @@ public class ApiAutomationService {
|
|||
if (map != null) {
|
||||
if (map.isEmpty()) {
|
||||
List<String> ids = (List<String>) JSONPath.read(definition, "$..projectId");
|
||||
idList.addAll(new HashSet<>(ids));
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
idList.addAll(new HashSet<>(ids));
|
||||
}
|
||||
} else {
|
||||
Set<String> set = d.getEnvironmentMap().keySet();
|
||||
idList = new ArrayList<>(set);
|
||||
|
@ -601,6 +603,7 @@ public class ApiAutomationService {
|
|||
ParameterConfig config = new ParameterConfig();
|
||||
config.setConfig(envConfig);
|
||||
HashTree hashTree = request.getTestElement().generateHashTree(config);
|
||||
System.out.println(request.getTestElement().getJmx(hashTree));
|
||||
// 调用执行方法
|
||||
APIScenarioReportResult reportResult = createScenarioReport(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(),
|
||||
SessionUtils.getUserId());
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.metersphere.security.ApiKeyFilter;
|
|||
import io.metersphere.security.CsrfFilter;
|
||||
import io.metersphere.security.UserModularRealmAuthenticator;
|
||||
import io.metersphere.security.realm.LdapRealm;
|
||||
import io.metersphere.security.realm.ShiroDBRealm;
|
||||
import io.metersphere.security.realm.LocalRealm;
|
||||
import org.apache.shiro.authc.pam.FirstSuccessfulStrategy;
|
||||
import org.apache.shiro.authc.pam.ModularRealmAuthenticator;
|
||||
import org.apache.shiro.cache.MemoryConstrainedCacheManager;
|
||||
|
@ -70,7 +70,7 @@ public class ShiroConfig implements EnvironmentAware {
|
|||
}
|
||||
|
||||
/**
|
||||
* securityManager 不用直接注入shiroDBRealm,可能会导致事务失效
|
||||
* securityManager 不用直接注入 Realm,可能会导致事务失效
|
||||
* 解决方法见 handleContextRefresh
|
||||
* http://www.debugrun.com/a/NKS9EJQ.html
|
||||
*/
|
||||
|
@ -85,8 +85,8 @@ public class ShiroConfig implements EnvironmentAware {
|
|||
|
||||
@Bean
|
||||
@DependsOn("lifecycleBeanPostProcessor")
|
||||
public ShiroDBRealm shiroDBRealm() {
|
||||
return new ShiroDBRealm();
|
||||
public LocalRealm localRealm() {
|
||||
return new LocalRealm();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -135,10 +135,10 @@ public class ShiroConfig implements EnvironmentAware {
|
|||
public void handleContextRefresh(ContextRefreshedEvent event) {
|
||||
ApplicationContext context = event.getApplicationContext();
|
||||
List<Realm> realmList = new ArrayList<>();
|
||||
ShiroDBRealm shiroDBRealm = context.getBean(ShiroDBRealm.class);
|
||||
LocalRealm localRealm = context.getBean(LocalRealm.class);
|
||||
LdapRealm ldapRealm = context.getBean(LdapRealm.class);
|
||||
// 基本realm
|
||||
realmList.add(shiroDBRealm);
|
||||
realmList.add(localRealm);
|
||||
realmList.add(ldapRealm);
|
||||
context.getBean(DefaultWebSecurityManager.class).setRealms(realmList);
|
||||
}
|
||||
|
|
|
@ -144,12 +144,12 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
String[] stepRes = new String[1];
|
||||
|
||||
if (data.getStepDesc() != null) {
|
||||
stepDesc = data.getStepDesc().split("\n");
|
||||
stepDesc = data.getStepDesc().split("\r\n");
|
||||
} else {
|
||||
stepDesc[0] = "";
|
||||
}
|
||||
if (data.getStepResult() != null) {
|
||||
stepRes = data.getStepResult().split("\n");
|
||||
stepRes = data.getStepResult().split("\r\n");
|
||||
} else {
|
||||
stepRes[0] = "";
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class LdapController {
|
|||
userService.addLdapUser(user);
|
||||
}
|
||||
|
||||
// 执行 ShiroDBRealm 中 LDAP 登录逻辑
|
||||
// 执行 LocalRealm 中 LDAP 登录逻辑
|
||||
LoginRequest loginRequest = new LoginRequest();
|
||||
loginRequest.setUsername(userId);
|
||||
return userService.login(loginRequest);
|
||||
|
|
|
@ -34,9 +34,9 @@ import java.util.stream.Collectors;
|
|||
* set realm
|
||||
* </p>
|
||||
*/
|
||||
public class ShiroDBRealm extends AuthorizingRealm {
|
||||
public class LocalRealm extends AuthorizingRealm {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ShiroDBRealm.class);
|
||||
private Logger logger = LoggerFactory.getLogger(LocalRealm.class);
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
|
@ -520,8 +520,8 @@ public class TestCaseService {
|
|||
|
||||
for (int j = 0; j < jsonArray.size(); j++) {
|
||||
int num = j + 1;
|
||||
step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\n");
|
||||
result.append(num + "." + jsonArray.getJSONObject(j).getString("result") + "\n");
|
||||
step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\r\n");
|
||||
result.append(num + "." + jsonArray.getJSONObject(j).getString("result") + "\r\n");
|
||||
|
||||
}
|
||||
data.setStepDesc(step.toString());
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 245845e07bf3fe2f60311eeb78f8f109301a2d39
|
||||
Subproject commit c9fd084c8f4453d7697677a79d9a0a953c045e38
|
|
@ -159,7 +159,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
timeout: 60000,
|
||||
responseTimeout: null,
|
||||
responseTimeout: 60000,
|
||||
statusCode: [],
|
||||
domains: [],
|
||||
params: [],
|
||||
|
|
|
@ -42,12 +42,11 @@
|
|||
<br>
|
||||
<div v-if="threadGroup.threadType === 'DURATION'">
|
||||
<el-form-item :label="$t('load_test.duration')">
|
||||
<!-- 最多两天的测试时长 -->
|
||||
<el-input-number
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.duration"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
:max="9999"
|
||||
@change="calculateChart(threadGroup)"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<el-card class="table-card" v-loading="result.loading" body-style="padding:10px;">
|
||||
<div slot="header">
|
||||
<span class="title">
|
||||
遗留缺陷统计
|
||||
用例评审
|
||||
</span>
|
||||
<ms-table-button :is-tester-permission="true" v-if="!showMyCreator" icon="el-icon-view"
|
||||
:content="$t('test_track.review.my_create')" @click="searchMyCreator" style="float: right"/>
|
||||
|
|
Loading…
Reference in New Issue