merge
This commit is contained in:
commit
d31382ec2a
|
@ -19,6 +19,8 @@ public class LoadTest implements Serializable {
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
private String testResourcePoolId;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -84,4 +86,12 @@ public class LoadTest implements Serializable {
|
||||||
public void setStatus(String status) {
|
public void setStatus(String status) {
|
||||||
this.status = status == null ? null : status.trim();
|
this.status = status == null ? null : status.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTestResourcePoolId() {
|
||||||
|
return testResourcePoolId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestResourcePoolId(String testResourcePoolId) {
|
||||||
|
this.testResourcePoolId = testResourcePoolId == null ? null : testResourcePoolId.trim();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -643,6 +643,76 @@ public class LoadTestExample {
|
||||||
addCriterion("status not between", value1, value2, "status");
|
addCriterion("status not between", value1, value2, "status");
|
||||||
return (Criteria) this;
|
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 static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -7,10 +7,6 @@ public class TestResource implements Serializable {
|
||||||
|
|
||||||
private String testResourcePoolId;
|
private String testResourcePoolId;
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
@ -37,22 +33,6 @@ public class TestResource implements Serializable {
|
||||||
this.testResourcePoolId = testResourcePoolId == null ? null : testResourcePoolId.trim();
|
this.testResourcePoolId = testResourcePoolId == null ? null : testResourcePoolId.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name == null ? null : name.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description == null ? null : description.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,146 +244,6 @@ public class TestResourceExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andNameIsNull() {
|
|
||||||
addCriterion("name is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameIsNotNull() {
|
|
||||||
addCriterion("name is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameEqualTo(String value) {
|
|
||||||
addCriterion("name =", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotEqualTo(String value) {
|
|
||||||
addCriterion("name <>", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameGreaterThan(String value) {
|
|
||||||
addCriterion("name >", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("name >=", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameLessThan(String value) {
|
|
||||||
addCriterion("name <", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("name <=", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameLike(String value) {
|
|
||||||
addCriterion("name like", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotLike(String value) {
|
|
||||||
addCriterion("name not like", value, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameIn(List<String> values) {
|
|
||||||
addCriterion("name in", values, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotIn(List<String> values) {
|
|
||||||
addCriterion("name not in", values, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameBetween(String value1, String value2) {
|
|
||||||
addCriterion("name between", value1, value2, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andNameNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("name not between", value1, value2, "name");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionIsNull() {
|
|
||||||
addCriterion("description is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionIsNotNull() {
|
|
||||||
addCriterion("description is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionEqualTo(String value) {
|
|
||||||
addCriterion("description =", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotEqualTo(String value) {
|
|
||||||
addCriterion("description <>", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionGreaterThan(String value) {
|
|
||||||
addCriterion("description >", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("description >=", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionLessThan(String value) {
|
|
||||||
addCriterion("description <", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("description <=", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionLike(String value) {
|
|
||||||
addCriterion("description like", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotLike(String value) {
|
|
||||||
addCriterion("description not like", value, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionIn(List<String> values) {
|
|
||||||
addCriterion("description in", values, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotIn(List<String> values) {
|
|
||||||
addCriterion("description not in", values, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
|
||||||
addCriterion("description between", value1, value2, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("description not between", value1, value2, "description");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andStatusIsNull() {
|
public Criteria andStatusIsNull() {
|
||||||
addCriterion("status is null");
|
addCriterion("status is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
|
|
@ -13,8 +13,6 @@ public class TestResourcePool implements Serializable {
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
private String info;
|
|
||||||
|
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
private Long updateTime;
|
private Long updateTime;
|
||||||
|
@ -61,14 +59,6 @@ public class TestResourcePool implements Serializable {
|
||||||
this.status = status == null ? null : status.trim();
|
this.status = status == null ? null : status.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInfo() {
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInfo(String info) {
|
|
||||||
this.info = info == null ? null : info.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCreateTime() {
|
public Long getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,76 +454,6 @@ public class TestResourcePoolExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andInfoIsNull() {
|
|
||||||
addCriterion("info is null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoIsNotNull() {
|
|
||||||
addCriterion("info is not null");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoEqualTo(String value) {
|
|
||||||
addCriterion("info =", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoNotEqualTo(String value) {
|
|
||||||
addCriterion("info <>", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoGreaterThan(String value) {
|
|
||||||
addCriterion("info >", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoGreaterThanOrEqualTo(String value) {
|
|
||||||
addCriterion("info >=", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoLessThan(String value) {
|
|
||||||
addCriterion("info <", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoLessThanOrEqualTo(String value) {
|
|
||||||
addCriterion("info <=", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoLike(String value) {
|
|
||||||
addCriterion("info like", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoNotLike(String value) {
|
|
||||||
addCriterion("info not like", value, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoIn(List<String> values) {
|
|
||||||
addCriterion("info in", values, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoNotIn(List<String> values) {
|
|
||||||
addCriterion("info not in", values, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoBetween(String value1, String value2) {
|
|
||||||
addCriterion("info between", value1, value2, "info");
|
|
||||||
return (Criteria) this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Criteria andInfoNotBetween(String value1, String value2) {
|
|
||||||
addCriterion("info not between", value1, value2, "info");
|
|
||||||
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;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<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="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
|
<result column="test_resource_pool_id" jdbcType="VARCHAR" property="testResourcePoolId" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||||
<result column="load_configuration" jdbcType="LONGVARCHAR" property="loadConfiguration" />
|
<result column="load_configuration" jdbcType="LONGVARCHAR" property="loadConfiguration" />
|
||||||
|
@ -76,7 +77,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, project_id, name, description, scenario_definition, create_time, update_time,
|
id, project_id, name, description, scenario_definition, create_time, update_time,
|
||||||
status
|
status, test_resource_pool_id
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
load_configuration, advanced_configuration, schedule
|
load_configuration, advanced_configuration, schedule
|
||||||
|
@ -132,14 +133,14 @@
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||||
insert into load_test (id, project_id, name,
|
insert into load_test (id, project_id, name,
|
||||||
description, scenario_definition, create_time,
|
description, scenario_definition, create_time,
|
||||||
update_time, status, load_configuration,
|
update_time, status, test_resource_pool_id,
|
||||||
advanced_configuration, schedule
|
load_configuration, advanced_configuration,
|
||||||
)
|
schedule)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||||
#{description,jdbcType=VARCHAR}, #{scenarioDefinition,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
#{description,jdbcType=VARCHAR}, #{scenarioDefinition,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
#{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR},
|
#{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
#{advancedConfiguration,jdbcType=LONGVARCHAR}, #{schedule,jdbcType=LONGVARCHAR}
|
#{loadConfiguration,jdbcType=LONGVARCHAR}, #{advancedConfiguration,jdbcType=LONGVARCHAR},
|
||||||
)
|
#{schedule,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||||
insert into load_test
|
insert into load_test
|
||||||
|
@ -168,6 +169,9 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status,
|
status,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="testResourcePoolId != null">
|
||||||
|
test_resource_pool_id,
|
||||||
|
</if>
|
||||||
<if test="loadConfiguration != null">
|
<if test="loadConfiguration != null">
|
||||||
load_configuration,
|
load_configuration,
|
||||||
</if>
|
</if>
|
||||||
|
@ -203,6 +207,9 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
#{status,jdbcType=VARCHAR},
|
#{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="testResourcePoolId != null">
|
||||||
|
#{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="loadConfiguration != null">
|
<if test="loadConfiguration != null">
|
||||||
#{loadConfiguration,jdbcType=LONGVARCHAR},
|
#{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -247,6 +254,9 @@
|
||||||
<if test="record.status != null">
|
<if test="record.status != null">
|
||||||
status = #{record.status,jdbcType=VARCHAR},
|
status = #{record.status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.testResourcePoolId != null">
|
||||||
|
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.loadConfiguration != null">
|
<if test="record.loadConfiguration != null">
|
||||||
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -271,6 +281,7 @@
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
status = #{record.status,jdbcType=VARCHAR},
|
status = #{record.status,jdbcType=VARCHAR},
|
||||||
|
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR},
|
||||||
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
advanced_configuration = #{record.advancedConfiguration,jdbcType=LONGVARCHAR},
|
advanced_configuration = #{record.advancedConfiguration,jdbcType=LONGVARCHAR},
|
||||||
schedule = #{record.schedule,jdbcType=LONGVARCHAR}
|
schedule = #{record.schedule,jdbcType=LONGVARCHAR}
|
||||||
|
@ -287,7 +298,8 @@
|
||||||
scenario_definition = #{record.scenarioDefinition,jdbcType=VARCHAR},
|
scenario_definition = #{record.scenarioDefinition,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},
|
||||||
status = #{record.status,jdbcType=VARCHAR}
|
status = #{record.status,jdbcType=VARCHAR},
|
||||||
|
test_resource_pool_id = #{record.testResourcePoolId,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -316,6 +328,9 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="testResourcePoolId != null">
|
||||||
|
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="loadConfiguration != null">
|
<if test="loadConfiguration != null">
|
||||||
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -337,6 +352,7 @@
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
|
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||||
advanced_configuration = #{advancedConfiguration,jdbcType=LONGVARCHAR},
|
advanced_configuration = #{advancedConfiguration,jdbcType=LONGVARCHAR},
|
||||||
schedule = #{schedule,jdbcType=LONGVARCHAR}
|
schedule = #{schedule,jdbcType=LONGVARCHAR}
|
||||||
|
@ -350,7 +366,8 @@
|
||||||
scenario_definition = #{scenarioDefinition,jdbcType=VARCHAR},
|
scenario_definition = #{scenarioDefinition,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
status = #{status,jdbcType=VARCHAR}
|
status = #{status,jdbcType=VARCHAR},
|
||||||
|
test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -4,8 +4,6 @@
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestResource">
|
<resultMap id="BaseResultMap" type="io.metersphere.base.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="name" jdbcType="VARCHAR" property="name" />
|
|
||||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<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" />
|
||||||
|
@ -72,7 +70,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, test_resource_pool_id, name, description, status, create_time, update_time
|
id, test_resource_pool_id, status, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
configuration
|
configuration
|
||||||
|
@ -126,12 +124,12 @@
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestResource">
|
<insert id="insert" parameterType="io.metersphere.base.domain.TestResource">
|
||||||
insert into test_resource (id, test_resource_pool_id, name,
|
insert into test_resource (id, test_resource_pool_id, status,
|
||||||
description, status, create_time,
|
create_time, update_time, configuration
|
||||||
update_time, configuration)
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||||
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{configuration,jdbcType=LONGVARCHAR}
|
||||||
#{updateTime,jdbcType=BIGINT}, #{configuration,jdbcType=LONGVARCHAR})
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResource">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResource">
|
||||||
insert into test_resource
|
insert into test_resource
|
||||||
|
@ -142,12 +140,6 @@
|
||||||
<if test="testResourcePoolId != null">
|
<if test="testResourcePoolId != null">
|
||||||
test_resource_pool_id,
|
test_resource_pool_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null">
|
|
||||||
name,
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
description,
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status,
|
status,
|
||||||
</if>
|
</if>
|
||||||
|
@ -168,12 +160,6 @@
|
||||||
<if test="testResourcePoolId != null">
|
<if test="testResourcePoolId != null">
|
||||||
#{testResourcePoolId,jdbcType=VARCHAR},
|
#{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="name != null">
|
|
||||||
#{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
#{description,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
#{status,jdbcType=VARCHAR},
|
#{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -203,12 +189,6 @@
|
||||||
<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.name != null">
|
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="record.description != null">
|
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="record.status != null">
|
<if test="record.status != null">
|
||||||
status = #{record.status,jdbcType=VARCHAR},
|
status = #{record.status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -230,8 +210,6 @@
|
||||||
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},
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
|
||||||
status = #{record.status,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},
|
||||||
|
@ -244,8 +222,6 @@
|
||||||
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},
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
|
||||||
status = #{record.status,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}
|
||||||
|
@ -259,12 +235,6 @@
|
||||||
<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="name != null">
|
|
||||||
name = #{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
description = #{description,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -283,8 +253,6 @@
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestResource">
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestResource">
|
||||||
update test_resource
|
update test_resource
|
||||||
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
name = #{name,jdbcType=VARCHAR},
|
|
||||||
description = #{description,jdbcType=VARCHAR},
|
|
||||||
status = #{status,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},
|
||||||
|
@ -294,8 +262,6 @@
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestResource">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestResource">
|
||||||
update test_resource
|
update test_resource
|
||||||
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
set test_resource_pool_id = #{testResourcePoolId,jdbcType=VARCHAR},
|
||||||
name = #{name,jdbcType=VARCHAR},
|
|
||||||
description = #{description,jdbcType=VARCHAR},
|
|
||||||
status = #{status,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}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
<result column="info" jdbcType="VARCHAR" property="info" />
|
|
||||||
<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" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
@ -70,7 +69,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, name, type, description, status, info, create_time, update_time
|
id, name, type, description, status, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -104,11 +103,11 @@
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestResourcePool">
|
<insert id="insert" parameterType="io.metersphere.base.domain.TestResourcePool">
|
||||||
insert into test_resource_pool (id, name, type,
|
insert into test_resource_pool (id, name, type,
|
||||||
description, status, info,
|
description, status, create_time,
|
||||||
create_time, update_time)
|
update_time)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||||
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{info,jdbcType=VARCHAR},
|
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
|
#{updateTime,jdbcType=BIGINT})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResourcePool">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResourcePool">
|
||||||
insert into test_resource_pool
|
insert into test_resource_pool
|
||||||
|
@ -128,9 +127,6 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status,
|
status,
|
||||||
</if>
|
</if>
|
||||||
<if test="info != null">
|
|
||||||
info,
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
|
@ -154,9 +150,6 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
#{status,jdbcType=VARCHAR},
|
#{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="info != null">
|
|
||||||
#{info,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
#{createTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
@ -189,9 +182,6 @@
|
||||||
<if test="record.status != null">
|
<if test="record.status != null">
|
||||||
status = #{record.status,jdbcType=VARCHAR},
|
status = #{record.status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.info != null">
|
|
||||||
info = #{record.info,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>
|
||||||
|
@ -210,7 +200,6 @@
|
||||||
type = #{record.type,jdbcType=VARCHAR},
|
type = #{record.type,jdbcType=VARCHAR},
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
description = #{record.description,jdbcType=VARCHAR},
|
||||||
status = #{record.status,jdbcType=VARCHAR},
|
status = #{record.status,jdbcType=VARCHAR},
|
||||||
info = #{record.info,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}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
|
@ -232,9 +221,6 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="info != null">
|
|
||||||
info = #{info,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
@ -250,7 +236,6 @@
|
||||||
type = #{type,jdbcType=VARCHAR},
|
type = #{type,jdbcType=VARCHAR},
|
||||||
description = #{description,jdbcType=VARCHAR},
|
description = #{description,jdbcType=VARCHAR},
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
info = #{info,jdbcType=VARCHAR},
|
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT}
|
update_time = #{updateTime,jdbcType=BIGINT}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package io.metersphere.base.mapper.ext;
|
||||||
|
|
||||||
|
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||||
|
import io.metersphere.dto.TestResourcePoolDTO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExtTestReourcePoolMapper {
|
||||||
|
List<TestResourcePoolDTO> listResourcePools(@Param("request") QueryResourcePoolRequest request);
|
||||||
|
|
||||||
|
// List<TestResource> listResourcesByPoolId(@Param("poolId") String poolId);
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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.base.mapper.ext.ExtTestReourcePoolMapper">
|
||||||
|
|
||||||
|
<resultMap id="TestReourcePoolResultMap" type="io.metersphere.dto.TestResourcePoolDTO">
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
|
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||||
|
<result column="description" jdbcType="VARCHAR" property="description"/>
|
||||||
|
<result column="status" jdbcType="VARCHAR" property="status"/>
|
||||||
|
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
||||||
|
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
|
||||||
|
|
||||||
|
<collection property="resources" column="id" ofType="io.metersphere.base.domain.TestResource"
|
||||||
|
select="io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper.listResourcesByPoolId">
|
||||||
|
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="listResourcePools" resultMap="TestReourcePoolResultMap">
|
||||||
|
SELECT * FROM test_resource_pool
|
||||||
|
<where>
|
||||||
|
<if test="request.name != null">
|
||||||
|
and test_resource_pool.name like CONCAT('%', #{request.name},'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listResourcesByPoolId" resultType="io.metersphere.base.domain.TestResource">
|
||||||
|
SELECT * FROM test_resource WHERE test_resource_pool_id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,15 @@
|
||||||
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author dongbin
|
||||||
|
*/
|
||||||
|
public enum ResourceStatusEnum {
|
||||||
|
/**
|
||||||
|
* 无效
|
||||||
|
*/
|
||||||
|
INVALID,
|
||||||
|
/**
|
||||||
|
* 有效
|
||||||
|
*/
|
||||||
|
VALID
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.controller.request.ReportRequest;
|
import io.metersphere.controller.request.ReportRequest;
|
||||||
import io.metersphere.dto.ReportDTO;
|
import io.metersphere.dto.ReportDTO;
|
||||||
|
import io.metersphere.report.base.RequestStatistics;
|
||||||
import io.metersphere.service.ReportService;
|
import io.metersphere.service.ReportService;
|
||||||
import io.metersphere.user.SessionUtils;
|
import io.metersphere.user.SessionUtils;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
|
@ -52,5 +53,10 @@ public class ReportController {
|
||||||
return reportService.getReportTestAndProInfo(reportId);
|
return reportService.getReportTestAndProInfo(reportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/content/{reportId}")
|
||||||
|
public List<RequestStatistics> getReportContent(@PathVariable String reportId) {
|
||||||
|
return reportService.getReport(reportId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.TestResourcePool;
|
||||||
import io.metersphere.commons.utils.PageUtils;
|
import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||||
|
import io.metersphere.dto.TestResourcePoolDTO;
|
||||||
import io.metersphere.service.TestResourcePoolService;
|
import io.metersphere.service.TestResourcePoolService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@ -20,8 +21,8 @@ public class TestResourcePoolController {
|
||||||
private TestResourcePoolService testResourcePoolService;
|
private TestResourcePoolService testResourcePoolService;
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public TestResourcePool addTestResourcePool(@RequestBody TestResourcePool testResourcePool) {
|
public TestResourcePoolDTO addTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
|
||||||
return testResourcePoolService.addTestResourcePool(testResourcePool);
|
return testResourcePoolService.addTestResourcePool(testResourcePoolDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/delete/{testResourcePoolId}")
|
@GetMapping("/delete/{testResourcePoolId}")
|
||||||
|
@ -30,18 +31,18 @@ public class TestResourcePoolController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public void updateTestResourcePool(@RequestBody TestResourcePool testResourcePool) {
|
public void updateTestResourcePool(@RequestBody TestResourcePoolDTO testResourcePoolDTO) {
|
||||||
testResourcePoolService.updateTestResourcePool(testResourcePool);
|
testResourcePoolService.updateTestResourcePool(testResourcePoolDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("list/{goPage}/{pageSize}")
|
@PostMapping("list/{goPage}/{pageSize}")
|
||||||
public Pager<List<TestResourcePool>> listResourcePools(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryResourcePoolRequest request) {
|
public Pager<List<TestResourcePoolDTO>> listResourcePools(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryResourcePoolRequest request) {
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
|
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("list/all")
|
@GetMapping("list/all")
|
||||||
public List<TestResourcePool> listResourcePools() {
|
public List<TestResourcePoolDTO> listResourcePools() {
|
||||||
PageHelper.startPage(1, 10000, true);
|
PageHelper.startPage(1, 10000, true);
|
||||||
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
|
QueryResourcePoolRequest request = new QueryResourcePoolRequest();
|
||||||
return testResourcePoolService.listResourcePools(request);
|
return testResourcePoolService.listResourcePools(request);
|
||||||
|
|
|
@ -24,6 +24,8 @@ public class TestPlanRequest {
|
||||||
|
|
||||||
private String schedule;
|
private String schedule;
|
||||||
|
|
||||||
|
private String testResourcePoolId;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,4 +117,11 @@ public class TestPlanRequest {
|
||||||
this.schedule = schedule == null ? null : schedule.trim();
|
this.schedule = schedule == null ? null : schedule.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTestResourcePoolId() {
|
||||||
|
return testResourcePoolId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestResourcePoolId(String testResourcePoolId) {
|
||||||
|
this.testResourcePoolId = testResourcePoolId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
package io.metersphere.dto;
|
|
||||||
|
|
||||||
public class KubernetesDTO {
|
|
||||||
|
|
||||||
private String masterUrl;
|
|
||||||
private String token;
|
|
||||||
private Integer maxConcurrency;
|
|
||||||
private Boolean validate;
|
|
||||||
|
|
||||||
public String getMasterUrl() {
|
|
||||||
return masterUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMasterUrl(String masterUrl) {
|
|
||||||
this.masterUrl = masterUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getToken() {
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToken(String token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getMaxConcurrency() {
|
|
||||||
return maxConcurrency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxConcurrency(Integer maxConcurrency) {
|
|
||||||
this.maxConcurrency = maxConcurrency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getValidate() {
|
|
||||||
return validate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValidate(Boolean validate) {
|
|
||||||
this.validate = validate;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,7 +4,6 @@ public class NodeDTO {
|
||||||
private String ip;
|
private String ip;
|
||||||
private Integer port;
|
private Integer port;
|
||||||
private Integer maxConcurrency;
|
private Integer maxConcurrency;
|
||||||
private Boolean validate;
|
|
||||||
|
|
||||||
public String getIp() {
|
public String getIp() {
|
||||||
return ip;
|
return ip;
|
||||||
|
@ -29,12 +28,4 @@ public class NodeDTO {
|
||||||
public void setMaxConcurrency(Integer maxConcurrency) {
|
public void setMaxConcurrency(Integer maxConcurrency) {
|
||||||
this.maxConcurrency = maxConcurrency;
|
this.maxConcurrency = maxConcurrency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getValidate() {
|
|
||||||
return validate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValidate(Boolean validate) {
|
|
||||||
this.validate = validate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package io.metersphere.dto;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.TestResource;
|
||||||
|
import io.metersphere.base.domain.TestResourcePool;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TestResourcePoolDTO extends TestResourcePool {
|
||||||
|
|
||||||
|
private List<TestResource> resources;
|
||||||
|
|
||||||
|
public List<TestResource> getResources() {
|
||||||
|
return resources;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResources(List<TestResource> resources) {
|
||||||
|
this.resources = resources;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package io.metersphere.engine;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||||
|
import io.metersphere.base.domain.TestResource;
|
||||||
|
import io.metersphere.base.domain.TestResourcePool;
|
||||||
|
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
||||||
|
import io.metersphere.commons.constants.TestStatus;
|
||||||
|
import io.metersphere.commons.exception.MSException;
|
||||||
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
|
import io.metersphere.service.LoadTestService;
|
||||||
|
import io.metersphere.service.TestResourcePoolService;
|
||||||
|
import io.metersphere.service.TestResourceService;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class AbstractEngine implements Engine {
|
||||||
|
protected LoadTestWithBLOBs loadTest;
|
||||||
|
protected LoadTestService loadTestService;
|
||||||
|
protected Integer threadNum;
|
||||||
|
protected List<TestResource> resourceList;
|
||||||
|
|
||||||
|
private TestResourcePoolService testResourcePoolService;
|
||||||
|
private TestResourceService testResourceService;
|
||||||
|
|
||||||
|
public AbstractEngine() {
|
||||||
|
testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
|
||||||
|
testResourceService = CommonBeanFactory.getBean(TestResourceService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(LoadTestWithBLOBs loadTest) {
|
||||||
|
if (loadTest == null) {
|
||||||
|
MSException.throwException("LoadTest is null.");
|
||||||
|
}
|
||||||
|
this.loadTest = loadTest;
|
||||||
|
|
||||||
|
this.loadTestService = CommonBeanFactory.getBean(LoadTestService.class);
|
||||||
|
|
||||||
|
threadNum = getThreadNum(loadTest);
|
||||||
|
String resourcePoolId = loadTest.getTestResourcePoolId();
|
||||||
|
if (StringUtils.isBlank(resourcePoolId)) {
|
||||||
|
MSException.throwException("Resource Pool ID is empty");
|
||||||
|
}
|
||||||
|
TestResourcePool resourcePool = testResourcePoolService.getResourcePool(resourcePoolId);
|
||||||
|
if (resourcePool == null) {
|
||||||
|
MSException.throwException("Resource Pool is empty");
|
||||||
|
}
|
||||||
|
if (!ResourcePoolTypeEnum.K8S.name().equals(resourcePool.getType())) {
|
||||||
|
MSException.throwException("Invalid Resource Pool type.");
|
||||||
|
}
|
||||||
|
this.resourceList = testResourceService.getResourcesByPoolId(resourcePool.getId());
|
||||||
|
if (CollectionUtils.isEmpty(this.resourceList)) {
|
||||||
|
MSException.throwException("Test Resource is empty");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Integer getRunningThreadNum() {
|
||||||
|
List<LoadTestWithBLOBs> loadTests = loadTestService.selectByTestResourcePoolId(loadTest.getTestResourcePoolId());
|
||||||
|
// 使用当前资源池正在运行的测试占用的并发数
|
||||||
|
return loadTests.stream()
|
||||||
|
.filter(t -> TestStatus.Running.name().equals(t.getStatus()))
|
||||||
|
.map(this::getThreadNum)
|
||||||
|
.reduce(Integer::sum)
|
||||||
|
.orElse(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getThreadNum(LoadTestWithBLOBs t) {
|
||||||
|
Integer s = 0;
|
||||||
|
String loadConfiguration = t.getLoadConfiguration();
|
||||||
|
JSONArray jsonArray = JSON.parseArray(loadConfiguration);
|
||||||
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
JSONObject o = jsonArray.getJSONObject(i);
|
||||||
|
if (StringUtils.equals(o.getString("key"), "TargetLevel")) {
|
||||||
|
s = o.getInteger("value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
package io.metersphere.engine;
|
package io.metersphere.engine;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||||
|
|
||||||
public interface Engine {
|
public interface Engine {
|
||||||
boolean init(EngineContext context);
|
boolean init(LoadTestWithBLOBs loadTest);
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ public class EngineContext {
|
||||||
private String namespace;
|
private String namespace;
|
||||||
private String fileType;
|
private String fileType;
|
||||||
private String content;
|
private String content;
|
||||||
|
private String resourcePoolId;
|
||||||
|
private Long threadNum;
|
||||||
private Map<String, Object> properties = new HashMap<>();
|
private Map<String, Object> properties = new HashMap<>();
|
||||||
private Map<String, String> testData = new HashMap<>();
|
private Map<String, String> testData = new HashMap<>();
|
||||||
|
|
||||||
|
@ -67,4 +69,20 @@ public class EngineContext {
|
||||||
public void setTestData(Map<String, String> testData) {
|
public void setTestData(Map<String, String> testData) {
|
||||||
this.testData = testData;
|
this.testData = testData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getResourcePoolId() {
|
||||||
|
return resourcePoolId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourcePoolId(String resourcePoolId) {
|
||||||
|
this.resourcePoolId = resourcePoolId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getThreadNum() {
|
||||||
|
return threadNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThreadNum(Long threadNum) {
|
||||||
|
this.threadNum = threadNum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.FileContent;
|
||||||
import io.metersphere.base.domain.FileMetadata;
|
import io.metersphere.base.domain.FileMetadata;
|
||||||
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||||
import io.metersphere.base.domain.TestResourcePool;
|
import io.metersphere.base.domain.TestResourcePool;
|
||||||
|
import io.metersphere.commons.constants.FileType;
|
||||||
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.engine.docker.DockerTestEngine;
|
import io.metersphere.engine.docker.DockerTestEngine;
|
||||||
|
@ -24,6 +25,7 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class EngineFactory {
|
public class EngineFactory {
|
||||||
|
@ -31,17 +33,7 @@ public class EngineFactory {
|
||||||
private static TestResourcePoolService testResourcePoolService;
|
private static TestResourcePoolService testResourcePoolService;
|
||||||
|
|
||||||
public static Engine createEngine(LoadTestWithBLOBs loadTest) {
|
public static Engine createEngine(LoadTestWithBLOBs loadTest) {
|
||||||
String resourcePoolId = null;
|
String resourcePoolId = loadTest.getTestResourcePoolId();
|
||||||
if (!StringUtils.isEmpty(loadTest.getLoadConfiguration())) {
|
|
||||||
final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration());
|
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
|
||||||
final JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
||||||
if (StringUtils.equals(jsonObject.getString("key"), "resourcePoolId")) {
|
|
||||||
resourcePoolId = jsonObject.getString("value");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StringUtils.isBlank(resourcePoolId)) {
|
if (StringUtils.isBlank(resourcePoolId)) {
|
||||||
MSException.throwException("Resource Pool ID is empty.");
|
MSException.throwException("Resource Pool ID is empty.");
|
||||||
}
|
}
|
||||||
|
@ -62,8 +54,18 @@ public class EngineFactory {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EngineContext createContext(LoadTestWithBLOBs loadTest, FileMetadata fileMetadata, List<FileMetadata> csvFiles) throws Exception {
|
public static EngineContext createContext(LoadTestWithBLOBs loadTest, long threadNum) throws Exception {
|
||||||
final FileContent fileContent = fileService.getFileContent(fileMetadata.getId());
|
final List<FileMetadata> fileMetadataList = fileService.getFileMetadataByTestId(loadTest.getId());
|
||||||
|
if (org.springframework.util.CollectionUtils.isEmpty(fileMetadataList)) {
|
||||||
|
MSException.throwException(Translator.get("run_load_test_file_not_found") + loadTest.getId());
|
||||||
|
}
|
||||||
|
FileMetadata jmxFile = fileMetadataList.stream().filter(f -> StringUtils.equalsIgnoreCase(f.getType(), FileType.JMX.name()))
|
||||||
|
.findFirst().orElseGet(() -> {
|
||||||
|
throw new RuntimeException(Translator.get("run_load_test_file_not_found") + loadTest.getId());
|
||||||
|
});
|
||||||
|
|
||||||
|
List<FileMetadata> csvFiles = fileMetadataList.stream().filter(f -> StringUtils.equalsIgnoreCase(f.getType(), FileType.CSV.name())).collect(Collectors.toList());
|
||||||
|
final FileContent fileContent = fileService.getFileContent(jmxFile.getId());
|
||||||
if (fileContent == null) {
|
if (fileContent == null) {
|
||||||
MSException.throwException(Translator.get("run_load_test_file_content_not_found") + loadTest.getId());
|
MSException.throwException(Translator.get("run_load_test_file_content_not_found") + loadTest.getId());
|
||||||
}
|
}
|
||||||
|
@ -71,7 +73,9 @@ public class EngineFactory {
|
||||||
engineContext.setTestId(loadTest.getId());
|
engineContext.setTestId(loadTest.getId());
|
||||||
engineContext.setTestName(loadTest.getName());
|
engineContext.setTestName(loadTest.getName());
|
||||||
engineContext.setNamespace(loadTest.getProjectId());
|
engineContext.setNamespace(loadTest.getProjectId());
|
||||||
engineContext.setFileType(fileMetadata.getType());
|
engineContext.setFileType(jmxFile.getType());
|
||||||
|
engineContext.setThreadNum(threadNum);
|
||||||
|
engineContext.setResourcePoolId(loadTest.getTestResourcePoolId());
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(loadTest.getLoadConfiguration())) {
|
if (!StringUtils.isEmpty(loadTest.getLoadConfiguration())) {
|
||||||
final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration());
|
final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration());
|
||||||
|
@ -88,8 +92,10 @@ public class EngineFactory {
|
||||||
MSException.throwException("File type unknown");
|
MSException.throwException("File type unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
String content = engineSourceParser.parse(engineContext, new ByteArrayInputStream(fileContent.getFile()));
|
try (ByteArrayInputStream source = new ByteArrayInputStream(fileContent.getFile())) {
|
||||||
engineContext.setContent(content);
|
String content = engineSourceParser.parse(engineContext, source);
|
||||||
|
engineContext.setContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(csvFiles)) {
|
if (CollectionUtils.isNotEmpty(csvFiles)) {
|
||||||
Map<String, String> data = new HashMap<>();
|
Map<String, String> data = new HashMap<>();
|
||||||
|
|
|
@ -1,32 +1,67 @@
|
||||||
package io.metersphere.engine.docker;
|
package io.metersphere.engine.docker;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||||
|
import io.metersphere.commons.constants.ResourceStatusEnum;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.controller.request.TestRequest;
|
import io.metersphere.controller.request.TestRequest;
|
||||||
import io.metersphere.engine.Engine;
|
import io.metersphere.dto.NodeDTO;
|
||||||
|
import io.metersphere.engine.AbstractEngine;
|
||||||
import io.metersphere.engine.EngineContext;
|
import io.metersphere.engine.EngineContext;
|
||||||
|
import io.metersphere.engine.EngineFactory;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class DockerTestEngine implements Engine {
|
public class DockerTestEngine extends AbstractEngine {
|
||||||
private EngineContext context;
|
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
RestTemplate restTemplate;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(EngineContext context) {
|
public boolean init(LoadTestWithBLOBs loadTest) {
|
||||||
|
super.init(loadTest);
|
||||||
this.restTemplate = CommonBeanFactory.getBean(RestTemplate.class);
|
this.restTemplate = CommonBeanFactory.getBean(RestTemplate.class);
|
||||||
// todo 初始化操作
|
// todo 初始化操作
|
||||||
this.context = context;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
|
Integer runningSumThreadNum = getRunningThreadNum();
|
||||||
|
Integer totalThreadNum = resourceList.stream()
|
||||||
|
.filter(r -> ResourceStatusEnum.VALID.name().equals(r.getStatus()))
|
||||||
|
.map(r -> JSON.parseObject(r.getConfiguration(), NodeDTO.class).getMaxConcurrency())
|
||||||
|
.reduce(Integer::sum)
|
||||||
|
.orElse(0);
|
||||||
|
if (threadNum > totalThreadNum - runningSumThreadNum) {
|
||||||
|
MSException.throwException("Insufficient resources");
|
||||||
|
}
|
||||||
|
List<Integer> resourceRatio = resourceList.stream()
|
||||||
|
.filter(r -> ResourceStatusEnum.VALID.name().equals(r.getStatus()))
|
||||||
|
.map(r -> JSON.parseObject(r.getConfiguration(), NodeDTO.class).getMaxConcurrency())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
resourceRatio.forEach(ratio -> {
|
||||||
|
double realThreadNum = ((double) ratio / totalThreadNum) * threadNum;
|
||||||
|
runTest(Math.round(realThreadNum));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runTest(long realThreadNum) {
|
||||||
// todo 运行测试
|
// todo 运行测试
|
||||||
// RestTemplate restTemplate = new RestTemplate();
|
EngineContext context = null;
|
||||||
|
try {
|
||||||
|
context = EngineFactory.createContext(loadTest, realThreadNum);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
String testId = context.getTestId();
|
String testId = context.getTestId();
|
||||||
String content = context.getContent();
|
String content = context.getContent();
|
||||||
|
|
||||||
|
@ -42,7 +77,7 @@ public class DockerTestEngine implements Engine {
|
||||||
List containerList = restTemplate.getForObject(taskStatusUri, List.class);
|
List containerList = restTemplate.getForObject(taskStatusUri, List.class);
|
||||||
for (int i = 0; i < containerList.size(); i++) {
|
for (int i = 0; i < containerList.size(); i++) {
|
||||||
HashMap h = (HashMap) containerList.get(i);
|
HashMap h = (HashMap) containerList.get(i);
|
||||||
if (StringUtils.equals((String)h.get("State"), "running")) {
|
if (StringUtils.equals((String) h.get("State"), "running")) {
|
||||||
MSException.throwException("the test is running!");
|
MSException.throwException("the test is running!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +90,7 @@ public class DockerTestEngine implements Engine {
|
||||||
// TODO 停止运行测试
|
// TODO 停止运行测试
|
||||||
// RestTemplate restTemplate = new RestTemplate();
|
// RestTemplate restTemplate = new RestTemplate();
|
||||||
|
|
||||||
String testId = context.getTestId();
|
String testId = loadTest.getId();
|
||||||
|
|
||||||
String uri = "http://localhost:8082/jmeter/container/stop/" + testId;
|
String uri = "http://localhost:8082/jmeter/container/stop/" + testId;
|
||||||
restTemplate.postForObject(uri, "", String.class);
|
restTemplate.postForObject(uri, "", String.class);
|
||||||
|
|
|
@ -4,41 +4,52 @@ import com.alibaba.fastjson.JSON;
|
||||||
import io.fabric8.kubernetes.api.model.ConfigMap;
|
import io.fabric8.kubernetes.api.model.ConfigMap;
|
||||||
import io.fabric8.kubernetes.api.model.ObjectMeta;
|
import io.fabric8.kubernetes.api.model.ObjectMeta;
|
||||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||||
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.engine.Engine;
|
import io.metersphere.engine.AbstractEngine;
|
||||||
import io.metersphere.engine.EngineContext;
|
import io.metersphere.engine.EngineContext;
|
||||||
|
import io.metersphere.engine.EngineFactory;
|
||||||
import io.metersphere.engine.kubernetes.crds.jmeter.Jmeter;
|
import io.metersphere.engine.kubernetes.crds.jmeter.Jmeter;
|
||||||
import io.metersphere.engine.kubernetes.crds.jmeter.JmeterSpec;
|
import io.metersphere.engine.kubernetes.crds.jmeter.JmeterSpec;
|
||||||
import io.metersphere.engine.kubernetes.provider.ClientCredential;
|
import io.metersphere.engine.kubernetes.provider.ClientCredential;
|
||||||
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
|
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
|
||||||
import io.metersphere.service.TestResourcePoolService;
|
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class KubernetesTestEngine implements Engine {
|
public class KubernetesTestEngine extends AbstractEngine {
|
||||||
private EngineContext context;
|
|
||||||
private TestResourcePoolService testResourcePoolService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean init(EngineContext context) {
|
public boolean init(LoadTestWithBLOBs loadTest) {
|
||||||
// todo 初始化操作
|
super.init(loadTest);
|
||||||
this.context = context;
|
|
||||||
this.testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
if (context == null) {
|
Integer sumThreadNum = getRunningThreadNum();
|
||||||
LogUtil.warn("Please initial the engine.");
|
// resourceList size 1
|
||||||
return;
|
resourceList.forEach(r -> {
|
||||||
}
|
String configuration = r.getConfiguration();
|
||||||
// todo 运行测试
|
ClientCredential clientCredential = JSON.parseObject(configuration, ClientCredential.class);
|
||||||
ClientCredential credential = new ClientCredential();
|
// 最大并发数
|
||||||
credential.setMasterUrl("https://172.16.10.93:6443");
|
Integer maxConcurrency = clientCredential.getMaxConcurrency();
|
||||||
|
// 当前测试需要的并发数大于剩余的并发数报错
|
||||||
|
if (threadNum > maxConcurrency - sumThreadNum) {
|
||||||
|
MSException.throwException("Insufficient resources");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
EngineContext context = EngineFactory.createContext(loadTest, threadNum);
|
||||||
|
runTest(context, clientCredential, 1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runTest(EngineContext context, ClientCredential credential, int replicas) {
|
||||||
KubernetesProvider kubernetesProvider = new KubernetesProvider(JSON.toJSONString(credential));
|
KubernetesProvider kubernetesProvider = new KubernetesProvider(JSON.toJSONString(credential));
|
||||||
// create namespace
|
// create namespace
|
||||||
kubernetesProvider.confirmNamespace(context.getNamespace());
|
kubernetesProvider.confirmNamespace(context.getNamespace());
|
||||||
|
@ -61,6 +72,7 @@ public class KubernetesTestEngine implements Engine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// create jmeter
|
// create jmeter
|
||||||
|
// todo image
|
||||||
try {
|
try {
|
||||||
Jmeter jmeter = new Jmeter();
|
Jmeter jmeter = new Jmeter();
|
||||||
jmeter.setMetadata(new ObjectMeta() {{
|
jmeter.setMetadata(new ObjectMeta() {{
|
||||||
|
@ -68,7 +80,7 @@ public class KubernetesTestEngine implements Engine {
|
||||||
setName(context.getTestId());
|
setName(context.getTestId());
|
||||||
}});
|
}});
|
||||||
jmeter.setSpec(new JmeterSpec() {{
|
jmeter.setSpec(new JmeterSpec() {{
|
||||||
setReplicas(1);
|
setReplicas(replicas);
|
||||||
setImage("registry.fit2cloud.com/metersphere/jmeter-master:0.0.2");
|
setImage("registry.fit2cloud.com/metersphere/jmeter-master:0.0.2");
|
||||||
}});
|
}});
|
||||||
LogUtil.info("Load test started. " + context.getTestId());
|
LogUtil.info("Load test started. " + context.getTestId());
|
||||||
|
|
|
@ -4,6 +4,7 @@ public class ClientCredential {
|
||||||
|
|
||||||
private String masterUrl;
|
private String masterUrl;
|
||||||
private String token;
|
private String token;
|
||||||
|
private Integer maxConcurrency;
|
||||||
|
|
||||||
public String getMasterUrl() {
|
public String getMasterUrl() {
|
||||||
return masterUrl;
|
return masterUrl;
|
||||||
|
@ -20,4 +21,12 @@ public class ClientCredential {
|
||||||
public void setToken(String token) {
|
public void setToken(String token) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getMaxConcurrency() {
|
||||||
|
return maxConcurrency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxConcurrency(Integer maxConcurrency) {
|
||||||
|
this.maxConcurrency = maxConcurrency;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,11 +233,10 @@ public class JmeterDocumentParser implements DocumentParser {
|
||||||
collectionProp.appendChild(createKafkaProp(document, "kafka.batch.size", kafkaProperties.getBatchSize()));
|
collectionProp.appendChild(createKafkaProp(document, "kafka.batch.size", kafkaProperties.getBatchSize()));
|
||||||
collectionProp.appendChild(createKafkaProp(document, "kafka.client.id", kafkaProperties.getClientId()));
|
collectionProp.appendChild(createKafkaProp(document, "kafka.client.id", kafkaProperties.getClientId()));
|
||||||
collectionProp.appendChild(createKafkaProp(document, "kafka.connections.max.idle.ms", kafkaProperties.getConnectionsMaxIdleMs()));
|
collectionProp.appendChild(createKafkaProp(document, "kafka.connections.max.idle.ms", kafkaProperties.getConnectionsMaxIdleMs()));
|
||||||
// 添加关联关系 test.id test.name test.startTime test.size
|
// 添加关联关系 test.id test.name test.startTime
|
||||||
collectionProp.appendChild(createKafkaProp(document, "test.id", context.getTestId()));
|
collectionProp.appendChild(createKafkaProp(document, "test.id", context.getTestId()));
|
||||||
collectionProp.appendChild(createKafkaProp(document, "test.name", context.getTestName()));
|
collectionProp.appendChild(createKafkaProp(document, "test.name", context.getTestName()));
|
||||||
collectionProp.appendChild(createKafkaProp(document, "test.startTime", "" + System.currentTimeMillis()));
|
collectionProp.appendChild(createKafkaProp(document, "test.startTime", "" + System.currentTimeMillis()));
|
||||||
collectionProp.appendChild(createKafkaProp(document, "test.size", "1"));
|
|
||||||
|
|
||||||
elementProp.appendChild(collectionProp);
|
elementProp.appendChild(collectionProp);
|
||||||
// set elementProp
|
// set elementProp
|
||||||
|
@ -314,7 +313,7 @@ public class JmeterDocumentParser implements DocumentParser {
|
||||||
threadGroup.appendChild(createStringProp(document, "LogFilename", ""));
|
threadGroup.appendChild(createStringProp(document, "LogFilename", ""));
|
||||||
threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
|
threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
|
||||||
// todo 单位是S 要修改 成M
|
// todo 单位是S 要修改 成M
|
||||||
threadGroup.appendChild(createStringProp(document, "Unit", "S"));
|
threadGroup.appendChild(createStringProp(document, "Unit", "M"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processCheckoutTimer(Element element) {
|
private void processCheckoutTimer(Element element) {
|
||||||
|
@ -387,6 +386,11 @@ public class JmeterDocumentParser implements DocumentParser {
|
||||||
if (nodeNameEquals(ele, STRING_PROP)) {
|
if (nodeNameEquals(ele, STRING_PROP)) {
|
||||||
parseStringProp(ele);
|
parseStringProp(ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置具体的线程数
|
||||||
|
if (nodeNameEquals(ele, STRING_PROP) && "TargetLevel".equals(ele.getAttribute("name"))) {
|
||||||
|
ele.getFirstChild().setNodeValue(context.getThreadNum().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,13 @@ import io.metersphere.report.base.RequestStatistics;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class JtlResolver {
|
public class JtlResolver {
|
||||||
|
|
||||||
private List<Metric> resolver(String jtlString) {
|
private static List<Metric> resolver(String jtlString) {
|
||||||
HeaderColumnNameMappingStrategy<Metric> ms = new HeaderColumnNameMappingStrategy<>();
|
HeaderColumnNameMappingStrategy<Metric> ms = new HeaderColumnNameMappingStrategy<>();
|
||||||
ms.setType(Metric.class);
|
ms.setType(Metric.class);
|
||||||
try (Reader reader = new StringReader(jtlString)) {
|
try (Reader reader = new StringReader(jtlString)) {
|
||||||
|
@ -32,7 +33,7 @@ public class JtlResolver {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<RequestStatistics> getOneRpsResult(Map<String, List<Metric>> map){
|
private static List<RequestStatistics> getOneRpsResult(Map<String, List<Metric>> map){
|
||||||
List<RequestStatistics> requestStatisticsList = new ArrayList<>();
|
List<RequestStatistics> requestStatisticsList = new ArrayList<>();
|
||||||
Iterator<Map.Entry<String, List<Metric>>> iterator = map.entrySet().iterator();
|
Iterator<Map.Entry<String, List<Metric>>> iterator = map.entrySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -45,7 +46,7 @@ public class JtlResolver {
|
||||||
int sumElapsed=0;
|
int sumElapsed=0;
|
||||||
Integer failSize = 0;
|
Integer failSize = 0;
|
||||||
Integer totalBytes = 0;
|
Integer totalBytes = 0;
|
||||||
List<Integer> elapsedList = new ArrayList<Integer>();
|
List<Integer> elapsedList = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
try {
|
try {
|
||||||
|
@ -83,8 +84,10 @@ public class JtlResolver {
|
||||||
|
|
||||||
RequestStatistics requestStatistics = new RequestStatistics();
|
RequestStatistics requestStatistics = new RequestStatistics();
|
||||||
requestStatistics.setRequestLabel(label);
|
requestStatistics.setRequestLabel(label);
|
||||||
requestStatistics.setSamples(index+"");
|
requestStatistics.setSamples(index);
|
||||||
requestStatistics.setAverage(sumElapsed/index+"");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
String s = df.format((float)sumElapsed/index);
|
||||||
|
requestStatistics.setAverage(s+"");
|
||||||
/**
|
/**
|
||||||
* TP90的计算
|
* TP90的计算
|
||||||
* 1,把一段时间内全部的请求的响应时间,从小到大排序,获得序列A
|
* 1,把一段时间内全部的请求的响应时间,从小到大排序,获得序列A
|
||||||
|
@ -104,7 +107,7 @@ public class JtlResolver {
|
||||||
return requestStatisticsList;
|
return requestStatisticsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RequestStatistics> getRequestStatistics(String jtlString) {
|
public static List<RequestStatistics> getRequestStatistics(String jtlString) {
|
||||||
List<Metric> totalLines = resolver(jtlString);
|
List<Metric> totalLines = resolver(jtlString);
|
||||||
Map<String, List<Metric>> map = totalLines.stream().collect(Collectors.groupingBy(Metric::getLabel));
|
Map<String, List<Metric>> map = totalLines.stream().collect(Collectors.groupingBy(Metric::getLabel));
|
||||||
return getOneRpsResult(map);
|
return getOneRpsResult(map);
|
||||||
|
|
|
@ -6,7 +6,7 @@ public class RequestStatistics {
|
||||||
private String requestLabel;
|
private String requestLabel;
|
||||||
|
|
||||||
/**压测请求数*/
|
/**压测请求数*/
|
||||||
private String samples;
|
private Integer samples;
|
||||||
|
|
||||||
/**平均响应时间*/
|
/**平均响应时间*/
|
||||||
private String average;
|
private String average;
|
||||||
|
@ -43,11 +43,11 @@ public class RequestStatistics {
|
||||||
this.requestLabel = requestLabel;
|
this.requestLabel = requestLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSamples() {
|
public Integer getSamples() {
|
||||||
return samples;
|
return samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSamples(String samples) {
|
public void setSamples(Integer samples) {
|
||||||
this.samples = samples;
|
this.samples = samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import io.metersphere.engine.Engine;
|
||||||
import io.metersphere.engine.EngineFactory;
|
import io.metersphere.engine.EngineFactory;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
@ -88,6 +87,7 @@ public class LoadTestService {
|
||||||
loadTest.setUpdateTime(System.currentTimeMillis());
|
loadTest.setUpdateTime(System.currentTimeMillis());
|
||||||
loadTest.setScenarioDefinition("todo");
|
loadTest.setScenarioDefinition("todo");
|
||||||
loadTest.setDescription("todo");
|
loadTest.setDescription("todo");
|
||||||
|
loadTest.setTestResourcePoolId(request.getTestResourcePoolId());
|
||||||
loadTest.setLoadConfiguration(request.getLoadConfiguration());
|
loadTest.setLoadConfiguration(request.getLoadConfiguration());
|
||||||
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
|
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
|
||||||
loadTestMapper.insert(loadTest);
|
loadTestMapper.insert(loadTest);
|
||||||
|
@ -154,6 +154,7 @@ public class LoadTestService {
|
||||||
loadTest.setDescription("todo");
|
loadTest.setDescription("todo");
|
||||||
loadTest.setLoadConfiguration(request.getLoadConfiguration());
|
loadTest.setLoadConfiguration(request.getLoadConfiguration());
|
||||||
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
|
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
|
||||||
|
loadTest.setTestResourcePoolId(request.getTestResourcePoolId());
|
||||||
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,27 +167,16 @@ public class LoadTestService {
|
||||||
MSException.throwException(Translator.get("run_load_test_not_found") + request.getId());
|
MSException.throwException(Translator.get("run_load_test_not_found") + request.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<FileMetadata> fileMetadataList = fileService.getFileMetadataByTestId(request.getId());
|
|
||||||
if (CollectionUtils.isEmpty(fileMetadataList)) {
|
|
||||||
MSException.throwException(Translator.get("run_load_test_file_not_found") + request.getId());
|
|
||||||
}
|
|
||||||
FileMetadata fileMetadata = fileMetadataList.stream().filter(f -> StringUtils.equalsIgnoreCase(f.getType(), FileType.JMX.name()))
|
|
||||||
.findFirst().orElseGet(() -> {
|
|
||||||
throw new RuntimeException(Translator.get("run_load_test_file_not_found") + request.getId());
|
|
||||||
});
|
|
||||||
|
|
||||||
List<FileMetadata> csvFiles = fileMetadataList.stream().filter(f -> StringUtils.equalsIgnoreCase(f.getType(), FileType.CSV.name())).collect(Collectors.toList());
|
|
||||||
|
|
||||||
LogUtil.info("Load test started " + loadTest.getName());
|
LogUtil.info("Load test started " + loadTest.getName());
|
||||||
// engine type (NODE|K8S)
|
// engine type (NODE|K8S)
|
||||||
final Engine engine = EngineFactory.createEngine(loadTest);
|
final Engine engine = EngineFactory.createEngine(loadTest);
|
||||||
if (engine == null) {
|
if (engine == null) {
|
||||||
MSException.throwException(String.format("Test cannot be run,test ID:%s,file type:%s", request.getId(), fileMetadata.getType()));
|
MSException.throwException(String.format("Test cannot be run,test ID:%s", request.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean init = true;
|
boolean init = true;
|
||||||
try {
|
try {
|
||||||
init = engine.init(EngineFactory.createContext(loadTest, fileMetadata, csvFiles));
|
init = engine.init(loadTest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MSException.throwException(e);
|
MSException.throwException(e);
|
||||||
}
|
}
|
||||||
|
@ -226,4 +216,10 @@ public class LoadTestService {
|
||||||
LoadTestWithBLOBs loadTestWithBLOBs = loadTestMapper.selectByPrimaryKey(testId);
|
LoadTestWithBLOBs loadTestWithBLOBs = loadTestMapper.selectByPrimaryKey(testId);
|
||||||
return Optional.ofNullable(loadTestWithBLOBs).orElse(new LoadTestWithBLOBs()).getLoadConfiguration();
|
return Optional.ofNullable(loadTestWithBLOBs).orElse(new LoadTestWithBLOBs()).getLoadConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LoadTestWithBLOBs> selectByTestResourcePoolId(String resourcePoolId) {
|
||||||
|
LoadTestExample example = new LoadTestExample();
|
||||||
|
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId);
|
||||||
|
return loadTestMapper.selectByExampleWithBLOBs(example);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import io.metersphere.base.mapper.LoadTestReportMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
|
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
|
||||||
import io.metersphere.controller.request.ReportRequest;
|
import io.metersphere.controller.request.ReportRequest;
|
||||||
import io.metersphere.dto.ReportDTO;
|
import io.metersphere.dto.ReportDTO;
|
||||||
|
import io.metersphere.report.JtlResolver;
|
||||||
|
import io.metersphere.report.base.RequestStatistics;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -42,7 +44,10 @@ public class ReportService {
|
||||||
return extLoadTestReportMapper.getReportTestAndProInfo(reportId);
|
return extLoadTestReportMapper.getReportTestAndProInfo(reportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoadTestReport getReport(String id) {
|
public List<RequestStatistics> getReport(String id) {
|
||||||
return loadTestReportMapper.selectByPrimaryKey(id);
|
LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||||
|
String content = loadTestReport.getContent();
|
||||||
|
List<RequestStatistics> requestStatistics = JtlResolver.getRequestStatistics(content);
|
||||||
|
return requestStatistics;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
package io.metersphere.service;
|
package io.metersphere.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import io.metersphere.base.domain.TestResource;
|
||||||
|
import io.metersphere.base.domain.TestResourceExample;
|
||||||
import io.metersphere.base.domain.TestResourcePool;
|
import io.metersphere.base.domain.TestResourcePool;
|
||||||
import io.metersphere.base.domain.TestResourcePoolExample;
|
import io.metersphere.base.mapper.TestResourceMapper;
|
||||||
import io.metersphere.base.mapper.TestResourcePoolMapper;
|
import io.metersphere.base.mapper.TestResourcePoolMapper;
|
||||||
|
import io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper;
|
||||||
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.constants.ResourceStatusEnum;
|
||||||
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||||
import io.metersphere.dto.KubernetesDTO;
|
|
||||||
import io.metersphere.dto.NodeDTO;
|
import io.metersphere.dto.NodeDTO;
|
||||||
import io.metersphere.engine.kubernetes.provider.ClientCredential;
|
import io.metersphere.dto.TestResourcePoolDTO;
|
||||||
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
|
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -30,40 +32,41 @@ import java.util.UUID;
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class TestResourcePoolService {
|
public class TestResourcePoolService {
|
||||||
|
|
||||||
private final static String nodeControllerUrl = "%s:%s/status";
|
private final static String nodeControllerUrl = "http://%s:%s/status";
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private TestResourcePoolMapper testResourcePoolMapper;
|
private TestResourcePoolMapper testResourcePoolMapper;
|
||||||
|
@Resource
|
||||||
|
private TestResourceMapper testResourceMapper;
|
||||||
|
@Resource
|
||||||
|
private ExtTestReourcePoolMapper extTestReourcePoolMapper;
|
||||||
|
|
||||||
public TestResourcePool addTestResourcePool(TestResourcePool testResourcePool) {
|
public TestResourcePoolDTO addTestResourcePool(TestResourcePoolDTO testResourcePool) {
|
||||||
testResourcePool.setId(UUID.randomUUID().toString());
|
testResourcePool.setId(UUID.randomUUID().toString());
|
||||||
testResourcePool.setCreateTime(System.currentTimeMillis());
|
testResourcePool.setCreateTime(System.currentTimeMillis());
|
||||||
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||||
testResourcePool.setStatus("1");
|
testResourcePool.setStatus(ResourceStatusEnum.VALID.name());
|
||||||
validateTestResourcePool(testResourcePool);
|
validateTestResourcePool(testResourcePool);
|
||||||
testResourcePoolMapper.insertSelective(testResourcePool);
|
testResourcePoolMapper.insertSelective(testResourcePool);
|
||||||
return testResourcePool;
|
return testResourcePool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteTestResourcePool(String testResourcePoolId) {
|
public void deleteTestResourcePool(String testResourcePoolId) {
|
||||||
|
deleteTestResource(testResourcePoolId);
|
||||||
testResourcePoolMapper.deleteByPrimaryKey(testResourcePoolId);
|
testResourcePoolMapper.deleteByPrimaryKey(testResourcePoolId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTestResourcePool(TestResourcePool testResourcePool) {
|
public void updateTestResourcePool(TestResourcePoolDTO testResourcePool) {
|
||||||
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||||
validateTestResourcePool(testResourcePool);
|
validateTestResourcePool(testResourcePool);
|
||||||
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestResourcePool> listResourcePools(QueryResourcePoolRequest request) {
|
public List<TestResourcePoolDTO> listResourcePools(QueryResourcePoolRequest request) {
|
||||||
TestResourcePoolExample example = new TestResourcePoolExample();
|
return extTestReourcePoolMapper.listResourcePools(request);
|
||||||
if (!StringUtils.isEmpty(request.getName())) {
|
|
||||||
example.createCriteria().andNameLike("%" + request.getName() + "%");
|
|
||||||
}
|
|
||||||
return testResourcePoolMapper.selectByExample(example);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateTestResourcePool(TestResourcePool testResourcePool) {
|
private void validateTestResourcePool(TestResourcePoolDTO testResourcePool) {
|
||||||
if (StringUtils.equalsIgnoreCase(testResourcePool.getType(), ResourcePoolTypeEnum.K8S.name())) {
|
if (StringUtils.equalsIgnoreCase(testResourcePool.getType(), ResourcePoolTypeEnum.K8S.name())) {
|
||||||
validateK8s(testResourcePool);
|
validateK8s(testResourcePool);
|
||||||
return;
|
return;
|
||||||
|
@ -71,47 +74,69 @@ public class TestResourcePoolService {
|
||||||
validateNodes(testResourcePool);
|
validateNodes(testResourcePool);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateNodes(TestResourcePool testResourcePool) {
|
private void validateNodes(TestResourcePoolDTO testResourcePool) {
|
||||||
List<NodeDTO> nodes = JSON.parseArray(testResourcePool.getInfo(), NodeDTO.class);
|
if (CollectionUtils.isEmpty(testResourcePool.getResources())) {
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(nodes)) {
|
|
||||||
throw new RuntimeException("没有节点信息");
|
throw new RuntimeException("没有节点信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NodeDTO node : nodes) {
|
deleteTestResource(testResourcePool.getId());
|
||||||
boolean isValidate = validateNode(node);
|
for (TestResource resource : testResourcePool.getResources()) {
|
||||||
|
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
|
||||||
|
boolean isValidate = validateNode(nodeDTO);
|
||||||
if (!isValidate) {
|
if (!isValidate) {
|
||||||
testResourcePool.setStatus("0");
|
testResourcePool.setStatus(ResourceStatusEnum.INVALID.name());
|
||||||
|
resource.setStatus(ResourceStatusEnum.INVALID.name());
|
||||||
|
} else {
|
||||||
|
resource.setStatus(ResourceStatusEnum.VALID.name());
|
||||||
}
|
}
|
||||||
node.setValidate(isValidate);
|
resource.setTestResourcePoolId(testResourcePool.getId());
|
||||||
|
updateTestResource(resource);
|
||||||
|
|
||||||
}
|
}
|
||||||
testResourcePool.setInfo(JSON.toJSONString(nodes));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateNode(NodeDTO dto) {
|
private boolean validateNode(NodeDTO node) {
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
try {
|
||||||
ResponseEntity<String> entity = restTemplate.getForEntity(String.format(nodeControllerUrl, dto.getIp(), dto.getPort()), String.class);
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
return entity.getStatusCode().value() == HttpStatus.SC_OK;
|
ResponseEntity<String> entity = restTemplate.getForEntity(String.format(nodeControllerUrl, node.getIp(), node.getPort()), String.class);
|
||||||
|
return entity.getStatusCode().value() == HttpStatus.SC_OK;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateK8s(TestResourcePool testResourcePool) {
|
private void validateK8s(TestResourcePoolDTO testResourcePool) {
|
||||||
List<KubernetesDTO> dtos = JSON.parseArray(testResourcePool.getInfo(), KubernetesDTO.class);
|
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(dtos) || dtos.size() != 1) {
|
if (CollectionUtils.isEmpty(testResourcePool.getResources()) || testResourcePool.getResources().size() != 1) {
|
||||||
throw new RuntimeException("只能添加一个 K8s");
|
throw new RuntimeException("只能添加一个 K8s");
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientCredential clientCredential = new ClientCredential();
|
TestResource testResource = testResourcePool.getResources().get(0);
|
||||||
BeanUtils.copyBean(clientCredential, dtos.get(0));
|
testResource.setTestResourcePoolId(testResourcePool.getId());
|
||||||
try {
|
try {
|
||||||
KubernetesProvider provider = new KubernetesProvider(JSON.toJSONString(clientCredential));
|
KubernetesProvider provider = new KubernetesProvider(testResource.getConfiguration());
|
||||||
provider.validateCredential();
|
provider.validateCredential();
|
||||||
dtos.get(0).setValidate(true);
|
testResource.setStatus(ResourceStatusEnum.VALID.name());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
dtos.get(0).setValidate(false);
|
testResource.setStatus(ResourceStatusEnum.INVALID.name());
|
||||||
testResourcePool.setStatus("0");
|
testResourcePool.setStatus(ResourceStatusEnum.INVALID.name());
|
||||||
}
|
}
|
||||||
testResourcePool.setInfo(JSON.toJSONString(dtos));
|
deleteTestResource(testResourcePool.getId());
|
||||||
|
updateTestResource(testResource);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTestResource(TestResource testResource) {
|
||||||
|
testResource.setUpdateTime(System.currentTimeMillis());
|
||||||
|
testResource.setCreateTime(System.currentTimeMillis());
|
||||||
|
testResource.setId(UUID.randomUUID().toString());
|
||||||
|
testResourceMapper.insertSelective(testResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteTestResource(String testResourcePoolId) {
|
||||||
|
TestResourceExample testResourceExample = new TestResourceExample();
|
||||||
|
testResourceExample.createCriteria().andTestResourcePoolIdEqualTo(testResourcePoolId);
|
||||||
|
testResourceMapper.deleteByExample(testResourceExample);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestResourcePool getResourcePool(String resourcePoolId) {
|
public TestResourcePool getResourcePool(String resourcePoolId) {
|
||||||
|
|
|
@ -41,4 +41,10 @@ public class TestResourceService {
|
||||||
testResource.setUpdateTime(System.currentTimeMillis());
|
testResource.setUpdateTime(System.currentTimeMillis());
|
||||||
testResourceMapper.updateByPrimaryKeySelective(testResource);
|
testResourceMapper.updateByPrimaryKeySelective(testResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TestResource> getResourcesByPoolId(String resourcePoolId) {
|
||||||
|
TestResourceExample example = new TestResourceExample();
|
||||||
|
example.createCriteria().andTestResourcePoolIdEqualTo(resourcePoolId);
|
||||||
|
return testResourceMapper.selectByExampleWithBLOBs(example);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ CREATE TABLE IF NOT EXISTS `load_test` (
|
||||||
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
|
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
|
||||||
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
|
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
|
||||||
`status` varchar(64) DEFAULT NULL COMMENT 'Test Status Running, Completed, Error, etc.',
|
`status` varchar(64) DEFAULT NULL COMMENT 'Test Status Running, Completed, Error, etc.',
|
||||||
|
`test_resource_pool_id` varchar(50) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
)
|
)
|
||||||
ENGINE = InnoDB
|
ENGINE = InnoDB
|
||||||
|
@ -112,8 +113,6 @@ CREATE TABLE IF NOT EXISTS `system_parameter` (
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `test_resource` (
|
CREATE TABLE IF NOT EXISTS `test_resource` (
|
||||||
`id` varchar(50) NOT NULL COMMENT 'Test resource ID',
|
`id` varchar(50) NOT NULL COMMENT 'Test resource ID',
|
||||||
`test_resource_pool_id` varchar(50) NOT NULL COMMENT 'Test resource pool ID this test resource belongs to',
|
|
||||||
`name` varchar(64) NOT NULL COMMENT 'Test resource name',
|
|
||||||
`description` varchar(255) DEFAULT NULL COMMENT 'Test resource description',
|
`description` varchar(255) DEFAULT NULL COMMENT 'Test resource description',
|
||||||
`configuration` longtext COMMENT 'Test resource configuration',
|
`configuration` longtext COMMENT 'Test resource configuration',
|
||||||
`status` varchar(64) NOT NULL COMMENT 'Test resource status',
|
`status` varchar(64) NOT NULL COMMENT 'Test resource status',
|
||||||
|
@ -128,6 +127,7 @@ CREATE TABLE IF NOT EXISTS `test_resource` (
|
||||||
CREATE TABLE IF NOT EXISTS `test_resource_pool` (
|
CREATE TABLE IF NOT EXISTS `test_resource_pool` (
|
||||||
`id` varchar(50) NOT NULL COMMENT 'Test resource pool ID',
|
`id` varchar(50) NOT NULL COMMENT 'Test resource pool ID',
|
||||||
`name` varchar(64) NOT NULL COMMENT 'Test resource pool name',
|
`name` varchar(64) NOT NULL COMMENT 'Test resource pool name',
|
||||||
|
`type` varchar(30) NOT NULL COMMENT 'Test resource pool type',
|
||||||
`description` varchar(255) DEFAULT NULL COMMENT 'Test resource pool description',
|
`description` varchar(255) DEFAULT NULL COMMENT 'Test resource pool description',
|
||||||
`status` varchar(64) NOT NULL COMMENT 'Test resource pool status',
|
`status` varchar(64) NOT NULL COMMENT 'Test resource pool status',
|
||||||
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
|
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
|
||||||
|
|
|
@ -199,6 +199,7 @@ public class JtlTest {
|
||||||
"1584602504095,65,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-7,text,false,,4469,1745,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,65,0,4\n" +
|
"1584602504095,65,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate?session_code=YWUneSay4qlQuHRZsD4kPaZDIIR50KJLaNpW7uhsD-Q&execution=c7620733-54ab-46b2-802b-66764e42682b&client_id=cmp-client&tab_id=S8xOQPgCmhQ,400,Bad Request,Thread Group 1-7,text,false,,4469,1745,3,3,https://rddev2.fit2cloud.com/auth/realms/cmp/login-actions/authenticate,65,0,4\n" +
|
||||||
"1584602504200,12,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,200,OK,Thread Group 1-3,text,true,,1570,582,2,2,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,12,0,0\n";
|
"1584602504200,12,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,200,OK,Thread Group 1-3,text,true,,1570,582,2,2,https://rddev2.fit2cloud.com/dashboard/web-public/project/html/notification-menus.html?_t=1577351137654,12,0,0\n";
|
||||||
List<Metric> metrics = beanBuilderExample(jtlString);
|
List<Metric> metrics = beanBuilderExample(jtlString);
|
||||||
|
// 根据label分组,label作为map的key
|
||||||
Map<String, List<Metric>> map = metrics.stream().collect(Collectors.groupingBy(Metric::getLabel));
|
Map<String, List<Metric>> map = metrics.stream().collect(Collectors.groupingBy(Metric::getLabel));
|
||||||
getOneRpsResult(map);
|
getOneRpsResult(map);
|
||||||
}
|
}
|
||||||
|
@ -215,7 +216,8 @@ public class JtlTest {
|
||||||
int sumElapsed=0;
|
int sumElapsed=0;
|
||||||
Integer failSize = 0;
|
Integer failSize = 0;
|
||||||
Integer totalBytes = 0;
|
Integer totalBytes = 0;
|
||||||
List<Integer> elapsedList = new ArrayList<Integer>();
|
// 响应时间的列表排序之后 用于计算90%line、95%line、99line
|
||||||
|
List<Integer> elapsedList = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
try {
|
try {
|
||||||
|
@ -253,8 +255,8 @@ public class JtlTest {
|
||||||
|
|
||||||
RequestStatistics sceneResult = new RequestStatistics();
|
RequestStatistics sceneResult = new RequestStatistics();
|
||||||
sceneResult.setRequestLabel(label);
|
sceneResult.setRequestLabel(label);
|
||||||
sceneResult.setSamples(index+"");
|
sceneResult.setSamples(index);
|
||||||
sceneResult.setAverage(sumElapsed/index+"");
|
// sceneResult.setAverage(sumElapsed/index);
|
||||||
sceneResult.setTp90(elapsedList.get(tp90)+"");
|
sceneResult.setTp90(elapsedList.get(tp90)+"");
|
||||||
sceneResult.setTp95(elapsedList.get(tp95)+"");
|
sceneResult.setTp95(elapsedList.get(tp95)+"");
|
||||||
sceneResult.setTp99(elapsedList.get(tp99)+"");
|
sceneResult.setTp99(elapsedList.get(tp99)+"");
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package io.metersphere.service;
|
||||||
|
|
||||||
|
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||||
|
import io.metersphere.dto.TestResourcePoolDTO;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class TestResourcePoolServiceTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TestResourcePoolService testResourcePoolService;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void listResourcePools() {
|
||||||
|
List<TestResourcePoolDTO> list = testResourcePoolService.listResourcePools(new QueryResourcePoolRequest());
|
||||||
|
System.out.println(list.size());
|
||||||
|
}
|
||||||
|
}
|
|
@ -160,6 +160,7 @@
|
||||||
this.testPlan.updatedFileList = this.$refs.basicConfig.updatedFileList();
|
this.testPlan.updatedFileList = this.$refs.basicConfig.updatedFileList();
|
||||||
// 压力配置
|
// 压力配置
|
||||||
this.testPlan.loadConfiguration = JSON.stringify(this.$refs.pressureConfig.convertProperty());
|
this.testPlan.loadConfiguration = JSON.stringify(this.$refs.pressureConfig.convertProperty());
|
||||||
|
this.testPlan.testResourcePoolId = this.$refs.pressureConfig.resourcePool;
|
||||||
// 高级配置
|
// 高级配置
|
||||||
this.testPlan.advancedConfiguration = JSON.stringify(this.$refs.advancedConfig.configurations());
|
this.testPlan.advancedConfiguration = JSON.stringify(this.$refs.advancedConfig.configurations());
|
||||||
|
|
||||||
|
|
|
@ -104,13 +104,12 @@
|
||||||
const STEPS = "Steps";
|
const STEPS = "Steps";
|
||||||
const DURATION = "duration";
|
const DURATION = "duration";
|
||||||
const RPS_LIMIT = "rpsLimit";
|
const RPS_LIMIT = "rpsLimit";
|
||||||
const RESOURCE_POOL = "resourcePoolId";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PerformancePressureConfig",
|
name: "PerformancePressureConfig",
|
||||||
|
props: ['testPlan'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
testPlan: {},
|
|
||||||
threadNumber: 10,
|
threadNumber: 10,
|
||||||
duration: 10,
|
duration: 10,
|
||||||
rampUpTime: 10,
|
rampUpTime: 10,
|
||||||
|
@ -128,7 +127,7 @@
|
||||||
} else {
|
} else {
|
||||||
this.calculateChart();
|
this.calculateChart();
|
||||||
}
|
}
|
||||||
|
this.resourcePool = this.testPlan.testResourcePoolId;
|
||||||
this.getResourcePools();
|
this.getResourcePools();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -142,6 +141,9 @@
|
||||||
} else {
|
} else {
|
||||||
this.calculateChart();
|
this.calculateChart();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
testPlan(n) {
|
||||||
|
this.resourcePool = n.testResourcePoolId;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -174,9 +176,6 @@
|
||||||
case RPS_LIMIT:
|
case RPS_LIMIT:
|
||||||
this.rpsLimit = d.value;
|
this.rpsLimit = d.value;
|
||||||
break;
|
break;
|
||||||
case RESOURCE_POOL:
|
|
||||||
this.resourcePool = d.value;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +298,6 @@
|
||||||
{key: STEPS, value: this.step},
|
{key: STEPS, value: this.step},
|
||||||
{key: DURATION, value: this.duration},
|
{key: DURATION, value: this.duration},
|
||||||
{key: RPS_LIMIT, value: this.rpsLimit},
|
{key: RPS_LIMIT, value: this.rpsLimit},
|
||||||
{key: RESOURCE_POOL, value: this.resourcePool},
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<ms-report-test-overview />
|
<ms-report-test-overview />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('report.test_request_statistics')">
|
<el-tab-pane :label="$t('report.test_request_statistics')">
|
||||||
<ms-report-request-statistics />
|
<ms-report-request-statistics :id="reportId"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('report.test_error_log')">
|
<el-tab-pane :label="$t('report.test_error_log')">
|
||||||
<ms-report-error-log />
|
<ms-report-error-log />
|
||||||
|
|
|
@ -2,78 +2,73 @@
|
||||||
<div>
|
<div>
|
||||||
<el-table
|
<el-table
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
|
stripe
|
||||||
border
|
border
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:default-sort = "{prop: 'elementLabel'}"
|
show-summary
|
||||||
|
:default-sort = "{prop: 'samples', order: 'descending'}"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<el-table-column label="Requests" fixed width="450" align="center">
|
||||||
prop="elementLabel"
|
<el-table-column
|
||||||
label="Element Label"
|
prop="requestLabel"
|
||||||
fixed
|
label="Label"
|
||||||
width="150"
|
width="450"/>
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
|
||||||
prop="samples"
|
<el-table-column label="Executions" align="center">
|
||||||
label="Samples"
|
<el-table-column
|
||||||
width="150"
|
prop="samples"
|
||||||
sortable>
|
label="Samples"
|
||||||
|
sortable
|
||||||
|
width="110"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="errors"
|
||||||
|
label="Error%"
|
||||||
|
align="center"
|
||||||
|
fixed="right"/>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
|
||||||
prop="avgResponseTime"
|
<el-table-column label="Response Times(ms)" align="center">
|
||||||
label="Avg Response Time(ms)"
|
<el-table-column
|
||||||
width="220"
|
prop="average"
|
||||||
sortable>
|
label="Average"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="min"
|
||||||
|
label="Min"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="max"
|
||||||
|
label="Max"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="tp90"
|
||||||
|
label="90% line"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="tp95"
|
||||||
|
label="95% line"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
prop="tp99"
|
||||||
|
label="99% line"
|
||||||
|
/>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<!-- <el-table-column-->
|
||||||
|
<!-- prop="avgHits"-->
|
||||||
|
<!-- label="Avg Hits/s"-->
|
||||||
|
<!-- width="150"-->
|
||||||
|
<!-- />-->
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="avgHits"
|
prop="kbPerSec"
|
||||||
label="Avg Hits/s"
|
|
||||||
width="150"
|
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="90line"
|
|
||||||
label="90% line(ms)"
|
|
||||||
width="150"
|
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="95line"
|
|
||||||
label="95% line(ms)"
|
|
||||||
width="150"
|
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="99line"
|
|
||||||
label="99% line(ms)"
|
|
||||||
width="150"
|
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="minResponseTime"
|
|
||||||
label="Min Response Time(ms)"
|
|
||||||
width="220"
|
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="maxResponseTime"
|
|
||||||
label="Max Response Time(ms)"
|
|
||||||
width="220"
|
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="avgBandwidth"
|
|
||||||
label="Avg Bandwidth(KBytes/s)"
|
label="Avg Bandwidth(KBytes/s)"
|
||||||
width="220"
|
align="center"
|
||||||
sortable>
|
width="200"
|
||||||
</el-table-column>
|
/>
|
||||||
<el-table-column
|
|
||||||
prop="errorPercentage"
|
|
||||||
label="Error Percentage"
|
|
||||||
width="180"
|
|
||||||
fixed="right"
|
|
||||||
sortable>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -83,11 +78,29 @@
|
||||||
name: "RequestStatistics",
|
name: "RequestStatistics",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableData: [{},{},{},{},{}]
|
tableData: [{},{},{},{},{}],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initTableData() {
|
||||||
|
this.$get("/report/content/" + this.id, res => {
|
||||||
|
this.tableData = res.data;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initTableData()
|
||||||
|
},
|
||||||
|
props: ['id'],
|
||||||
|
watch: {
|
||||||
|
'$route'(to) {
|
||||||
|
let reportId = to.path.split('/')[4];
|
||||||
|
if(reportId){
|
||||||
|
this.$get("/report/content/" + reportId, res => {
|
||||||
|
this.tableData = res.data;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
<el-switch v-model="scope.row.status"
|
<el-switch v-model="scope.row.status"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
inactive-color="#ff4949"
|
inactive-color="#ff4949"
|
||||||
active-value="1"
|
active-value="VALID"
|
||||||
inactive-value="0"
|
inactive-value="INVALID"
|
||||||
@change="changeSwitch(scope.row)"
|
@change="changeSwitch(scope.row)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-dialog v-loading="testLoading" title="创建资源池" :visible.sync="createVisible" width="70%" @closed="closeFunc"
|
<el-dialog title="创建资源池" :visible.sync="createVisible" width="70%" @closed="closeFunc"
|
||||||
:destroy-on-close="true">
|
:destroy-on-close="true">
|
||||||
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
||||||
ref="createTestResourcePoolForm">
|
ref="createTestResourcePoolForm">
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog v-loading="testLoading" title="修改资源池" :visible.sync="updateVisible" width="70%" :destroy-on-close="true"
|
<el-dialog title="修改资源池" :visible.sync="updateVisible" width="70%" :destroy-on-close="true"
|
||||||
@close="closeFunc">
|
@close="closeFunc">
|
||||||
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
||||||
ref="updateTestResourcePoolForm">
|
ref="updateTestResourcePoolForm">
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
rule: {
|
rule: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: '请输入资源池名称', trigger: 'blur'},
|
{required: true, message: '请输入资源池名称', trigger: 'blur'},
|
||||||
{min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur'},
|
{min: 2, max: 64, message: this.$t('commons.input_limit', [2, 64]), trigger: 'blur'},
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||||
|
@ -334,11 +334,18 @@
|
||||||
this.createVisible = true;
|
this.createVisible = true;
|
||||||
},
|
},
|
||||||
edit(row) {
|
edit(row) {
|
||||||
window.console.log(row);
|
|
||||||
// this.loading = true;
|
|
||||||
this.updateVisible = true;
|
this.updateVisible = true;
|
||||||
this.form = JSON.parse(JSON.stringify(row));
|
this.form = JSON.parse(JSON.stringify(row));
|
||||||
this.infoList = JSON.parse(this.form.info);
|
this.convertResources();
|
||||||
|
},
|
||||||
|
convertResources() {
|
||||||
|
let resources = [];
|
||||||
|
if (this.form.resources) {
|
||||||
|
this.form.resources.forEach(function (resource) {
|
||||||
|
resources.push(JSON.parse(resource.configuration));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.infoList = resources;
|
||||||
},
|
},
|
||||||
del(row) {
|
del(row) {
|
||||||
window.console.log(row);
|
window.console.log(row);
|
||||||
|
@ -367,7 +374,7 @@
|
||||||
let vri = this.validateResourceInfo();
|
let vri = this.validateResourceInfo();
|
||||||
if (vri.validate) {
|
if (vri.validate) {
|
||||||
this.testLoading = true;
|
this.testLoading = true;
|
||||||
this.form.info = JSON.stringify(this.infoList);
|
this.convertSubmitResources();
|
||||||
this.$post("/testresourcepool/add", this.form)
|
this.$post("/testresourcepool/add", this.form)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
@ -392,13 +399,25 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
convertSubmitResources() {
|
||||||
|
let resources = [];
|
||||||
|
let poolId = this.form.id;
|
||||||
|
this.infoList.forEach(function (info) {
|
||||||
|
let resource = {"configuration": JSON.stringify(info)};
|
||||||
|
if (poolId) {
|
||||||
|
resource.testResourcePoolId = poolId;
|
||||||
|
}
|
||||||
|
resources.push(resource);
|
||||||
|
});
|
||||||
|
this.form.resources = resources;
|
||||||
|
},
|
||||||
updateTestResourcePool(updateTestResourcePoolForm) {
|
updateTestResourcePool(updateTestResourcePoolForm) {
|
||||||
this.$refs[updateTestResourcePoolForm].validate(valide => {
|
this.$refs[updateTestResourcePoolForm].validate(valide => {
|
||||||
if (valide) {
|
if (valide) {
|
||||||
this.testLoading = true;
|
this.testLoading = true;
|
||||||
let vri = this.validateResourceInfo();
|
let vri = this.validateResourceInfo();
|
||||||
if (vri.validate) {
|
if (vri.validate) {
|
||||||
this.form.info = JSON.stringify(this.infoList);
|
this.convertSubmitResources();
|
||||||
this.$post("/testresourcepool/update", this.form)
|
this.$post("/testresourcepool/update", this.form)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
|
Loading…
Reference in New Issue