This commit is contained in:
chenjianxing 2020-10-20 16:48:45 +08:00
commit 8dad580a6a
11 changed files with 76 additions and 79 deletions

View File

@ -98,8 +98,8 @@
</sql>
<select id="getTestCaseByNotInReview" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status
from test_case
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case as test_case
left join test_case_review_test_case as T2 on test_case.id=T2.case_id
<where>
<if test="request.combine != null">
<include refid="combine">
@ -107,7 +107,7 @@
<property name="name" value="request.name"/>
</include>
</if>
and test_case.id not in (select case_id from test_case_review_test_case where review_id =#{request.reviewId})
and T2.case_id is null
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>
@ -152,8 +152,8 @@
</select>
<select id="getTestCaseByNotInPlan" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status
from test_case
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case as test_case
left join test_plan_test_case as T2 on test_case.id=T2.case_id
<where>
<if test="request.combine != null">
<include refid="combine">
@ -161,7 +161,7 @@
<property name="name" value="request.name"/>
</include>
</if>
and test_case.id not in (select case_id from test_plan_test_case where plan_id =#{request.planId})
and T2.case_id is null
<if test="request.name != null">
and test_case.name like CONCAT('%', #{request.name},'%')
</if>

View File

@ -9,7 +9,18 @@ import java.util.List;
@Getter
@Setter
public class PlanCaseRelevanceRequest {
/**
* 测试计划ID
*/
private String planId;
private String projectId;
/**
* 当选择关联全部用例时把加载条件送到后台从后台查询
*/
private QueryTestCaseRequest request;
/**
* 具体要关联的用例
*/
private List<String> testCaseIds = new ArrayList<>();
}

View File

@ -1,5 +1,6 @@
package io.metersphere.track.request.testreview;
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import lombok.Getter;
import lombok.Setter;
@ -9,7 +10,18 @@ import java.util.List;
@Getter
@Setter
public class ReviewRelevanceRequest {
/**
* 评审ID
*/
private String reviewId;
private String projectId;
/**
* 当选择关联全部用例时把加载条件送到后台从后台查询
*/
private QueryTestCaseRequest request;
/**
* 具体选择要关联的用例
*/
private List<String> testCaseIds = new ArrayList<>();
}

View File

@ -326,12 +326,9 @@ public class TestCaseReviewService {
if (testCaseIds.isEmpty()) {
return;
}
// 如果是关联全部指令则从新查询未关联的案例
// 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) {
QueryTestCaseRequest req = new QueryTestCaseRequest();
req.setReviewId(request.getReviewId());
req.setProjectId(request.getProjectId());
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(req);
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}

View File

@ -211,12 +211,9 @@ public class TestPlanService {
return;
}
// 如果是关联全部指令则从新查询未关联的案例
// 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) {
QueryTestCaseRequest req = new QueryTestCaseRequest();
req.setPlanId(request.getPlanId());
req.setProjectId(request.getProjectId());
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInPlan(req);
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInPlan(request.getRequest());
if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}

View File

@ -116,17 +116,13 @@
return true;
},
validateDomain(domain) {
let url = {};
try {
if (!domain.startsWith("http") || !domain.startsWith("https")) {
domain += "http://";
}
url = new URL(domain);
} catch (e) {
this.$warning(this.$t('load_test.input_domain'));
return false
let strRegex = "^(?=^.{3,255}$)(http(s)?:\\/\\/)?(www\\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\\d+)*(\\/\\w+\\.\\w+)*$";
const re = new RegExp(strRegex);
if (re.test(domain) && domain.length < 26) {
return true;
}
return true;
this.$warning(this.$t('load_test.input_domain'));
return false;
},
dblHostTable: function (row) {
row.status = 'edit';

View File

@ -49,43 +49,35 @@
<el-row :gutter="10">
<el-col :span="6">
<el-form-item>
<el-form-item :label="$t('api_test.request.refer_to_environment')">
<el-switch
v-model="request.useEnvironment"
:active-text="$t('api_test.request.refer_to_environment')"
@change="useEnvironmentChange">
</el-switch>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-switch
v-model="request.reUseConnection"
:active-text="$t('api_test.request.tcp.re_use_connection')">
</el-switch>
<el-form-item :label="$t('api_test.request.tcp.re_use_connection')">
<el-checkbox v-model="request.reUseConnection"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-switch
v-model="request.closeConnection"
:active-text="$t('api_test.request.tcp.close_connection')">
</el-switch>
<el-form-item :label="$t('api_test.request.tcp.close_connection')">
<el-checkbox v-model="request.closeConnection"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-switch
v-model="request.nodelay"
:active-text="$t('api_test.request.tcp.no_delay')">
</el-switch>
<el-form-item :label="$t('api_test.request.tcp.no_delay')">
<el-checkbox v-model="request.nodelay"/>
</el-form-item>
</el-col>
</el-row>
<el-form-item :label="$t('api_test.request.tcp.request')" prop="request">
<el-input type="textarea" v-model="request.request" :autosize="{minRows: 4, maxRows: 6}">
</el-input>
<div class="send-request">
<ms-code-edit mode="text" :read-only="isReadOnly" :data.sync="request.request"
:modes="['text', 'json', 'xml', 'html']" theme="eclipse"/>
</div>
</el-form-item>
<el-row :gutter="10">
@ -128,10 +120,11 @@ import {Scenario, TCPConfig, TCPRequest} from "@/business/components/api/test/mo
import MsApiAssertions from "@/business/components/api/test/components/assertion/ApiAssertions";
import MsApiExtract from "@/business/components/api/test/components/extract/ApiExtract";
import MsJsr233Processor from "@/business/components/api/test/components/processor/Jsr233Processor";
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
export default {
name: "MsApiTcpRequestForm",
components: {MsJsr233Processor, MsApiExtract, MsApiAssertions},
components: {MsCodeEdit, MsJsr233Processor, MsApiExtract, MsApiAssertions},
props: {
request: TCPRequest,
scenario: Scenario,
@ -144,15 +137,7 @@ export default {
return {
activeName: "assertions",
classes: TCPConfig.CLASSES,
rules: {
server: [
{
required: true,
message: this.$t('commons.required', [this.$t('api_test.request.tcp.server')]),
trigger: 'blur'
}
],
}
rules: {}
}
},
@ -175,4 +160,9 @@ export default {
.tcp >>> .el-input-number {
width: 100%;
}
.send-request {
padding: 15px 0;
height: 300px;
}
</style>

View File

@ -22,22 +22,25 @@
</el-row>
<el-row :gutter="10">
<el-col :span="6">
<el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.connect')" prop="ctimeout">
<el-input-number v-model="config.ctimeout" controls-position="right" :min="0" :step="1000" :controls="false"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.response')" prop="timeout">
<el-input-number v-model="config.timeout" controls-position="right" :min="0" :step="1000" :controls="false"/>
</el-form-item>
</el-col>
<el-col :span="6">
</el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.so_linger')" prop="soLinger">
<el-input v-model="config.soLinger"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="12">
<el-form-item :label="$t('api_test.request.tcp.eol_byte')" prop="eolByte">
<el-input v-model="config.eolByte"/>
</el-form-item>
@ -46,27 +49,18 @@
<el-row :gutter="10">
<el-col :span="8">
<el-form-item>
<el-switch
v-model="config.reUseConnection"
:active-text="$t('api_test.request.tcp.re_use_connection')">
</el-switch>
<el-form-item :label="$t('api_test.request.tcp.re_use_connection')">
<el-checkbox v-model="config.reUseConnection"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-switch
v-model="config.closeConnection"
:active-text="$t('api_test.request.tcp.close_connection')">
</el-switch>
<el-form-item :label="$t('api_test.request.tcp.close_connection')">
<el-checkbox v-model="config.closeConnection"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-switch
v-model="config.nodelay"
:active-text="$t('api_test.request.tcp.no_delay')">
</el-switch>
<el-form-item :label="$t('api_test.request.tcp.no_delay')">
<el-checkbox v-model="config.nodelay"/>
</el-form-item>
</el-col>
</el-row>

View File

@ -176,7 +176,7 @@
let param = {};
param.planId = this.planId;
param.testCaseIds = [...this.selectIds];
param.projectId = this.projectId;
param.request = this.condition;
//
if (this.testCases.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];

View File

@ -185,7 +185,7 @@
let param = {};
param.reviewId = this.reviewId;
param.testCaseIds = [...this.selectIds];
param.projectId = this.projectId;
param.request = this.condition;
//
if (this.testReviews.length === param.testCaseIds.length) {
param.testCaseIds = ['all'];

@ -1 +1 @@
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1
Subproject commit cc38137a69a0f20fadece9c0f9f50a9468c4ace9