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(); List<DataSource> dataSources = envConfig.getConfig().getDataSources();
// 先按ID匹配 // 先按ID匹配
dataSources = dataSources.stream() List<DataSource> dataSourceResults = dataSources.stream()
.filter(item -> StringUtils.equals(item.getId(), sqlProcessor.getDataSourceId())) .filter(item -> StringUtils.equals(item.getId(), sqlProcessor.getDataSourceId()))
.toList(); .toList();
// 再按名称匹配 // 再按名称匹配
if (CollectionUtils.isEmpty(dataSources)) { if (CollectionUtils.isEmpty(dataSourceResults)) {
dataSources = dataSources.stream() dataSourceResults = dataSources.stream()
.filter(item -> StringUtils.equals(item.getDataSource(), sqlProcessor.getDataSourceName())) .filter(item -> StringUtils.equals(item.getDataSource(), sqlProcessor.getDataSourceName()))
.toList(); .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) { protected AbstractJDBCProcessor getJdbcProcessor(SQLProcessor sqlProcessor, AbstractJDBCProcessor jdbcProcessor, DataSource dataSource) {

View File

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