Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
1f5c07a4
提交
1f5c07a4
authored
3月 24, 2022
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(base): 修了一些小问题
上级
6952c6a0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
22 行增加
和
23 行删除
+22
-23
HttpClientActuator.java
...a/org/matrix/actuators/httpclient/HttpClientActuator.java
+1
-1
MoveActuator.java
...src/main/java/org/matrix/actuators/move/MoveActuator.java
+2
-1
CaseActuator.java
.../main/java/org/matrix/actuators/usecase/CaseActuator.java
+19
-21
没有找到文件。
kt-base/src/main/java/org/matrix/actuators/httpclient/HttpClientActuator.java
浏览文件 @
1f5c07a4
...
@@ -152,7 +152,7 @@ public class HttpClientActuator implements Actuator {
...
@@ -152,7 +152,7 @@ public class HttpClientActuator implements Actuator {
if
(!
StringUtils
.
isEmpty
(
httpRequestDetail
.
getStringValue
())){
if
(!
StringUtils
.
isEmpty
(
httpRequestDetail
.
getStringValue
())){
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次发送请求参数: %s"
,
JsonUtil
.
toJsonPretty
(
httpRequestDetail
.
getStringValue
())));
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次发送请求参数: %s"
,
JsonUtil
.
toJsonPretty
(
httpRequestDetail
.
getStringValue
())));
}
else
if
(
httpRequestDetail
.
getRequestBodies
()!=
null
&&
httpRequestDetail
.
getRequestBodies
().
size
()>
0
){
}
else
if
(
httpRequestDetail
.
getRequestBodies
()!=
null
&&
httpRequestDetail
.
getRequestBodies
().
size
()>
0
){
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次发送请求参数: %s"
,
Json
FormatUtil
.
formatJson
(
JSONObject
.
toJSONString
(
httpRequestDetail
.
getRequestBodies
()
))));
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次发送请求参数: %s"
,
Json
Util
.
toJsonPretty
(
httpRequestDetail
.
getRequestBodies
(
))));
}
else
{
}
else
{
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次发送请求无参数"
));
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次发送请求无参数"
));
}
}
...
...
kt-base/src/main/java/org/matrix/actuators/move/MoveActuator.java
浏览文件 @
1f5c07a4
...
@@ -25,6 +25,7 @@ import org.matrix.exception.GlobalException;
...
@@ -25,6 +25,7 @@ import org.matrix.exception.GlobalException;
import
org.matrix.socket.queue.LogQueueRuntime
;
import
org.matrix.socket.queue.LogQueueRuntime
;
import
org.matrix.util.BeanFlattener
;
import
org.matrix.util.BeanFlattener
;
import
org.matrix.util.JsonFormatUtil
;
import
org.matrix.util.JsonFormatUtil
;
import
org.matrix.util.JsonUtil
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.*
;
...
@@ -210,7 +211,7 @@ public class MoveActuator implements Actuator {
...
@@ -210,7 +211,7 @@ public class MoveActuator implements Actuator {
LogQueueRuntime
.
addNewLog
(
getClass
(),
MOVE_ACTUATOR
,
String
.
format
(
LogQueueRuntime
.
addNewLog
(
getClass
(),
MOVE_ACTUATOR
,
String
.
format
(
"当前执行的行为策略 = %s, 行为名 = %s, 动作名 = %s , 动作id = %d , 动作池里的变量 = %s"
,
"当前执行的行为策略 = %s, 行为名 = %s, 动作名 = %s , 动作id = %d , 动作池里的变量 = %s"
,
strategy
.
getDes
(),
move
.
getName
(),
action
.
getName
(),
action
.
getId
(),
Json
FormatUtil
.
formatJson
(
JSONObject
.
toJSONString
(
res
)
)));
strategy
.
getDes
(),
move
.
getName
(),
action
.
getName
(),
action
.
getId
(),
Json
Util
.
toJsonPretty
(
res
)));
log
.
info
(
"[动作执行器] 动作执行完毕"
);
log
.
info
(
"[动作执行器] 动作执行完毕"
);
}
}
...
...
kt-base/src/main/java/org/matrix/actuators/usecase/CaseActuator.java
浏览文件 @
1f5c07a4
...
@@ -29,9 +29,8 @@ import org.matrix.socket.queue.LogQueueRuntime;
...
@@ -29,9 +29,8 @@ import org.matrix.socket.queue.LogQueueRuntime;
import
org.matrix.socket.vo.CaseExecuteVo
;
import
org.matrix.socket.vo.CaseExecuteVo
;
import
org.matrix.socket.vo.SocketResponseMessage
;
import
org.matrix.socket.vo.SocketResponseMessage
;
import
org.matrix.socket.vo.TestExecuteLog
;
import
org.matrix.socket.vo.TestExecuteLog
;
import
org.matrix.util.Json
Format
Util
;
import
org.matrix.util.JsonUtil
;
import
org.matrix.util.SpringUtils
;
import
org.matrix.util.SpringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.socket.TextMessage
;
import
org.springframework.web.socket.TextMessage
;
import
org.springframework.web.socket.WebSocketSession
;
import
org.springframework.web.socket.WebSocketSession
;
...
@@ -51,7 +50,7 @@ import static org.matrix.enums.ModuleType.HTTP_ACTUATOR;
...
@@ -51,7 +50,7 @@ import static org.matrix.enums.ModuleType.HTTP_ACTUATOR;
@Component
@Component
public
class
CaseActuator
implements
Actuator
{
public
class
CaseActuator
implements
Actuator
{
@Autowired
final
HttpRequestConfig
httpRequestConfig
;
HttpRequestConfig
httpRequestConfig
;
final
final
...
@@ -63,16 +62,15 @@ public class CaseActuator implements Actuator {
...
@@ -63,16 +62,15 @@ public class CaseActuator implements Actuator {
private
final
IExecutionHistoryService
executionHistoryService
;
private
final
IExecutionHistoryService
executionHistoryService
;
private
final
String
baseJsPath
=
"syntaxCheck.js"
;
private
final
ExecutionStatusMonitorSocketHandler
executionStatusMonitorSocketHandler
;
private
final
ExecutionStatusMonitorSocketHandler
executionStatusMonitorSocketHandler
;
public
CaseActuator
(
CheckPointActuator
checkPointActuator
,
HttpClientActuator
httpClientActuator
,
IExecutionHistoryService
executionHistoryService
,
ExecutionStatusMonitorSocketHandler
executionStatusMonitorSocketHandler
,
IDataSourceService
dataSourceService
)
{
public
CaseActuator
(
CheckPointActuator
checkPointActuator
,
HttpClientActuator
httpClientActuator
,
IExecutionHistoryService
executionHistoryService
,
ExecutionStatusMonitorSocketHandler
executionStatusMonitorSocketHandler
,
IDataSourceService
dataSourceService
,
HttpRequestConfig
httpRequestConfig
)
{
this
.
checkPointActuator
=
checkPointActuator
;
this
.
checkPointActuator
=
checkPointActuator
;
this
.
httpClientActuator
=
httpClientActuator
;
this
.
httpClientActuator
=
httpClientActuator
;
this
.
executionHistoryService
=
executionHistoryService
;
this
.
executionHistoryService
=
executionHistoryService
;
this
.
executionStatusMonitorSocketHandler
=
executionStatusMonitorSocketHandler
;
this
.
executionStatusMonitorSocketHandler
=
executionStatusMonitorSocketHandler
;
this
.
dataSourceService
=
dataSourceService
;
this
.
dataSourceService
=
dataSourceService
;
this
.
httpRequestConfig
=
httpRequestConfig
;
}
}
...
@@ -97,7 +95,7 @@ public class CaseActuator implements Actuator {
...
@@ -97,7 +95,7 @@ public class CaseActuator implements Actuator {
testCaseBto
.
getTestData
());
testCaseBto
.
getTestData
());
//执行中置动作
//执行中置动作
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterTest
()
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterTest
()
,
envId
,
projectId
,
baseTestCaseResponseDetail
!=
null
?
baseTestCaseResponseDetail
.
getResponseBody
()
:
null
,
MoveStrategy
.
MID_MOVE
);
,
envId
,
projectId
,
baseTestCaseResponseDetail
.
getResponseBody
()
,
MoveStrategy
.
MID_MOVE
);
//进行检验
//进行检验
CheckPointResult
checkPointResult
=
getCheckPointResult
(
testCaseBto
.
getTestCase
(),
CheckPointResult
checkPointResult
=
getCheckPointResult
(
testCaseBto
.
getTestCase
(),
testCaseBto
.
getTestData
(),
testCaseBto
.
getTestData
(),
...
@@ -106,7 +104,7 @@ public class CaseActuator implements Actuator {
...
@@ -106,7 +104,7 @@ public class CaseActuator implements Actuator {
baseTestCaseResponseDetail
);
baseTestCaseResponseDetail
);
//执行后置动作
//执行后置动作
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterCase
()
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterCase
()
,
envId
,
projectId
,
baseTestCaseResponseDetail
!=
null
?
baseTestCaseResponseDetail
.
getResponseBody
()
:
null
,
MoveStrategy
.
AFT_MOVE
);
,
envId
,
projectId
,
baseTestCaseResponseDetail
.
getResponseBody
()
,
MoveStrategy
.
AFT_MOVE
);
TestDataExecuteResult
testDataExecuteResult
=
new
TestDataExecuteResult
(
TestDataExecuteResult
testDataExecuteResult
=
new
TestDataExecuteResult
(
dataStartTime
,
dataStartTime
,
LocalDateTime
.
now
(),
LocalDateTime
.
now
(),
...
@@ -115,7 +113,7 @@ public class CaseActuator implements Actuator {
...
@@ -115,7 +113,7 @@ public class CaseActuator implements Actuator {
testCaseBto
.
getTestData
().
getId
(),
testCaseBto
.
getTestData
().
getId
(),
baseTestCaseResponseDetail
,
baseTestCaseResponseDetail
,
checkPointResult
);
checkPointResult
);
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
CASE_ACTUATOR
,
JSON
.
toJSONString
(
testDataExecuteResult
));
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
CASE_ACTUATOR
,
"[用例执行器] 本次用例执行结果"
+
JsonUtil
.
toJsonPretty
(
testDataExecuteResult
));
return
testDataExecuteResult
;
return
testDataExecuteResult
;
}
}
...
@@ -148,7 +146,7 @@ public class CaseActuator implements Actuator {
...
@@ -148,7 +146,7 @@ public class CaseActuator implements Actuator {
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
CASE_ACTUATOR
,
"[用例执行器] 即将开始执行中置动作"
);
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
CASE_ACTUATOR
,
"[用例执行器] 即将开始执行中置动作"
);
//执行中置动作
//执行中置动作
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterTest
()
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterTest
()
,
envId
,
projectId
,
baseTestCaseResponseDetail
!=
null
?
baseTestCaseResponseDetail
.
getResponseBody
()
:
null
,
MoveStrategy
.
MID_MOVE
);
,
envId
,
projectId
,
baseTestCaseResponseDetail
.
getResponseBody
()
,
MoveStrategy
.
MID_MOVE
);
CheckPointResult
checkPointResult
=
getCheckPointResult
(
testCaseBto
.
getTestCase
(),
CheckPointResult
checkPointResult
=
getCheckPointResult
(
testCaseBto
.
getTestCase
(),
testData
,
testData
,
envId
,
envId
,
...
@@ -164,10 +162,10 @@ public class CaseActuator implements Actuator {
...
@@ -164,10 +162,10 @@ public class CaseActuator implements Actuator {
checkPointResult
checkPointResult
);
);
resultList
.
add
(
testDataExecuteResult
);
resultList
.
add
(
testDataExecuteResult
);
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
CASE_ACTUATOR
,
"[用例执行器] 用例执行结果:"
+
Json
FormatUtil
.
formatJson
(
JSONObject
.
toJSONString
(
testDataExecuteResult
)
));
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
CASE_ACTUATOR
,
"[用例执行器] 用例执行结果:"
+
Json
Util
.
toJsonPretty
(
testDataExecuteResult
));
//执行后置动作
//执行后置动作
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterCase
()
executeMove
(
testCaseBto
.
getTestCase
().
getMoveAfterCase
()
,
envId
,
projectId
,
baseTestCaseResponseDetail
!=
null
?
baseTestCaseResponseDetail
.
getResponseBody
()
:
null
,
MoveStrategy
.
AFT_MOVE
);
,
envId
,
projectId
,
baseTestCaseResponseDetail
.
getResponseBody
()
,
MoveStrategy
.
AFT_MOVE
);
changeExecutionHistoryStatus
(
ExecutionHistoryStatus
.
FINISH
);
changeExecutionHistoryStatus
(
ExecutionHistoryStatus
.
FINISH
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
dataSourceService
.
switchMainDataSource
();
dataSourceService
.
switchMainDataSource
();
...
@@ -247,11 +245,11 @@ public class CaseActuator implements Actuator {
...
@@ -247,11 +245,11 @@ public class CaseActuator implements Actuator {
/**
/**
* 根据Case的Detail进行Case的核心部分执行
* 根据Case的Detail进行Case的核心部分执行
*
*
* @param envId
* @param envId
环境ID
* @param projectId
* @param projectId
项目ID
* @param testCase
* @param testCase
测试用例
* @param testData
* @param testData
测试数据
* @return
* @return
执行后的返回值
*/
*/
private
HttpResponseDetail
executionCaseDetail
(
private
HttpResponseDetail
executionCaseDetail
(
Long
envId
,
Long
projectId
,
TestCase
testCase
,
TestData
testData
)
{
Long
envId
,
Long
projectId
,
TestCase
testCase
,
TestData
testData
)
{
...
@@ -265,9 +263,9 @@ public class CaseActuator implements Actuator {
...
@@ -265,9 +263,9 @@ public class CaseActuator implements Actuator {
HttpResponseDetail
httpResponseDetail
=
httpClientActuator
.
sendHttpRequest
(
httpRequestDetail
,
envId
,
projectId
);
HttpResponseDetail
httpResponseDetail
=
httpClientActuator
.
sendHttpRequest
(
httpRequestDetail
,
envId
,
projectId
);
String
responseBody
=
httpResponseDetail
.
getResponseBody
();
String
responseBody
=
httpResponseDetail
.
getResponseBody
();
if
(
StringUtils
.
isEmpty
(
responseBody
)){
if
(
StringUtils
.
isEmpty
(
responseBody
)){
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次请求结果为空"
)
);
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
"[HTTP执行器] 本次请求结果为空"
);
}
else
{
}
else
{
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次请求结果:%s"
,
Json
FormatUtil
.
formatJson
(
responseBody
)));
LogQueueRuntime
.
addNewLog
(
this
.
getClass
(),
HTTP_ACTUATOR
,
String
.
format
(
"[HTTP执行器] 本次请求结果:%s"
,
Json
Util
.
toJsonPretty
(
responseBody
)));
}
}
return
httpResponseDetail
;
return
httpResponseDetail
;
...
@@ -317,7 +315,7 @@ public class CaseActuator implements Actuator {
...
@@ -317,7 +315,7 @@ public class CaseActuator implements Actuator {
}
}
}
}
B
oolean
hasInit
=
false
;
b
oolean
hasInit
=
false
;
for
(
TestCaseListDataBto
testCaseListDataBto
:
testCaseListDataBtoList
)
{
for
(
TestCaseListDataBto
testCaseListDataBto
:
testCaseListDataBtoList
)
{
LocalDateTime
caseStartTime
=
LocalDateTime
.
now
();
LocalDateTime
caseStartTime
=
LocalDateTime
.
now
();
try
{
try
{
...
@@ -368,7 +366,7 @@ public class CaseActuator implements Actuator {
...
@@ -368,7 +366,7 @@ public class CaseActuator implements Actuator {
LocalDateTime
.
now
(),
LocalDateTime
.
now
(),
testCaseListDataBto
.
getTestCase
().
getId
(),
testCaseListDataBto
.
getTestCase
().
getId
(),
testCaseListDataBto
.
getTestCase
().
getName
(),
testCaseListDataBto
.
getTestCase
().
getName
(),
TestCaseTypeEnum
.
getTypeByValue
(
testCaseListDataBto
.
getTestCase
().
getType
(
)).
toString
(),
Objects
.
requireNonNull
(
TestCaseTypeEnum
.
getTypeByValue
(
testCaseListDataBto
.
getTestCase
().
getType
()
)).
toString
(),
testCaseListDataBto
.
getTestCase
().
getDetail
(),
testCaseListDataBto
.
getTestCase
().
getDetail
(),
testCaseListDataBto
.
getTestCase
().
getDes
(),
testCaseListDataBto
.
getTestCase
().
getDes
(),
testCaseListDataBto
.
getTestCase
().
getMoveBefore
(),
testCaseListDataBto
.
getTestCase
().
getMoveBefore
(),
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论