fix: 删除资源池时检查是否存在关联的性能测试

This commit is contained in:
Captain.B 2020-08-18 13:22:05 +08:00
parent c95afcc29e
commit c8c53a9030
1 changed files with 1 additions and 5 deletions

View File

@ -5,7 +5,6 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.LoadTestMapper; import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.TestResourceMapper; import io.metersphere.base.mapper.TestResourceMapper;
import io.metersphere.base.mapper.TestResourcePoolMapper; import io.metersphere.base.mapper.TestResourcePoolMapper;
import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.constants.ResourceStatusEnum; import io.metersphere.commons.constants.ResourceStatusEnum;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.LogUtil;
@ -25,7 +24,6 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -70,11 +68,9 @@ public class TestResourcePoolService {
} }
public void checkTestStatus(String testResourcePoolId) { public void checkTestStatus(String testResourcePoolId) {
List list = Arrays.asList(PerformanceTestStatus.Running, PerformanceTestStatus.Starting, PerformanceTestStatus.Error);
LoadTestExample example = new LoadTestExample(); LoadTestExample example = new LoadTestExample();
example.createCriteria() example.createCriteria()
.andTestResourcePoolIdEqualTo(testResourcePoolId) .andTestResourcePoolIdEqualTo(testResourcePoolId);
.andStatusIn(list);
if (loadTestMapper.countByExample(example) > 0) { if (loadTestMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("test_resource_pool_is_use")); MSException.throwException(Translator.get("test_resource_pool_is_use"));
} }