Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
auto-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄承天
auto-test
Commits
9651099a
提交
9651099a
authored
3月 26, 2020
作者:
孙洁清
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
路由规则
上级
e5dccc09
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
97 行增加
和
36 行删除
+97
-36
TestReportDao.java
src/main/java/com/zjty/autotest/dao/TestReportDao.java
+6
-0
TestTask.java
src/main/java/com/zjty/autotest/mq/TestTask.java
+76
-21
FileType.java
src/main/java/com/zjty/autotest/pojo/sjq/FileType.java
+13
-0
AutoResultSetServiceImpl.java
.../zjty/autotest/service/impl/AutoResultSetServiceImpl.java
+1
-0
TestReportServiceImpl.java
...com/zjty/autotest/service/impl/TestReportServiceImpl.java
+1
-15
FileHtmlUtil.java
src/main/java/com/zjty/autotest/util/FileHtmlUtil.java
+0
-0
没有找到文件。
src/main/java/com/zjty/autotest/dao/TestReportDao.java
浏览文件 @
9651099a
...
@@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Modifying;
...
@@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Modifying;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.data.repository.query.Param
;
import
javax.transaction.Transactional
;
import
java.beans.Transient
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -25,6 +27,10 @@ public interface TestReportDao extends JpaRepository<TestReport,String>, JpaSpec
...
@@ -25,6 +27,10 @@ public interface TestReportDao extends JpaRepository<TestReport,String>, JpaSpec
TestReport
findByResultId
(
@Param
(
"resultId"
)
String
resultId
);
TestReport
findByResultId
(
@Param
(
"resultId"
)
String
resultId
);
@Modifying
@Modifying
int
deleteByResultId
(
@Param
(
"resultId"
)
String
resultId
);
int
deleteByResultId
(
@Param
(
"resultId"
)
String
resultId
);
@Modifying
@Transactional
@Query
(
"update TestReport set outReport=:outReport,status=1 where resultId=:resultId"
)
void
updateOut
(
String
outReport
,
String
resultId
);
@Query
(
value
=
"select result_id,status from test_report "
,
nativeQuery
=
true
)
@Query
(
value
=
"select result_id,status from test_report "
,
nativeQuery
=
true
)
List
<
Map
<
String
,
Object
>>
findAllStatus
();
List
<
Map
<
String
,
Object
>>
findAllStatus
();
...
...
src/main/java/com/zjty/autotest/mq/TestTask.java
浏览文件 @
9651099a
...
@@ -17,6 +17,9 @@ import org.springframework.stereotype.Component;
...
@@ -17,6 +17,9 @@ import org.springframework.stereotype.Component;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Predicate
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
@Component
@Component
@Slf4j
@Slf4j
...
@@ -29,10 +32,10 @@ public class TestTask {
...
@@ -29,10 +32,10 @@ public class TestTask {
@Scheduled
(
cron
=
"0/1 * * * * ?"
)
@Scheduled
(
cron
=
"0/1 * * * * ?"
)
@Async
(
"asyncServiceExecutor"
)
@Async
(
"asyncServiceExecutor"
)
public
void
getMessage
(){
public
void
getMessage
()
{
String
take
=
QueueManager
.
take
();
String
take
=
QueueManager
.
take
();
log
.
info
(
"获取到消息:{}"
,
take
);
log
.
info
(
"获取到消息:{}"
,
take
);
if
(!
StringUtils
.
isEmpty
(
take
))
{
if
(!
StringUtils
.
isEmpty
(
take
))
{
doBusiness
(
take
);
doBusiness
(
take
);
}
}
}
}
...
@@ -42,7 +45,7 @@ public class TestTask {
...
@@ -42,7 +45,7 @@ public class TestTask {
TestChannel
testChannel
=
(
TestChannel
)
CacheManager
.
getCache
(
id
);
TestChannel
testChannel
=
(
TestChannel
)
CacheManager
.
getCache
(
id
);
if
(
testChannel
!=
null
)
{
if
(
testChannel
!=
null
)
{
log
.
info
(
"testChannel不为空:{}"
,
testChannel
);
log
.
info
(
"testChannel不为空:{}"
,
testChannel
);
try
{
try
{
EvaReport
evaReport
=
new
EvaReport
();
EvaReport
evaReport
=
new
EvaReport
();
evaReport
.
setBrowser
(
testChannel
.
getBrowser
());
evaReport
.
setBrowser
(
testChannel
.
getBrowser
());
...
@@ -101,25 +104,34 @@ public class TestTask {
...
@@ -101,25 +104,34 @@ public class TestTask {
Thread
.
sleep
(
600
);
Thread
.
sleep
(
600
);
if
(
testChannel
.
getCodeUrl
()
!=
null
)
{
if
(
testChannel
.
getCodeUrl
()
!=
null
)
{
//解压上传得代码
//解压上传得代码
String
fileRoutes
=
FileHtmlUtil
.
getFileRoutes
(
testChannel
.
getCodeUrl
());
FileHtmlUtil
.
getFiles
(
testChannel
.
getCodeUrl
(),
null
);
FileHtmlUtil
.
getFiles
(
testChannel
.
getCodeUrl
(),
null
);
Map
<
String
,
List
<
FileBean
>>
alls
=
FileHtmlUtil
.
getAlls
();
Map
<
String
,
List
<
FileType
>>
alls
=
FileHtmlUtil
.
getAlls
();
//所有的路由
List
<
String
>
allRouters
=
new
ArrayList
<>();
//获取项目类型
Set
<
String
>
all
=
alls
.
keySet
();
FileHtmlUtil
.
getFileRoutes
(
testChannel
.
getCodeUrl
());
for
(
String
s1
:
all
)
{
int
jspcount
=
FileHtmlUtil
.
jspNum
;
List
<
FileBean
>
fileBeans
=
alls
.
get
(
s1
);
int
jscount
=
FileHtmlUtil
.
jsNum
;
if
(
fileRoutes
!=
null
)
{
int
vuecount
=
FileHtmlUtil
.
vueNum
;
if
(
s1
.
contains
(
"router"
))
{
int
angularcount
=
FileHtmlUtil
.
angularNum
;
for
(
FileBean
fileBean
:
fileBeans
)
{
int
htmlcount
=
FileHtmlUtil
.
count
;
allRouters
.
addAll
(
FileHtmlUtil
.
readTxtFile
(
fileBean
.
getUrl
(),
"(\\/:*[a-zA-Z0-9]*)+"
));
String
fileRoutes
=
null
;
}
if
(
jspcount
>
0
){
}
fileRoutes
=
"jsp"
;
}
}
else
if
(
vuecount
>
0
){
fileRoutes
=
"vue"
;
}
else
if
(
jscount
>
0
){
fileRoutes
=
"react"
;
}
else
if
(
angularcount
>
0
){
fileRoutes
=
"angular"
;
}
}
for
(
String
allRouter
:
allRouters
)
{
if
(
fileRoutes
!=
null
)
{
System
.
out
.
println
(
"路由:"
+
allRouter
);
List
<
String
>
routerList
=
getRouterList
(
alls
,
fileRoutes
);
List
<
String
>
collect
=
routerList
.
stream
().
map
(
String:
:
toLowerCase
).
distinct
().
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
collect
.
toString
());
}
}
FileHtmlUtil
.
clearAll
();
FileHtmlUtil
.
clearAll
();
//获取前端代码中得网页路由地址
//获取前端代码中得网页路由地址
//比对黄承天代码中访问得地址和路由地址,黄承天是否访问全了。
//比对黄承天代码中访问得地址和路由地址,黄承天是否访问全了。
...
@@ -141,4 +153,47 @@ public class TestTask {
...
@@ -141,4 +153,47 @@ public class TestTask {
}
}
}
}
private
List
<
String
>
getRouterList
(
Map
<
String
,
List
<
FileType
>>
alls
,
String
fileRoutes
)
{
List
<
String
>
allRouters
=
new
ArrayList
<>();
Set
<
String
>
all
=
alls
.
keySet
();
//所有的路由
if
(
fileRoutes
.
equals
(
"vue"
))
{
for
(
String
s1
:
all
)
{
List
<
FileType
>
fileBeans
=
alls
.
get
(
s1
);
if
(
fileRoutes
!=
null
)
{
if
(
s1
.
contains
(
"router"
))
{
for
(
FileType
fileBean
:
fileBeans
)
{
allRouters
.
addAll
(
FileHtmlUtil
.
readTxtFile
(
fileBean
.
getAddress
(),
"(\\/:*[a-zA-Z0-9]*)+"
));
}
}
}
}
}
else
if
(
fileRoutes
.
equals
(
"angular"
)||
fileRoutes
.
equals
(
"react"
)){
for
(
String
s1
:
all
)
{
List
<
FileType
>
fileBeans
=
alls
.
get
(
s1
);
if
(
fileRoutes
!=
null
)
{
if
(
s1
.
contains
(
"router"
)||
s1
.
contains
(
"js"
))
{
for
(
FileType
fileBean
:
fileBeans
)
{
allRouters
.
addAll
(
FileHtmlUtil
.
readTxtFile
(
fileBean
.
getAddress
(),
"(\\/:*[a-zA-Z0-9]*)+"
));
}
}
}
}
}
else
{
for
(
String
s1
:
all
)
{
List
<
FileType
>
fileBeans
=
alls
.
get
(
s1
);
if
(
fileRoutes
!=
null
)
{
for
(
FileType
fileBean
:
fileBeans
)
{
if
(
fileBean
.
getSuffix
().
equals
(
"jsp"
))
{
allRouters
.
addAll
(
FileHtmlUtil
.
readTxtFile
(
fileBean
.
getAddress
(),
"(\\/:*[a-zA-Z0-9]*)+"
));
}
}
}
}
}
return
allRouters
;
}
}
}
src/main/java/com/zjty/autotest/pojo/sjq/FileType.java
0 → 100644
浏览文件 @
9651099a
package
com
.
zjty
.
autotest
.
pojo
.
sjq
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
public
class
FileType
{
private
String
address
;
private
String
suffix
;
private
String
fileName
;
}
src/main/java/com/zjty/autotest/service/impl/AutoResultSetServiceImpl.java
浏览文件 @
9651099a
...
@@ -105,6 +105,7 @@ public class AutoResultSetServiceImpl implements AutoResultSetService {
...
@@ -105,6 +105,7 @@ public class AutoResultSetServiceImpl implements AutoResultSetService {
AutoResultSet
save
=
autoResultSetDao
.
save
(
autoResultSet
);
AutoResultSet
save
=
autoResultSetDao
.
save
(
autoResultSet
);
String
in
=
JSON
.
toJSONString
(
testChannel
);
String
in
=
JSON
.
toJSONString
(
testChannel
);
TestReport
testReport
=
new
TestReport
();
TestReport
testReport
=
new
TestReport
();
testReport
.
setId
(
idWorker
.
nextId
()+
""
);
testReport
.
setResultId
(
tid
);
testReport
.
setResultId
(
tid
);
testReport
.
setStatus
(
0
);
testReport
.
setStatus
(
0
);
testReport
.
setInputReport
(
in
);
testReport
.
setInputReport
(
in
);
...
...
src/main/java/com/zjty/autotest/service/impl/TestReportServiceImpl.java
浏览文件 @
9651099a
...
@@ -76,12 +76,7 @@ public class TestReportServiceImpl implements TestReportService {
...
@@ -76,12 +76,7 @@ public class TestReportServiceImpl implements TestReportService {
* @param testReport
* @param testReport
*/
*/
public
void
update
(
TestReport
testReport
)
{
public
void
update
(
TestReport
testReport
)
{
TestReport
report
=
testReportDao
.
findByResultId
(
testReport
.
getResultId
());
testReportDao
.
updateOut
(
testReport
.
getOutReport
(),
testReport
.
getResultId
());
if
(
report
!=
null
)
{
report
.
setStatus
(
1
);
report
.
setOutReport
(
testReport
.
getOutReport
());
testReportDao
.
save
(
testReport
);
}
}
}
/**
/**
...
@@ -96,17 +91,8 @@ public class TestReportServiceImpl implements TestReportService {
...
@@ -96,17 +91,8 @@ public class TestReportServiceImpl implements TestReportService {
@Transient
@Transient
@Override
@Override
public
ResponseResult
save
(
TestReport
testReport
)
{
public
ResponseResult
save
(
TestReport
testReport
)
{
System
.
out
.
println
(
testReport
);
if
(
testReport
!=
null
){
testReport
.
setId
(
idWorker
.
nextId
()+
""
);
// testReport.setOutReport(testReport.getOutReport());
testReport
.
setStatus
(
testReport
.
getStatus
());
testReport
.
setInputReport
(
testReport
.
getInputReport
());
testReport
.
setResultId
(
testReport
.
getResultId
());
testReportDao
.
save
(
testReport
);
testReportDao
.
save
(
testReport
);
return
ResponseResult
.
okResult
(
AppHttpCodeEnum
.
SUCCESS
);
return
ResponseResult
.
okResult
(
AppHttpCodeEnum
.
SUCCESS
);
}
return
ResponseResult
.
errorResult
(
AppHttpCodeEnum
.
ERROR
);
}
}
@Transient
@Transient
@Override
@Override
...
...
src/main/java/com/zjty/autotest/util/FileHtmlUtil.java
浏览文件 @
9651099a
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论