refactor(接口测试): 接口列表支持多协议查询
This commit is contained in:
parent
e7304e5272
commit
f1bc941411
|
@ -1,6 +1,5 @@
|
|||
package io.metersphere.request;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.metersphere.validation.groups.Created;
|
||||
import io.metersphere.validation.groups.Updated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -8,6 +7,7 @@ import jakarta.validation.Valid;
|
|||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -44,7 +44,7 @@ public class AssociateOtherCaseRequest {
|
|||
private String sourceId;
|
||||
|
||||
@Schema(description = "接口用例的接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
private List<String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "关联用例的类型(API,SCENARIO,UI,PERFORMANCE)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{associate_other_case_request.type.not_blank}")
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package io.metersphere.request;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
@ -11,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -25,15 +25,15 @@ public class TestCasePageProviderRequest extends BaseProviderCondition implement
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Min(value = 1, message = "当前页码必须大于0")
|
||||
@Schema(description = "当前页码")
|
||||
@Schema(description = "当前页码")
|
||||
private int current;
|
||||
|
||||
@Min(value = 5, message = "每页显示条数必须不小于5")
|
||||
@Max(value = 500, message = "每页显示条数不能大于500")
|
||||
@Schema(description = "每页显示条数")
|
||||
@Schema(description = "每页显示条数")
|
||||
private int pageSize;
|
||||
|
||||
@Schema(description = "排序字段(model中的字段 : asc/desc)")
|
||||
@Schema(description = "排序字段(model中的字段 : asc/desc)")
|
||||
private Map<@Valid @Pattern(regexp = "^[A-Za-z]+$") String, @Valid @NotBlank String> sort;
|
||||
|
||||
@Schema(description = "接口pk")
|
||||
|
@ -45,9 +45,7 @@ public class TestCasePageProviderRequest extends BaseProviderCondition implement
|
|||
private String projectId;
|
||||
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
private List<String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "模块ID")
|
||||
private List<@NotBlank String> moduleIds;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -28,9 +29,8 @@ public class ApiDefinitionBatchRequest extends TableBatchProcessDTO implements S
|
|||
private String projectId;
|
||||
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_debug.protocol.not_blank}")
|
||||
@Size(min = 1, max = 20, message = "{api_debug.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@NotEmpty(message = "{api_debug.protocol.not_blank}")
|
||||
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)")
|
||||
private List<@NotBlank String> moduleIds;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -19,7 +20,7 @@ public class ApiDefinitionDocRequest implements Serializable {
|
|||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "关键字")
|
||||
@Schema(description = "关键字")
|
||||
private String keyword;
|
||||
|
||||
@Schema(description = "接口pk")
|
||||
|
@ -32,8 +33,8 @@ public class ApiDefinitionDocRequest implements Serializable {
|
|||
private String projectId;
|
||||
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Size(min = 1, max = 20, message = "{api_debug.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)")
|
||||
private List<@NotBlank String> moduleIds;
|
||||
|
|
|
@ -34,5 +34,7 @@ public class ApiDefinitionMockDTO extends ApiDefinitionMock {
|
|||
|
||||
@Schema(description = "接口类型")
|
||||
private String apiMethod;
|
||||
@Schema(description = "接口协议")
|
||||
private String protocol;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -21,14 +22,13 @@ public class ApiDefinitionPageRequest extends BasePageRequest {
|
|||
@Size(min = 1, max = 50, message = "{api_definition.id.length_range}")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "接口名称")
|
||||
@Schema(description = "接口名称")
|
||||
@Size(min = 1, max = 255, message = "{api_definition.name.length_range}")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition.project_id.not_blank}")
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.metersphere.system.dto.sdk.BaseCondition;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -15,9 +16,8 @@ public class ApiModuleRequest extends BaseCondition {
|
|||
private List<@NotBlank String> moduleIds;
|
||||
|
||||
@Schema(description = "协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition_module.protocol.not_blank}")
|
||||
@Size(min = 1, max = 20, message = "{api_definition_module.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@NotEmpty(message = "{api_definition_module.protocol.not_blank}")
|
||||
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition_module.project_id.not_blank}")
|
||||
@Size(min = 1, max = 50, message = "{api_definition_module.project_id.length_range}")
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.metersphere.system.dto.table.TableBatchProcessDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -27,9 +28,8 @@ public class ApiTestCaseBatchRequest extends TableBatchProcessDTO implements Ser
|
|||
private String projectId;
|
||||
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||
private List<String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "模块ID")
|
||||
private List<@NotBlank String> moduleIds;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -29,9 +30,8 @@ public class ApiTestCasePageRequest extends BasePageRequest implements Serializa
|
|||
private String projectId;
|
||||
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "模块ID")
|
||||
private List<@NotBlank String> moduleIds;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package io.metersphere.api.dto.definition.request;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +18,7 @@ import java.util.List;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ApiDefinitionMockPageRequest extends BasePageRequest {
|
||||
|
||||
@Schema(description = "接口 mock 名称")
|
||||
@Schema(description = "接口 mock 名称")
|
||||
@Size(min = 1, max = 255, message = "{api_definition_mock.name.length_range}")
|
||||
private String name;
|
||||
|
||||
|
@ -34,9 +35,8 @@ public class ApiDefinitionMockPageRequest extends BasePageRequest {
|
|||
private String apiDefinitionId;
|
||||
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{api_definition.protocol.not_blank}")
|
||||
@Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}")
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@NotEmpty
|
||||
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||
|
||||
@Schema(description = "模块ID")
|
||||
private List<@NotBlank String> moduleIds;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.api.dto.scenario;
|
||||
|
||||
import io.metersphere.sdk.constants.ModuleConstants;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -24,8 +24,8 @@ public class ScenarioSystemRequest {
|
|||
@Size(min = 1, max = 50, message = "{api_scenario.project_id.length_range}")
|
||||
private String projectId;
|
||||
@Schema(description = "协议 接口和用例的时候 是必传的", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank
|
||||
private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP;
|
||||
@NotEmpty
|
||||
private List<@NotBlank String> protocols = new ArrayList<>();
|
||||
@Schema(description = "版本id")
|
||||
private String versionId;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public interface ExtApiDefinitionMapper {
|
|||
|
||||
Long getPos(@Param("projectId") String projectId);
|
||||
|
||||
List<String> getIds(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocol") String protocol, @Param("deleted") boolean deleted);
|
||||
List<String> getIds(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocols") List<String> protocols, @Param("deleted") boolean deleted);
|
||||
|
||||
List<String> getRefIds(@Param("ids") List<String> ids, @Param("deleted") boolean deleted);
|
||||
|
||||
|
|
|
@ -66,7 +66,13 @@
|
|||
<select id="getIds" resultType="java.lang.String">
|
||||
SELECT id
|
||||
FROM api_definition
|
||||
where project_id = #{projectId} AND protocol = #{protocol} and deleted = #{deleted}
|
||||
where project_id = #{projectId} and deleted = #{deleted}
|
||||
<if test="protocols != null and protocols.size() > 0">
|
||||
AND protocol in
|
||||
<foreach collection="protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() != 0">
|
||||
AND module_id IN
|
||||
<foreach collection="request.moduleIds" item="item" open="(" separator="," close=")">
|
||||
|
@ -228,8 +234,11 @@
|
|||
<if test="request.projectId != null and request.projectId != ''">
|
||||
and api_definition.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol != ''">
|
||||
AND api_definition.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and api_definition.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
and api_definition.module_id in
|
||||
|
@ -265,8 +274,11 @@
|
|||
<if test="request.projectId != null and request.projectId != ''">
|
||||
and api_definition.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol != ''">
|
||||
AND api_definition.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and api_definition.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
and api_definition.module_id in
|
||||
|
@ -501,8 +513,11 @@
|
|||
<if test="request.projectId != null and request.projectId != ''">
|
||||
and api_definition.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol != ''">
|
||||
AND api_definition.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
AND api_definition.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
and api_definition.module_id in
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<select id="list" resultMap="ApiDefinitionMockDTO">
|
||||
select
|
||||
m.id, m.create_time, m.update_time, m.create_user, m.`name`, m.tags, m.`enable`, m.expect_num, m.project_id, m.status_code,
|
||||
m.api_definition_id, u.name as create_user_name, d.path as api_path, d.method as apiMethod
|
||||
m.api_definition_id, u.name as create_user_name, d.path as api_path, d.method as apiMethod, d.protocol as protocol
|
||||
from api_definition_mock m
|
||||
left join `api_definition` d on d.id = m.api_definition_id
|
||||
left join `user` u on u.id = m.create_user
|
||||
|
@ -62,9 +62,13 @@
|
|||
</select>
|
||||
|
||||
<sql id="queryWhereConditionByBatch">
|
||||
<if test="request.protocol != null and request.protocol!=''">
|
||||
and a.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and a.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||
and m.api_definition_id = #{request.apiDefinitionId}
|
||||
</if>
|
||||
|
@ -107,8 +111,11 @@
|
|||
<if test="request.apiDefinitionId != null and request.apiDefinitionId != ''">
|
||||
and m.api_definition_id = #{request.apiDefinitionId}
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol!=''">
|
||||
and d.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and d.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
and d.module_id in
|
||||
|
|
|
@ -176,8 +176,11 @@
|
|||
<if test="request.projectId != null and request.projectId != ''">
|
||||
and api_definition.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol != ''">
|
||||
AND api_definition.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() >0 ">
|
||||
AND api_definition.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
and api_definition.module_id in
|
||||
|
|
|
@ -284,8 +284,11 @@
|
|||
<if test="request.projectId != null and request.projectId != ''">
|
||||
and api_test_case.project_id = #{request.projectId}
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol != ''">
|
||||
AND api_definition.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
AND api_definition.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.moduleIds != null and request.moduleIds.size() > 0">
|
||||
and api_definition.module_id in
|
||||
|
@ -412,8 +415,11 @@
|
|||
</sql>
|
||||
|
||||
<sql id="queryWhereConditionByBatch">
|
||||
<if test="request.protocol != null and request.protocol!=''">
|
||||
and a.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and a.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||
and atc.api_definition_id = #{request.apiDefinitionId}
|
||||
|
@ -444,8 +450,11 @@
|
|||
</sql>
|
||||
|
||||
<sql id="queryWhereCondition">
|
||||
<if test="request.protocol != null and request.protocol!=''">
|
||||
and a.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and a.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||
and atc.api_definition_id = #{request.apiDefinitionId}
|
||||
|
@ -552,8 +561,11 @@
|
|||
#{moduleId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol!=''">
|
||||
and ad.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and ad.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" open="(" separator="," close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||
and ac.api_definition_id = #{request.apiDefinitionId}
|
||||
|
@ -575,8 +587,12 @@
|
|||
#{moduleId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.protocol != null and request.protocol!=''">
|
||||
and ad.protocol = #{request.protocol}
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and ad.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" open="(" separator="," close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||
and ac.api_definition_id = #{request.apiDefinitionId}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class ApiDefinitionImportUtilService {
|
|||
//查询数据库中所有的数据, 用于判断是否重复
|
||||
ApiDefinitionPageRequest pageRequest = new ApiDefinitionPageRequest();
|
||||
pageRequest.setProjectId(request.getProjectId());
|
||||
pageRequest.setProtocol(request.getProtocol());
|
||||
pageRequest.setProtocols(List.of(request.getProtocol()));
|
||||
//TODO 如果是有版本的话 需要加上版本的判断
|
||||
List<ApiDefinitionImportDetail> apiLists = extApiDefinitionMapper.importList(pageRequest);
|
||||
List<BaseTreeNode> apiModules = this.buildTreeData(request.getProjectId(), request.getProtocol());
|
||||
|
@ -812,7 +812,7 @@ public class ApiDefinitionImportUtilService {
|
|||
public List<BaseTreeNode> buildTreeData(String projectId, String protocol) {
|
||||
ApiModuleRequest request = new ApiModuleRequest();
|
||||
request.setProjectId(projectId);
|
||||
request.setProtocol(protocol);
|
||||
request.setProtocols(List.of(protocol));
|
||||
List<BaseTreeNode> apiModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(request);
|
||||
return this.buildTreeAndCountResource(apiModuleList, true, Translator.get(UNPLANNED_API));
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ public class ApiDefinitionModuleService extends ModuleTreeService {
|
|||
example.createCriteria()
|
||||
.andProjectIdEqualTo(request.getProjectId())
|
||||
.andDeletedEqualTo(true)
|
||||
.andProtocolEqualTo(request.getProtocol());
|
||||
.andProtocolIn(request.getProtocols());
|
||||
List<ApiDefinition> apiDefinitions = apiDefinitionMapper.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(apiDefinitions)) {
|
||||
return new ArrayList<>();
|
||||
|
@ -315,7 +315,7 @@ public class ApiDefinitionModuleService extends ModuleTreeService {
|
|||
EnvApiTreeDTO envApiTreeDTO = new EnvApiTreeDTO();
|
||||
ApiModuleRequest apiModuleRequest = new ApiModuleRequest();
|
||||
apiModuleRequest.setProjectId(request.getProjectId());
|
||||
apiModuleRequest.setProtocol(ModuleConstants.NODE_PROTOCOL_HTTP);
|
||||
apiModuleRequest.setProtocols(List.of(ModuleConstants.NODE_PROTOCOL_HTTP));
|
||||
List<BaseTreeNode> fileModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(apiModuleRequest);
|
||||
List<BaseTreeNode> baseTreeNodes = super.buildTreeAndCountResource(fileModuleList, true, Translator.get(UNPLANNED_API));
|
||||
envApiTreeDTO.setModuleTree(baseTreeNodes);
|
||||
|
|
|
@ -291,7 +291,7 @@ public class ApiDefinitionService extends MoveNodeService {
|
|||
|
||||
public void batchUpdate(ApiDefinitionBatchUpdateRequest request, String userId) {
|
||||
ProjectService.checkResourceExist(request.getProjectId());
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId);
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId);
|
||||
// 记录更新前的数据
|
||||
apiDefinitionLogService.batchUpdateLog(ids, userId, request.getProjectId());
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
|
@ -417,14 +417,14 @@ public class ApiDefinitionService extends MoveNodeService {
|
|||
}
|
||||
|
||||
public void batchDeleteToGc(ApiDefinitionBatchDeleteRequest request, String userId) {
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId);
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId);
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
handleDeleteApiDefinition(ids, request.getDeleteAllVersion(), request.getProjectId(), userId, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void batchMove(ApiDefinitionBatchMoveRequest request, String userId) {
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId);
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId);
|
||||
if (!ids.isEmpty()) {
|
||||
// 移动接口所有版本引用的数据
|
||||
List<String> refIds = extApiDefinitionMapper.getRefIds(ids, false);
|
||||
|
@ -805,14 +805,14 @@ public class ApiDefinitionService extends MoveNodeService {
|
|||
}
|
||||
|
||||
public void batchRecover(ApiDefinitionBatchRequest request, String userId) {
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), true, userId);
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId);
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
handleRecoverApiDefinition(ids, userId, request.getProjectId(), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void batchDelete(ApiDefinitionBatchRequest request, String userId) {
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), true, userId);
|
||||
List<String> ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId);
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
handleTrashDelApiDefinition(ids, userId, request.getProjectId(), true);
|
||||
}
|
||||
|
@ -864,12 +864,12 @@ public class ApiDefinitionService extends MoveNodeService {
|
|||
}
|
||||
|
||||
// 获取批量操作选中的ID
|
||||
public <T> List<String> getBatchApiIds(T dto, String projectId, String protocol, boolean deleted, String userId) {
|
||||
public <T> List<String> getBatchApiIds(T dto, String projectId, List<String> protocols, boolean deleted, String userId) {
|
||||
TableBatchProcessDTO request = (TableBatchProcessDTO) dto;
|
||||
if (request.isSelectAll()) {
|
||||
// 全选
|
||||
CustomFieldUtils.setBaseQueryRequestCustomMultipleFields(request.getCondition(), userId);
|
||||
List<String> ids = extApiDefinitionMapper.getIds(request, projectId, protocol, deleted);
|
||||
List<String> ids = extApiDefinitionMapper.getIds(request, projectId, protocols, deleted);
|
||||
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
||||
ids.removeAll(request.getExcludeIds());
|
||||
}
|
||||
|
|
|
@ -689,6 +689,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002", "1005"));
|
||||
apiDefinitionBatchUpdateRequest.setExcludeIds(List.of("1005"));
|
||||
apiDefinitionBatchUpdateRequest.setSelectAll(false);
|
||||
apiDefinitionBatchUpdateRequest.setProtocols(List.of("HTTP"));
|
||||
apiDefinitionBatchUpdateRequest.setType("tags");
|
||||
// 修改标签,追加
|
||||
apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002"));
|
||||
|
@ -814,6 +815,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
request.setSelectIds(List.of("1001", "1002", "1005"));
|
||||
request.setExcludeIds(List.of("1005"));
|
||||
request.setSelectAll(false);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
this.requestPostWithOkAndReturn(BATCH_MOVE, request);
|
||||
// @@校验日志
|
||||
|
||||
|
@ -918,6 +920,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setDeleted(false);
|
||||
request.setSort(Map.of("createTime", "asc"));
|
||||
// "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED"
|
||||
|
@ -1019,6 +1022,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
apiDefinition = apiDefinitionMapper.selectByPrimaryKey("1001");
|
||||
request.setApiId(apiDefinition.getId());
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setType(ApiDefinitionDocType.API.name());
|
||||
// @@请求成功
|
||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(DOC, request);
|
||||
|
@ -1111,6 +1115,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
// @@模块查看文档
|
||||
request.setApiId(null);
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setType(ApiDefinitionDocType.MODULE.name());
|
||||
request.setModuleIds(List.of("1001001"));
|
||||
MvcResult mvcResultModule = this.requestPostWithOkAndReturn(DOC, request);
|
||||
|
@ -1325,6 +1330,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
request.setSelectIds(List.of("1004"));
|
||||
request.setDeleteAllVersion(false);
|
||||
request.setSelectAll(false);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
this.requestPostWithOkAndReturn(BATCH_DELETE_TO_GC, request);
|
||||
// @@校验日志
|
||||
checkLogModelList.add(new CheckLogModel("1004", OperationLogType.DELETE, BATCH_DELETE_TO_GC));
|
||||
|
@ -1399,6 +1405,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
LogUtils.info("batch recover api test");
|
||||
ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest();
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
// 恢复选中
|
||||
request.setSelectIds(List.of("1002", "1004", "1005"));
|
||||
request.setExcludeIds(List.of("1005"));
|
||||
|
@ -1480,6 +1487,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
LogUtils.info("batch trash delete api test");
|
||||
ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest();
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
|
||||
// 删除选中
|
||||
request.setSelectIds(List.of("1003"));
|
||||
|
|
|
@ -525,6 +525,7 @@ public class ApiDefinitionMockControllerTests extends BaseTest {
|
|||
request.setApiDefinitionId(apiDefinitionMock.getApiDefinitionId());
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setSort(Map.of("createTime", "asc"));
|
||||
// "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED"
|
||||
switch (search) {
|
||||
|
@ -600,6 +601,7 @@ public class ApiDefinitionMockControllerTests extends BaseTest {
|
|||
request.setType("Tags");
|
||||
request.setAppend(true);
|
||||
request.setSelectAll(true);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||
ApiDefinitionMockExample example = new ApiDefinitionMockExample();
|
||||
|
|
|
@ -815,7 +815,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
|||
public void TestModuleCountSuccess() throws Exception {
|
||||
this.preliminaryData();
|
||||
ApiModuleRequest request = new ApiModuleRequest() {{
|
||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
||||
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||
this.setProjectId(project.getId());
|
||||
}};
|
||||
MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_FILE_MODULE_COUNT, request);
|
||||
|
@ -879,7 +879,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
|||
apiDefinition.setDeleted(true);
|
||||
apiDefinitionMapper.updateByExampleSelective(apiDefinition, example);
|
||||
MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_TREE, new ApiModuleRequest() {{
|
||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
||||
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||
this.setProjectId(project.getId());
|
||||
}});
|
||||
|
||||
|
@ -892,7 +892,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
|||
@Order(12)
|
||||
public void getModuleTrashTreeCount() throws Exception {
|
||||
ApiModuleRequest request = new ApiModuleRequest() {{
|
||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
||||
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||
this.setProjectId(project.getId());
|
||||
}};
|
||||
MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_COUNT, request);
|
||||
|
@ -954,11 +954,11 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
|||
|
||||
private List<BaseTreeNode> getModuleTreeNode() throws Exception {
|
||||
MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TREE, new ApiModuleRequest() {{
|
||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
||||
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||
this.setProjectId(project.getId());
|
||||
}});
|
||||
this.requestPostWithOkAndReturn(URL_MODULE_ONLY_TREE, new ApiModuleRequest() {{
|
||||
this.setProtocol(ApiConstants.HTTP_PROTOCOL);
|
||||
this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL));
|
||||
this.setProjectId(project.getId());
|
||||
}});
|
||||
String returnData = result.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
|
|
|
@ -2829,7 +2829,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
|
||||
ScenarioSystemRequest scenarioSystemRequest = new ScenarioSystemRequest();
|
||||
scenarioSystemRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||
scenarioSystemRequest.setProtocol("HTTP");
|
||||
scenarioSystemRequest.setProtocols(List.of("HTTP"));
|
||||
scenarioSystemRequest.setModuleIds(List.of("test-default"));
|
||||
ApiScenarioSystemRequest apiScenarioSystemRequest = new ApiScenarioSystemRequest();
|
||||
apiScenarioSystemRequest.setApiRequest(scenarioSystemRequest);
|
||||
|
|
|
@ -508,6 +508,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
apiRunModeRequest.setIntegratedReportName("aaaa");
|
||||
apiRunModeRequest.setPoolId("poolId");
|
||||
request.setRunModeConfig(apiRunModeRequest);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
this.requestPostWithOk(BATCH_RUN, request);
|
||||
|
||||
apiRunModeRequest.setIntegratedReport(false);
|
||||
|
@ -833,6 +834,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
pageRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||
pageRequest.setPageSize(10);
|
||||
pageRequest.setCurrent(1);
|
||||
pageRequest.setProtocols(List.of("HTTP"));
|
||||
MvcResult mvcResult = requestPostWithOkAndReturn(PAGE, pageRequest);
|
||||
Pager<?> returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||
//返回值不为空
|
||||
|
@ -912,6 +914,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
request.setType("Tags");
|
||||
request.setAppend(true);
|
||||
request.setSelectAll(true);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4")));
|
||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||
|
@ -1086,6 +1089,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
pageRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||
pageRequest.setPageSize(10);
|
||||
pageRequest.setCurrent(1);
|
||||
pageRequest.setProtocols(List.of("HTTP"));
|
||||
MvcResult mvcResult = requestPostWithOkAndReturn(TRASH_PAGE, pageRequest);
|
||||
Pager<?> returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||
//返回值不为空
|
||||
|
@ -1137,6 +1141,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
request.setSelectAll(false);
|
||||
request.setSelectIds(List.of(apiTestCase.getId()));
|
||||
request.setExcludeIds(List.of(apiTestCase.getId()));
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
requestPostWithOkAndReturn(BATCH_RECOVER, request);
|
||||
|
||||
ApiDefinition apiDefinition = new ApiDefinition();
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
@AutoConfigureMockMvc
|
||||
public class AssociateApiProviderTest extends BaseTest {
|
||||
|
@ -36,6 +36,7 @@ public class AssociateApiProviderTest extends BaseTest {
|
|||
request.setProjectId("project-associate-case-test");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setSort(new HashMap<>() {{
|
||||
put("createTime", "desc");
|
||||
}});
|
||||
|
@ -53,6 +54,7 @@ public class AssociateApiProviderTest extends BaseTest {
|
|||
request.setProjectId("project-associate-case-test");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setSort(new HashMap<>() {{
|
||||
put("createTime", "desc");
|
||||
}});
|
||||
|
@ -69,6 +71,7 @@ public class AssociateApiProviderTest extends BaseTest {
|
|||
request.setSourceType("API");
|
||||
request.setSourceId("gyq_associate_case_id_1");
|
||||
request.setSelectAll(true);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setProjectId("project-associate-case-test");
|
||||
request.setExcludeIds(List.of("gyq_associate_api_case_id_2"));
|
||||
List<ApiTestCase> apiTestCases = provider.getSelectApiTestCases(request, false);
|
||||
|
|
|
@ -114,6 +114,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
|||
request.setProjectId("project_gyq_associate_test");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setSort(new HashMap<>() {{
|
||||
put("createTime", "desc");
|
||||
}});
|
||||
|
@ -162,6 +163,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
|||
request.setProjectId("project_gyq_associate_test");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
List<TestCaseProviderDTO> apiTestCaseList = provider.getApiTestCaseList("functional_case_test", "case_id", "source_id", request);
|
||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE, request);
|
||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
|
@ -195,6 +197,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
|||
request.setProjectId("project_gyq_associate_test");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE_MODULE_COUNT, request);
|
||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||
|
@ -592,7 +595,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
|||
testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis());
|
||||
testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory);
|
||||
gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case");
|
||||
Assertions.assertTrue(gyqReviewCaseTest.size()>1);
|
||||
Assertions.assertTrue(gyqReviewCaseTest.size() > 1);
|
||||
}
|
||||
|
||||
public List<TestPlanCaseExecuteHistoryDTO> getPlanExecuteHistoryList(String caseId) throws Exception {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.plan.dto.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -13,5 +14,5 @@ import java.util.List;
|
|||
public class TestPlanApiCaseBatchRequest extends BasePlanCaseBatchRequest {
|
||||
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "{api_definition.protocol.not_blank}")
|
||||
private List<String> protocols;
|
||||
private List<@NotBlank String> protocols;
|
||||
}
|
||||
|
|
|
@ -128,9 +128,12 @@
|
|||
<if test="request.projectId != null and request.projectId != ''">
|
||||
and api_definition.project_id = #{request.projectId}
|
||||
</if>
|
||||
<!--<if test="request.protocol != null and request.protocol != ''">
|
||||
AND api_definition.protocol = #{request.protocol}
|
||||
</if>-->
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
AND api_definition.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<include refid="filters">
|
||||
<property name="filter" value="request.filter"/>
|
||||
</include>
|
||||
|
@ -437,9 +440,12 @@
|
|||
|
||||
|
||||
<sql id="queryApiCaseWhereCondition">
|
||||
<!--<if test="request.protocol != null and request.protocol!=''">
|
||||
and a.protocol = #{request.protocol}
|
||||
</if>-->
|
||||
<if test="request.protocols != null and request.protocols.size() > 0">
|
||||
and a.protocol in
|
||||
<foreach collection="request.protocols" item="protocol" separator="," open="(" close=")">
|
||||
#{protocol}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.apiDefinitionId != null and request.apiDefinitionId!=''">
|
||||
and atc.api_definition_id = #{request.apiDefinitionId}
|
||||
</if>
|
||||
|
@ -639,7 +645,6 @@
|
|||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="collectionCountByRequest" parameterType="java.lang.String" resultType="io.metersphere.project.dto.ModuleCountDTO">
|
||||
SELECT
|
||||
test_plan_api_case.test_plan_collection_id AS moduleId,
|
||||
|
@ -653,4 +658,6 @@
|
|||
GROUP BY
|
||||
test_plan_api_case.test_plan_collection_id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -23,6 +23,7 @@ import io.metersphere.system.service.UserLoginService;
|
|||
import io.metersphere.system.utils.PageUtils;
|
||||
import io.metersphere.system.utils.Pager;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
|
@ -113,15 +114,18 @@ public class TestPlanTaskCenterService {
|
|||
public List<TaskCenterDTO> getPage(TaskCenterPageRequest request, List<OptionDTO> projectList, boolean isSystem) {
|
||||
List<TaskCenterDTO> list = new ArrayList<>();
|
||||
List<String> projectIds = projectList.stream().map(OptionDTO::getId).toList();
|
||||
Map<String, ExecuteReportDTO> historyDeletedMap = new HashMap<>();
|
||||
list = extTestPlanReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime());
|
||||
//执行历史列表
|
||||
if (CollectionUtils.isNotEmpty(projectIds)) {
|
||||
Map<String, ExecuteReportDTO> historyDeletedMap = new HashMap<>();
|
||||
list = extTestPlanReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime());
|
||||
//执行历史列表
|
||||
/*List<String> reportIds = list.stream().map(TaskCenterDTO::getId).toList();
|
||||
if (CollectionUtils.isNotEmpty(reportIds)) {
|
||||
List<ExecuteReportDTO> historyDeletedList = extTestPlanReportMapper.getHistoryDeleted(reportIds);
|
||||
historyDeletedMap = historyDeletedList.stream().collect(Collectors.toMap(ExecuteReportDTO::getId, Function.identity()));
|
||||
}*/
|
||||
processTaskCenter(list, projectList, projectIds, historyDeletedMap);
|
||||
processTaskCenter(list, projectList, projectIds, historyDeletedMap);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest {
|
|||
request.setPageSize(10);
|
||||
request.setTestPlanId("wxxx_1");
|
||||
request.setProjectId("wxx_1234");
|
||||
request.setProtocol("HTTP");
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
this.requestPost(API_CASE_PAGE, request);
|
||||
request.setSort(new HashMap<>() {{
|
||||
put("createTime", "desc");
|
||||
|
@ -54,7 +54,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest {
|
|||
TestPlanApiCaseModuleRequest request = new TestPlanApiCaseModuleRequest();
|
||||
request.setTestPlanId("wxxx_1");
|
||||
request.setProjectId("wxx_1234");
|
||||
request.setProtocol("HTTP");
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
request.setTreeType("MODULE");
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.test.web.servlet.MvcResult;
|
|||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
|
@ -54,6 +55,7 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
|||
request.setPageSize(10);
|
||||
request.setTestPlanId("wxx_1");
|
||||
request.setProjectId("1234567");
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
this.requestPost(API_ASSOCIATION_URL, request);
|
||||
request.setProjectId("wx_1234");
|
||||
this.requestPost(API_ASSOCIATION_URL, request);
|
||||
|
@ -74,6 +76,7 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
|||
request.setPageSize(10);
|
||||
request.setProjectId("1234567");
|
||||
request.setTestPlanId("wxx_1");
|
||||
request.setProtocols(List.of("HTTP"));
|
||||
this.requestPost(API_CASE_ASSOCIATION_URL, request);
|
||||
request.setProjectId("wx_1234");
|
||||
this.requestPost(API_CASE_ASSOCIATION_URL, request);
|
||||
|
|
|
@ -383,6 +383,13 @@
|
|||
width: 200,
|
||||
columnSelectorDisabled: true,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.protocol',
|
||||
dataIndex: 'protocol',
|
||||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.apiType',
|
||||
dataIndex: 'method',
|
||||
|
@ -494,6 +501,7 @@
|
|||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
await initFilterColumn();
|
||||
await tableStore.initColumn(TableKeyEnum.API_TEST, columns, 'drawer', true);
|
||||
if (props.readOnly) {
|
||||
|
@ -964,12 +972,15 @@
|
|||
:deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) {
|
||||
&:not(:hover) {
|
||||
border-color: transparent !important;
|
||||
|
||||
.arco-input::placeholder {
|
||||
@apply invisible;
|
||||
}
|
||||
|
||||
.arco-select-view-icon {
|
||||
@apply invisible;
|
||||
}
|
||||
|
||||
.arco-select-view-value {
|
||||
color: var(--color-text-brand);
|
||||
}
|
||||
|
|
|
@ -400,6 +400,13 @@
|
|||
width: 180,
|
||||
columnSelectorDisabled: true,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.protocol',
|
||||
dataIndex: 'protocol',
|
||||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: 'case.caseLevel',
|
||||
dataIndex: 'priority',
|
||||
|
|
|
@ -286,6 +286,13 @@
|
|||
width: 200,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.protocol',
|
||||
dataIndex: 'protocol',
|
||||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: 'mockManagement.apiPath',
|
||||
dataIndex: 'apiPath',
|
||||
|
|
|
@ -173,6 +173,13 @@
|
|||
width: 200,
|
||||
columnSelectorDisabled: true,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.protocol',
|
||||
dataIndex: 'protocol',
|
||||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.apiType',
|
||||
dataIndex: 'method',
|
||||
|
|
|
@ -181,6 +181,13 @@
|
|||
width: 180,
|
||||
columnSelectorDisabled: true,
|
||||
},
|
||||
{
|
||||
title: 'apiTestManagement.protocol',
|
||||
dataIndex: 'protocol',
|
||||
showTooltip: true,
|
||||
width: 200,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: 'case.caseLevel',
|
||||
dataIndex: 'priority',
|
||||
|
|
|
@ -40,6 +40,7 @@ export default {
|
|||
'apiTestManagement.apiType': 'Method',
|
||||
'apiTestManagement.apiStatus': 'Status',
|
||||
'apiTestManagement.path': 'Path',
|
||||
'apiTestManagement.protocol': 'Protocol',
|
||||
'apiTestManagement.version': 'Version',
|
||||
'apiTestManagement.createTime': 'Creation Time',
|
||||
'apiTestManagement.updateTime': 'Update Time',
|
||||
|
|
|
@ -39,6 +39,7 @@ export default {
|
|||
'apiTestManagement.apiType': '请求类型',
|
||||
'apiTestManagement.apiStatus': '状态',
|
||||
'apiTestManagement.path': '路径',
|
||||
'apiTestManagement.protocol': '协议',
|
||||
'apiTestManagement.version': '版本',
|
||||
'apiTestManagement.createTime': '创建时间',
|
||||
'apiTestManagement.updateTime': '更新时间',
|
||||
|
|
Loading…
Reference in New Issue