parent
db46056049
commit
b8cbee5615
|
@ -92,10 +92,6 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
|
||||
// 数据兼容处理
|
||||
if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
|
||||
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
|
||||
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
|
||||
this.environmentId = environmentConfig.getApiEnvironmentid();
|
||||
}
|
||||
// 1.8 之后 当前正常数据
|
||||
} else if (config.getConfig() != null && config.getConfig().containsKey(getParentProjectId())) {
|
||||
// 1.8 前后 混合数据
|
||||
|
@ -119,6 +115,10 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
// 自选了数据源
|
||||
if (config.isEffective(this.getProjectId()) && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())
|
||||
&& isDataSource(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())) {
|
||||
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
|
||||
if (environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())) {
|
||||
this.environmentId = environmentConfig.getApiEnvironmentid();
|
||||
}
|
||||
this.initDataSource();
|
||||
} else {
|
||||
// 取当前环境下默认的一个数据源
|
||||
|
|
|
@ -92,10 +92,6 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
|
||||
// 数据兼容处理
|
||||
if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
|
||||
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
|
||||
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
|
||||
this.environmentId = environmentConfig.getApiEnvironmentid();
|
||||
}
|
||||
// 1.8 之后 当前正常数据
|
||||
} else if (config.getConfig() != null && config.getConfig().containsKey(getParentProjectId())) {
|
||||
// 1.8 前后 混合数据
|
||||
|
@ -119,6 +115,10 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
// 自选了数据源
|
||||
if (config.isEffective(this.getProjectId()) && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())
|
||||
&& isDataSource(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())) {
|
||||
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
|
||||
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
|
||||
this.environmentId = environmentConfig.getApiEnvironmentid();
|
||||
}
|
||||
this.initDataSource();
|
||||
} else {
|
||||
// 取当前环境下默认的一个数据源
|
||||
|
|
|
@ -102,10 +102,6 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
|
||||
// 数据兼容处理
|
||||
if (config.getConfig() != null && StringUtils.isNotEmpty(this.getProjectId()) && config.getConfig().containsKey(this.getProjectId())) {
|
||||
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
|
||||
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
|
||||
this.environmentId = environmentConfig.getApiEnvironmentid();
|
||||
}
|
||||
// 1.8 之后 当前正常数据
|
||||
} else if (config.getConfig() != null && config.getConfig().containsKey(getParentProjectId())) {
|
||||
// 1.8 前后 混合数据
|
||||
|
@ -128,6 +124,10 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
// 自选了数据源
|
||||
if (config.isEffective(this.getProjectId()) && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())
|
||||
&& isDataSource(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())) {
|
||||
EnvironmentConfig environmentConfig = config.getConfig().get(this.getProjectId());
|
||||
if(environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getApiEnvironmentid())){
|
||||
this.environmentId = environmentConfig.getApiEnvironmentid();
|
||||
}
|
||||
this.dataSource = null;
|
||||
envConfig = this.initDataSource();
|
||||
} else {
|
||||
|
|
|
@ -127,6 +127,14 @@ export default {
|
|||
return getCurrentProjectID();
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'$store.state.scenarioEnvMap': {
|
||||
handler(v) {
|
||||
this.getEnvironments();
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
remove(row) {
|
||||
let index = this.request.hashTree.indexOf(row);
|
||||
|
@ -167,38 +175,30 @@ export default {
|
|||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.request.environmentId) {
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map) {
|
||||
if (this.$store.state.scenarioEnvMap.has(this.projectId) &&
|
||||
this.$store.state.scenarioEnvMap.get(this.projectId) === this.request.environmentId) {
|
||||
hasEnvironment = true;
|
||||
}
|
||||
} else {
|
||||
hasEnvironment = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
let envId = "";
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
|
||||
&& this.$store.state.scenarioEnvMap.has(this.projectId)) {
|
||||
envId = this.$store.state.scenarioEnvMap.get(this.projectId);
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
|
||||
&& this.$store.state.scenarioEnvMap.has(this.projectId)) {
|
||||
this.request.environmentId = this.$store.state.scenarioEnvMap.get(this.projectId);
|
||||
}
|
||||
}
|
||||
if (!this.request.environmentId) {
|
||||
this.request.dataSourceId = undefined;
|
||||
}
|
||||
this.initDataSource();
|
||||
this.initDataSource(envId);
|
||||
});
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
this.$refs.environmentConfig.open(getCurrentProjectID());
|
||||
},
|
||||
initDataSource() {
|
||||
initDataSource(envId) {
|
||||
let flag = false;
|
||||
let environment = {};
|
||||
if (envId) {
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === envId && this.environments[i].config && this.environments[i].config.databaseConfigs
|
||||
&& this.environments[i].config.databaseConfigs.length > 0) {
|
||||
this.request.environmentId = envId;
|
||||
this.request.dataSourceId = this.environments[i].config.databaseConfigs[0].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.request.environmentId) {
|
||||
environment = this.environments[i];
|
||||
|
|
|
@ -43,6 +43,7 @@ import MsTag from "../../../../common/components/MsTag";
|
|||
import MsEnvironmentSelect from "./MsEnvironmentSelect";
|
||||
import {API_METHOD_COLOUR} from "../../model/JsonData";
|
||||
import ApiCaseItem from "@/business/components/api/definition/components/case/ApiCaseItem";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
export default {
|
||||
name: "ApiCaseHeader",
|
||||
|
@ -99,6 +100,8 @@ export default {
|
|||
setEnvironment(data) {
|
||||
if (data) {
|
||||
this.$emit('setEnvironment', data.id);
|
||||
this.$store.state.scenarioEnvMap = new Map();
|
||||
this.$store.state.scenarioEnvMap.set(getCurrentProjectID(), data.id);
|
||||
}
|
||||
},
|
||||
open() {
|
||||
|
|
|
@ -262,6 +262,7 @@ export default {
|
|||
maintainerOptions: Array,
|
||||
},
|
||||
created() {
|
||||
this.$store.state.scenarioEnvMap = undefined;
|
||||
if (requireComponent != null && JSON.stringify(esbDefinition) != '{}' && JSON.stringify(esbDefinitionResponse) != '{}') {
|
||||
this.isXpack = true;
|
||||
}
|
||||
|
|
|
@ -365,6 +365,7 @@ export default {
|
|||
uuid: newUuid,
|
||||
caseStatus: "Underway"
|
||||
};
|
||||
request.projectId = getCurrentProjectID();
|
||||
obj.request = request;
|
||||
this.apiCaseList.unshift(obj);
|
||||
}
|
||||
|
|
|
@ -114,8 +114,6 @@ import MsApiExtract from "../../extract/ApiExtract";
|
|||
import ApiRequestMethodSelect from "../../collapse/ApiRequestMethodSelect";
|
||||
import MsCodeEdit from "../../../../../common/components/MsCodeEdit";
|
||||
import MsApiScenarioVariables from "../../ApiScenarioVariables";
|
||||
import {createComponent} from "../../jmeter/components";
|
||||
import {Assertions, Extract} from "../../../model/ApiTestModel";
|
||||
import {parseEnvironment} from "../../../model/EnvironmentModel";
|
||||
import ApiEnvironmentConfig from "@/business/components/api/test/components/ApiEnvironmentConfig";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
@ -251,38 +249,30 @@ export default {
|
|||
this.environments.forEach(environment => {
|
||||
parseEnvironment(environment);
|
||||
});
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.request.environmentId) {
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map) {
|
||||
if (this.$store.state.scenarioEnvMap.has(this.projectId) &&
|
||||
this.$store.state.scenarioEnvMap.get(this.projectId) === this.request.environmentId) {
|
||||
hasEnvironment = true;
|
||||
}
|
||||
} else {
|
||||
hasEnvironment = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
let envId = "";
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
|
||||
&& this.$store.state.scenarioEnvMap.has(this.projectId)) {
|
||||
envId = this.$store.state.scenarioEnvMap.get(this.projectId);
|
||||
}
|
||||
if (!hasEnvironment) {
|
||||
if (this.$store.state.scenarioEnvMap && this.$store.state.scenarioEnvMap instanceof Map
|
||||
&& this.$store.state.scenarioEnvMap.has(this.projectId)) {
|
||||
this.request.environmentId = this.$store.state.scenarioEnvMap.get(this.projectId);
|
||||
}
|
||||
}
|
||||
if (!this.request.environmentId) {
|
||||
this.request.dataSourceId = undefined;
|
||||
}
|
||||
this.initDataSource();
|
||||
this.initDataSource(envId);
|
||||
});
|
||||
},
|
||||
openEnvironmentConfig() {
|
||||
this.$refs.environmentConfig.open(getCurrentProjectID());
|
||||
},
|
||||
initDataSource() {
|
||||
initDataSource(envId) {
|
||||
let flag = false;
|
||||
let environment = {};
|
||||
if (envId) {
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === envId && this.environments[i].config && this.environments[i].config.databaseConfigs
|
||||
&& this.environments[i].config.databaseConfigs.length > 0) {
|
||||
this.request.environmentId = envId;
|
||||
this.request.dataSourceId = this.environments[i].config.databaseConfigs[0].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.request.environmentId) {
|
||||
environment = this.environments[i];
|
||||
|
|
Loading…
Reference in New Issue