fix(接口测试): 修复swagger定时同步覆盖模式不生效的缺陷

--bug=1014696 --user=王孝刚 【接口测试】swagger 定时同步导入,覆盖模式没生效
https://www.tapd.cn/55049933/s/1196530
This commit is contained in:
wxg0103 2022-07-06 19:44:02 +08:00 committed by xiaomeinvG
parent db93ac1a4b
commit 51bcc0a9bc
9 changed files with 382 additions and 285 deletions

View File

@ -17,6 +17,8 @@ public class SwaggerUrlProject implements Serializable {
private String modeId;
private Boolean coverModule;
private String config;
private static final long serialVersionUID = 1L;

View File

@ -523,6 +523,66 @@ public class SwaggerUrlProjectExample {
addCriterion("mode_id not between", value1, value2, "modeId");
return (Criteria) this;
}
public Criteria andCoverModuleIsNull() {
addCriterion("cover_module is null");
return (Criteria) this;
}
public Criteria andCoverModuleIsNotNull() {
addCriterion("cover_module is not null");
return (Criteria) this;
}
public Criteria andCoverModuleEqualTo(Boolean value) {
addCriterion("cover_module =", value, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleNotEqualTo(Boolean value) {
addCriterion("cover_module <>", value, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleGreaterThan(Boolean value) {
addCriterion("cover_module >", value, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleGreaterThanOrEqualTo(Boolean value) {
addCriterion("cover_module >=", value, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleLessThan(Boolean value) {
addCriterion("cover_module <", value, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleLessThanOrEqualTo(Boolean value) {
addCriterion("cover_module <=", value, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleIn(List<Boolean> values) {
addCriterion("cover_module in", values, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleNotIn(List<Boolean> values) {
addCriterion("cover_module not in", values, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleBetween(Boolean value1, Boolean value2) {
addCriterion("cover_module between", value1, value2, "coverModule");
return (Criteria) this;
}
public Criteria andCoverModuleNotBetween(Boolean value1, Boolean value2) {
addCriterion("cover_module not between", value1, value2, "coverModule");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -8,6 +8,7 @@
<result column="module_id" jdbcType="VARCHAR" property="moduleId"/>
<result column="module_path" jdbcType="VARCHAR" property="modulePath"/>
<result column="mode_id" jdbcType="VARCHAR" property="modeId"/>
<result column="cover_module" jdbcType="BIT" property="coverModule"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.SwaggerUrlProject">
<result column="config" jdbcType="LONGVARCHAR" property="config"/>
@ -30,7 +31,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
@ -59,7 +61,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
@ -71,12 +74,14 @@
</where>
</sql>
<sql id="Base_Column_List">
id, project_id, swagger_url, module_id, module_path, mode_id
id
, project_id, swagger_url, module_id, module_path, mode_id, cover_module
</sql>
<sql id="Blob_Column_List">
config
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
@ -92,7 +97,8 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
@ -115,7 +121,8 @@
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from swagger_url_project
delete
from swagger_url_project
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample">
@ -127,10 +134,10 @@
<insert id="insert" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
insert into swagger_url_project (id, project_id, swagger_url,
module_id, module_path, mode_id,
config)
cover_module, config)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{swaggerUrl,jdbcType=VARCHAR},
#{moduleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{modeId,jdbcType=VARCHAR},
#{config,jdbcType=LONGVARCHAR})
#{coverModule,jdbcType=BIT}, #{config,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.SwaggerUrlProject">
insert into swagger_url_project
@ -153,6 +160,9 @@
<if test="modeId != null">
mode_id,
</if>
<if test="coverModule != null">
cover_module,
</if>
<if test="config != null">
config,
</if>
@ -176,12 +186,16 @@
<if test="modeId != null">
#{modeId,jdbcType=VARCHAR},
</if>
<if test="coverModule != null">
#{coverModule,jdbcType=BIT},
</if>
<if test="config != null">
#{config,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="io.metersphere.base.domain.SwaggerUrlProjectExample"
resultType="java.lang.Long">
select count(*) from swagger_url_project
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
@ -208,6 +222,9 @@
<if test="record.modeId != null">
mode_id = #{record.modeId,jdbcType=VARCHAR},
</if>
<if test="record.coverModule != null">
cover_module = #{record.coverModule,jdbcType=BIT},
</if>
<if test="record.config != null">
config = #{record.config,jdbcType=LONGVARCHAR},
</if>
@ -224,6 +241,7 @@
module_id = #{record.moduleId,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
mode_id = #{record.modeId,jdbcType=VARCHAR},
cover_module = #{record.coverModule,jdbcType=BIT},
config = #{record.config,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
@ -236,7 +254,8 @@
swagger_url = #{record.swaggerUrl,jdbcType=VARCHAR},
module_id = #{record.moduleId,jdbcType=VARCHAR},
module_path = #{record.modulePath,jdbcType=VARCHAR},
mode_id = #{record.modeId,jdbcType=VARCHAR}
mode_id = #{record.modeId,jdbcType=VARCHAR},
cover_module = #{record.coverModule,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
@ -259,6 +278,9 @@
<if test="modeId != null">
mode_id = #{modeId,jdbcType=VARCHAR},
</if>
<if test="coverModule != null">
cover_module = #{coverModule,jdbcType=BIT},
</if>
<if test="config != null">
config = #{config,jdbcType=LONGVARCHAR},
</if>
@ -272,6 +294,7 @@
module_id = #{moduleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
mode_id = #{modeId,jdbcType=VARCHAR},
cover_module = #{coverModule,jdbcType=BIT},
config = #{config,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -281,7 +304,8 @@
swagger_url = #{swaggerUrl,jdbcType=VARCHAR},
module_id = #{moduleId,jdbcType=VARCHAR},
module_path = #{modulePath,jdbcType=VARCHAR},
mode_id = #{modeId,jdbcType=VARCHAR}
mode_id = #{modeId,jdbcType=VARCHAR},
cover_module = #{coverModule,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -5,6 +5,7 @@ import io.metersphere.api.dto.scenario.KeyValue;
import io.metersphere.base.domain.Schedule;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
@ -35,5 +36,6 @@ public class ScheduleRequest extends Schedule {
private List<KeyValue> headers;
private List<KeyValue> arguments;
private MsAuthManager authManager;
private Boolean coverModule = false;
}

View File

@ -16,6 +16,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobKey;
import org.quartz.TriggerKey;
import java.util.List;
public class SwaggerUrlImportJob extends MsScheduleJob {
@ -37,6 +38,8 @@ public class SwaggerUrlImportJob extends MsScheduleJob {
request.setProjectId(swaggerUrlProject.getProjectId());
request.setSwaggerUrl(swaggerUrlProject.getSwaggerUrl());
request.setModuleId(swaggerUrlProject.getModuleId());
request.setModeId(swaggerUrlProject.getModeId());
request.setCoverModule(swaggerUrlProject.getCoverModule());
request.setPlatform("Swagger2");
request.setUserId(jobDataMap.getString("userId"));
request.setType("schedule");

View File

@ -761,7 +761,9 @@ export default {
}
});
this.$emit('getTrashCase');
if (this.$refs.scenarioTable) {
this.$refs.scenarioTable.clearSelection();
}
});
}
},

View File

@ -205,7 +205,7 @@ export default {
},
formData: {
swaggerUrl: '',
modeId: this.$t('commons.not_cover'),
modeId: 'incrementalMerge',
moduleId: '',
rule: '',
coverModule: false

View File

@ -717,7 +717,9 @@ export default {
}
});
}
if (this.$refs.caseTable) {
this.$refs.caseTable.clearSelection();
}
},
setRunning(id) {
this.tableData.forEach(item => {

View File

@ -640,7 +640,9 @@ export default {
item.caseTotal = parseInt(item.caseTotal);
});
this.$emit('getTrashApi');
if (this.$refs.table) {
this.$refs.table.clearSelection();
}
});
}
if (this.needRefreshModule()) {