Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
kt-keystone
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
kt-keystone
Commits
d60c375e
提交
d60c375e
authored
1月 19, 2022
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(base): 修改了ContainCheckPoint对象使结构更加合理了
上级
954c9de0
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
57 行增加
和
36 行删除
+57
-36
CheckPointActuator.java
...src/main/java/org/matrix/actuator/CheckPointActuator.java
+29
-23
HttpClientActuator.java
...src/main/java/org/matrix/actuator/HttpClientActuator.java
+3
-3
CheckPoint.java
...rc/main/java/org/matrix/entity/checkPoint/CheckPoint.java
+7
-2
ContainCheckPoint.java
.../java/org/matrix/entity/checkPoint/ContainCheckPoint.java
+0
-5
NoContainCheckPoint.java
...ava/org/matrix/entity/checkPoint/NoContainCheckPoint.java
+14
-0
baseJS.js
kt-base/src/main/resources/baseJS.js
+2
-2
App.java
kt-web/src/main/java/org/matrix/App.java
+2
-1
没有找到文件。
kt-base/src/main/java/org/matrix/
util/CheckPointUtil
.java
→
kt-base/src/main/java/org/matrix/
actuator/CheckPointActuator
.java
浏览文件 @
d60c375e
package
org
.
matrix
.
util
;
package
org
.
matrix
.
actuator
;
import
cn.hutool.script.ScriptUtil
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -31,17 +31,23 @@ import java.util.regex.Pattern;
*
* @author huangxiahao
*/
public
class
CheckPoint
Util
{
public
class
CheckPoint
Actuator
{
private
String
baseJs
;
private
final
String
baseJs
;
CheckPointUtil
(
String
path
)
{
ClassPathResource
cpr
=
new
ClassPathResource
(
path
);
private
int
projectId
;
private
String
env
;
CheckPointActuator
(
String
baseJsPath
,
String
env
,
int
projectId
)
{
ClassPathResource
cpr
=
new
ClassPathResource
(
baseJsPath
);
try
{
this
.
baseJs
=
IOUtils
.
toString
(
cpr
.
getInputStream
(),
StandardCharsets
.
UTF_8
);
}
catch
(
IOException
e
)
{
throw
new
CheckPointException
(
"初始JS加载失败"
);
}
this
.
projectId
=
projectId
;
this
.
env
=
env
;
}
public
void
httpCheck
(
HttpResponseDetail
httpResponseDetail
,
CheckPoint
checkPoint
)
{
...
...
@@ -56,9 +62,9 @@ public class CheckPointUtil {
checkPointResult
.
addCheckPointResultDetail
(
nullCheck
(
httpResponseDetail
.
getResponseBody
()));
}
//包含检查点检测
for
(
ContainCheckPoint
containCheckPoint
:
checkPoint
.
getContainCheckPoints
())
{
checkPointResult
.
addCheckPointResultDetail
(
containCheck
(
containCheckPoint
,
httpResponseDetail
.
getResponseBody
()));
}
checkPointResult
.
addCheckPointResultDetail
(
containCheck
(
checkPoint
.
getContainCheckPoints
(),
httpResponseDetail
.
getResponseBody
()));
//不包含检查点检测
checkPointResult
.
addCheckPointResultDetail
(
noContainCheck
(
checkPoint
.
getNoContainCheckPoint
(),
httpResponseDetail
.
getResponseBody
()));
//JsonPath检查点检测
if
(
checkPoint
.
getJsonPathCheckPoints
().
size
()
>
0
)
{
Object
jsonObject
=
Configuration
.
defaultConfiguration
().
jsonProvider
().
parse
(
httpResponseDetail
.
getResponseBody
());
...
...
@@ -131,23 +137,24 @@ public class CheckPointUtil {
}
public
CheckPointResultDetail
containCheck
(
ContainCheckPoint
containCheckPoint
,
String
responseBody
)
{
if
(
containCheckPoint
.
getIsContain
())
{
if
(
responseBody
.
contains
(
containCheckPoint
.
getValue
()))
{
return
new
CheckPointResultDetail
(
true
,
"包含检查点,检查通过"
);
}
else
{
return
new
CheckPointResultDetail
(
false
,
String
.
format
(
"包含检查点,检查未通过,结果:%s 中,不包含值:%s"
,
responseBody
,
containCheckPoint
.
getValue
())
);
}
if
(
responseBody
.
contains
(
containCheckPoint
.
getValue
()))
{
return
new
CheckPointResultDetail
(
true
,
"包含检查点,检查通过"
);
}
else
{
if
(
responseBody
.
contains
(
containCheckPoint
.
getValue
()))
{
return
new
CheckPointResultDetail
(
false
,
String
.
format
(
"包含检查点,检查未通过,结果:%s 中,不包含值:%s"
,
responseBody
,
containCheckPoint
.
getValue
())
);
}
}
public
CheckPointResultDetail
noContainCheck
(
NoContainCheckPoint
noContainCheckPoint
,
String
responseBody
)
{
if
(
responseBody
.
contains
(
noContainCheckPoint
.
getValue
()))
{
return
new
CheckPointResultDetail
(
false
,
String
.
format
(
"不包含检查点,检查未通过,结果:%s 中,包含值:%s"
,
responseBody
,
c
ontainCheckPoint
.
getValue
())
String
.
format
(
"不包含检查点,检查未通过,结果:%s 中,包含值:%s"
,
responseBody
,
noC
ontainCheckPoint
.
getValue
())
);
}
else
{
return
new
CheckPointResultDetail
(
...
...
@@ -155,7 +162,6 @@ public class CheckPointUtil {
"不包含检查点,检查通过"
);
}
}
}
...
...
kt-base/src/main/java/org/matrix/
util/HttpClientUtil
.java
→
kt-base/src/main/java/org/matrix/
actuator/HttpClientActuator
.java
浏览文件 @
d60c375e
package
org
.
matrix
.
util
;
package
org
.
matrix
.
actuator
;
import
io.netty.handler.codec.http.HttpHeaderValues
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -40,7 +40,7 @@ import java.util.List;
* todo 打印LOG
* @author HuangXiahao
**/
public
class
HttpClient
Util
{
public
class
HttpClient
Actuator
{
HttpRequestConfig
config
;
...
...
@@ -49,7 +49,7 @@ public class HttpClientUtil {
CloseableHttpClient
client
;
public
HttpClient
Util
(
HttpRequestConfig
config
)
throws
KeyStoreException
,
NoSuchAlgorithmException
,
KeyManagementException
{
public
HttpClient
Actuator
(
HttpRequestConfig
config
)
throws
KeyStoreException
,
NoSuchAlgorithmException
,
KeyManagementException
{
this
.
config
=
config
;
this
.
cookieStore
=
config
.
cookieStore
();
this
.
client
=
config
.
client
();
...
...
kt-base/src/main/java/org/matrix/entity/checkPoint/CheckPoint.java
浏览文件 @
d60c375e
...
...
@@ -22,9 +22,14 @@ public class CheckPoint {
private
Boolean
useNullCheck
=
false
;
/**
*
是否
包含检测
* 包含检测
*/
private
List
<
ContainCheckPoint
>
containCheckPoints
;
private
ContainCheckPoint
containCheckPoints
;
/**
* 不包含检测
*/
private
NoContainCheckPoint
noContainCheckPoint
;
/**
* JsonPath检查点
...
...
kt-base/src/main/java/org/matrix/entity/checkPoint/ContainCheckPoint.java
浏览文件 @
d60c375e
...
...
@@ -9,11 +9,6 @@ import lombok.Data;
@Data
public
class
ContainCheckPoint
{
/**
* false为不包含检测,ture为包含检测
*/
private
Boolean
isContain
=
false
;
private
String
value
;
}
kt-base/src/main/java/org/matrix/entity/checkPoint/NoContainCheckPoint.java
0 → 100644
浏览文件 @
d60c375e
package
org
.
matrix
.
entity
.
checkPoint
;
import
lombok.Data
;
/**
* 是否包含检查点
* @author Administrator
*/
@Data
public
class
NoContainCheckPoint
{
private
String
value
;
}
kt-base/src/main/resources/baseJS.js
浏览文件 @
d60c375e
...
...
@@ -7,10 +7,10 @@ function equal(a, b) {
//数组类型
switch
(
bType
)
{
case
"[object Array]"
:
return
JSON
.
stringify
(
a
)
==
JSON
.
stringify
(
b
);
return
JSON
.
stringify
(
a
)
==
=
JSON
.
stringify
(
b
);
default
:
for
(
var
i
=
0
;
i
<
a
.
length
;
i
++
)
{
if
(
JSON
.
stringify
(
a
[
i
])
!=
JSON
.
stringify
(
b
))
{
if
(
JSON
.
stringify
(
a
[
i
])
!=
=
JSON
.
stringify
(
b
))
{
return
false
;
}
}
...
...
kt-web/src/main/java/org/matrix/App.java
浏览文件 @
d60c375e
...
...
@@ -13,4 +13,4 @@ public class App {
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
App
.
class
);
}
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论