set report id
This commit is contained in:
parent
5d4c53e15b
commit
bc1dc869f6
|
@ -9,16 +9,12 @@ public class LoadTestReport implements Serializable {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
|
|
||||||
private Long updateTime;
|
private Long updateTime;
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -45,14 +41,6 @@ public class LoadTestReport implements Serializable {
|
||||||
this.name = name == null ? null : name.trim();
|
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 Long getCreateTime() {
|
public Long getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +64,4 @@ public class LoadTestReport 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 getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content == null ? null : content.trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -314,76 +314,6 @@ public class LoadTestReportExample {
|
||||||
return (Criteria) this;
|
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 andCreateTimeIsNull() {
|
public Criteria andCreateTimeIsNull() {
|
||||||
addCriterion("create_time is null");
|
addCriterion("create_time is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.base.mapper;
|
||||||
|
|
||||||
import io.metersphere.base.domain.LoadTestReport;
|
import io.metersphere.base.domain.LoadTestReport;
|
||||||
import io.metersphere.base.domain.LoadTestReportExample;
|
import io.metersphere.base.domain.LoadTestReportExample;
|
||||||
|
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,25 +14,25 @@ public interface LoadTestReportMapper {
|
||||||
|
|
||||||
int deleteByPrimaryKey(String id);
|
int deleteByPrimaryKey(String id);
|
||||||
|
|
||||||
int insert(LoadTestReport record);
|
int insert(LoadTestReportWithBLOBs record);
|
||||||
|
|
||||||
int insertSelective(LoadTestReport record);
|
int insertSelective(LoadTestReportWithBLOBs record);
|
||||||
|
|
||||||
List<LoadTestReport> selectByExampleWithBLOBs(LoadTestReportExample example);
|
List<LoadTestReportWithBLOBs> selectByExampleWithBLOBs(LoadTestReportExample example);
|
||||||
|
|
||||||
List<LoadTestReport> selectByExample(LoadTestReportExample example);
|
List<LoadTestReport> selectByExample(LoadTestReportExample example);
|
||||||
|
|
||||||
LoadTestReport selectByPrimaryKey(String id);
|
LoadTestReportWithBLOBs selectByPrimaryKey(String id);
|
||||||
|
|
||||||
int updateByExampleSelective(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
|
int updateByExampleSelective(@Param("record") LoadTestReportWithBLOBs record, @Param("example") LoadTestReportExample example);
|
||||||
|
|
||||||
int updateByExampleWithBLOBs(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
|
int updateByExampleWithBLOBs(@Param("record") LoadTestReportWithBLOBs record, @Param("example") LoadTestReportExample example);
|
||||||
|
|
||||||
int updateByExample(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
|
int updateByExample(@Param("record") LoadTestReport record, @Param("example") LoadTestReportExample example);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(LoadTestReport record);
|
int updateByPrimaryKeySelective(LoadTestReportWithBLOBs record);
|
||||||
|
|
||||||
int updateByPrimaryKeyWithBLOBs(LoadTestReport record);
|
int updateByPrimaryKeyWithBLOBs(LoadTestReportWithBLOBs record);
|
||||||
|
|
||||||
int updateByPrimaryKey(LoadTestReport record);
|
int updateByPrimaryKey(LoadTestReport record);
|
||||||
}
|
}
|
|
@ -5,12 +5,12 @@
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
<result column="test_id" jdbcType="VARCHAR" property="testId" />
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
|
||||||
<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" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReport">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportWithBLOBs">
|
||||||
|
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||||
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
|
@ -72,10 +72,10 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, test_id, name, description, create_time, update_time, status
|
id, test_id, name, create_time, update_time, status
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
content
|
description, content
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultMap="ResultMapWithBLOBs">
|
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportExample" resultMap="ResultMapWithBLOBs">
|
||||||
select
|
select
|
||||||
|
@ -125,15 +125,15 @@
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReport">
|
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs">
|
||||||
insert into load_test_report (id, test_id, name,
|
insert into load_test_report (id, test_id, name,
|
||||||
description, create_time, update_time,
|
create_time, update_time, status,
|
||||||
status, content)
|
description, content)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||||
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
|
||||||
#{status,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
|
#{description,jdbcType=LONGVARCHAR}, #{content,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReport">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs">
|
||||||
insert into load_test_report
|
insert into load_test_report
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -145,9 +145,6 @@
|
||||||
<if test="name != null">
|
<if test="name != null">
|
||||||
name,
|
name,
|
||||||
</if>
|
</if>
|
||||||
<if test="description != null">
|
|
||||||
description,
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
|
@ -157,6 +154,9 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status,
|
status,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="description != null">
|
||||||
|
description,
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
content,
|
content,
|
||||||
</if>
|
</if>
|
||||||
|
@ -171,9 +171,6 @@
|
||||||
<if test="name != null">
|
<if test="name != null">
|
||||||
#{name,jdbcType=VARCHAR},
|
#{name,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="description != null">
|
|
||||||
#{description,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
#{createTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
@ -183,6 +180,9 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
#{status,jdbcType=VARCHAR},
|
#{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="description != null">
|
||||||
|
#{description,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
#{content,jdbcType=LONGVARCHAR},
|
#{content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -206,9 +206,6 @@
|
||||||
<if test="record.name != null">
|
<if test="record.name != null">
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
name = #{record.name,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.description != null">
|
|
||||||
description = #{record.description,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>
|
||||||
|
@ -218,6 +215,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.description != null">
|
||||||
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.content != null">
|
<if test="record.content != null">
|
||||||
content = #{record.content,jdbcType=LONGVARCHAR},
|
content = #{record.content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -231,10 +231,10 @@
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
name = #{record.name,jdbcType=VARCHAR},
|
||||||
description = #{record.description,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},
|
||||||
|
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||||
content = #{record.content,jdbcType=LONGVARCHAR}
|
content = #{record.content,jdbcType=LONGVARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
@ -245,7 +245,6 @@
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
test_id = #{record.testId,jdbcType=VARCHAR},
|
test_id = #{record.testId,jdbcType=VARCHAR},
|
||||||
name = #{record.name,jdbcType=VARCHAR},
|
name = #{record.name,jdbcType=VARCHAR},
|
||||||
description = #{record.description,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}
|
||||||
|
@ -253,7 +252,7 @@
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReport">
|
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs">
|
||||||
update load_test_report
|
update load_test_report
|
||||||
<set>
|
<set>
|
||||||
<if test="testId != null">
|
<if test="testId != null">
|
||||||
|
@ -262,9 +261,6 @@
|
||||||
<if test="name != null">
|
<if test="name != null">
|
||||||
name = #{name,jdbcType=VARCHAR},
|
name = #{name,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="description != null">
|
|
||||||
description = #{description,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
@ -274,20 +270,23 @@
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="description != null">
|
||||||
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
<if test="content != null">
|
<if test="content != null">
|
||||||
content = #{content,jdbcType=LONGVARCHAR},
|
content = #{content,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReport">
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportWithBLOBs">
|
||||||
update load_test_report
|
update load_test_report
|
||||||
set test_id = #{testId,jdbcType=VARCHAR},
|
set test_id = #{testId,jdbcType=VARCHAR},
|
||||||
name = #{name,jdbcType=VARCHAR},
|
name = #{name,jdbcType=VARCHAR},
|
||||||
description = #{description,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},
|
||||||
|
description = #{description,jdbcType=LONGVARCHAR},
|
||||||
content = #{content,jdbcType=LONGVARCHAR}
|
content = #{content,jdbcType=LONGVARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
@ -295,7 +294,6 @@
|
||||||
update load_test_report
|
update load_test_report
|
||||||
set test_id = #{testId,jdbcType=VARCHAR},
|
set test_id = #{testId,jdbcType=VARCHAR},
|
||||||
name = #{name,jdbcType=VARCHAR},
|
name = #{name,jdbcType=VARCHAR},
|
||||||
description = #{description,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}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package io.metersphere.commons.constants;
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
public enum TestStatus {
|
public enum TestStatus {
|
||||||
Starting, Running, Completed
|
Starting, Running, Completed, Error
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,14 @@ import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class AbstractEngine implements Engine {
|
public abstract class AbstractEngine implements Engine {
|
||||||
public static final String REGISTRY = "registry.fit2cloud.com/metersphere/";
|
public static final String REGISTRY = "registry.fit2cloud.com/metersphere/";
|
||||||
public static final String JMETER_IMAGE = "jmeter-master:0.0.2";
|
public static final String JMETER_IMAGE = "jmeter-master:0.0.2";
|
||||||
|
|
||||||
private Long startTime;
|
private Long startTime;
|
||||||
|
private String reportId;
|
||||||
protected LoadTestWithBLOBs loadTest;
|
protected LoadTestWithBLOBs loadTest;
|
||||||
protected LoadTestService loadTestService;
|
protected LoadTestService loadTestService;
|
||||||
protected Integer threadNum;
|
protected Integer threadNum;
|
||||||
|
@ -35,6 +37,7 @@ public abstract class AbstractEngine implements Engine {
|
||||||
testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
|
testResourcePoolService = CommonBeanFactory.getBean(TestResourcePoolService.class);
|
||||||
testResourceService = CommonBeanFactory.getBean(TestResourceService.class);
|
testResourceService = CommonBeanFactory.getBean(TestResourceService.class);
|
||||||
this.startTime = System.currentTimeMillis();
|
this.startTime = System.currentTimeMillis();
|
||||||
|
this.reportId = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void init(LoadTestWithBLOBs loadTest) {
|
protected void init(LoadTestWithBLOBs loadTest) {
|
||||||
|
@ -86,7 +89,13 @@ public abstract class AbstractEngine implements Engine {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Long getStartTime() {
|
public Long getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getReportId() {
|
||||||
|
return reportId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package io.metersphere.engine;
|
||||||
public interface Engine {
|
public interface Engine {
|
||||||
Long getStartTime();
|
Long getStartTime();
|
||||||
|
|
||||||
|
String getReportId();
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class EngineContext {
|
||||||
private String resourcePoolId;
|
private String resourcePoolId;
|
||||||
private Long threadNum;
|
private Long threadNum;
|
||||||
private Long startTime;
|
private Long startTime;
|
||||||
|
private String reportId;
|
||||||
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<>();
|
||||||
|
|
||||||
|
@ -98,4 +99,12 @@ public class EngineContext {
|
||||||
public void setStartTime(Long startTime) {
|
public void setStartTime(Long startTime) {
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReportId() {
|
||||||
|
return reportId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReportId(String reportId) {
|
||||||
|
this.reportId = reportId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class EngineFactory {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EngineContext createContext(LoadTestWithBLOBs loadTest, long threadNum, long startTime) throws Exception {
|
public static EngineContext createContext(LoadTestWithBLOBs loadTest, long threadNum, long startTime, String reportId) throws Exception {
|
||||||
final List<FileMetadata> fileMetadataList = fileService.getFileMetadataByTestId(loadTest.getId());
|
final List<FileMetadata> fileMetadataList = fileService.getFileMetadataByTestId(loadTest.getId());
|
||||||
if (org.springframework.util.CollectionUtils.isEmpty(fileMetadataList)) {
|
if (org.springframework.util.CollectionUtils.isEmpty(fileMetadataList)) {
|
||||||
MSException.throwException(Translator.get("run_load_test_file_not_found") + loadTest.getId());
|
MSException.throwException(Translator.get("run_load_test_file_not_found") + loadTest.getId());
|
||||||
|
@ -77,6 +77,7 @@ public class EngineFactory {
|
||||||
engineContext.setThreadNum(threadNum);
|
engineContext.setThreadNum(threadNum);
|
||||||
engineContext.setResourcePoolId(loadTest.getTestResourcePoolId());
|
engineContext.setResourcePoolId(loadTest.getTestResourcePoolId());
|
||||||
engineContext.setStartTime(startTime);
|
engineContext.setStartTime(startTime);
|
||||||
|
engineContext.setReportId(reportId);
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(loadTest.getLoadConfiguration())) {
|
if (StringUtils.isNotEmpty(loadTest.getLoadConfiguration())) {
|
||||||
final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration());
|
final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration());
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class DockerTestEngine extends AbstractEngine {
|
||||||
// todo 运行测试
|
// todo 运行测试
|
||||||
EngineContext context = null;
|
EngineContext context = null;
|
||||||
try {
|
try {
|
||||||
context = EngineFactory.createContext(loadTest, realThreadNum, this.getStartTime());
|
context = EngineFactory.createContext(loadTest, realThreadNum, this.getStartTime(), this.getReportId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MSException.throwException(e);
|
MSException.throwException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class KubernetesTestEngine extends AbstractEngine {
|
||||||
MSException.throwException("Insufficient resources");
|
MSException.throwException("Insufficient resources");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
EngineContext context = EngineFactory.createContext(loadTest, threadNum, this.getStartTime());
|
EngineContext context = EngineFactory.createContext(loadTest, threadNum, this.getStartTime(), this.getReportId());
|
||||||
runTest(context, clientCredential);
|
runTest(context, clientCredential);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MSException.throwException(e);
|
MSException.throwException(e);
|
||||||
|
|
|
@ -567,10 +567,11 @@ 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.id test.name test.startTime test.reportId
|
||||||
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", context.getStartTime().toString()));
|
collectionProp.appendChild(createKafkaProp(document, "test.startTime", context.getStartTime().toString()));
|
||||||
|
collectionProp.appendChild(createKafkaProp(document, "test.reportId", context.getReportId()));
|
||||||
|
|
||||||
elementProp.appendChild(collectionProp);
|
elementProp.appendChild(collectionProp);
|
||||||
// set elementProp
|
// set elementProp
|
||||||
|
|
|
@ -178,25 +178,34 @@ public class LoadTestService {
|
||||||
if (engine == null) {
|
if (engine == null) {
|
||||||
MSException.throwException(String.format("Test cannot be run,test ID:%s", request.getId()));
|
MSException.throwException(String.format("Test cannot be run,test ID:%s", request.getId()));
|
||||||
}
|
}
|
||||||
|
LoadTestReportWithBLOBs testReport = new LoadTestReportWithBLOBs();
|
||||||
// 启动测试
|
testReport.setId(engine.getReportId());
|
||||||
engine.start();
|
|
||||||
// 标记running状态
|
|
||||||
loadTest.setStatus(TestStatus.Starting.name());
|
|
||||||
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
|
||||||
|
|
||||||
LoadTestReport testReport = new LoadTestReport();
|
|
||||||
testReport.setId(UUID.randomUUID().toString());
|
|
||||||
testReport.setCreateTime(engine.getStartTime());
|
testReport.setCreateTime(engine.getStartTime());
|
||||||
testReport.setUpdateTime(engine.getStartTime());
|
testReport.setUpdateTime(engine.getStartTime());
|
||||||
testReport.setTestId(loadTest.getId());
|
testReport.setTestId(loadTest.getId());
|
||||||
testReport.setName(loadTest.getName());
|
testReport.setName(loadTest.getName());
|
||||||
testReport.setContent(HEADERS);
|
|
||||||
testReport.setStatus(TestStatus.Starting.name());
|
|
||||||
loadTestReportMapper.insertSelective(testReport);
|
|
||||||
// append \n
|
|
||||||
extLoadTestReportMapper.appendLine(testReport.getId(), "\n");
|
|
||||||
|
|
||||||
|
// 启动测试
|
||||||
|
try {
|
||||||
|
engine.start();
|
||||||
|
// 标记running状态
|
||||||
|
loadTest.setStatus(TestStatus.Starting.name());
|
||||||
|
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
||||||
|
|
||||||
|
testReport.setContent(HEADERS);
|
||||||
|
testReport.setStatus(TestStatus.Starting.name());
|
||||||
|
loadTestReportMapper.insertSelective(testReport);
|
||||||
|
// append \n
|
||||||
|
extLoadTestReportMapper.appendLine(testReport.getId(), "\n");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
loadTest.setStatus(TestStatus.Error.name());
|
||||||
|
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
||||||
|
//
|
||||||
|
testReport.setStatus(TestStatus.Error.name());
|
||||||
|
testReport.setDescription(e.getMessage());
|
||||||
|
loadTestReportMapper.insertSelective(testReport);
|
||||||
|
}
|
||||||
// todo:通过调用stop方法能够停止正在运行的engine,但是如果部署了多个backend实例,页面发送的停止请求如何定位到具体的engine
|
// todo:通过调用stop方法能够停止正在运行的engine,但是如果部署了多个backend实例,页面发送的停止请求如何定位到具体的engine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue