refactor(接口测试): 优化查询tags

This commit is contained in:
wxg0103 2024-01-09 18:13:42 +08:00 committed by Craftsman
parent fc038ce5a1
commit 47e85281db
28 changed files with 565 additions and 202 deletions

View File

@ -1,12 +1,17 @@
package io.metersphere.api.domain;
import io.metersphere.validation.groups.*;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.Data;
import java.util.List;
@Data
public class ApiDefinition implements Serializable {
@ -40,7 +45,7 @@ public class ApiDefinition implements Serializable {
private Long num;
@Schema(description = "标签")
private String tags;
private List<String> tags;
@Schema(description = "自定义排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{api_definition.pos.not_blank}", groups = {Created.class})
@ -164,7 +169,7 @@ public class ApiDefinition implements Serializable {
return this.getEscapedColumnName() + " ASC";
}
public static Column[] excludes(Column ... excludes) {
public static Column[] excludes(Column... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));

View File

@ -64,19 +64,50 @@ public class ApiDefinitionExample {
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> tagsCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
tagsCriteria = new ArrayList<Criterion>();
}
public List<Criterion> getTagsCriteria() {
return tagsCriteria;
}
protected void addTagsCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
protected void addTagsCriterion(String condition, List<String> value1, List<String> value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
public boolean isValid() {
return criteria.size() > 0;
return criteria.size() > 0
|| tagsCriteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(tagsCriteria);
}
return allCriteria;
}
public List<Criterion> getCriteria() {
@ -88,6 +119,7 @@ public class ApiDefinitionExample {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
allCriteria = null;
}
protected void addCriterion(String condition, Object value, String property) {
@ -95,6 +127,7 @@ public class ApiDefinitionExample {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
allCriteria = null;
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
@ -102,6 +135,7 @@ public class ApiDefinitionExample {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
allCriteria = null;
}
public Criteria andIdIsNull() {
@ -594,63 +628,63 @@ public class ApiDefinitionExample {
return (Criteria) this;
}
public Criteria andTagsEqualTo(String value) {
addCriterion("tags =", value, "tags");
public Criteria andTagsEqualTo(List<String> value) {
addTagsCriterion("tags =", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotEqualTo(String value) {
addCriterion("tags <>", value, "tags");
public Criteria andTagsNotEqualTo(List<String> value) {
addTagsCriterion("tags <>", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThan(String value) {
addCriterion("tags >", value, "tags");
public Criteria andTagsGreaterThan(List<String> value) {
addTagsCriterion("tags >", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThanOrEqualTo(String value) {
addCriterion("tags >=", value, "tags");
public Criteria andTagsGreaterThanOrEqualTo(List<String> value) {
addTagsCriterion("tags >=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThan(String value) {
addCriterion("tags <", value, "tags");
public Criteria andTagsLessThan(List<String> value) {
addTagsCriterion("tags <", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThanOrEqualTo(String value) {
addCriterion("tags <=", value, "tags");
public Criteria andTagsLessThanOrEqualTo(List<String> value) {
addTagsCriterion("tags <=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLike(String value) {
addCriterion("tags like", value, "tags");
public Criteria andTagsLike(List<String> value) {
addTagsCriterion("tags like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotLike(String value) {
addCriterion("tags not like", value, "tags");
public Criteria andTagsNotLike(List<String> value) {
addTagsCriterion("tags not like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsIn(List<String> values) {
addCriterion("tags in", values, "tags");
public Criteria andTagsIn(List<List<String>> values) {
addTagsCriterion("tags in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsNotIn(List<String> values) {
addCriterion("tags not in", values, "tags");
public Criteria andTagsNotIn(List<List<String>> values) {
addTagsCriterion("tags not in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsBetween(String value1, String value2) {
addCriterion("tags between", value1, value2, "tags");
public Criteria andTagsBetween(List<String> value1, List<String> value2) {
addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this;
}
public Criteria andTagsNotBetween(String value1, String value2) {
addCriterion("tags not between", value1, value2, "tags");
public Criteria andTagsNotBetween(List<String> value1, List<String> value2) {
addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this;
}

View File

@ -1,12 +1,16 @@
package io.metersphere.api.domain;
import io.metersphere.validation.groups.*;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.Data;
import java.util.List;
@Data
public class ApiDefinitionMock implements Serializable {
@ -30,7 +34,7 @@ public class ApiDefinitionMock implements Serializable {
private String name;
@Schema(description = "自定义标签")
private String tags;
private List<String> tags;
@Schema(description = "启用/禁用")
private Boolean enable;
@ -107,7 +111,7 @@ public class ApiDefinitionMock implements Serializable {
return this.getEscapedColumnName() + " ASC";
}
public static Column[] excludes(Column ... excludes) {
public static Column[] excludes(Column... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));

View File

@ -64,19 +64,50 @@ public class ApiDefinitionMockExample {
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> tagsCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
tagsCriteria = new ArrayList<Criterion>();
}
public List<Criterion> getTagsCriteria() {
return tagsCriteria;
}
protected void addTagsCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
protected void addTagsCriterion(String condition, List<String> value1, List<String> value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
public boolean isValid() {
return criteria.size() > 0;
return criteria.size() > 0
|| tagsCriteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(tagsCriteria);
}
return allCriteria;
}
public List<Criterion> getCriteria() {
@ -88,6 +119,7 @@ public class ApiDefinitionMockExample {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
allCriteria = null;
}
protected void addCriterion(String condition, Object value, String property) {
@ -95,6 +127,7 @@ public class ApiDefinitionMockExample {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
allCriteria = null;
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
@ -102,6 +135,7 @@ public class ApiDefinitionMockExample {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
allCriteria = null;
}
public Criteria andIdIsNull() {
@ -444,63 +478,63 @@ public class ApiDefinitionMockExample {
return (Criteria) this;
}
public Criteria andTagsEqualTo(String value) {
addCriterion("tags =", value, "tags");
public Criteria andTagsEqualTo(List<String> value) {
addTagsCriterion("tags =", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotEqualTo(String value) {
addCriterion("tags <>", value, "tags");
public Criteria andTagsNotEqualTo(List<String> value) {
addTagsCriterion("tags <>", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThan(String value) {
addCriterion("tags >", value, "tags");
public Criteria andTagsGreaterThan(List<String> value) {
addTagsCriterion("tags >", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThanOrEqualTo(String value) {
addCriterion("tags >=", value, "tags");
public Criteria andTagsGreaterThanOrEqualTo(List<String> value) {
addTagsCriterion("tags >=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThan(String value) {
addCriterion("tags <", value, "tags");
public Criteria andTagsLessThan(List<String> value) {
addTagsCriterion("tags <", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThanOrEqualTo(String value) {
addCriterion("tags <=", value, "tags");
public Criteria andTagsLessThanOrEqualTo(List<String> value) {
addTagsCriterion("tags <=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLike(String value) {
addCriterion("tags like", value, "tags");
public Criteria andTagsLike(List<String> value) {
addTagsCriterion("tags like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotLike(String value) {
addCriterion("tags not like", value, "tags");
public Criteria andTagsNotLike(List<String> value) {
addTagsCriterion("tags not like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsIn(List<String> values) {
addCriterion("tags in", values, "tags");
public Criteria andTagsIn(List<List<String>> values) {
addTagsCriterion("tags in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsNotIn(List<String> values) {
addCriterion("tags not in", values, "tags");
public Criteria andTagsNotIn(List<List<String>> values) {
addTagsCriterion("tags not in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsBetween(String value1, String value2) {
addCriterion("tags between", value1, value2, "tags");
public Criteria andTagsBetween(List<String> value1, List<String> value2) {
addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this;
}
public Criteria andTagsNotBetween(String value1, String value2) {
addCriterion("tags not between", value1, value2, "tags");
public Criteria andTagsNotBetween(List<String> value1, List<String> value2) {
addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this;
}

View File

@ -1,12 +1,17 @@
package io.metersphere.api.domain;
import io.metersphere.validation.groups.*;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import lombok.Data;
import java.util.List;
@Data
public class ApiTestCase implements Serializable {
@ -29,7 +34,7 @@ public class ApiTestCase implements Serializable {
private Long num;
@Schema(description = "标签")
private String tags;
private List<String> tags;
@Schema(description = "用例状态", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_test_case.status.not_blank}", groups = {Created.class})
@ -153,7 +158,7 @@ public class ApiTestCase implements Serializable {
return this.getEscapedColumnName() + " ASC";
}
public static Column[] excludes(Column ... excludes) {
public static Column[] excludes(Column... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));

View File

@ -64,19 +64,50 @@ public class ApiTestCaseExample {
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> tagsCriteria;
protected List<Criterion> allCriteria;
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
tagsCriteria = new ArrayList<Criterion>();
}
public List<Criterion> getTagsCriteria() {
return tagsCriteria;
}
protected void addTagsCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
protected void addTagsCriterion(String condition, List<String> value1, List<String> value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
tagsCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
allCriteria = null;
}
public boolean isValid() {
return criteria.size() > 0;
return criteria.size() > 0
|| tagsCriteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
if (allCriteria == null) {
allCriteria = new ArrayList<Criterion>();
allCriteria.addAll(criteria);
allCriteria.addAll(tagsCriteria);
}
return allCriteria;
}
public List<Criterion> getCriteria() {
@ -88,6 +119,7 @@ public class ApiTestCaseExample {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
allCriteria = null;
}
protected void addCriterion(String condition, Object value, String property) {
@ -95,6 +127,7 @@ public class ApiTestCaseExample {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
allCriteria = null;
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
@ -102,6 +135,7 @@ public class ApiTestCaseExample {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
allCriteria = null;
}
public Criteria andIdIsNull() {
@ -384,63 +418,63 @@ public class ApiTestCaseExample {
return (Criteria) this;
}
public Criteria andTagsEqualTo(String value) {
addCriterion("tags =", value, "tags");
public Criteria andTagsEqualTo(List<String> value) {
addTagsCriterion("tags =", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotEqualTo(String value) {
addCriterion("tags <>", value, "tags");
public Criteria andTagsNotEqualTo(List<String> value) {
addTagsCriterion("tags <>", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThan(String value) {
addCriterion("tags >", value, "tags");
public Criteria andTagsGreaterThan(List<String> value) {
addTagsCriterion("tags >", value, "tags");
return (Criteria) this;
}
public Criteria andTagsGreaterThanOrEqualTo(String value) {
addCriterion("tags >=", value, "tags");
public Criteria andTagsGreaterThanOrEqualTo(List<String> value) {
addTagsCriterion("tags >=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThan(String value) {
addCriterion("tags <", value, "tags");
public Criteria andTagsLessThan(List<String> value) {
addTagsCriterion("tags <", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLessThanOrEqualTo(String value) {
addCriterion("tags <=", value, "tags");
public Criteria andTagsLessThanOrEqualTo(List<String> value) {
addTagsCriterion("tags <=", value, "tags");
return (Criteria) this;
}
public Criteria andTagsLike(String value) {
addCriterion("tags like", value, "tags");
public Criteria andTagsLike(List<String> value) {
addTagsCriterion("tags like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsNotLike(String value) {
addCriterion("tags not like", value, "tags");
public Criteria andTagsNotLike(List<String> value) {
addTagsCriterion("tags not like", value, "tags");
return (Criteria) this;
}
public Criteria andTagsIn(List<String> values) {
addCriterion("tags in", values, "tags");
public Criteria andTagsIn(List<List<String>> values) {
addTagsCriterion("tags in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsNotIn(List<String> values) {
addCriterion("tags not in", values, "tags");
public Criteria andTagsNotIn(List<List<String>> values) {
addTagsCriterion("tags not in", values, "tags");
return (Criteria) this;
}
public Criteria andTagsBetween(String value1, String value2) {
addCriterion("tags between", value1, value2, "tags");
public Criteria andTagsBetween(List<String> value1, List<String> value2) {
addTagsCriterion("tags between", value1, value2, "tags");
return (Criteria) this;
}
public Criteria andTagsNotBetween(String value1, String value2) {
addCriterion("tags not between", value1, value2, "tags");
public Criteria andTagsNotBetween(List<String> value1, List<String> value2) {
addTagsCriterion("tags not between", value1, value2, "tags");
return (Criteria) this;
}

View File

@ -9,7 +9,7 @@
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="num" jdbcType="BIGINT" property="num" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
<result column="pos" jdbcType="BIGINT" property="pos" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
@ -49,6 +49,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
@ -78,6 +97,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
@ -121,20 +159,20 @@
<insert id="insert" parameterType="io.metersphere.api.domain.ApiDefinition">
insert into api_definition (id, `name`, protocol,
`method`, `path`, `status`,
num, tags, pos, project_id,
module_id, latest, version_id,
ref_id, description, create_time,
create_user, update_time, update_user,
delete_user, delete_time, deleted
)
num, tags,
pos, project_id, module_id,
latest, version_id, ref_id,
description, create_time, create_user,
update_time, update_user, delete_user,
delete_time, deleted)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{protocol,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR},
#{moduleId,jdbcType=VARCHAR}, #{latest,jdbcType=BIT}, #{versionId,jdbcType=VARCHAR},
#{refId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR},
#{deleteUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleted,jdbcType=BIT}
)
#{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
#{latest,jdbcType=BIT}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}, #{deleteUser,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleted,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiDefinition">
insert into api_definition
@ -229,7 +267,7 @@
#{num,jdbcType=BIGINT},
</if>
<if test="tags != null">
#{tags,jdbcType=VARCHAR},
#{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="pos != null">
#{pos,jdbcType=BIGINT},
@ -306,7 +344,7 @@
num = #{record.num,jdbcType=BIGINT},
</if>
<if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="record.pos != null">
pos = #{record.pos,jdbcType=BIGINT},
@ -364,7 +402,7 @@
`path` = #{record.path,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
num = #{record.num,jdbcType=BIGINT},
tags = #{record.tags,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
pos = #{record.pos,jdbcType=BIGINT},
project_id = #{record.projectId,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR},
@ -405,7 +443,7 @@
num = #{num,jdbcType=BIGINT},
</if>
<if test="tags != null">
tags = #{tags,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="pos != null">
pos = #{pos,jdbcType=BIGINT},
@ -460,7 +498,7 @@
`path` = #{path,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
num = #{num,jdbcType=BIGINT},
tags = #{tags,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
pos = #{pos,jdbcType=BIGINT},
project_id = #{projectId,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
@ -486,12 +524,12 @@
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.protocol,jdbcType=VARCHAR},
#{item.method,jdbcType=VARCHAR}, #{item.path,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR},
#{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT},
#{item.projectId,jdbcType=VARCHAR}, #{item.moduleId,jdbcType=VARCHAR}, #{item.latest,jdbcType=BIT},
#{item.versionId,jdbcType=VARCHAR}, #{item.refId,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR},
#{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT},
#{item.updateUser,jdbcType=VARCHAR}, #{item.deleteUser,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=BIGINT},
#{item.deleted,jdbcType=BIT})
#{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{item.pos,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR}, #{item.moduleId,jdbcType=VARCHAR},
#{item.latest,jdbcType=BIT}, #{item.versionId,jdbcType=VARCHAR}, #{item.refId,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR},
#{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR}, #{item.deleteUser,jdbcType=VARCHAR},
#{item.deleteTime,jdbcType=BIGINT}, #{item.deleted,jdbcType=BIT})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -526,7 +564,7 @@
#{item.num,jdbcType=BIGINT}
</if>
<if test="'tags'.toString() == column.value">
#{item.tags,jdbcType=VARCHAR}
#{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
</if>
<if test="'pos'.toString() == column.value">
#{item.pos,jdbcType=BIGINT}

View File

@ -7,7 +7,7 @@
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
<result column="enable" jdbcType="BIT" property="enable" />
<result column="expect_num" jdbcType="VARCHAR" property="expectNum" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
@ -37,6 +37,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
@ -66,6 +85,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
@ -111,7 +149,7 @@
`enable`, expect_num, project_id,
api_definition_id)
values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{enable,jdbcType=BIT}, #{expectNum,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{apiDefinitionId,jdbcType=VARCHAR})
</insert>
@ -166,7 +204,7 @@
#{name,jdbcType=VARCHAR},
</if>
<if test="tags != null">
#{tags,jdbcType=VARCHAR},
#{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="enable != null">
#{enable,jdbcType=BIT},
@ -207,7 +245,7 @@
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="record.enable != null">
`enable` = #{record.enable,jdbcType=BIT},
@ -233,7 +271,7 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
create_user = #{record.createUser,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`enable` = #{record.enable,jdbcType=BIT},
expect_num = #{record.expectNum,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
@ -258,7 +296,7 @@
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="tags != null">
tags = #{tags,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="enable != null">
`enable` = #{enable,jdbcType=BIT},
@ -281,7 +319,7 @@
update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`enable` = #{enable,jdbcType=BIT},
expect_num = #{expectNum,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
@ -295,7 +333,7 @@
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT},
#{item.createUser,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR},
#{item.createUser,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{item.enable,jdbcType=BIT}, #{item.expectNum,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR},
#{item.apiDefinitionId,jdbcType=VARCHAR})
</foreach>
@ -326,7 +364,7 @@
#{item.name,jdbcType=VARCHAR}
</if>
<if test="'tags'.toString() == column.value">
#{item.tags,jdbcType=VARCHAR}
#{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
</if>
<if test="'enable'.toString() == column.value">
#{item.enable,jdbcType=BIT}

View File

@ -6,7 +6,7 @@
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="priority" jdbcType="VARCHAR" property="priority" />
<result column="num" jdbcType="BIGINT" property="num" />
<result column="tags" jdbcType="VARCHAR" property="tags" />
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="last_report_status" jdbcType="VARCHAR" property="lastReportStatus" />
<result column="last_report_id" jdbcType="VARCHAR" property="lastReportId" />
@ -47,6 +47,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
@ -76,6 +95,25 @@
</when>
</choose>
</foreach>
<foreach collection="criteria.tagsCriteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
@ -118,19 +156,21 @@
</delete>
<insert id="insert" parameterType="io.metersphere.api.domain.ApiTestCase">
insert into api_test_case (id, `name`, priority,
num, tags, `status`, last_report_status,
last_report_id, pos, project_id,
api_definition_id, version_id, environment_id,
create_time, create_user, update_time,
update_user, delete_time, delete_user,
deleted)
num, tags,
`status`, last_report_status, last_report_id,
pos, project_id, api_definition_id,
version_id, environment_id, create_time,
create_user, update_time, update_user,
delete_time, delete_user, deleted
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR},
#{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{lastReportStatus,jdbcType=VARCHAR},
#{lastReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR},
#{apiDefinitionId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT},
#{updateUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR},
#{deleted,jdbcType=BIT})
#{num,jdbcType=BIGINT}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{status,jdbcType=VARCHAR}, #{lastReportStatus,jdbcType=VARCHAR}, #{lastReportId,jdbcType=VARCHAR},
#{pos,jdbcType=BIGINT}, #{projectId,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR},
#{versionId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiTestCase">
insert into api_test_case
@ -210,7 +250,7 @@
#{num,jdbcType=BIGINT},
</if>
<if test="tags != null">
#{tags,jdbcType=VARCHAR},
#{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
@ -281,7 +321,7 @@
num = #{record.num,jdbcType=BIGINT},
</if>
<if test="record.tags != null">
tags = #{record.tags,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
@ -339,7 +379,7 @@
`name` = #{record.name,jdbcType=VARCHAR},
priority = #{record.priority,jdbcType=VARCHAR},
num = #{record.num,jdbcType=BIGINT},
tags = #{record.tags,jdbcType=VARCHAR},
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`status` = #{record.status,jdbcType=VARCHAR},
last_report_status = #{record.lastReportStatus,jdbcType=VARCHAR},
last_report_id = #{record.lastReportId,jdbcType=VARCHAR},
@ -372,7 +412,7 @@
num = #{num,jdbcType=BIGINT},
</if>
<if test="tags != null">
tags = #{tags,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
@ -427,7 +467,7 @@
set `name` = #{name,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
num = #{num,jdbcType=BIGINT},
tags = #{tags,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
`status` = #{status,jdbcType=VARCHAR},
last_report_status = #{lastReportStatus,jdbcType=VARCHAR},
last_report_id = #{lastReportId,jdbcType=VARCHAR},
@ -453,8 +493,8 @@
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.priority,jdbcType=VARCHAR},
#{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR},
#{item.lastReportStatus,jdbcType=VARCHAR}, #{item.lastReportId,jdbcType=VARCHAR},
#{item.num,jdbcType=BIGINT}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
#{item.status,jdbcType=VARCHAR}, #{item.lastReportStatus,jdbcType=VARCHAR}, #{item.lastReportId,jdbcType=VARCHAR},
#{item.pos,jdbcType=BIGINT}, #{item.projectId,jdbcType=VARCHAR}, #{item.apiDefinitionId,jdbcType=VARCHAR},
#{item.versionId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
#{item.createUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR},
@ -485,7 +525,7 @@
#{item.num,jdbcType=BIGINT}
</if>
<if test="'tags'.toString() == column.value">
#{item.tags,jdbcType=VARCHAR}
#{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
</if>
<if test="'status'.toString() == column.value">
#{item.status,jdbcType=VARCHAR}

View File

@ -8,6 +8,8 @@ import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.util.List;
@Data
public class TestCaseProviderDTO {
@ -30,7 +32,7 @@ public class TestCaseProviderDTO {
private Long num;
@Schema(description = "标签")
private String tags;
private List<String> tags;
@Schema(description = "自定义排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{api_test_case.pos.not_blank}", groups = {Created.class})

View File

@ -6,7 +6,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
@ -30,4 +32,12 @@ public class ApiCaseBatchEditRequest extends ApiTestCaseBatchRequest implements
@Schema(description = "用例等级")
private String priority;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
}

View File

@ -9,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@ -23,11 +24,11 @@ public class ApiDefinitionAddRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "接口名称", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "接口名称", requiredMode = Schema.RequiredMode.REQUIRED)
@Size(min = 1, max = 255, message = "{api_definition.name.length_range}")
private String name;
@Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED)
@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;
@ -89,4 +90,12 @@ public class ApiDefinitionAddRequest implements Serializable {
public void setPath(String path) {
this.path = StringUtils.trim(path);
}
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
}

View File

@ -7,7 +7,9 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
/**
* @author lan
@ -42,4 +44,12 @@ public class ApiDefinitionBatchUpdateRequest extends ApiDefinitionBatchRequest {
@Schema(description = "是否追加", requiredMode = Schema.RequiredMode.REQUIRED)
private boolean append = false;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
}

View File

@ -6,6 +6,7 @@ import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
@ -63,4 +64,12 @@ public class ApiTestCaseAddRequest implements Serializable {
@Schema(description = "关联文件ID")
private List<String> linkFileIds;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
}

View File

@ -4,7 +4,6 @@ import io.metersphere.plugin.api.spi.AbstractMsTestElement;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
@ -79,7 +78,7 @@ public class ApiTestCaseDTO {
private String deleteName;
@Schema(description = "标签")
private List<String> tags = new ArrayList<>();
private List<String> tags;
@Schema(description = "用例通过率")
private String passRate;

View File

@ -6,6 +6,7 @@ import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
@ -70,4 +71,12 @@ public class ApiTestCaseUpdateRequest implements Serializable {
@Schema(description = "取消关联文件ID")
private List<String> unLinkRefIds;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
}

View File

@ -0,0 +1,40 @@
package io.metersphere.api.dto.definition.importdto;
import io.metersphere.api.dto.request.http.Header;
import io.metersphere.api.dto.request.http.QueryParam;
import io.metersphere.api.dto.request.http.auth.HTTPAuth;
import io.metersphere.system.domain.Schedule;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class ScheduleRequest extends Schedule {
//定时任务来源 测试计划/测试场景
private String scheduleFrom;
private String projectId;
private String moduleId;
private String modulePath;
private String modeId;
private String swaggerUrl;
private String taskId;
// 鉴权相关
@Schema(description = "swagger的请求头参数")
private List<Header> headers;
@Schema(description = "swagger的请求参数")
private List<QueryParam> arguments;
@Schema(description = "swagger的认证参数")
private HTTPAuth authManager;
private Boolean coverModule = false;
}

View File

@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
@ -24,7 +25,7 @@ public class ApiDefinitionMockAddRequest implements Serializable {
@Size(min = 1, max = 50, message = "{api_definition_mock.project_id.length_range}")
private String projectId;
@Schema(description = "接口 mock 名称", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "接口 mock 名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_definition_mock.name.not_blank}")
@Size(min = 1, max = 255, message = "{api_definition_mock.name.length_range}")
private String name;
@ -58,4 +59,12 @@ public class ApiDefinitionMockAddRequest implements Serializable {
@Schema(description = "关联文件ID")
private List<String> linkFileIds;
public List<String> getTags() {
if (tags == null) {
return new ArrayList<>(0);
} else {
return new ArrayList<>(tags);
}
}
}

View File

@ -2,7 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.api.mapper.ExtApiDefinitionMapper">
<resultMap id="ApiDefinitionDTO" type="io.metersphere.api.dto.definition.ApiDefinitionDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<resultMap id="BaseResultMap" type="io.metersphere.api.domain.ApiDefinition">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<update id="deleteApiToGc">
update api_definition
set delete_user = #{userId},delete_time = #{time}, deleted = 1 , module_id = 'root'
@ -11,7 +17,7 @@
#{v}
</foreach>
</update>
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionDTO">
<select id="list" resultMap="ApiDefinitionDTO">
select
api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`,
api_definition.`path`, api_definition.`status`, api_definition.num, api_definition.tags, api_definition.pos,
@ -26,7 +32,7 @@
</select>
<select id="listDoc" resultType="io.metersphere.api.dto.definition.ApiDefinitionDTO">
<select id="listDoc" resultMap="ApiDefinitionDTO">
select
api_definition.id, api_definition.`name`, api_definition.protocol, api_definition.`method`,
api_definition.`path`, api_definition.`status`, api_definition.num, api_definition.tags, api_definition.pos,
@ -121,7 +127,7 @@
WHERE ref_id = #{refId}
</select>
<select id="getTagsByIds" resultType="io.metersphere.api.domain.ApiDefinition">
<select id="getTagsByIds" resultMap="BaseResultMap">
select id, tags from api_definition
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">

View File

@ -2,7 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.api.mapper.ExtApiDefinitionMockMapper">
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDefinitionMockDTO">
<resultMap id="ApiDefinitionMockDTO" type="io.metersphere.api.dto.definition.ApiDefinitionMockDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<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.api_definition_id, u.name as create_user_name

View File

@ -2,6 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.api.mapper.ExtApiTestCaseMapper">
<resultMap id="ApiTestCaseDTO" type="io.metersphere.api.dto.definition.ApiTestCaseDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<resultMap id="TestCaseProviderDTO" type="io.metersphere.dto.TestCaseProviderDTO">
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
</resultMap>
<update id="batchMoveGc">
UPDATE api_test_case
SET deleted = 1,
@ -21,7 +28,7 @@
LIMIT 1;
</select>
<select id="listByRequest" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
<select id="listByRequest" resultMap="ApiTestCaseDTO">
SELECT
t1.id,
t1.project_id,
@ -39,6 +46,7 @@
t1.last_report_status,
t1.last_report_id,
t1.environment_id,
t1.tags,
a.module_id
FROM
api_test_case t1
@ -153,7 +161,7 @@
</foreach>
</select>
<select id="listByProviderRequest" resultType="io.metersphere.dto.TestCaseProviderDTO">
<select id="listByProviderRequest" resultMap="TestCaseProviderDTO">
SELECT
t1.id,
t1.project_id,

View File

@ -23,7 +23,6 @@ import io.metersphere.sdk.constants.DefaultRepositoryDir;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.FileAssociationSourceUtil;
import io.metersphere.sdk.util.JSON;
import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.uid.IDGenerator;
import io.metersphere.system.uid.NumGenerator;
@ -79,7 +78,7 @@ public class ApiDefinitionMockService {
apiDefinitionMockConfigOptional.ifPresent(config -> {
apiDefinitionMockDTO.setMatching(ApiDataUtils.parseObject(new String(config.getMatching()), AbstractMsTestElement.class));
apiDefinitionMockDTO.setResponse(ApiDataUtils.parseArray(new String(config.getResponse()), HttpResponse.class));
});
});
}
public void handleApiDefinition(String id, ApiDefinitionMockDTO apiDefinitionMockDTO) {
@ -97,7 +96,7 @@ public class ApiDefinitionMockService {
* @param id mock id
*/
private ApiDefinitionMock checkApiDefinitionMock(String id) {
return ServiceUtils.checkResourceExist(apiDefinitionMockMapper.selectByPrimaryKey(id),"permission.api_mock.name");
return ServiceUtils.checkResourceExist(apiDefinitionMockMapper.selectByPrimaryKey(id), "permission.api_mock.name");
}
public ApiDefinitionMock create(ApiDefinitionMockAddRequest request, String userId) {
@ -111,7 +110,7 @@ public class ApiDefinitionMockService {
apiDefinitionMock.setUpdateTime(System.currentTimeMillis());
apiDefinitionMock.setCreateUser(userId);
if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinitionMock.setTags(JSON.toJSONString(request.getTags()));
apiDefinitionMock.setTags(request.getTags());
}
apiDefinitionMock.setEnable(true);
ApiDefinition apiDefinition = apiDefinitionMapper.selectByPrimaryKey(apiDefinitionMock.getApiDefinitionId());
@ -172,7 +171,7 @@ public class ApiDefinitionMockService {
checkUpdateExist(apiDefinitionMock);
apiDefinitionMock.setUpdateTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinitionMock.setTags(JSON.toJSONString(request.getTags()));
apiDefinitionMock.setTags(request.getTags());
}
apiDefinitionMockMapper.updateByPrimaryKeySelective(apiDefinitionMock);
ApiDefinitionMockConfig apiDefinitionMockConfig = new ApiDefinitionMockConfig();
@ -229,7 +228,7 @@ public class ApiDefinitionMockService {
}
private String getCopyName(String name) {
String copyName = "copy_" + name ;
String copyName = "copy_" + name;
if (copyName.length() > 200) {
copyName = copyName.substring(0, 195) + copyName.substring(copyName.length() - 5);
}
@ -255,7 +254,7 @@ public class ApiDefinitionMockService {
List<ApiDefinitionMock> apiDefinitionMocks = apiDefinitionMockMapper.selectByExample(apiDefinitionMockExample);
if(!apiDefinitionMocks.isEmpty()){
if (!apiDefinitionMocks.isEmpty()) {
apiDefinitionMocks.forEach(item -> {
String apiDefinitionMockDir = DefaultRepositoryDir.getApiDefinitionDir(item.getProjectId(), item.getId());
apiFileResourceService.deleteByResourceId(apiDefinitionMockDir, item.getId(), item.getProjectId(), userId, OperationLogModule.API_DEFINITION_MOCK);

View File

@ -170,7 +170,7 @@ public class ApiDefinitionService {
apiDefinition.setVersionId(StringUtils.defaultIfBlank(request.getVersionId(), extBaseProjectVersionMapper.getDefaultVersion(request.getProjectId())));
apiDefinition.setRefId(apiDefinition.getId());
if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinition.setTags(JSON.toJSONString(request.getTags()));
apiDefinition.setTags(request.getTags());
}
apiDefinitionMapper.insertSelective(apiDefinition);
ApiDefinitionBlob apiDefinitionBlob = new ApiDefinitionBlob();
@ -222,7 +222,7 @@ public class ApiDefinitionService {
apiDefinition.setUpdateTime(System.currentTimeMillis());
apiDefinition.setVersionId(request.getVersionId());
if (CollectionUtils.isNotEmpty(request.getTags())) {
apiDefinition.setTags(JSON.toJSONString(request.getTags()));
apiDefinition.setTags(request.getTags());
}
apiDefinitionMapper.updateByPrimaryKeySelective(apiDefinition);
ApiDefinitionBlob apiDefinitionBlob = new ApiDefinitionBlob();
@ -529,12 +529,12 @@ public class ApiDefinitionService {
ApiDefinitionMapper definitionMapper = sqlSession.getMapper(ApiDefinitionMapper.class);
ids.forEach(id -> {
ApiDefinition apiDefinition = new ApiDefinition();
if (StringUtils.isNotBlank(collect.get(id).getTags())) {
LinkedHashSet<String> tags = new LinkedHashSet<>((JSON.parseArray(collect.get(id).getTags(), String.class)));
if (CollectionUtils.isNotEmpty(collect.get(id).getTags())) {
List<String> tags = collect.get(id).getTags();
tags.addAll(request.getTags());
apiDefinition.setTags(JSON.toJSONString(tags));
apiDefinition.setTags(tags);
} else {
apiDefinition.setTags(JSON.toJSONString(request.getTags()));
apiDefinition.setTags(request.getTags());
}
apiDefinition.setId(id);
apiDefinition.setUpdateTime(System.currentTimeMillis());
@ -547,7 +547,7 @@ public class ApiDefinitionService {
} else {
//替换标签
ApiDefinition apiDefinition = new ApiDefinition();
apiDefinition.setTags(JSON.toJSONString(request.getTags()));
apiDefinition.setTags(request.getTags());
apiDefinition.setProjectId(request.getProjectId());
apiDefinition.setUpdateTime(System.currentTimeMillis());
apiDefinition.setUpdateUser(userId);

View File

@ -9,11 +9,11 @@ import io.metersphere.api.dto.definition.ApiTestCaseLogDTO;
import io.metersphere.api.dto.definition.ApiTestCaseUpdateRequest;
import io.metersphere.api.mapper.ApiTestCaseBlobMapper;
import io.metersphere.api.mapper.ApiTestCaseMapper;
import io.metersphere.api.utils.ApiDataUtils;
import io.metersphere.plugin.api.spi.AbstractMsTestElement;
import io.metersphere.project.domain.Project;
import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.sdk.constants.HttpMethodConstants;
import io.metersphere.api.utils.ApiDataUtils;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.Translator;
@ -112,7 +112,7 @@ public class ApiTestCaseLogService {
OperationLogType.RECOVER.name(),
OperationLogModule.API_DEFINITION_CASE,
apiTestCase.getName());
dto.setHistory(true);
dto.setHistory(false);
dto.setPath("/api/case/recover/" + id);
dto.setMethod(HttpMethodConstants.GET.name());
dto.setOriginalValue(JSON.toJSONBytes(apiTestCase));
@ -231,7 +231,7 @@ public class ApiTestCaseLogService {
}
public void batchRecoverLog(List<ApiTestCase> apiTestCases, String operator, String projectId) {
saveBatchLog(projectId, apiTestCases, "/api/case/recover", operator, OperationLogType.RECOVER.name(), true);
saveBatchLog(projectId, apiTestCases, "/api/case/recover", operator, OperationLogType.RECOVER.name(), false);
}
private void saveBatchLog(String projectId, List<ApiTestCase> apiTestCases, String path, String operator, String operationType, boolean isHistory) {
@ -267,7 +267,7 @@ public class ApiTestCaseLogService {
.createUser(operator)
.originalValue(JSON.toJSONBytes(apiTestCaseDTO))
.build().getLogDTO();
dto.setHistory(isHistory);
dto.setHistory(isHistory);
logs.add(dto);
}
);

View File

@ -16,7 +16,10 @@ import io.metersphere.sdk.domain.Environment;
import io.metersphere.sdk.domain.EnvironmentExample;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.mapper.EnvironmentMapper;
import io.metersphere.sdk.util.*;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.FileAssociationSourceUtil;
import io.metersphere.sdk.util.SubListUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.dto.sdk.request.PosRequest;
import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.service.UserLoginService;
@ -36,7 +39,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -143,7 +145,7 @@ public class ApiTestCaseService {
testCase.setCreateTime(System.currentTimeMillis());
testCase.setUpdateTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(request.getTags())) {
testCase.setTags(JSON.toJSONString(request.getTags()));
testCase.setTags(request.getTags());
}
apiTestCaseMapper.insertSelective(testCase);
@ -159,6 +161,7 @@ public class ApiTestCaseService {
apiFileResourceService.addFileResource(resourceUpdateRequest);
return testCase;
}
private ApiTestCase checkResourceExist(String id) {
ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(id);
if (testCase == null) {
@ -172,8 +175,8 @@ public class ApiTestCaseService {
ApiTestCase testCase = checkResourceExist(id);
ApiTestCaseBlob testCaseBlob = apiTestCaseBlobMapper.selectByPrimaryKey(id);
BeanUtils.copyBean(apiTestCaseDTO, testCase);
if (StringUtils.isNotBlank(testCase.getTags())) {
apiTestCaseDTO.setTags(JSON.parseArray(testCase.getTags(), String.class));
if (CollectionUtils.isNotEmpty(testCase.getTags())) {
apiTestCaseDTO.setTags(testCase.getTags());
} else {
apiTestCaseDTO.setTags(new ArrayList<>());
}
@ -225,7 +228,7 @@ public class ApiTestCaseService {
testCase.setUpdateUser(userId);
testCase.setUpdateTime(System.currentTimeMillis());
if (CollectionUtils.isNotEmpty(request.getTags())) {
testCase.setTags(JSON.toJSONString(request.getTags()));
testCase.setTags(request.getTags());
} else {
testCase.setTags(null);
}
@ -432,7 +435,7 @@ public class ApiTestCaseService {
}
private void batchUpdateTags(ApiTestCaseExample example, ApiTestCase updateCase,
LinkedHashSet<String> tags, boolean appendTag,
List<String> tags, boolean appendTag,
SqlSession sqlSession, ApiTestCaseMapper mapper) {
if (CollectionUtils.isEmpty(tags)) {
throw new MSException(Translator.get("tags_is_null"));
@ -441,12 +444,12 @@ public class ApiTestCaseService {
List<ApiTestCase> caseList = apiTestCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(caseList)) {
caseList.forEach(apiTestCase -> {
if (StringUtils.isNotBlank(apiTestCase.getTags())) {
LinkedHashSet orgTags = ApiDataUtils.parseObject(apiTestCase.getTags(), LinkedHashSet.class);
if (CollectionUtils.isNotEmpty(apiTestCase.getTags())) {
List<String> orgTags = apiTestCase.getTags();
orgTags.addAll(tags);
apiTestCase.setTags(JSON.toJSONString(orgTags));
apiTestCase.setTags(orgTags);
} else {
apiTestCase.setTags(JSON.toJSONString(tags));
apiTestCase.setTags(tags);
}
mapper.updateByPrimaryKey(apiTestCase);
});
@ -456,7 +459,7 @@ public class ApiTestCaseService {
}
}
} else {
updateCase.setTags(JSON.toJSONString(tags));
updateCase.setTags(tags);
apiTestCaseMapper.updateByExampleSelective(updateCase, example);
}
}

View File

@ -73,7 +73,6 @@
<table tableName="api_debug"/>
<table tableName="api_debug_blob"/>
<table tableName="api_debug_module"/>
<table tableName="api_definition"/>
<table tableName="api_definition_blob"/>
<table tableName="api_definition_follower"/>
<table tableName="api_definition_mock"/>
@ -94,13 +93,19 @@
<table tableName="api_scenario_report_log"/>
<table tableName="api_scenario_report_structure"/>
<table tableName="api_sync_config"/>
<table tableName="api_test_case"/>
<table tableName="api_test_case_blob"/>
<table tableName="api_test_case_follower"/>
<table tableName="api_definition_mock"/>
<table tableName="api_definition_mock_config"/>
<table tableName="api_definition_custom_field"/>
<table tableName="api_definition_mock">
<columnOverride column="tags" javaType="java.util.List&lt;String&gt;" jdbcType="VARCHAR" typeHandler="io.metersphere.handler.ListTypeHandler" />
</table>
<table tableName="api_definition">
<columnOverride column="tags" javaType="java.util.List&lt;String&gt;" jdbcType="VARCHAR" typeHandler="io.metersphere.handler.ListTypeHandler" />
</table>
<table tableName="api_test_case">
<columnOverride column="tags" javaType="java.util.List&lt;String&gt;" jdbcType="VARCHAR" typeHandler="io.metersphere.handler.ListTypeHandler" />
</table>
</context>
</generatorConfiguration>

View File

@ -528,9 +528,9 @@ public class ApiDefinitionControllerTests extends BaseTest {
}
if (request.getTags() != null) {
if (request.isAppend()) {
Assertions.assertTrue(JSON.parseArray(item.getTags(), String.class).containsAll(request.getTags()));
Assertions.assertTrue(item.getTags().containsAll(request.getTags()));
} else {
Assertions.assertEquals(item.getTags(), JSON.toJSONString(request.getTags()));
Assertions.assertTrue(item.getTags().containsAll(request.getTags()));
}
}
});

View File

@ -372,8 +372,8 @@ public class ApiTestCaseControllerTests extends BaseTest {
// 校验数据是否正确
ApiTestCase testCase = apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId());
ApiTestCaseDTO copyApiDebugDTO = BeanUtils.copyBean(new ApiTestCaseDTO(), testCase);
if (StringUtils.isNotEmpty(testCase.getTags())) {
copyApiDebugDTO.setTags(JSON.parseArray(testCase.getTags(), String.class));
if (CollectionUtils.isNotEmpty(testCase.getTags())) {
copyApiDebugDTO.setTags(testCase.getTags());
} else {
copyApiDebugDTO.setTags(new ArrayList<>());
}
@ -679,7 +679,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
request.setAppendTag(false);
responsePost(BATCH_EDIT, request);
apiTestCaseMapper.selectByExample(example).forEach(apiTestCase -> {
Assertions.assertEquals(apiTestCase.getTags(), "[\"tag1\"]");
Assertions.assertEquals(apiTestCase.getTags(), List.of("tag1"));
});
//标签为空 报错
request.setTags(new LinkedHashSet<>());
@ -858,6 +858,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
request.setSelectAll(true);
request.setSelectIds(List.of(apiTestCase.getId()));
request.setExcludeIds(List.of(apiTestCase.getId()));
request.setApiDefinitionId("apiDefinitionId");
request.setModuleIds(List.of("case-moduleId"));
responsePost(BATCH_RECOVER, request);
ApiTestCaseExample example = new ApiTestCaseExample();
@ -873,7 +874,16 @@ public class ApiTestCaseControllerTests extends BaseTest {
checkLog(apiTestCase.getId(), OperationLogType.DELETE);
//校验权限
requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_RECOVER, BATCH_RECOVER, request);
this.batchMoveGc();
ApiTestCaseBatchRequest gcRequest = new ApiTestCaseBatchRequest();
gcRequest.setProjectId(DEFAULT_PROJECT_ID);
gcRequest.setSelectAll(true);
gcRequest.setExcludeIds(new ArrayList<>());
gcRequest.setApiDefinitionId("apiDefinitionId");
responsePost(BATCH_MOVE_GC, gcRequest);
ApiTestCaseExample example1 = new ApiTestCaseExample();
example1.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andApiDefinitionIdEqualTo("apiDefinitionId").andDeletedEqualTo(true);
List<ApiTestCase> caseList1 = apiTestCaseMapper.selectByExample(example1);
caseList1.forEach(apiTestCase -> Assertions.assertTrue(apiTestCase.getDeleted()));
}
@ -916,7 +926,6 @@ public class ApiTestCaseControllerTests extends BaseTest {
responsePost(BATCH_DELETE, request);
request.setProjectId(DEFAULT_PROJECT_ID);
request.setSelectAll(true);
request.setModuleIds(List.of("case-moduleId"));
request.setApiDefinitionId("apiDefinitionId");
responsePost(BATCH_DELETE, request);
ApiTestCaseExample example = new ApiTestCaseExample();