build: add system test_resource_pool permission (#24918)
* build: add system test_resource_pool permission --------- Co-authored-by: guoyuqi <xiaomeinvG@126.com>
This commit is contained in:
parent
fedde82130
commit
c7a1c7f937
|
@ -1,39 +1,42 @@
|
||||||
package io.metersphere.system.domain;
|
package io.metersphere.system.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 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 java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TestResource implements Serializable {
|
public class TestResource implements Serializable {
|
||||||
@Schema(title = "资源节点ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "资源节点ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{test_resource.id.not_blank}", groups = {Updated.class})
|
@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})
|
@Size(min = 1, max = 50, message = "{test_resource.id.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{test_resource.test_resource_pool_id.not_blank}", groups = {Created.class})
|
@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})
|
@Size(min = 1, max = 50, message = "{test_resource.test_resource_pool_id.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String testResourcePoolId;
|
private String testResourcePoolId;
|
||||||
|
|
||||||
@Schema(title = "资源节点状态", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "{test_resource.enable.not_blank}", groups = {Created.class})
|
|
||||||
private Boolean enable;
|
|
||||||
|
|
||||||
@Schema(title = "创建时间")
|
@Schema(title = "创建时间")
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
@Schema(title = "更新时间")
|
@Schema(title = "更新时间")
|
||||||
private Long updateTime;
|
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 = "资源节点配置")
|
@Schema(title = "资源节点配置")
|
||||||
private byte[] configuration;
|
private byte[] configuration;
|
||||||
|
|
||||||
@Schema(title = "是否删除", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@NotNull(message = "{test_resource_pool.deleted.not_blank}", groups = {Created.class})
|
|
||||||
private Boolean deleted;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -244,76 +244,6 @@ public class TestResourceExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andStatusIsNull() {
|
|
||||||
addCriterion("`status` is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusIsNotNull() {
|
|
||||||
addCriterion("`status` is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusEqualTo(String value) {
|
|
||||||
addCriterion("`status` =", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusNotEqualTo(String value) {
|
|
||||||
addCriterion("`status` <>", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusGreaterThan(String value) {
|
|
||||||
addCriterion("`status` >", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("`status` >=", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusLessThan(String value) {
|
|
||||||
addCriterion("`status` <", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("`status` <=", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusLike(String value) {
|
|
||||||
addCriterion("`status` like", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusNotLike(String value) {
|
|
||||||
addCriterion("`status` not like", value, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusIn(List<String> values) {
|
|
||||||
addCriterion("`status` in", values, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusNotIn(List<String> values) {
|
|
||||||
addCriterion("`status` not in", values, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusBetween(String value1, String value2) {
|
|
||||||
addCriterion("`status` between", value1, value2, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("`status` not between", value1, value2, "status");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andCreateTimeIsNull() {
|
public Criteria andCreateTimeIsNull() {
|
||||||
addCriterion("create_time is null");
|
addCriterion("create_time is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
@ -433,6 +363,126 @@ public class TestResourceExample {
|
||||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||||
return (Criteria) this;
|
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 {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -1,25 +1,28 @@
|
||||||
package io.metersphere.system.domain;
|
package io.metersphere.system.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 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 java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TestResourcePool implements Serializable {
|
public class TestResourcePool implements Serializable {
|
||||||
@Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "资源池ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{test_resource_pool.id.not_blank}", groups = {Updated.class})
|
@NotBlank(message = "{test_resource_pool.id.not_blank}", groups = {Created.class, Updated.class})
|
||||||
@Size(min = 1, max = 50, message = "{test_resource_pool.id.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 50, message = "{test_resource_pool.id.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@Schema(title = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{test_resource_pool.name.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{test_resource_pool.name.not_blank}", groups = {Updated.class})
|
||||||
@Size(min = 1, max = 255, message = "{test_resource_pool.name.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 255, message = "{test_resource_pool.name.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(title = "类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{test_resource_pool.type.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{test_resource_pool.type.not_blank}", groups = {Updated.class})
|
||||||
@Size(min = 1, max = 30, message = "{test_resource_pool.type.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 30, message = "{test_resource_pool.type.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
@ -27,7 +30,7 @@ public class TestResourcePool implements Serializable {
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Schema(title = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(title = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "{test_resource_pool.enable.not_blank}", groups = {Created.class})
|
@NotNull(message = "{test_resource_pool.enable.not_blank}", groups = {Updated.class})
|
||||||
private Boolean enable;
|
private Boolean enable;
|
||||||
|
|
||||||
@Schema(title = "创建时间")
|
@Schema(title = "创建时间")
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.TestResource">
|
<resultMap id="BaseResultMap" type="io.metersphere.system.domain.TestResource">
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="test_resource_pool_id" jdbcType="VARCHAR" property="testResourcePoolId" />
|
<result column="test_resource_pool_id" jdbcType="VARCHAR" property="testResourcePoolId" />
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||||
|
<result column="enable" jdbcType="BIT" property="enable" />
|
||||||
|
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.TestResource">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.system.domain.TestResource">
|
||||||
<result column="configuration" jdbcType="LONGVARBINARY" property="configuration" />
|
<result column="configuration" jdbcType="LONGVARBINARY" property="configuration" />
|
||||||
|
@ -70,7 +71,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, test_resource_pool_id, `status`, create_time, update_time
|
id, test_resource_pool_id, create_time, update_time, `enable`, deleted
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
configuration
|
configuration
|
||||||
|
@ -124,12 +125,12 @@
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.system.domain.TestResource">
|
<insert id="insert" parameterType="io.metersphere.system.domain.TestResource">
|
||||||
insert into test_resource (id, test_resource_pool_id, `status`,
|
insert into test_resource (id, test_resource_pool_id, create_time,
|
||||||
create_time, update_time, configuration
|
update_time, `enable`, deleted,
|
||||||
)
|
configuration)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{configuration,jdbcType=LONGVARBINARY}
|
#{updateTime,jdbcType=BIGINT}, #{enable,jdbcType=BIT}, #{deleted,jdbcType=BIT},
|
||||||
)
|
#{configuration,jdbcType=LONGVARBINARY})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.system.domain.TestResource">
|
<insert id="insertSelective" parameterType="io.metersphere.system.domain.TestResource">
|
||||||
insert into test_resource
|
insert into test_resource
|
||||||
|
@ -140,15 +141,18 @@
|
||||||
<if test="testResourcePoolId != null">
|
<if test="testResourcePoolId != null">
|
||||||
test_resource_pool_id,
|
test_resource_pool_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
|
||||||
`status`,
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
update_time,
|
update_time,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="enable != null">
|
||||||
|
`enable`,
|
||||||
|
</if>
|
||||||
|
<if test="deleted != null">
|
||||||
|
deleted,
|
||||||
|
</if>
|
||||||
<if test="configuration != null">
|
<if test="configuration != null">
|
||||||
configuration,
|
configuration,
|
||||||
</if>
|
</if>
|
||||||
|
@ -160,15 +164,18 @@
|
||||||
<if test="testResourcePoolId != null">
|
<if test="testResourcePoolId != null">
|
||||||
#{testResourcePoolId,jdbcType=VARCHAR},
|
#{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
|
||||||
#{status,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
#{createTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
#{updateTime,jdbcType=BIGINT},
|
#{updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="enable != null">
|
||||||
|
#{enable,jdbcType=BIT},
|
||||||
|
</if>
|
||||||
|
<if test="deleted != null">
|
||||||
|
#{deleted,jdbcType=BIT},
|
||||||
|
</if>
|
||||||
<if test="configuration != null">
|
<if test="configuration != null">
|
||||||
#{configuration,jdbcType=LONGVARBINARY},
|
#{configuration,jdbcType=LONGVARBINARY},
|
||||||
</if>
|
</if>
|
||||||
|
@ -189,15 +196,18 @@
|
||||||
<if test="record.testResourcePoolId != null">
|
<if test="record.testResourcePoolId != null">
|
||||||
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.status != null">
|
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="record.createTime != null">
|
<if test="record.createTime != null">
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.updateTime != null">
|
<if test="record.updateTime != null">
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</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">
|
<if test="record.configuration != null">
|
||||||
configuration = #{record.configuration,jdbcType=LONGVARBINARY},
|
configuration = #{record.configuration,jdbcType=LONGVARBINARY},
|
||||||
</if>
|
</if>
|
||||||
|
@ -210,9 +220,10 @@
|
||||||
update test_resource
|
update test_resource
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
|
`enable` = #{record.enable,jdbcType=BIT},
|
||||||
|
deleted = #{record.deleted,jdbcType=BIT},
|
||||||
configuration = #{record.configuration,jdbcType=LONGVARBINARY}
|
configuration = #{record.configuration,jdbcType=LONGVARBINARY}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
@ -222,9 +233,10 @@
|
||||||
update test_resource
|
update test_resource
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
|
`enable` = #{record.enable,jdbcType=BIT},
|
||||||
|
deleted = #{record.deleted,jdbcType=BIT}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -235,15 +247,18 @@
|
||||||
<if test="testResourcePoolId != null">
|
<if test="testResourcePoolId != null">
|
||||||
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="enable != null">
|
||||||
|
`enable` = #{enable,jdbcType=BIT},
|
||||||
|
</if>
|
||||||
|
<if test="deleted != null">
|
||||||
|
deleted = #{deleted,jdbcType=BIT},
|
||||||
|
</if>
|
||||||
<if test="configuration != null">
|
<if test="configuration != null">
|
||||||
configuration = #{configuration,jdbcType=LONGVARBINARY},
|
configuration = #{configuration,jdbcType=LONGVARBINARY},
|
||||||
</if>
|
</if>
|
||||||
|
@ -253,18 +268,20 @@
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.TestResource">
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.system.domain.TestResource">
|
||||||
update test_resource
|
update test_resource
|
||||||
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
|
`enable` = #{enable,jdbcType=BIT},
|
||||||
|
deleted = #{deleted,jdbcType=BIT},
|
||||||
configuration = #{configuration,jdbcType=LONGVARBINARY}
|
configuration = #{configuration,jdbcType=LONGVARBINARY}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.TestResource">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.system.domain.TestResource">
|
||||||
update test_resource
|
update test_resource
|
||||||
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT}
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
|
`enable` = #{enable,jdbcType=BIT},
|
||||||
|
deleted = #{deleted,jdbcType=BIT}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -255,56 +255,57 @@ CREATE TABLE system_parameter
|
||||||
COLLATE = utf8mb4_general_ci COMMENT = '系统参数';
|
COLLATE = utf8mb4_general_ci COMMENT = '系统参数';
|
||||||
|
|
||||||
DROP TABLE IF EXISTS test_resource;
|
DROP TABLE IF EXISTS test_resource;
|
||||||
CREATE TABLE test_resource
|
CREATE TABLE test_resource(
|
||||||
(
|
`id` VARCHAR(50) NOT NULL COMMENT '资源节点ID' ,
|
||||||
`id` VARCHAR(50) NOT NULL COMMENT '资源节点ID',
|
`test_resource_pool_id` VARCHAR(50) NOT NULL COMMENT '资源池ID' ,
|
||||||
`test_resource_pool_id` VARCHAR(50) NOT NULL COMMENT '资源池ID',
|
`configuration` BLOB COMMENT '资源节点配置' ,
|
||||||
`configuration` BLOB COMMENT '资源节点配置',
|
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
|
||||||
`status` VARCHAR(20) NOT NULL COMMENT '资源节点状态',
|
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
|
||||||
`create_time` BIGINT NOT NULL COMMENT '创建时间',
|
`enable` BIT NOT NULL DEFAULT 1 COMMENT '是否启用' ,
|
||||||
`update_time` BIGINT NOT NULL COMMENT '更新时间',
|
`deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否删除' ,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4
|
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_resource_pool_id ON test_resource(`test_resource_pool_id`);
|
||||||
CREATE INDEX idx_status ON test_resource (`status`);
|
CREATE INDEX idx_deleted ON test_resource(`deleted`);
|
||||||
CREATE INDEX idx_create_time ON test_resource (`create_time`);
|
CREATE INDEX idx_create_time ON test_resource(`create_time`);
|
||||||
CREATE INDEX idx_update_time ON test_resource (`update_time`);
|
CREATE INDEX idx_enable ON test_resource(`enable`);
|
||||||
|
CREATE INDEX idx_update_time ON test_resource(`update_time`);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS test_resource_pool;
|
DROP TABLE IF EXISTS test_resource_pool;
|
||||||
CREATE TABLE test_resource_pool
|
CREATE TABLE test_resource_pool(
|
||||||
(
|
`id` VARCHAR(50) NOT NULL COMMENT '资源池ID' ,
|
||||||
`id` VARCHAR(50) NOT NULL COMMENT '资源池ID',
|
`name` VARCHAR(255) NOT NULL COMMENT '名称' ,
|
||||||
`name` VARCHAR(255) NOT NULL COMMENT '名称',
|
`type` VARCHAR(30) NOT NULL COMMENT '类型' ,
|
||||||
`type` VARCHAR(30) NOT NULL COMMENT '类型',
|
`description` VARCHAR(500) COMMENT '描述' ,
|
||||||
`description` VARCHAR(500) COMMENT '描述',
|
`enable` BIT NOT NULL DEFAULT 1 COMMENT '是否启用' ,
|
||||||
`enable` BIT NOT NULL DEFAULT 1 COMMENT '是否启用',
|
`create_time` BIGINT NOT NULL COMMENT '创建时间' ,
|
||||||
`create_time` BIGINT NOT NULL COMMENT '创建时间',
|
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
|
||||||
`update_time` BIGINT NOT NULL COMMENT '更新时间',
|
`load_test_image` VARCHAR(100) COMMENT '性能测试镜像' ,
|
||||||
`load_test_image` VARCHAR(100) COMMENT '性能测试镜像',
|
`load_test_heap` VARCHAR(200) COMMENT '性能测试jvm配置' ,
|
||||||
`load_test_heap` VARCHAR(200) COMMENT '性能测试jvm配置',
|
`create_user` VARCHAR(50) COMMENT '创建人' ,
|
||||||
`create_user` VARCHAR(50) COMMENT '创建人',
|
`api_test` BIT COMMENT '是否用于接口测试' ,
|
||||||
`api_test` BIT COMMENT '是否用于接口测试',
|
`load_test` BIT COMMENT '是否用于性能测试' ,
|
||||||
`load_test` BIT COMMENT '是否用于性能测试',
|
`ui_test` BIT COMMENT '是否用于ui测试' ,
|
||||||
`ui_test` BIT COMMENT '是否用于ui测试',
|
`grid` VARCHAR(255) COMMENT 'ui测试grid配置' ,
|
||||||
`grid` VARCHAR(255) COMMENT 'ui测试grid配置',
|
`server_url` VARCHAR(255) COMMENT 'ms部署地址' ,
|
||||||
`server_url` VARCHAR(255) COMMENT 'ms部署地址',
|
`deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否删除' ,
|
||||||
`deleted` BIT NOT NULL DEFAULT 0 COMMENT '是否删除',
|
PRIMARY KEY (id)
|
||||||
PRIMARY KEY (id)
|
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4
|
DEFAULT CHARSET = utf8mb4
|
||||||
COLLATE = utf8mb4_general_ci COMMENT = '测试资源池';
|
COLLATE = utf8mb4_general_ci COMMENT = '测试资源池';
|
||||||
|
|
||||||
|
|
||||||
CREATE INDEX idx_name ON test_resource_pool (`name`);
|
CREATE INDEX idx_name ON test_resource_pool(`name`);
|
||||||
CREATE INDEX idx_type ON test_resource_pool (`type`);
|
CREATE INDEX idx_type ON test_resource_pool(`type`);
|
||||||
CREATE INDEX idx_status ON test_resource_pool (`enable`);
|
CREATE INDEX idx_deleted ON test_resource_pool(`deleted`);
|
||||||
CREATE INDEX idx_create_time ON test_resource_pool (`create_time`);
|
CREATE INDEX idx_enable ON test_resource_pool(`enable`);
|
||||||
CREATE INDEX idx_update_time ON test_resource_pool (`update_time`);
|
CREATE INDEX idx_create_time ON test_resource_pool(`create_time`);
|
||||||
CREATE INDEX idx_create_user ON test_resource_pool (`create_user`);
|
CREATE INDEX idx_update_time ON test_resource_pool(`update_time`);
|
||||||
|
CREATE INDEX idx_create_user ON test_resource_pool(`create_user`);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS user;
|
DROP TABLE IF EXISTS user;
|
||||||
CREATE TABLE user
|
CREATE TABLE user
|
||||||
|
|
|
@ -4,6 +4,7 @@ public class OperationLogModule {
|
||||||
public static final String UNKNOWN_MODULE = "UNKNOWN_MODULE";
|
public static final String UNKNOWN_MODULE = "UNKNOWN_MODULE";
|
||||||
public static final String SYSTEM_PARAMETER_SETTING = "SYSTEM_PARAMETER_SETTING";
|
public static final String SYSTEM_PARAMETER_SETTING = "SYSTEM_PARAMETER_SETTING";
|
||||||
public static final String SYSTEM_TEST_RESOURCE = "SYSTEM_TEST_RESOURCE";
|
public static final String SYSTEM_TEST_RESOURCE = "SYSTEM_TEST_RESOURCE";
|
||||||
|
public static final String SYSTEM_TEST_RESOURCE_POOL = "SYSTEM_TEST_RESOURCE_POOL";
|
||||||
public static final String SYSTEM_USER = "SYSTEM_USER";
|
public static final String SYSTEM_USER = "SYSTEM_USER";
|
||||||
public static final String SYSTEM_WORKSPACE = "SYSTEM_WORKSPACE";
|
public static final String SYSTEM_WORKSPACE = "SYSTEM_WORKSPACE";
|
||||||
public static final String WORKSPACE_TEMPLATE_SETTINGS = "WORKSPACE_TEMPLATE_SETTINGS";
|
public static final String WORKSPACE_TEMPLATE_SETTINGS = "WORKSPACE_TEMPLATE_SETTINGS";
|
||||||
|
|
|
@ -2,6 +2,10 @@ package io.metersphere.system.controller;
|
||||||
|
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import io.metersphere.sdk.constants.PermissionConstants;
|
||||||
|
import io.metersphere.sdk.log.annotation.RequestLog;
|
||||||
|
import io.metersphere.sdk.log.constants.OperationLogModule;
|
||||||
|
import io.metersphere.sdk.log.constants.OperationLogType;
|
||||||
import io.metersphere.sdk.util.PageUtils;
|
import io.metersphere.sdk.util.PageUtils;
|
||||||
import io.metersphere.sdk.util.Pager;
|
import io.metersphere.sdk.util.Pager;
|
||||||
import io.metersphere.system.consul.CacheNode;
|
import io.metersphere.system.consul.CacheNode;
|
||||||
|
@ -9,6 +13,7 @@ import io.metersphere.system.dto.TestResourcePoolDTO;
|
||||||
import io.metersphere.system.request.QueryResourcePoolRequest;
|
import io.metersphere.system.request.QueryResourcePoolRequest;
|
||||||
import io.metersphere.system.service.TestResourcePoolService;
|
import io.metersphere.system.service.TestResourcePoolService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -22,23 +27,31 @@ public class TestResourcePoolController {
|
||||||
private TestResourcePoolService testResourcePoolService;
|
private TestResourcePoolService testResourcePoolService;
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ_ADD)
|
||||||
|
@RequestLog(type = OperationLogType.ADD, module = OperationLogModule.SYSTEM_TEST_RESOURCE_POOL,
|
||||||
|
sourceId = "#testResourcePoolDTO.id", projectId = "#testResourcePoolDTO.projectId", details = "#testResourcePoolDTO.name")
|
||||||
public TestResourcePoolDTO addTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
|
public TestResourcePoolDTO addTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
|
||||||
return testResourcePoolService.addTestResourcePool(testResourcePoolDTO);
|
return testResourcePoolService.addTestResourcePool(testResourcePoolDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/delete/{poolId}")
|
@GetMapping("/delete/{poolId}")
|
||||||
@CacheNode // 把监控节点缓存起来
|
@CacheNode // 把监控节点缓存起来
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ_DELETE)
|
||||||
public void deleteTestResourcePool(@PathVariable(value = "poolId") String testResourcePoolId) {
|
public void deleteTestResourcePool(@PathVariable(value = "poolId") String testResourcePoolId) {
|
||||||
testResourcePoolService.deleteTestResourcePool(testResourcePoolId);
|
testResourcePoolService.deleteTestResourcePool(testResourcePoolId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@CacheNode // 把监控节点缓存起来
|
@CacheNode // 把监控节点缓存起来
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ_UPDATE)
|
||||||
|
@RequestLog(type = OperationLogType.UPDATE, module = OperationLogModule.SYSTEM_TEST_RESOURCE_POOL,
|
||||||
|
sourceId = "#testResourcePoolDTO.id", projectId = "#testResourcePoolDTO.projectId", details = "#testResourcePoolDTO.name")
|
||||||
public void updateTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
|
public void updateTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
|
||||||
testResourcePoolService.updateTestResourcePool(testResourcePoolDTO);
|
testResourcePoolService.updateTestResourcePool(testResourcePoolDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
|
@RequiresPermissions(PermissionConstants.SYSTEM_TEST_POOL_READ)
|
||||||
public Pager<List<TestResourcePoolDTO>> listResourcePools( @RequestBody QueryResourcePoolRequest request) {
|
public Pager<List<TestResourcePoolDTO>> listResourcePools( @RequestBody QueryResourcePoolRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(request.getCurrent(),request.getPageSize(), true);
|
Page<Object> page = PageHelper.startPage(request.getCurrent(),request.getPageSize(), true);
|
||||||
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
|
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package io.metersphere.system.controller;
|
package io.metersphere.system.controller;
|
||||||
|
|
||||||
import base.BaseTest;
|
import base.BaseTest;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.metersphere.sdk.constants.SessionConstants;
|
import io.metersphere.sdk.constants.SessionConstants;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.domain.TestResource;
|
import io.metersphere.system.domain.TestResource;
|
||||||
|
@ -12,7 +14,10 @@ import org.junit.jupiter.api.*;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.test.context.jdbc.Sql;
|
||||||
|
import org.springframework.test.context.jdbc.SqlConfig;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,13 +25,14 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||||
|
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
class TestResourcePoolControllerTest extends BaseTest {
|
class TestResourcePoolControllerTest extends BaseTest {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
|
@ -38,13 +44,18 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
testResourcePoolDTO.setName("test_pool_1");
|
testResourcePoolDTO.setName("test_pool_1");
|
||||||
testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name());
|
testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name());
|
||||||
setResources(testResourcePoolDTO);
|
setResources(testResourcePoolDTO);
|
||||||
mockMvc.perform(MockMvcRequestBuilders.post("/test/resource/pool/add")
|
|
||||||
|
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.post("/test/resource/pool/add")
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
.content(JSON.toJSONString(testResourcePoolDTO))
|
.content(JSON.toJSONString(testResourcePoolDTO))
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn();
|
||||||
|
//获取数据
|
||||||
|
JSONObject jsonObject = new JSONObject(Boolean.parseBoolean(mvcResult.getResponse().getContentAsString()));
|
||||||
|
JSONArray jsonArrayData = (JSONArray) jsonObject.get("data");
|
||||||
|
System.out.println(jsonArrayData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -66,6 +77,22 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
@Order(3)
|
||||||
|
void listResourcePools() throws Exception {
|
||||||
|
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
|
||||||
|
request.setCurrent(1);
|
||||||
|
request.setPageSize(5);
|
||||||
|
request.setName("test_pool");
|
||||||
|
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(4)
|
||||||
void updateTestResourcePool() throws Exception {
|
void updateTestResourcePool() throws Exception {
|
||||||
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
||||||
testResourcePoolDTO.setName("test_pool");
|
testResourcePoolDTO.setName("test_pool");
|
||||||
|
@ -92,7 +119,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(5)
|
||||||
void updateTestResourcePoolFiled() throws Exception {
|
void updateTestResourcePoolFiled() throws Exception {
|
||||||
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
TestResourcePoolDTO testResourcePoolDTO = new TestResourcePoolDTO();
|
||||||
testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name());
|
testResourcePoolDTO.setType(ResourcePoolTypeEnum.NODE.name());
|
||||||
|
@ -106,24 +133,16 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(5)
|
@Sql(scripts = {"/sql/init_test_resource_pool.sql"},
|
||||||
void listResourcePools() throws Exception {
|
config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED),
|
||||||
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
|
executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
|
||||||
request.setCurrent(1);
|
@Order(6)
|
||||||
request.setPageSize(5);
|
void deleteTestResourcePool() throws Exception {
|
||||||
request.setName("test_pool");
|
mockMvc.perform(MockMvcRequestBuilders.get("/test/resource/pool/delete/102")
|
||||||
mockMvc.perform(MockMvcRequestBuilders.post("/test/resource/pool/page")
|
|
||||||
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
.header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken))
|
||||||
.content(JSON.toJSONString(request))
|
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Order(6)
|
|
||||||
void deleteTestResourcePool() {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +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);
|
Loading…
Reference in New Issue