fix(接口测试): 执行时按名称匹配数据源失效

This commit is contained in:
AgAngle 2024-04-17 11:38:49 +08:00 committed by 刘瑞斌
parent 5365e7818c
commit 73cf6fb06b
2 changed files with 4 additions and 5 deletions

View File

@ -110,18 +110,18 @@ public abstract class SqlProcessorConverter extends MsProcessorConverter<SQLProc
List<DataSource> dataSources = envConfig.getConfig().getDataSources();
// 先按ID匹配
dataSources = dataSources.stream()
List<DataSource> dataSourceResults = dataSources.stream()
.filter(item -> StringUtils.equals(item.getId(), sqlProcessor.getDataSourceId()))
.toList();
// 再按名称匹配
if (CollectionUtils.isEmpty(dataSources)) {
dataSources = dataSources.stream()
if (CollectionUtils.isEmpty(dataSourceResults)) {
dataSourceResults = dataSources.stream()
.filter(item -> StringUtils.equals(item.getDataSource(), sqlProcessor.getDataSourceName()))
.toList();
}
return CollectionUtils.isEmpty(dataSources) ? null : dataSources.get(0);
return CollectionUtils.isEmpty(dataSourceResults) ? null : dataSourceResults.get(0);
}
protected AbstractJDBCProcessor getJdbcProcessor(SQLProcessor sqlProcessor, AbstractJDBCProcessor jdbcProcessor, DataSource dataSource) {

View File

@ -31,7 +31,6 @@ public class DocumentAssertionConverter extends ResponseBodyTypeAssertionConvert
if (msAssertion == null) {
return;
}
// todo 定义好 jsonschema 再补充
if (needParse(msAssertion, config)) {
String documentType = msAssertion.getDocumentType();
if (StringUtils.equals(documentType, MsDocumentAssertion.DocumentType.XML.name())) {