refactor(接口测试): 批量执行的API过滤掉回收站中的数据

This commit is contained in:
fit2-zhao 2022-06-30 17:53:46 +08:00 committed by f2c-ci-robot[bot]
parent f68fb91a5b
commit 405e573123
2 changed files with 15 additions and 4 deletions

View File

@ -222,7 +222,7 @@ public class ApiCaseExecuteService {
List<MsExecResponseDTO> responseDTOS = new LinkedList<>();
ApiTestCaseExample example = new ApiTestCaseExample();
example.createCriteria().andIdIn(request.getIds());
example.createCriteria().andIdIn(request.getIds()).andStatusNotEqualTo("Trash");
List<ApiTestCaseWithBLOBs> caseList = apiTestCaseMapper.selectByExampleWithBLOBs(example);
LoggerUtil.debug("查询到执行数据:" + caseList.size());
// 环境检查

View File

@ -108,22 +108,28 @@ public class PluginService {
return resources;
}
private void loadJar(String jarPath) {
private boolean loadJar(String jarPath) {
try {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
try {
File file = new File(jarPath);
if (!file.exists()) {
return false;
}
Method method = classLoader.getClass().getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
method.invoke(classLoader, new File(jarPath).toURI().toURL());
method.invoke(classLoader, file.toURI().toURL());
} catch (NoSuchMethodException e) {
Method method = classLoader.getClass()
.getDeclaredMethod("appendToClassPathForInstrumentation", String.class);
method.setAccessible(true);
method.invoke(classLoader, jarPath);
}
return true;
} catch (Exception e) {
LogUtil.error(e);
}
return false;
}
public void loadPlugins() {
@ -135,7 +141,12 @@ public class PluginService {
-> new TreeSet<>(Comparator.comparing(Plugin::getPluginId))), ArrayList::new));
if (CollectionUtils.isNotEmpty(plugins)) {
plugins.forEach(item -> {
this.loadJar(item.getSourcePath());
boolean isLoad = this.loadJar(item.getSourcePath());
if (!isLoad) {
PluginExample pluginExample = new PluginExample();
pluginExample.createCriteria().andPluginIdEqualTo(item.getPluginId());
pluginMapper.deleteByExample(pluginExample);
}
});
}
}