Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
e6a9556e
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
e6a9556e
编写于
4月 29, 2021
作者:
B
BugKing
提交者:
GitHub
4月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2445 from metersphere/dev
合并dev
上级
254da266
c8c9c446
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
403 addition
and
363 deletion
+403
-363
backend/src/main/java/io/metersphere/api/service/MockConfigService.java
...in/java/io/metersphere/api/service/MockConfigService.java
+123
-28
frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue
...mponents/api/automation/scenario/api/RelevanceApiList.vue
+266
-327
frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue
...nents/settings/workspace/template/CustomFieldFormList.vue
+1
-1
frontend/src/business/components/track/case/components/MsRichText.vue
.../business/components/track/case/components/MsRichText.vue
+1
-1
frontend/src/business/components/track/case/components/StepChangeItem.vue
...iness/components/track/case/components/StepChangeItem.vue
+2
-2
frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue
...plan/view/comonents/functional/FunctionalTestCaseEdit.vue
+3
-0
frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue
...s/track/review/view/components/TestReviewTestCaseEdit.vue
+4
-1
frontend/src/i18n/en-US.js
frontend/src/i18n/en-US.js
+1
-1
frontend/src/i18n/zh-CN.js
frontend/src/i18n/zh-CN.js
+1
-1
frontend/src/i18n/zh-TW.js
frontend/src/i18n/zh-TW.js
+1
-1
未找到文件。
backend/src/main/java/io/metersphere/api/service/MockConfigService.java
浏览文件 @
e6a9556e
...
...
@@ -14,13 +14,14 @@ import io.metersphere.commons.utils.JsonPathUtils;
import
io.metersphere.commons.utils.SessionUtils
;
import
io.metersphere.i18n.Translator
;
import
org.apache.commons.lang3.StringUtils
;
import
org.json.XML
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.
IOException
;
import
java.io.
*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -410,10 +411,39 @@ public class MockConfigService {
e
.
printStackTrace
();
}
return
object
;
}
else
{
Enumeration
<
String
>
paramNameItor
=
request
.
getParameterNames
();
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
"text/xml"
,
request
.
getContentType
()))
{
String
xmlString
=
this
.
readXml
(
request
);
System
.
out
.
println
(
xmlString
);
org
.
json
.
JSONObject
xmlJSONObj
=
XML
.
toJSONObject
(
xmlString
);
String
jsonStr
=
xmlJSONObj
.
toString
();
JSONObject
object
=
null
;
try
{
object
=
JSONObject
.
parseObject
(
jsonStr
);
}
catch
(
Exception
e
)
{
}
return
object
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
"application/x-www-form-urlencoded"
,
request
.
getContentType
()))
{
JSONObject
object
=
new
JSONObject
();
Enumeration
<
String
>
paramNameItor
=
request
.
getParameterNames
();
while
(
paramNameItor
.
hasMoreElements
())
{
String
key
=
paramNameItor
.
nextElement
();
String
value
=
request
.
getParameter
(
key
);
object
.
put
(
key
,
value
);
}
return
object
;
}
else
{
JSONObject
object
=
new
JSONObject
();
String
bodyParam
=
this
.
readBody
(
request
);
if
(!
StringUtils
.
isEmpty
(
bodyParam
))
{
try
{
object
=
JSONObject
.
parseObject
(
bodyParam
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
Enumeration
<
String
>
paramNameItor
=
request
.
getParameterNames
();
while
(
paramNameItor
.
hasMoreElements
())
{
String
key
=
paramNameItor
.
nextElement
();
String
value
=
request
.
getParameter
(
key
);
...
...
@@ -423,40 +453,103 @@ public class MockConfigService {
}
}
private
String
readXml
(
HttpServletRequest
request
)
{
{
String
inputLine
=
null
;
// 接收到的数据
StringBuffer
recieveData
=
new
StringBuffer
();
BufferedReader
in
=
null
;
try
{
in
=
new
BufferedReader
(
new
InputStreamReader
(
request
.
getInputStream
(),
"UTF-8"
));
while
((
inputLine
=
in
.
readLine
())
!=
null
)
{
recieveData
.
append
(
inputLine
);
}
}
catch
(
IOException
e
)
{
}
finally
{
try
{
if
(
null
!=
in
)
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
}
}
return
recieveData
.
toString
();
}
}
private
String
readBody
(
HttpServletRequest
request
)
{
String
result
=
""
;
try
{
InputStream
inputStream
=
request
.
getInputStream
();
ByteArrayOutputStream
outSteam
=
new
ByteArrayOutputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
len
;
while
((
len
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
outSteam
.
write
(
buffer
,
0
,
len
);
}
outSteam
.
close
();
inputStream
.
close
();
result
=
new
String
(
outSteam
.
toByteArray
(),
"UTF-8"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
public
JSONObject
getSendRestParamMapByIdAndUrl
(
ApiDefinitionWithBLOBs
api
,
String
urlParams
)
{
// ApiDefinitionWithBLOBs api = apiDefinitionMapper.selectByPrimaryKey(apiId);
JSONObject
returnJson
=
new
JSONObject
();
if
(
api
!=
null
)
{
String
path
=
api
.
getPath
();
if
(
path
.
startsWith
(
"/"
))
{
path
=
path
.
substring
(
1
);
}
String
[]
pathArr
=
path
.
split
(
"/"
);
List
<
String
>
sendParams
=
new
ArrayList
<>();
for
(
String
param
:
pathArr
)
{
String
[]
sendParamArr
=
urlParams
.
split
(
"/"
);
//获取 url的<参数名-参数值>,通过匹配api的接口设置和实际发送的url
for
(
int
i
=
0
;
i
<
pathArr
.
length
;
i
++)
{
String
param
=
pathArr
[
i
];
if
(
param
.
startsWith
(
"{"
)
&&
param
.
endsWith
(
"}"
))
{
param
=
param
.
substring
(
1
,
param
.
length
()
-
1
);
sendParams
.
add
(
param
);
}
}
try
{
JSONObject
requestJson
=
JSONObject
.
parseObject
(
api
.
getRequest
());
if
(
requestJson
.
containsKey
(
"rest"
))
{
JSONArray
jsonArray
=
requestJson
.
getJSONArray
(
"rest"
);
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
object
=
jsonArray
.
getJSONObject
(
i
);
if
(
object
.
containsKey
(
"name"
)
&&
object
.
containsKey
(
"enable"
)
&&
object
.
getBoolean
(
"enable"
))
{
String
name
=
object
.
getString
(
"name"
);
if
(
sendParams
.
contains
(
name
))
{
String
value
=
""
;
if
(
object
.
containsKey
(
"value"
))
{
value
=
object
.
getString
(
"value"
);
}
returnJson
.
put
(
name
,
value
);
}
}
String
value
=
""
;
if
(
sendParamArr
.
length
>
i
)
{
value
=
sendParamArr
[
i
];
}
returnJson
.
put
(
param
,
value
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
// List<String> sendParams = new ArrayList<>();
// for (String param : pathArr) {
// if (param.startsWith("{") && param.endsWith("}")) {
// param = param.substring(1, param.length() - 1);
// sendParams.add(param);
// }
// }
// try {
// JSONObject requestJson = JSONObject.parseObject(api.getRequest());
// if (requestJson.containsKey("rest")) {
// JSONArray jsonArray = requestJson.getJSONArray("rest");
// for (int i = 0; i < jsonArray.size(); i++) {
// JSONObject object = jsonArray.getJSONObject(i);
// if (object.containsKey("name") && object.containsKey("enable") && object.getBoolean("enable")) {
// String name = object.getString("name");
// if (sendParams.contains(name)) {
// String value = "";
// if (object.containsKey("value")) {
// value = object.getString("value");
// }
// returnJson.put(name, value);
// }
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}
return
returnJson
;
}
...
...
@@ -577,7 +670,8 @@ public class MockConfigService {
return
this
.
assemblyMockConfingResponse
(
configList
);
}
public
String
checkReturnWithMockExpectByBodyParam
(
String
method
,
String
projectId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
String
checkReturnWithMockExpectByBodyParam
(
String
method
,
String
projectId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
returnStr
=
""
;
String
urlSuffix
=
this
.
getUrlSuffix
(
projectId
,
request
);
List
<
ApiDefinitionWithBLOBs
>
aualifiedApiList
=
apiDefinitionService
.
preparedUrl
(
projectId
,
method
,
urlSuffix
,
urlSuffix
);
...
...
@@ -599,7 +693,8 @@ public class MockConfigService {
return
returnStr
;
}
public
String
checkReturnWithMockExpectByUrlParam
(
String
get
,
String
projectId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
String
checkReturnWithMockExpectByUrlParam
(
String
get
,
String
projectId
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
returnStr
=
""
;
String
urlSuffix
=
this
.
getUrlSuffix
(
projectId
,
request
);
List
<
ApiDefinitionWithBLOBs
>
aualifiedApiList
=
apiDefinitionService
.
preparedUrl
(
projectId
,
"GET"
,
null
,
urlSuffix
);
...
...
frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue
浏览文件 @
e6a9556e
此差异已折叠。
点击以展开。
frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue
浏览文件 @
e6a9556e
...
...
@@ -32,7 +32,7 @@
</
template
>
</ms-table-column>
<field-custom-data-table-item
:scene=
"scene"
/
>
<!-- <field-custom-data-table-item :scene="scene"/>--
>
<ms-table-column
:label=
"$t('api_test.definition.document.table_coloum.is_required')"
...
...
frontend/src/business/components/track/case/components/MsRichText.vue
浏览文件 @
e6a9556e
...
...
@@ -30,7 +30,7 @@
return
{
editor
:
ClassicEditor
,
editorConfig
:
{
toolbar
:
[
'
heading
'
,
'
|
'
,
'
bold
'
,
'
italic
'
,
'
link
'
,
'
bulletedList
'
,
'
numberedList
'
,
'
blockQuote
'
,
'
insertTable
'
,
'
imageUpload
'
,
'
|
'
,
'
undo
'
,
'
redo
'
],
toolbar
:
[
'
heading
'
,
'
|
'
,
'
bold
'
,
'
italic
'
,
'
link
'
,
'
bulletedList
'
,
'
numberedList
'
,
'
blockQuote
'
,
'
insertTable
'
,
'
|
'
,
'
undo
'
,
'
redo
'
],
// ckfinder: {
// uploadUrl: `/image/uploadCkEditor?imgPath=${JSON.stringify(this.imagePath)}`
// },
...
...
frontend/src/business/components/track/case/components/StepChangeItem.vue
浏览文件 @
e6a9556e
...
...
@@ -7,11 +7,11 @@
<el-dropdown-menu>
<el-dropdown-item
command=
"STEP"
>
<div>
{{
$t
(
'
test_track.case.step_describe
'
)
}}
</div>
<div>
{{
$t
(
'
test_track.case.
text
_describe_tip
'
)
}}
</div>
<div>
{{
$t
(
'
test_track.case.
step
_describe_tip
'
)
}}
</div>
</el-dropdown-item>
<el-dropdown-item
command=
"TEXT"
>
<div>
{{
$t
(
'
test_track.case.text_describe
'
)
}}
</div>
<div>
{{
$t
(
'
test_track.case.
change_typ
e_tip
'
)
}}
</div>
<div>
{{
$t
(
'
test_track.case.
text_describ
e_tip
'
)
}}
</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
...
...
frontend/src/business/components/track/plan/view/comonents/functional/FunctionalTestCaseEdit.vue
浏览文件 @
e6a9556e
...
...
@@ -63,6 +63,7 @@
</el-row>
<el-form
ref=
"customFieldForm"
v-if=
"isCustomFiledActive"
class=
"case-form"
>
<el-row>
<el-col
:span=
"7"
v-for=
"(item, index) in testCaseTemplate.customFields"
:key=
"index"
>
...
...
@@ -181,6 +182,7 @@ export default {
comments
:
[],
testCaseTemplate
:
{},
formLabelWidth
:
"
100px
"
,
isCustomFiledActive
:
false
};
},
props
:
{
...
...
@@ -352,6 +354,7 @@ export default {
}
this
.
testCase
=
item
;
parseCustomField
(
this
.
testCase
,
this
.
testCaseTemplate
,
null
,
null
,
buildTestCaseOldFields
(
this
.
testCase
));
this
.
isCustomFiledActive
=
true
;
if
(
!
this
.
testCase
.
actualResult
)
{
// 如果没值,使用模板的默认值
this
.
testCase
.
actualResult
=
this
.
testCaseTemplate
.
actualResult
;
...
...
frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue
浏览文件 @
e6a9556e
...
...
@@ -78,6 +78,7 @@
</el-row>
<el-form
ref=
"customFieldForm"
v-if=
"isCustomFiledActive"
class=
"case-form"
>
<el-row>
<el-col
:span=
"7"
v-for=
"(item, index) in testCaseTemplate.customFields"
:key=
"index"
>
...
...
@@ -187,7 +188,8 @@ export default {
testCaseTemplate
:
{},
hasTapdId
:
false
,
hasZentaoId
:
false
,
formLabelWidth
:
'
100px
'
formLabelWidth
:
'
100px
'
,
isCustomFiledActive
:
false
};
},
props
:
{
...
...
@@ -302,6 +304,7 @@ export default {
item
.
stepModel
=
'
STEP
'
;
}
parseCustomField
(
item
,
this
.
testCaseTemplate
,
null
,
null
,
buildTestCaseOldFields
(
item
));
this
.
isCustomFiledActive
=
true
;
this
.
testCase
=
item
;
if
(
!
this
.
testCase
.
actualResult
)
{
// 如果没值,使用模板的默认值
...
...
frontend/src/i18n/en-US.js
浏览文件 @
e6a9556e
...
...
@@ -1250,10 +1250,10 @@ export default {
step_info
:
"
Step Info
"
,
other_info
:
"
Other Info
"
,
step_describe
:
"
Step Describe
"
,
step_describe_tip
:
"
Applicable to every step of the test scenario, there are clear test steps, expected results
"
,
text_describe
:
"
Text Describe
"
,
text_describe_tip
:
"
For simple test scenarios, there are no clear test steps
"
,
change_type
:
"
Change Type
"
,
change_type_tip
:
"
Applicable to every step of the test scenario, there are clear test steps, expected results
"
,
minder_create_tip
:
"
failed, unable to create its parent module in minder
"
,
check_select
:
"
Please check the case
"
,
export_all_cases
:
'
Are you sure you want to export all use cases?
'
,
...
...
frontend/src/i18n/zh-CN.js
浏览文件 @
e6a9556e
...
...
@@ -1255,10 +1255,10 @@ export default {
step_info
:
"
步骤信息
"
,
other_info
:
"
其他信息
"
,
step_describe
:
"
步骤描述
"
,
step_describe_tip
:
"
适用于需要每一个步骤进行测试的场景,有明确的测试步骤、预期结果
"
,
text_describe
:
"
文本描述
"
,
text_describe_tip
:
"
使用于简单的测试场景,没有明确的测试步骤
"
,
change_type
:
"
更改类型
"
,
change_type_tip
:
"
适用于需要每一个步骤进行测试的场景,有明确的测试步骤、预期结果
"
,
minder_create_tip
:
"
失败, 无法在脑图创建其父模块
"
,
check_select
:
"
请勾选用例
"
,
export_all_cases
:
'
确定要导出全部用例吗?
'
,
...
...
frontend/src/i18n/zh-TW.js
浏览文件 @
e6a9556e
...
...
@@ -1255,10 +1255,10 @@ export default {
step_info
:
"
步驟信息
"
,
other_info
:
"
其他信息
"
,
step_describe
:
"
步驟描述
"
,
step_describe_tip
:
"
適用於需要每一個步驟進行測試的場景,有明確的測試步驟、預期結果
"
,
text_describe
:
"
文本描述
"
,
text_describe_tip
:
"
使用於簡單的測試場景,沒有明確的測試步驟
"
,
change_type
:
"
更改類型
"
,
change_type_tip
:
"
適用於需要每一個步驟進行測試的場景,有明確的測試步驟、預期結果
"
,
minder_create_tip
:
"
失敗, 無法在腦圖創建其父模塊
"
,
check_select
:
"
請勾選用例
"
,
export_all_cases
:
'
確定要導出全部用例嗎?
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录