build: rebuild system test_resource_pool

This commit is contained in:
guoyuqi 2023-06-15 18:59:01 +08:00 committed by 刘瑞斌
parent 22ab84a615
commit 48dc33212f
23 changed files with 676 additions and 1166 deletions

View File

@ -1,42 +0,0 @@
package io.metersphere.system.domain;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestResource implements Serializable {
@Schema(title = "资源节点ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_resource.id.not_blank}", groups = {Created.class, Updated.class})
@Size(min = 1, max = 50, message = "{test_resource.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_resource.test_resource_pool_id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{test_resource.test_resource_pool_id.length_range}", groups = {Created.class, Updated.class})
private String testResourcePoolId;
@Schema(title = "创建时间")
private Long createTime;
@Schema(title = "更新时间")
private Long updateTime;
@Schema(title = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_resource.enable.not_blank}", groups = {Updated.class})
private Boolean enable;
@Schema(title = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_resource.deleted.not_blank}", groups = {Created.class})
private Boolean deleted;
@Schema(title = "资源节点配置")
private byte[] configuration;
private static final long serialVersionUID = 1L;
}

View File

@ -1,580 +0,0 @@
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class TestResourceExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TestResourceExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIsNull() {
addCriterion("test_resource_pool_id is null");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIsNotNull() {
addCriterion("test_resource_pool_id is not null");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdEqualTo(String value) {
addCriterion("test_resource_pool_id =", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotEqualTo(String value) {
addCriterion("test_resource_pool_id <>", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdGreaterThan(String value) {
addCriterion("test_resource_pool_id >", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdGreaterThanOrEqualTo(String value) {
addCriterion("test_resource_pool_id >=", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLessThan(String value) {
addCriterion("test_resource_pool_id <", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLessThanOrEqualTo(String value) {
addCriterion("test_resource_pool_id <=", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdLike(String value) {
addCriterion("test_resource_pool_id like", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotLike(String value) {
addCriterion("test_resource_pool_id not like", value, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdIn(List<String> values) {
addCriterion("test_resource_pool_id in", values, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotIn(List<String> values) {
addCriterion("test_resource_pool_id not in", values, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdBetween(String value1, String value2) {
addCriterion("test_resource_pool_id between", value1, value2, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andTestResourcePoolIdNotBetween(String value1, String value2) {
addCriterion("test_resource_pool_id not between", value1, value2, "testResourcePoolId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Long value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Long value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Long value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Long value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Long> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Long> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Long value1, Long value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Long value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Long value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Long value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Long value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Long> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Long> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andEnableIsNull() {
addCriterion("`enable` is null");
return (Criteria) this;
}
public Criteria andEnableIsNotNull() {
addCriterion("`enable` is not null");
return (Criteria) this;
}
public Criteria andEnableEqualTo(Boolean value) {
addCriterion("`enable` =", value, "enable");
return (Criteria) this;
}
public Criteria andEnableNotEqualTo(Boolean value) {
addCriterion("`enable` <>", value, "enable");
return (Criteria) this;
}
public Criteria andEnableGreaterThan(Boolean value) {
addCriterion("`enable` >", value, "enable");
return (Criteria) this;
}
public Criteria andEnableGreaterThanOrEqualTo(Boolean value) {
addCriterion("`enable` >=", value, "enable");
return (Criteria) this;
}
public Criteria andEnableLessThan(Boolean value) {
addCriterion("`enable` <", value, "enable");
return (Criteria) this;
}
public Criteria andEnableLessThanOrEqualTo(Boolean value) {
addCriterion("`enable` <=", value, "enable");
return (Criteria) this;
}
public Criteria andEnableIn(List<Boolean> values) {
addCriterion("`enable` in", values, "enable");
return (Criteria) this;
}
public Criteria andEnableNotIn(List<Boolean> values) {
addCriterion("`enable` not in", values, "enable");
return (Criteria) this;
}
public Criteria andEnableBetween(Boolean value1, Boolean value2) {
addCriterion("`enable` between", value1, value2, "enable");
return (Criteria) this;
}
public Criteria andEnableNotBetween(Boolean value1, Boolean value2) {
addCriterion("`enable` not between", value1, value2, "enable");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;
}
public Criteria andDeletedIsNotNull() {
addCriterion("deleted is not null");
return (Criteria) this;
}
public Criteria andDeletedEqualTo(Boolean value) {
addCriterion("deleted =", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotEqualTo(Boolean value) {
addCriterion("deleted <>", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThan(Boolean value) {
addCriterion("deleted >", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) {
addCriterion("deleted >=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThan(Boolean value) {
addCriterion("deleted <", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedLessThanOrEqualTo(Boolean value) {
addCriterion("deleted <=", value, "deleted");
return (Criteria) this;
}
public Criteria andDeletedIn(List<Boolean> values) {
addCriterion("deleted in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotIn(List<Boolean> values) {
addCriterion("deleted not in", values, "deleted");
return (Criteria) this;
}
public Criteria andDeletedBetween(Boolean value1, Boolean value2) {
addCriterion("deleted between", value1, value2, "deleted");
return (Criteria) this;
}
public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) {
addCriterion("deleted not between", value1, value2, "deleted");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -1,36 +1,32 @@
package io.metersphere.system.domain;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestResourcePool implements Serializable {
@Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_resource_pool.id.not_blank}", groups = {Created.class, Updated.class})
@NotBlank(message = "{test_resource_pool.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{test_resource_pool.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_resource_pool.name.not_blank}", groups = {Updated.class})
@NotBlank(message = "{test_resource_pool.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{test_resource_pool.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(title = "类型", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_resource_pool.type.not_blank}", groups = {Updated.class})
@NotBlank(message = "{test_resource_pool.type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 30, message = "{test_resource_pool.type.length_range}", groups = {Created.class, Updated.class})
private String type;
@Schema(title = "描述")
private String description;
@Schema(title = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_resource_pool.enable.not_blank}", groups = {Updated.class})
@Schema(title = "是否启用")
private Boolean enable;
@Schema(title = "创建时间")
@ -39,12 +35,6 @@ public class TestResourcePool implements Serializable {
@Schema(title = "更新时间")
private Long updateTime;
@Schema(title = "性能测试镜像")
private String loadTestImage;
@Schema(title = "性能测试jvm配置")
private String loadTestHeap;
@Schema(title = "创建人")
private String createUser;
@ -57,9 +47,6 @@ public class TestResourcePool implements Serializable {
@Schema(title = "是否用于ui测试")
private Boolean uiTest;
@Schema(title = "ui测试grid配置")
private String grid;
@Schema(title = "ms部署地址")
private String serverUrl;

View File

@ -0,0 +1,20 @@
package io.metersphere.system.domain;
import io.metersphere.validation.groups.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import java.io.Serializable;
import lombok.Data;
@Data
public class TestResourcePoolBlob implements Serializable {
@Schema(title = "id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_resource_pool_blob.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{test_resource_pool_blob.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "资源节点配置")
private byte[] configuration;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,270 @@
package io.metersphere.system.domain;
import java.util.ArrayList;
import java.util.List;
public class TestResourcePoolBlobExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TestResourcePoolBlobExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -564,146 +564,6 @@ public class TestResourcePoolExample {
return (Criteria) this;
}
public Criteria andLoadTestImageIsNull() {
addCriterion("load_test_image is null");
return (Criteria) this;
}
public Criteria andLoadTestImageIsNotNull() {
addCriterion("load_test_image is not null");
return (Criteria) this;
}
public Criteria andLoadTestImageEqualTo(String value) {
addCriterion("load_test_image =", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageNotEqualTo(String value) {
addCriterion("load_test_image <>", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageGreaterThan(String value) {
addCriterion("load_test_image >", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageGreaterThanOrEqualTo(String value) {
addCriterion("load_test_image >=", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageLessThan(String value) {
addCriterion("load_test_image <", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageLessThanOrEqualTo(String value) {
addCriterion("load_test_image <=", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageLike(String value) {
addCriterion("load_test_image like", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageNotLike(String value) {
addCriterion("load_test_image not like", value, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageIn(List<String> values) {
addCriterion("load_test_image in", values, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageNotIn(List<String> values) {
addCriterion("load_test_image not in", values, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageBetween(String value1, String value2) {
addCriterion("load_test_image between", value1, value2, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestImageNotBetween(String value1, String value2) {
addCriterion("load_test_image not between", value1, value2, "loadTestImage");
return (Criteria) this;
}
public Criteria andLoadTestHeapIsNull() {
addCriterion("load_test_heap is null");
return (Criteria) this;
}
public Criteria andLoadTestHeapIsNotNull() {
addCriterion("load_test_heap is not null");
return (Criteria) this;
}
public Criteria andLoadTestHeapEqualTo(String value) {
addCriterion("load_test_heap =", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapNotEqualTo(String value) {
addCriterion("load_test_heap <>", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapGreaterThan(String value) {
addCriterion("load_test_heap >", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapGreaterThanOrEqualTo(String value) {
addCriterion("load_test_heap >=", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapLessThan(String value) {
addCriterion("load_test_heap <", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapLessThanOrEqualTo(String value) {
addCriterion("load_test_heap <=", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapLike(String value) {
addCriterion("load_test_heap like", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapNotLike(String value) {
addCriterion("load_test_heap not like", value, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapIn(List<String> values) {
addCriterion("load_test_heap in", values, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapNotIn(List<String> values) {
addCriterion("load_test_heap not in", values, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapBetween(String value1, String value2) {
addCriterion("load_test_heap between", value1, value2, "loadTestHeap");
return (Criteria) this;
}
public Criteria andLoadTestHeapNotBetween(String value1, String value2) {
addCriterion("load_test_heap not between", value1, value2, "loadTestHeap");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
@ -954,76 +814,6 @@ public class TestResourcePoolExample {
return (Criteria) this;
}
public Criteria andGridIsNull() {
addCriterion("grid is null");
return (Criteria) this;
}
public Criteria andGridIsNotNull() {
addCriterion("grid is not null");
return (Criteria) this;
}
public Criteria andGridEqualTo(String value) {
addCriterion("grid =", value, "grid");
return (Criteria) this;
}
public Criteria andGridNotEqualTo(String value) {
addCriterion("grid <>", value, "grid");
return (Criteria) this;
}
public Criteria andGridGreaterThan(String value) {
addCriterion("grid >", value, "grid");
return (Criteria) this;
}
public Criteria andGridGreaterThanOrEqualTo(String value) {
addCriterion("grid >=", value, "grid");
return (Criteria) this;
}
public Criteria andGridLessThan(String value) {
addCriterion("grid <", value, "grid");
return (Criteria) this;
}
public Criteria andGridLessThanOrEqualTo(String value) {
addCriterion("grid <=", value, "grid");
return (Criteria) this;
}
public Criteria andGridLike(String value) {
addCriterion("grid like", value, "grid");
return (Criteria) this;
}
public Criteria andGridNotLike(String value) {
addCriterion("grid not like", value, "grid");
return (Criteria) this;
}
public Criteria andGridIn(List<String> values) {
addCriterion("grid in", values, "grid");
return (Criteria) this;
}
public Criteria andGridNotIn(List<String> values) {
addCriterion("grid not in", values, "grid");
return (Criteria) this;
}
public Criteria andGridBetween(String value1, String value2) {
addCriterion("grid between", value1, value2, "grid");
return (Criteria) this;
}
public Criteria andGridNotBetween(String value1, String value2) {
addCriterion("grid not between", value1, value2, "grid");
return (Criteria) this;
}
public Criteria andServerUrlIsNull() {
addCriterion("server_url is null");
return (Criteria) this;

View File

@ -1,36 +0,0 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.TestResource;
import io.metersphere.system.domain.TestResourceExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestResourceMapper {
long countByExample(TestResourceExample example);
int deleteByExample(TestResourceExample example);
int deleteByPrimaryKey(String id);
int insert(TestResource record);
int insertSelective(TestResource record);
List<TestResource> selectByExampleWithBLOBs(TestResourceExample example);
List<TestResource> selectByExample(TestResourceExample example);
TestResource selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestResource record, @Param("example") TestResourceExample example);
int updateByExampleWithBLOBs(@Param("record") TestResource record, @Param("example") TestResourceExample example);
int updateByExample(@Param("record") TestResource record, @Param("example") TestResourceExample example);
int updateByPrimaryKeySelective(TestResource record);
int updateByPrimaryKeyWithBLOBs(TestResource record);
int updateByPrimaryKey(TestResource record);
}

View File

@ -0,0 +1,34 @@
package io.metersphere.system.mapper;
import io.metersphere.system.domain.TestResourcePoolBlob;
import io.metersphere.system.domain.TestResourcePoolBlobExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestResourcePoolBlobMapper {
long countByExample(TestResourcePoolBlobExample example);
int deleteByExample(TestResourcePoolBlobExample example);
int deleteByPrimaryKey(String id);
int insert(TestResourcePoolBlob record);
int insertSelective(TestResourcePoolBlob record);
List<TestResourcePoolBlob> selectByExampleWithBLOBs(TestResourcePoolBlobExample example);
List<TestResourcePoolBlob> selectByExample(TestResourcePoolBlobExample example);
TestResourcePoolBlob selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestResourcePoolBlob record, @Param("example") TestResourcePoolBlobExample example);
int updateByExampleWithBLOBs(@Param("record") TestResourcePoolBlob record, @Param("example") TestResourcePoolBlobExample example);
int updateByExample(@Param("record") TestResourcePoolBlob record, @Param("example") TestResourcePoolBlobExample example);
int updateByPrimaryKeySelective(TestResourcePoolBlob record);
int updateByPrimaryKeyWithBLOBs(TestResourcePoolBlob record);
}

View File

@ -1,15 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.system.mapper.TestResourceMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.TestResource">
<mapper namespace="io.metersphere.system.mapper.TestResourcePoolBlobMapper">
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.TestResourcePoolBlob">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_resource_pool_id" jdbcType="VARCHAR" property="testResourcePoolId" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="enable" jdbcType="BIT" property="enable" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.TestResource">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.TestResourcePoolBlob">
<result column="configuration" jdbcType="LONGVARBINARY" property="configuration" />
</resultMap>
<sql id="Example_Where_Clause">
@ -71,12 +66,12 @@
</where>
</sql>
<sql id="Base_Column_List">
id, test_resource_pool_id, create_time, update_time, `enable`, deleted
id
</sql>
<sql id="Blob_Column_List">
configuration
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.system.domain.TestResourceExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.system.domain.TestResourcePoolBlobExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
@ -84,7 +79,7 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from test_resource
from test_resource_pool_blob
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -92,13 +87,13 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.system.domain.TestResourceExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.system.domain.TestResourcePoolBlobExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from test_resource
from test_resource_pool_blob
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -111,48 +106,29 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from test_resource
from test_resource_pool_blob
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from test_resource
delete from test_resource_pool_blob
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.TestResourceExample">
delete from test_resource
<delete id="deleteByExample" parameterType="io.metersphere.system.domain.TestResourcePoolBlobExample">
delete from test_resource_pool_blob
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.system.domain.TestResource">
insert into test_resource (id, test_resource_pool_id, create_time,
update_time, `enable`, deleted,
configuration)
values (#{id,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{enable,jdbcType=BIT}, #{deleted,jdbcType=BIT},
#{configuration,jdbcType=LONGVARBINARY})
<insert id="insert" parameterType="io.metersphere.system.domain.TestResourcePoolBlob">
insert into test_resource_pool_blob (id, configuration)
values (#{id,jdbcType=VARCHAR}, #{configuration,jdbcType=LONGVARBINARY})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.TestResource">
insert into test_resource
<insert id="insertSelective" parameterType="io.metersphere.system.domain.TestResourcePoolBlob">
insert into test_resource_pool_blob
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="testResourcePoolId != null">
test_resource_pool_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="enable != null">
`enable`,
</if>
<if test="deleted != null">
deleted,
</if>
<if test="configuration != null">
configuration,
</if>
@ -161,53 +137,23 @@
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="testResourcePoolId != null">
#{testResourcePoolId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="enable != null">
#{enable,jdbcType=BIT},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
<if test="configuration != null">
#{configuration,jdbcType=LONGVARBINARY},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.system.domain.TestResourceExample" resultType="java.lang.Long">
select count(*) from test_resource
<select id="countByExample" parameterType="io.metersphere.system.domain.TestResourcePoolBlobExample" resultType="java.lang.Long">
select count(*) from test_resource_pool_blob
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_resource
update test_resource_pool_blob
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.testResourcePoolId != null">
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.enable != null">
`enable` = #{record.enable,jdbcType=BIT},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
<if test="record.configuration != null">
configuration = #{record.configuration,jdbcType=LONGVARBINARY},
</if>
@ -217,71 +163,32 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update test_resource
update test_resource_pool_blob
set id = #{record.id,jdbcType=VARCHAR},
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
`enable` = #{record.enable,jdbcType=BIT},
deleted = #{record.deleted,jdbcType=BIT},
configuration = #{record.configuration,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_resource
set id = #{record.id,jdbcType=VARCHAR},
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
`enable` = #{record.enable,jdbcType=BIT},
deleted = #{record.deleted,jdbcType=BIT}
update test_resource_pool_blob
set id = #{record.id,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.TestResource">
update test_resource
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.system.domain.TestResourcePoolBlob">
update test_resource_pool_blob
<set>
<if test="testResourcePoolId != null">
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="enable != null">
`enable` = #{enable,jdbcType=BIT},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
<if test="configuration != null">
configuration = #{configuration,jdbcType=LONGVARBINARY},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.TestResource">
update test_resource
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
`enable` = #{enable,jdbcType=BIT},
deleted = #{deleted,jdbcType=BIT},
configuration = #{configuration,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.TestResource">
update test_resource
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
`enable` = #{enable,jdbcType=BIT},
deleted = #{deleted,jdbcType=BIT}
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.TestResourcePoolBlob">
update test_resource_pool_blob
set configuration = #{configuration,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -9,13 +9,10 @@
<result column="enable" jdbcType="BIT" property="enable" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="load_test_image" jdbcType="VARCHAR" property="loadTestImage" />
<result column="load_test_heap" jdbcType="VARCHAR" property="loadTestHeap" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="api_test" jdbcType="BIT" property="apiTest" />
<result column="load_test" jdbcType="BIT" property="loadTest" />
<result column="ui_test" jdbcType="BIT" property="uiTest" />
<result column="grid" jdbcType="VARCHAR" property="grid" />
<result column="server_url" jdbcType="VARCHAR" property="serverUrl" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
@ -78,8 +75,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, `type`, description, `enable`, create_time, update_time, load_test_image,
load_test_heap, create_user, api_test, load_test, ui_test, grid, server_url, deleted
id, `name`, `type`, description, `enable`, create_time, update_time, create_user,
api_test, load_test, ui_test, server_url, deleted
</sql>
<select id="selectByExample" parameterType="io.metersphere.system.domain.TestResourcePoolExample" resultMap="BaseResultMap">
select
@ -114,15 +111,13 @@
<insert id="insert" parameterType="io.metersphere.system.domain.TestResourcePool">
insert into test_resource_pool (id, `name`, `type`,
description, `enable`, create_time,
update_time, load_test_image, load_test_heap,
create_user, api_test, load_test,
ui_test, grid, server_url,
update_time, create_user, api_test,
load_test, ui_test, server_url,
deleted)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{enable,jdbcType=BIT}, #{createTime,jdbcType=BIGINT},
#{updateTime,jdbcType=BIGINT}, #{loadTestImage,jdbcType=VARCHAR}, #{loadTestHeap,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{apiTest,jdbcType=BIT}, #{loadTest,jdbcType=BIT},
#{uiTest,jdbcType=BIT}, #{grid,jdbcType=VARCHAR}, #{serverUrl,jdbcType=VARCHAR},
#{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{apiTest,jdbcType=BIT},
#{loadTest,jdbcType=BIT}, #{uiTest,jdbcType=BIT}, #{serverUrl,jdbcType=VARCHAR},
#{deleted,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.system.domain.TestResourcePool">
@ -149,12 +144,6 @@
<if test="updateTime != null">
update_time,
</if>
<if test="loadTestImage != null">
load_test_image,
</if>
<if test="loadTestHeap != null">
load_test_heap,
</if>
<if test="createUser != null">
create_user,
</if>
@ -167,9 +156,6 @@
<if test="uiTest != null">
ui_test,
</if>
<if test="grid != null">
grid,
</if>
<if test="serverUrl != null">
server_url,
</if>
@ -199,12 +185,6 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="loadTestImage != null">
#{loadTestImage,jdbcType=VARCHAR},
</if>
<if test="loadTestHeap != null">
#{loadTestHeap,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
@ -217,9 +197,6 @@
<if test="uiTest != null">
#{uiTest,jdbcType=BIT},
</if>
<if test="grid != null">
#{grid,jdbcType=VARCHAR},
</if>
<if test="serverUrl != null">
#{serverUrl,jdbcType=VARCHAR},
</if>
@ -258,12 +235,6 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.loadTestImage != null">
load_test_image = #{record.loadTestImage,jdbcType=VARCHAR},
</if>
<if test="record.loadTestHeap != null">
load_test_heap = #{record.loadTestHeap,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
@ -276,9 +247,6 @@
<if test="record.uiTest != null">
ui_test = #{record.uiTest,jdbcType=BIT},
</if>
<if test="record.grid != null">
grid = #{record.grid,jdbcType=VARCHAR},
</if>
<if test="record.serverUrl != null">
server_url = #{record.serverUrl,jdbcType=VARCHAR},
</if>
@ -299,13 +267,10 @@
`enable` = #{record.enable,jdbcType=BIT},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
load_test_image = #{record.loadTestImage,jdbcType=VARCHAR},
load_test_heap = #{record.loadTestHeap,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
api_test = #{record.apiTest,jdbcType=BIT},
load_test = #{record.loadTest,jdbcType=BIT},
ui_test = #{record.uiTest,jdbcType=BIT},
grid = #{record.grid,jdbcType=VARCHAR},
server_url = #{record.serverUrl,jdbcType=VARCHAR},
deleted = #{record.deleted,jdbcType=BIT}
<if test="_parameter != null">
@ -333,12 +298,6 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="loadTestImage != null">
load_test_image = #{loadTestImage,jdbcType=VARCHAR},
</if>
<if test="loadTestHeap != null">
load_test_heap = #{loadTestHeap,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
@ -351,9 +310,6 @@
<if test="uiTest != null">
ui_test = #{uiTest,jdbcType=BIT},
</if>
<if test="grid != null">
grid = #{grid,jdbcType=VARCHAR},
</if>
<if test="serverUrl != null">
server_url = #{serverUrl,jdbcType=VARCHAR},
</if>
@ -371,13 +327,10 @@
`enable` = #{enable,jdbcType=BIT},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
load_test_image = #{loadTestImage,jdbcType=VARCHAR},
load_test_heap = #{loadTestHeap,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
api_test = #{apiTest,jdbcType=BIT},
load_test = #{loadTest,jdbcType=BIT},
ui_test = #{uiTest,jdbcType=BIT},
grid = #{grid,jdbcType=VARCHAR},
server_url = #{serverUrl,jdbcType=VARCHAR},
deleted = #{deleted,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}

View File

@ -243,27 +243,15 @@ CREATE TABLE IF NOT EXISTS system_parameter
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '系统参数';
CREATE TABLE IF NOT EXISTS test_resource(
`id` VARCHAR(50) NOT NULL COMMENT '资源节点ID' ,
`test_resource_pool_id` VARCHAR(50) NOT NULL COMMENT '资源池ID' ,
`configuration` BLOB COMMENT '资源节点配置' ,
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
`enable` BIT NOT NULL DEFAULT 1 COMMENT '是否启用' ,
`deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否删除' ,
PRIMARY KEY (id)
CREATE TABLE test_resource_pool_blob(
`id` VARCHAR(50) NOT NULL COMMENT 'id' ,
`configuration` LONGBLOB COMMENT '资源节点配置' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '测试资源池节点';
COLLATE = utf8mb4_general_ci COMMENT = '测试资源池大字段';
CREATE INDEX idx_resource_pool_id ON test_resource(`test_resource_pool_id`);
CREATE INDEX idx_deleted ON test_resource(`deleted`);
CREATE INDEX idx_create_time ON test_resource(`create_time`);
CREATE INDEX idx_enable ON test_resource(`enable`);
CREATE INDEX idx_update_time ON test_resource(`update_time`);
CREATE TABLE IF NOT EXISTS test_resource_pool(
CREATE TABLE test_resource_pool(
`id` VARCHAR(50) NOT NULL COMMENT '资源池ID' ,
`name` VARCHAR(255) NOT NULL COMMENT '名称' ,
`type` VARCHAR(30) NOT NULL COMMENT '类型' ,
@ -271,13 +259,10 @@ CREATE TABLE IF NOT EXISTS test_resource_pool(
`enable` BIT NOT NULL DEFAULT 1 COMMENT '是否启用' ,
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
`load_test_image` VARCHAR(100) COMMENT '性能测试镜像' ,
`load_test_heap` VARCHAR(200) COMMENT '性能测试jvm配置' ,
`create_user` VARCHAR(50) COMMENT '创建人' ,
`api_test` BIT COMMENT '是否用于接口测试' ,
`load_test` BIT COMMENT '是否用于性能测试' ,
`ui_test` BIT COMMENT '是否用于ui测试' ,
`grid` VARCHAR(255) COMMENT 'ui测试grid配置' ,
`server_url` VARCHAR(255) COMMENT 'ms部署地址' ,
`deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否删除' ,
PRIMARY KEY (id)

View File

@ -15,7 +15,7 @@ public class SystemInterceptor {
public List<MybatisInterceptorConfig> systemCompressConfigs() {
List<MybatisInterceptorConfig> configList = new ArrayList<>();
configList.add(new MybatisInterceptorConfig(TestResource.class, "configuration", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(TestResourcePoolBlob.class, "configuration", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(AuthSource.class, "configuration", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(NoviceStatistics.class, "dataOption", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(PluginBlob.class, "formOption", CompressUtils.class, "zip", "unzip"));

View File

@ -14,6 +14,7 @@ import io.metersphere.system.request.QueryResourcePoolRequest;
import io.metersphere.system.service.TestResourcePoolService;
import jakarta.annotation.Resource;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -29,7 +30,7 @@ public class TestResourcePoolController {
@PostMapping("/add")
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_RESOURCE_POOL_READ_ADD)
@RequestLog(type = OperationLogType.ADD, module = OperationLogModule.SYSTEM_TEST_RESOURCE_POOL, details = "#poolDTO.name")
public TestResourcePoolDTO addTestResourcePool(@RequestBody TestResourcePoolDTO poolDTO) {
public TestResourcePoolDTO addTestResourcePool(@Validated @RequestBody TestResourcePoolDTO poolDTO) {
return testResourcePoolService.addTestResourcePool(poolDTO);
}
@ -47,13 +48,13 @@ public class TestResourcePoolController {
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_RESOURCE_POOL_READ_UPDATE)
@RequestLog(type = OperationLogType.UPDATE, module = OperationLogModule.SYSTEM_TEST_RESOURCE_POOL,
sourceId = "#testResourcePoolDTO.id", details = "#testResourcePoolDTO.name")
public void updateTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
public void updateTestResourcePool(@Validated @RequestBody TestResourcePoolDTO testResourcePoolDTO) {
testResourcePoolService.updateTestResourcePool(testResourcePoolDTO);
}
@PostMapping("/page")
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_RESOURCE_POOL_READ)
public Pager<List<TestResourcePoolDTO>> listResourcePools(@RequestBody QueryResourcePoolRequest request) {
public Pager<List<TestResourcePoolDTO>> listResourcePools(@Validated @RequestBody QueryResourcePoolRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), true);
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
}

View File

@ -0,0 +1,77 @@
package io.metersphere.system.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
*用来解析TestResourceBlob的结构
*/
@Getter
@Setter
public class TestResourceDTO {
/**
* type为 node时, 性能测试的镜像
*/
private String loadTestImage;
/**
* type为 node时, 性能测试jvm配置
*/
private String loadTestHeap;
/**
* type为 node时, 接口测试 性能测试 node 节点配置
*/
private List<TestResourceNodeDTO> nodesList;
/**
* type为 k8s 接口测试性能测试的ip
*/
private String ip;
/**
* type为 k8s 接口测试性能测试的token
*/
private String token;
/**
* type为 k8s 接口测试性能测试的命名空间
*/
private String namespaces;
/**
* type为 k8s 接口测试性能测试UI测试的最大并发数
*/
private Integer concurrentNumber;
/**
* type为 k8s 接口测试性能测试的单pod 最大线程数
*/
private Integer podThreads;
/**
* type为 k8s 性能测试自定义JOB模版 string
*/
private String jobDefinition;
/**
* type为 k8s 接口测试镜像
*/
private String apiTestImage;
/**
* type为 k8s 接口测试deployName
*/
private String deployName;
/**
* UI测试的grid配置
*/
private String uiGrid;
}

View File

@ -0,0 +1,30 @@
package io.metersphere.system.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TestResourceNodeDTO {
/**
* 接口测试 性能测试 node节点ip
*/
private String ip;
/**
* 接口测试 性能测试 node节点端口
*/
private String port;
/**
* 性能测试 node节点监控器
*/
private String monitor;
/**
* 接口测试 性能测试 最大并发数
*/
private Integer concurrentNumber;
}

View File

@ -1,15 +1,14 @@
package io.metersphere.system.dto;
import io.metersphere.system.domain.TestResource;
import io.metersphere.system.domain.TestResourcePool;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class TestResourcePoolDTO extends TestResourcePool {
private List<TestResource> testResources;
private String configuration;
}

View File

@ -1,9 +1,9 @@
package io.metersphere.system.service;
import io.metersphere.system.dto.TestResourcePoolDTO;
import io.metersphere.system.dto.TestResourceDTO;
public interface KubernetesResourcePoolService {
boolean validate(TestResourcePoolDTO testResourcePool);
boolean validate(TestResourceDTO testResourceDT);
}

View File

@ -0,0 +1,9 @@
package io.metersphere.system.service;
import io.metersphere.system.dto.TestResourceDTO;
public interface LoadResourceService {
boolean validate(TestResourceDTO testResourceDTO, String type);
}

View File

@ -1,10 +1,6 @@
package io.metersphere.system.service;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.dto.TestResourcePoolDTO;
import org.apache.commons.collections4.CollectionUtils;
import io.metersphere.system.dto.TestResourceDTO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -13,10 +9,11 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional(rollbackFor = Exception.class)
public class NodeResourcePoolService {
public boolean validate(TestResourcePoolDTO testResourcePool) {
if (CollectionUtils.isEmpty(testResourcePool.getTestResources())) {
throw new MSException(Translator.get("no_nodes_message"));
}
public boolean validate(TestResourceDTO testResourceDTO) {
/*TestResourcePoolBlob testResourcePoolBlob = testResourcePool.getConfiguration();
if (testResourcePoolBlob == null || testResourcePoolBlob.getConfiguration()==null){
throw new MSException(Translator.get("no_nodes_message"));
}*/
//校验节点
return true;
}

View File

@ -3,15 +3,16 @@ package io.metersphere.system.service;
import groovy.util.logging.Slf4j;
import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.CommonBeanFactory;
import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.TestResource;
import io.metersphere.system.domain.TestResourceExample;
import io.metersphere.system.domain.TestResourcePool;
import io.metersphere.system.domain.TestResourcePoolBlob;
import io.metersphere.system.domain.TestResourcePoolExample;
import io.metersphere.system.dto.ResourcePoolTypeEnum;
import io.metersphere.system.dto.TestResourceDTO;
import io.metersphere.system.dto.TestResourcePoolDTO;
import io.metersphere.system.mapper.TestResourceMapper;
import io.metersphere.system.mapper.TestResourcePoolBlobMapper;
import io.metersphere.system.mapper.TestResourcePoolMapper;
import io.metersphere.system.request.QueryResourcePoolRequest;
import jakarta.annotation.Resource;
@ -32,23 +33,78 @@ public class TestResourcePoolService {
@Resource
private TestResourcePoolMapper testResourcePoolMapper;
@Resource
private TestResourceMapper testResourceMapper;
private TestResourcePoolBlobMapper testResourcePoolBlobMapper;
public TestResourcePoolDTO addTestResourcePool(TestResourcePoolDTO testResourcePoolDTO) {
String id = UUID.randomUUID().toString();
checkTestResourcePool(testResourcePoolDTO);
testResourcePoolDTO.setId(UUID.randomUUID().toString());
buildTestPoolBaseInfo(testResourcePoolDTO, id);
TestResourcePoolBlob testResourcePoolBlob = new TestResourcePoolBlob();
testResourcePoolBlob.setId(id);
String configuration = testResourcePoolDTO.getConfiguration();
TestResourceDTO testResourceDTO = JSON.parseObject(configuration, TestResourceDTO.class);
checkApiConfig(testResourceDTO, testResourcePoolDTO.getApiTest(), testResourcePoolDTO.getType());
checkLoadConfig(testResourceDTO, testResourcePoolDTO.getLoadTest(), testResourcePoolDTO.getType());
checkUiConfig(testResourceDTO, testResourcePoolDTO.getUiTest());
testResourcePoolBlob.setConfiguration(configuration.getBytes());
testResourcePoolMapper.insertSelective(testResourcePoolDTO);
testResourcePoolBlobMapper.insertSelective(testResourcePoolBlob);
return testResourcePoolDTO;
}
private static void buildTestPoolBaseInfo(TestResourcePoolDTO testResourcePoolDTO, String id) {
testResourcePoolDTO.setId(id);
testResourcePoolDTO.setCreateTime(System.currentTimeMillis());
testResourcePoolDTO.setUpdateTime(System.currentTimeMillis());
testResourcePoolDTO.setEnable(true);
testResourcePoolDTO.setDeleted(false);
if (testResourcePoolDTO.getUiTest() != null && testResourcePoolDTO.getUiTest() && StringUtils.isBlank(testResourcePoolDTO.getGrid())) {
throw new MSException("Please add ui grid");
}
private boolean checkLoadConfig(TestResourceDTO testResourceDTO, Boolean loadTest, String type) {
if (!loadTest) {
return true;
}
LoadResourceService resourcePoolService = CommonBeanFactory.getBean(LoadResourceService.class);
if (resourcePoolService == null) {
return false;
}
return resourcePoolService.validate(testResourceDTO,type);
}
private boolean checkUiConfig(TestResourceDTO testResourceDTO, Boolean uiTest) {
if (!uiTest) {
return true;
}
UiResourceService resourcePoolService = CommonBeanFactory.getBean(UiResourceService.class);
if (resourcePoolService == null) {
return false;
}
return resourcePoolService.validate(testResourceDTO);
}
private boolean checkApiConfig(TestResourceDTO testResourceDTO, Boolean apiTest, String type) {
if (!apiTest) {
return false;
}
if (StringUtils.equalsIgnoreCase(type,ResourcePoolTypeEnum.NODE.name())) {
NodeResourcePoolService resourcePoolService = CommonBeanFactory.getBean(NodeResourcePoolService.class);
return resourcePoolService.validate(testResourceDTO);
} else {
KubernetesResourcePoolService resourcePoolService = CommonBeanFactory.getBean(KubernetesResourcePoolService.class);
if (resourcePoolService == null) {
return false;
}
return resourcePoolService.validate(testResourceDTO);
}
validateTestResourcePool(testResourcePoolDTO);
testResourcePoolMapper.insertSelective(testResourcePoolDTO);
return testResourcePoolDTO;
}
public void deleteTestResourcePool(String testResourcePoolId) {
@ -64,8 +120,13 @@ public class TestResourcePoolService {
public void updateTestResourcePool(TestResourcePoolDTO testResourcePoolDTO) {
checkTestResourcePool(testResourcePoolDTO);
testResourcePoolDTO.setCreateUser(null);
testResourcePoolDTO.setUpdateTime(System.currentTimeMillis());
validateTestResourcePool(testResourcePoolDTO);
String configuration = testResourcePoolDTO.getConfiguration();
TestResourceDTO testResourceDTO = JSON.parseObject(configuration, TestResourceDTO.class);
checkApiConfig(testResourceDTO, testResourcePoolDTO.getApiTest(), testResourcePoolDTO.getType());
checkLoadConfig(testResourceDTO, testResourcePoolDTO.getLoadTest(), testResourcePoolDTO.getType());
checkUiConfig(testResourceDTO, testResourcePoolDTO.getUiTest());
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePoolDTO);
}
@ -83,20 +144,17 @@ public class TestResourcePoolService {
List<TestResourcePool> testResourcePools = testResourcePoolMapper.selectByExample(example);
List<TestResourcePoolDTO> testResourcePoolDTOS = new ArrayList<>();
testResourcePools.forEach(pool -> {
TestResourceExample resourceExample = new TestResourceExample();
resourceExample.createCriteria().andTestResourcePoolIdEqualTo(pool.getId());
resourceExample.setOrderByClause("create_time");
List<TestResource> testResources = testResourceMapper.selectByExampleWithBLOBs(resourceExample);
TestResourcePoolBlob testResourcePoolBlob = testResourcePoolBlobMapper.selectByPrimaryKey(pool.getId());
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
try {
BeanUtils.copyProperties(testResourcePoolDTO, pool);
testResourcePoolDTO.setTestResources(testResources);
testResourcePoolDTO.setConfiguration(new String(testResourcePoolBlob.getConfiguration()));
testResourcePoolDTOS.add(testResourcePoolDTO);
} catch (IllegalAccessException | InvocationTargetException e) {
LogUtils.error(e.getMessage(), e);
}
});
return new ArrayList<>();
return testResourcePoolDTOS;
}
public void checkTestResourcePool(TestResourcePoolDTO testResourcePoolDTO) {
@ -119,18 +177,6 @@ public class TestResourcePoolService {
}
}
private boolean validateTestResourcePool(TestResourcePoolDTO testResourcePool) {
if (StringUtils.equalsIgnoreCase(testResourcePool.getType(), ResourcePoolTypeEnum.K8S.name())) {
KubernetesResourcePoolService resourcePoolService = CommonBeanFactory.getBean(KubernetesResourcePoolService.class);
if (resourcePoolService == null) {
return false;
}
return resourcePoolService.validate(testResourcePool);
}
NodeResourcePoolService resourcePoolService = CommonBeanFactory.getBean(NodeResourcePoolService.class);
return resourcePoolService.validate(testResourcePool);
}
public String getLogDetails(String id) {
TestResourcePool pool = testResourcePoolMapper.selectByPrimaryKey(id);
if (pool != null) {

View File

@ -0,0 +1,9 @@
package io.metersphere.system.service;
import io.metersphere.system.dto.TestResourceDTO;
public interface UiResourceService {
boolean validate(TestResourceDTO testResourceDTO);
}

View File

@ -3,7 +3,6 @@ package io.metersphere.system.controller;
import base.BaseTest;
import io.metersphere.sdk.constants.SessionConstants;
import io.metersphere.sdk.util.JSON;
import io.metersphere.system.domain.TestResource;
import io.metersphere.system.dto.ResourcePoolTypeEnum;
import io.metersphere.system.dto.TestResourcePoolDTO;
import io.metersphere.system.request.QueryResourcePoolRequest;
@ -21,10 +20,6 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultMatcher;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@ -43,14 +38,36 @@ class TestResourcePoolControllerTest extends BaseTest {
private static final ResultMatcher ERROR_REQUEST_MATCHER = status().is5xxServerError();
private static final String configuration = "{\n" +
" \"loadTestImage\": \"123\",\n" +
" \"loadTestHeap\": \"123\",\n" +
" \"nodesList\":[{\n" +
" \"ip\":\"172.2.130.1\",\n" +
" \"port\": \"3306\",\n" +
" \"monitor\": \"11\",\n" +
" \"concurrentNumber\": 1\n" +
" }],\n" +
"\"ip\":\"172.2.130.1\",\n" +
"\"token\":\"dsdfssdsvgsd\",\n" +
"\"namespaces\":\"测试\",\n" +
"\"concurrentNumber\":3,\n" +
"\"podThreads\":2,\n" +
"\"jobDefinition\":\"jsfsjs\",\n" +
"\"apiTestImage\":\"ddgd\",\n" +
"\"deployName\":\"hello\",\n" +
"\"uiGrid\":\"localhost:4444\"\n" +
"}";
@Test
@Order(1)
void addTestResourcePool() throws Exception {
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
testResourcePoolDTO.setName("test_pool_1");
testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name());
testResourcePoolDTO.setApiTest(true);
testResourcePoolDTO.setLoadTest(false);
testResourcePoolDTO.setUiTest(false);
setResources(testResourcePoolDTO);
mockMvc.perform(MockMvcRequestBuilders.post(TEST_RESOURCE_POOL_ADD)
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken)
@ -64,23 +81,28 @@ class TestResourcePoolControllerTest extends BaseTest {
@Order(2)
void addUiTestResourcePoolFiled() throws Exception {
//资源池名称为空
TestResourcePoolDTO testResourcePoolDTO = generatorDto(true, false, false, false);
TestResourcePoolDTO testResourcePoolDTO = generatorDto(true, false, false, false, false, false);
this.requestPost(TEST_RESOURCE_POOL_ADD, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//资源池类型为空
testResourcePoolDTO = generatorDto(false, true, false, false);
testResourcePoolDTO = generatorDto(false, true, false, false, false, false);
this.requestPost(TEST_RESOURCE_POOL_ADD, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//资源池节点集合为空
testResourcePoolDTO = generatorDto(false, false, true, false);
testResourcePoolDTO = generatorDto(false, false, true, false, false, false);
this.requestPost(TEST_RESOURCE_POOL_ADD, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//UI的grid为空
testResourcePoolDTO = generatorDto(true, true, true, false);
//用途测试
testResourcePoolDTO = generatorDto(false, false, false, true, false, false);
this.requestPost(TEST_RESOURCE_POOL_ADD, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//ui用途为空
testResourcePoolDTO = generatorDto(false, false, false, false,true, false);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//load用途为空
testResourcePoolDTO = generatorDto(false, false, false, false,false, true);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
}
@Test
@Order(3)
void listResourcePools() throws Exception {
void listResourcePoolsWidthSearch() throws Exception {
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
request.setCurrent(1);
request.setPageSize(5);
@ -96,11 +118,29 @@ class TestResourcePoolControllerTest extends BaseTest {
@Test
@Order(4)
void listResourcePoolsNoSearch() throws Exception {
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
request.setCurrent(1);
request.setPageSize(5);
mockMvc.perform(MockMvcRequestBuilders.post("/test/resource/pool/page")
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken)
.content(JSON.toJSONString(request))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(print())
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
@Test
@Order(5)
void updateTestResourcePool() throws Exception {
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
testResourcePoolDTO.setName("test_pool");
testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name());
setResources(testResourcePoolDTO);
testResourcePoolDTO.setApiTest(true);
testResourcePoolDTO.setLoadTest(false);
testResourcePoolDTO.setUiTest(false);
mockMvc.perform(MockMvcRequestBuilders.post(TEST_RESOURCE_POOL_UPDATE)
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken)
@ -111,29 +151,28 @@ class TestResourcePoolControllerTest extends BaseTest {
}
private static void setResources(TestResourcePoolDTO testResourcePoolDTO) {
TestResource testResource = new TestResource();
testResource.setId(UUID.randomUUID().toString());
testResource.setTestResourcePoolId(UUID.randomUUID().toString());
testResource.setEnable(true);
testResource.setDeleted(false);
List<TestResource> testResources = new ArrayList<>();
testResources.add(testResource);
testResourcePoolDTO.setTestResources(testResources);
testResourcePoolDTO.setConfiguration(configuration);
}
@Test
@Order(5)
@Order(6)
void updateTestResourcePoolFiled() throws Exception {
TestResourcePoolDTO testResourcePoolDTO = generatorDto(true, false, false, false);
TestResourcePoolDTO testResourcePoolDTO = generatorDto(true, false, false,false, false, false);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//资源池类型为空
testResourcePoolDTO = generatorDto(false, true, false, false);
testResourcePoolDTO = generatorDto(false, true, false, false, false, false);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//资源池节点集合为空
testResourcePoolDTO = generatorDto(false, false, true, false);
testResourcePoolDTO = generatorDto(false, false, true, false, false, false);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//UI的grid为空
testResourcePoolDTO = generatorDto(true, true, true, false);
//api用途为空
testResourcePoolDTO = generatorDto(false, false, false, true,false, false);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//ui用途为空
testResourcePoolDTO = generatorDto(false, false, false, false,true, false);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
//load用途为空
testResourcePoolDTO = generatorDto(false, false, false, false,false, true);
this.requestPost(TEST_RESOURCE_POOL_UPDATE, testResourcePoolDTO, ERROR_REQUEST_MATCHER);
}
@ -141,7 +180,7 @@ class TestResourcePoolControllerTest extends BaseTest {
@Sql(scripts = {"/dml/init_test_resource_pool.sql"},
config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED),
executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Order(6)
@Order(7)
void deleteTestResourcePool() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/test/resource/pool/delete/102")
.header(SessionConstants.HEADER_TOKEN, sessionId)
@ -151,6 +190,17 @@ class TestResourcePoolControllerTest extends BaseTest {
}
@Test
@Order(8)
void deleteTestResourcePoolFiled() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/test/resource/pool/delete/105")
.header(SessionConstants.HEADER_TOKEN, sessionId)
.header(SessionConstants.CSRF_TOKEN, csrfToken))
.andExpect(ERROR_REQUEST_MATCHER)
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
private void requestPost(String url, Object param, ResultMatcher resultMatcher) throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post(url)
.header(SessionConstants.HEADER_TOKEN, sessionId)
@ -161,7 +211,7 @@ class TestResourcePoolControllerTest extends BaseTest {
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
private TestResourcePoolDTO generatorDto(boolean noName, boolean noType, boolean noResources, boolean noUiGrid) {
private TestResourcePoolDTO generatorDto(boolean noName, boolean noType, boolean noResources, boolean noUseApi, boolean noUseUi, boolean noUseLoad) {
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
//没名字
if (!noName) {
@ -175,11 +225,15 @@ class TestResourcePoolControllerTest extends BaseTest {
if (!noResources) {
setResources(testResourcePoolDTO);
}
testResourcePoolDTO.setUiTest(true);
//没UI的grid
if (!noUiGrid) {
testResourcePoolDTO.setGrid("localhost:4444");
//没api
if(!noUseApi) {
testResourcePoolDTO.setApiTest(true);
}
if (!noUseUi) {
testResourcePoolDTO.setUiTest(true);
}
if (!noUseLoad) {
testResourcePoolDTO.setLoadTest(true);
}
return testResourcePoolDTO;
}

View File

@ -1,3 +1,3 @@
# 插入测试数据
INSERT INTO `test_resource_pool` VALUES ('102','test_pool_one', 'node', '1', 1, '1686634885000', '1686634885000', NULL, NULL, 'TCP', 0, 0, 0, NULL, null, 1);
INSERT INTO `test_resource_pool` VALUES ('102','test_pool_one', 'node', '1', 1, '1686634885000', '1686634885000', NULL, NULL, 'TCP', 0, 0, 0, NULL, null, 1);
INSERT INTO `test_resource_pool` VALUES ('102','test_pool_one', 'node', '1', 1, '1686634885000', '1686634885000', 'TCP', 0, 0, 0, NULL, 1);
INSERT INTO `test_resource_pool` VALUES ('102','test_pool_one', 'node', '1', 1, '1686634885000', '1686634885000', 'TCP', 0, 0, 0, NULL, 1);