Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
龚小红
oto
Commits
442e2d68
Commit
442e2d68
authored
Apr 19, 2021
by
张艳玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
44bb7901
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
438 additions
and
38 deletions
+438
-38
build.gradle
build.gradle
+1
-0
AgentVideo.java
src/test/java/com/kjj/bean/agent/AgentVideo.java
+0
-3
RuleBean.java
src/test/java/com/kjj/bean/manager/RuleBean.java
+11
-0
SaveLimitBean.java
src/test/java/com/kjj/bean/manager/SaveLimitBean.java
+9
-0
LiveLater.java
src/test/java/com/kjj/cases/live/agent/LiveLater.java
+21
-21
OpenLive.java
src/test/java/com/kjj/cases/live/anchor/OpenLive.java
+1
-1
LotteryRule.java
src/test/java/com/kjj/cases/live/manager/LotteryRule.java
+184
-0
SaveAndUpdate.java
src/test/java/com/kjj/cases/live/manager/SaveAndUpdate.java
+3
-4
MyWebSocketUtil.java
src/test/java/com/kjj/utils/MyWebSocketUtil.java
+189
-0
liveTestNG.xml
src/test/liveTestNG.xml
+19
-9
No files found.
build.gradle
View file @
442e2d68
...
@@ -24,6 +24,7 @@ repositories {
...
@@ -24,6 +24,7 @@ repositories {
dependencies
{
dependencies
{
compile
'org.projectlombok:lombok:1.18.12'
compile
'org.projectlombok:lombok:1.18.12'
compile
'org.java-websocket:Java-WebSocket:1.5.1'
annotationProcessor
'org.projectlombok:lombok:1.18.12'
annotationProcessor
'org.projectlombok:lombok:1.18.12'
testCompile
'org.projectlombok:lombok:1.18.12'
testCompile
'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor
'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor
'org.projectlombok:lombok:1.18.12'
...
...
src/test/java/com/kjj/bean/agent/AgentVideo.java
View file @
442e2d68
package
com
.
kjj
.
bean
.
agent
;
package
com
.
kjj
.
bean
.
agent
;
import
com.sun.org.apache.xpath.internal.objects.XString
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
...
...
src/test/java/com/kjj/bean/manager/RuleBean.java
0 → 100644
View file @
442e2d68
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
@Data
public
class
RuleBean
{
public
Integer
cityCode
;
public
Integer
provinceCode
;
public
Integer
totalNum
;
}
src/test/java/com/kjj/bean/manager/SaveLimitBean.java
0 → 100644
View file @
442e2d68
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
@Data
public
class
SaveLimitBean
{
public
Integer
confName
;
public
Integer
confValue
;
}
src/test/java/com/kjj/cases/live/agent/LiveLater.java
View file @
442e2d68
...
@@ -37,9 +37,9 @@ public class LiveLater implements AdminAuthorization {
...
@@ -37,9 +37,9 @@ public class LiveLater implements AdminAuthorization {
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success
"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data
"
);
System
.
out
.
println
(
success
);
System
.
out
.
println
(
data
);
Assert
.
assert
True
(
success
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束后全部tab下数据失败"
,
response
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束后全部tab下数据失败"
,
response
.
body
().
asString
()));
}
}
// 获取直播结束我的客户页面直接邀请tab;
// 获取直播结束我的客户页面直接邀请tab;
...
@@ -51,9 +51,9 @@ public class LiveLater implements AdminAuthorization {
...
@@ -51,9 +51,9 @@ public class LiveLater implements AdminAuthorization {
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"actionTypeList"
,
26
);
params
.
put
(
"actionTypeList"
,
26
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success
"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data
"
);
System
.
out
.
println
(
success
);
System
.
out
.
println
(
data
);
Assert
.
assert
True
(
success
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面直接邀请tab数据失败"
,
response
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面直接邀请tab数据失败"
,
response
.
body
().
asString
()));
}
}
// 获取直播结束我的客户页面转介绍tab;
// 获取直播结束我的客户页面转介绍tab;
...
@@ -65,9 +65,9 @@ public class LiveLater implements AdminAuthorization {
...
@@ -65,9 +65,9 @@ public class LiveLater implements AdminAuthorization {
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"actionTypeList"
,
22
);
params
.
put
(
"actionTypeList"
,
22
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success
"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data
"
);
System
.
out
.
println
(
success
);
System
.
out
.
println
(
data
);
Assert
.
assert
True
(
success
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面转介绍tab数据失败"
,
response
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面转介绍tab数据失败"
,
response
.
body
().
asString
()));
}
}
// 获取直播结束我的客户页面中奖tab;
// 获取直播结束我的客户页面中奖tab;
...
@@ -79,9 +79,9 @@ public class LiveLater implements AdminAuthorization {
...
@@ -79,9 +79,9 @@ public class LiveLater implements AdminAuthorization {
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"actionTypeList"
,
17
);
params
.
put
(
"actionTypeList"
,
17
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success
"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data
"
);
System
.
out
.
println
(
success
);
System
.
out
.
println
(
data
);
Assert
.
assert
True
(
success
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面中奖tab数据失败"
,
response
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面中奖tab数据失败"
,
response
.
body
().
asString
()));
}
}
// 获取直播结束我的客户页面报名tab;
// 获取直播结束我的客户页面报名tab;
...
@@ -93,9 +93,9 @@ public class LiveLater implements AdminAuthorization {
...
@@ -93,9 +93,9 @@ public class LiveLater implements AdminAuthorization {
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"actionTypeList"
,
20
);
params
.
put
(
"actionTypeList"
,
20
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success
"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data
"
);
System
.
out
.
println
(
success
);
System
.
out
.
println
(
data
);
Assert
.
assert
True
(
success
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面报名tab数据失败"
,
response
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面报名tab数据失败"
,
response
.
body
().
asString
()));
}
}
// 获取直播结束我的客户页面观看20分钟+tab;
// 获取直播结束我的客户页面观看20分钟+tab;
...
@@ -107,9 +107,9 @@ public class LiveLater implements AdminAuthorization {
...
@@ -107,9 +107,9 @@ public class LiveLater implements AdminAuthorization {
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"actionTypeList"
,
4
);
params
.
put
(
"actionTypeList"
,
4
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_ClueList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success
"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data
"
);
System
.
out
.
println
(
success
);
System
.
out
.
println
(
data
);
Assert
.
assert
True
(
success
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面观看20分钟以上tab数据失败"
,
response
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_ClueList
,
"获取直播结束我的客户页面观看20分钟以上tab数据失败"
,
response
.
body
().
asString
()));
}
}
//直播结束后中奖名单查询
//直播结束后中奖名单查询
...
@@ -121,9 +121,9 @@ public class LiveLater implements AdminAuthorization {
...
@@ -121,9 +121,9 @@ public class LiveLater implements AdminAuthorization {
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageIndex"
,
1
);
params
.
put
(
"pageSize"
,
30
);
params
.
put
(
"pageSize"
,
30
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_RewardAgentList
);
Response
response
=
network
.
getResponse
(
params
,
BasicConfig
.
MOBILE_RewardAgentList
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success
"
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data
"
);
System
.
out
.
println
(
success
);
System
.
out
.
println
(
data
);
Assert
.
assert
True
(
success
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_RewardAgentList
,
"获取直播结束中奖名单失败"
,
response
.
body
().
asString
()));
Assert
.
assert
NotNull
(
data
,
network
.
message
(
params
,
BasicConfig
.
MOBILE_RewardAgentList
,
"获取直播结束中奖名单失败"
,
response
.
body
().
asString
()));
}
}
...
...
src/test/java/com/kjj/cases/live/anchor/OpenLive.java
View file @
442e2d68
...
@@ -35,7 +35,7 @@ public class OpenLive implements AdminAuthorization {
...
@@ -35,7 +35,7 @@ public class OpenLive implements AdminAuthorization {
Object
data
=
openRes
.
jsonPath
().
getJsonObject
(
"data"
);
Object
data
=
openRes
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
openParam
,
BasicConfig
.
ANCHOR_OPEN
,
"开启直播失败"
,
openRes
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
openParam
,
BasicConfig
.
ANCHOR_OPEN
,
"开启直播失败"
,
openRes
.
body
().
asString
()));
ThreadSleepUtils
.
sleep
(
5
000
);
ThreadSleepUtils
.
sleep
(
10
000
);
}
}
...
...
src/test/java/com/kjj/cases/live/manager/LotteryRule.java
0 → 100644
View file @
442e2d68
package
com
.
kjj
.
cases
.
live
.
manager
;
import
com.kjj.bean.manager.RewardPkBean
;
import
com.kjj.bean.manager.RuleBean
;
import
com.kjj.bean.manager.SaveLimitBean
;
import
com.kjj.cases.live.admin.AdminAuthorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.BaseUtils
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
LotteryRule
implements
AdminAuthorization
{
public
long
confId
;
@Test
(
description
=
"获取抽奖轮次信息"
,
priority
=
1
)
public
void
获取抽奖轮次信息
()
{
BaseUtils
.
ssoLogin
();
Map
<
String
,
Object
>
listParam
=
new
HashMap
<>();
listParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
listParam
,
BasicConfig
.
MANAGER_list
);
List
data
=
response
.
jsonPath
().
getList
(
"data"
);
Map
resultMap
=
(
Map
)
data
.
get
(
1
);
System
.
out
.
println
(
resultMap
.
get
(
"confId"
));
confId
=
Long
.
parseLong
(
resultMap
.
get
(
"confId"
).
toString
());
Assert
.
assertNotNull
(
confId
,
network
.
message
(
listParam
,
BasicConfig
.
MANAGER_list
,
"获取抽奖轮次信息失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"未配置区域开启开关"
,
priority
=
2
)
public
void
未配置区域开启开关
()
{
Map
<
String
,
Object
>
changeStatusParam
=
new
HashMap
<>();
changeStatusParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
changeStatusParam
.
put
(
"confId"
,
confId
);
changeStatusParam
.
put
(
"status"
,
1
);
Response
response
=
network
.
postResponse
(
changeStatusParam
,
BasicConfig
.
MANAGER_changeStatus
);
boolean
success
=
response
.
jsonPath
().
getBoolean
(
"success"
);
System
.
out
.
println
(
success
);
Assert
.
assertFalse
(
success
,
network
.
message
(
changeStatusParam
,
BasicConfig
.
MANAGER_changeStatus
,
"查询没有区域中奖配置记录失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取省市区数据"
,
priority
=
3
)
public
void
获取省市区数据
()
{
Map
<
String
,
Object
>
areaParam
=
new
HashMap
<>();
areaParam
.
put
(
"areaType"
,
2
);
Response
response
=
network
.
getResponse
(
areaParam
,
BasicConfig
.
MANAGER_area
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
areaParam
,
BasicConfig
.
MANAGER_area
,
"获取省市区数据失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取抽奖轮次配置头部信息"
,
priority
=
4
)
public
void
获取抽奖轮次配置头部信息
()
{
Map
<
String
,
Object
>
headerParam
=
new
HashMap
<>();
headerParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
headerParam
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
getResponse
(
headerParam
,
BasicConfig
.
MANAGER_header
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
headerParam
,
BasicConfig
.
MANAGER_header
,
"获取抽奖轮次配置头部信息失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"获取抽奖轮次信息配置的中奖地区配置"
,
priority
=
5
)
public
void
获取抽奖轮次信息配置的中奖地区配置
()
{
Map
<
String
,
Object
>
confListParam
=
new
HashMap
<>();
confListParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
confListParam
.
put
(
"confId"
,
confId
);
Response
response
=
network
.
getResponse
(
confListParam
,
BasicConfig
.
MANAGER_confList
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
confListParam
,
BasicConfig
.
MANAGER_confList
,
"获取抽奖轮次配置头部信息失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"保存抽奖轮次信息配置的中奖地区配置"
,
priority
=
6
)
public
void
保存抽奖轮次信息配置的中奖地区配置
()
{
Map
<
String
,
Object
>
saveParam
=
new
HashMap
<>();
saveParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
saveParam
.
put
(
"confId"
,
confId
);
List
<
RuleBean
>
Rule
=
new
ArrayList
<>();
RuleBean
save
=
new
RuleBean
();
save
.
setProvinceCode
(
110000
);
save
.
setCityCode
(
null
);
save
.
setTotalNum
(
10
);
Rule
.
add
(
save
);
RuleBean
save1
=
new
RuleBean
();
save1
.
setProvinceCode
(
330000
);
save1
.
setCityCode
(
null
);
save1
.
setTotalNum
(
90
);
Rule
.
add
(
save1
);
RuleBean
save2
=
new
RuleBean
();
save2
.
setProvinceCode
(
330000
);
save2
.
setCityCode
(
330100
);
save2
.
setTotalNum
(
90
);
Rule
.
add
(
save2
);
saveParam
.
put
(
"list"
,
Rule
);
Response
response
=
network
.
postResponse
(
saveParam
,
BasicConfig
.
MANAGER_save
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
saveParam
,
BasicConfig
.
MANAGER_save
,
"保存抽奖轮次信息配置的中奖地区配置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"已配置区域开启开关"
,
priority
=
7
)
public
void
已配置区域开启开关
()
{
Map
<
String
,
Object
>
changeStatusParam
=
new
HashMap
<>();
changeStatusParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
changeStatusParam
.
put
(
"confId"
,
confId
);
changeStatusParam
.
put
(
"status"
,
1
);
Response
response
=
network
.
postResponse
(
changeStatusParam
,
BasicConfig
.
MANAGER_changeStatus
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
changeStatusParam
,
BasicConfig
.
MANAGER_changeStatus
,
"已配置区域开启开关失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询中奖限制"
,
priority
=
8
)
public
void
查询中奖限制
()
{
Map
<
String
,
Object
>
limitParam
=
new
HashMap
<>();
limitParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
limitParam
,
BasicConfig
.
MANAGER_limit
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
limitParam
,
BasicConfig
.
MANAGER_limit
,
"查询中奖限制失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"修改中奖规则限制"
,
priority
=
9
)
public
void
修改中奖规则限制
()
{
Map
<
String
,
Object
>
savelimitParam
=
new
HashMap
<>();
savelimitParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
List
<
SaveLimitBean
>
savelimit
=
new
ArrayList
<>();
SaveLimitBean
limitlist
=
new
SaveLimitBean
();
limitlist
.
setConfValue
(
3
);
limitlist
.
setConfName
(
1
);
savelimit
.
add
(
limitlist
);
SaveLimitBean
limitlist1
=
new
SaveLimitBean
();
limitlist1
.
setConfValue
(
4
);
limitlist1
.
setConfName
(
1
);
savelimit
.
add
(
limitlist1
);
SaveLimitBean
limitlist2
=
new
SaveLimitBean
();
limitlist2
.
setConfValue
(
11
);
limitlist2
.
setConfName
(
1
);
savelimit
.
add
(
limitlist2
);
SaveLimitBean
limitlist3
=
new
SaveLimitBean
();
limitlist3
.
setConfValue
(
12
);
limitlist3
.
setConfName
(
0
);
savelimit
.
add
(
limitlist3
);
savelimitParam
.
put
(
"list"
,
savelimit
);
Response
response
=
network
.
postResponse
(
savelimitParam
,
BasicConfig
.
MANAGER_saveLimit
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
savelimitParam
,
BasicConfig
.
MANAGER_saveLimit
,
"修改中奖规则限制失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询修改中奖限制是否成功"
,
priority
=
10
)
public
void
查询修改中奖限制是否成功
()
{
Map
<
String
,
Object
>
limitParam
=
new
HashMap
<>();
limitParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
limitParam
,
BasicConfig
.
MANAGER_limit
);
Object
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
limitParam
,
BasicConfig
.
MANAGER_limit
,
"未查询到修改后的中奖规则"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/live/manager/SaveAndUpdate.java
View file @
442e2d68
...
@@ -71,7 +71,6 @@ public class SaveAndUpdate implements AdminAuthorization {
...
@@ -71,7 +71,6 @@ public class SaveAndUpdate implements AdminAuthorization {
Map
<
String
,
Object
>
maxAmountParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
maxAmountParam
=
new
HashMap
<>();
maxAmountParam
.
put
(
"liveId"
,
liveID
);
maxAmountParam
.
put
(
"liveId"
,
liveID
);
maxAmountParam
.
put
(
"maxAmount"
,
100000
);
maxAmountParam
.
put
(
"maxAmount"
,
100000
);
Response
maxAmountRes
=
network
.
postResponse
(
maxAmountParam
,
BasicConfig
.
MANAGER_SAVEORUPDATEMAXAMOUNT
);
Response
maxAmountRes
=
network
.
postResponse
(
maxAmountParam
,
BasicConfig
.
MANAGER_SAVEORUPDATEMAXAMOUNT
);
boolean
data
=
maxAmountRes
.
jsonPath
().
getBoolean
(
"data"
);
boolean
data
=
maxAmountRes
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
System
.
out
.
println
(
data
);
...
@@ -209,13 +208,13 @@ public class SaveAndUpdate implements AdminAuthorization {
...
@@ -209,13 +208,13 @@ public class SaveAndUpdate implements AdminAuthorization {
public
void
查询抽奖奖品列表
()
{
public
void
查询抽奖奖品列表
()
{
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
getLiveAwardListParam
=
new
HashMap
<>();
getLiveAwardListParam
.
put
(
"liveId"
,
liveID
);
getLiveAwardListParam
.
put
(
"liveId"
,
liveID
);
Response
s
getLiveAwardListRes
=
network
.
getResponse
(
getLiveAwardListParam
,
BasicConfig
.
MANAGER_getLiveAwardList
);
Response
getLiveAwardListRes
=
network
.
getResponse
(
getLiveAwardListParam
,
BasicConfig
.
MANAGER_getLiveAwardList
);
List
data
=
s
getLiveAwardListRes
.
jsonPath
().
getList
(
"data"
);
List
data
=
getLiveAwardListRes
.
jsonPath
().
getList
(
"data"
);
Map
resultMap
=
(
Map
)
data
.
get
(
0
);
Map
resultMap
=
(
Map
)
data
.
get
(
0
);
System
.
out
.
println
(
resultMap
.
get
(
"welfareConfId"
));
System
.
out
.
println
(
resultMap
.
get
(
"welfareConfId"
));
welfareConfId
=
Long
.
parseLong
(
resultMap
.
get
(
"welfareConfId"
).
toString
());
welfareConfId
=
Long
.
parseLong
(
resultMap
.
get
(
"welfareConfId"
).
toString
());
System
.
out
.
println
(
data
);
System
.
out
.
println
(
data
);
Assert
.
assertNotNull
(
data
,
network
.
message
(
getLiveAwardListParam
,
BasicConfig
.
MANAGER_getLiveAwardList
,
"查询奖品列表失败"
,
s
getLiveAwardListRes
.
body
().
asString
()));
Assert
.
assertNotNull
(
data
,
network
.
message
(
getLiveAwardListParam
,
BasicConfig
.
MANAGER_getLiveAwardList
,
"查询奖品列表失败"
,
getLiveAwardListRes
.
body
().
asString
()));
}
}
@Test
(
description
=
"指定中奖奖品"
,
priority
=
11
)
@Test
(
description
=
"指定中奖奖品"
,
priority
=
11
)
...
...
src/test/java/com/kjj/utils/MyWebSocketUtil.java
0 → 100644
View file @
442e2d68
package
com
.
kjj
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.java_websocket.client.WebSocketClient
;
import
org.java_websocket.enums.ReadyState
;
import
org.java_websocket.handshake.ServerHandshake
;
import
java.net.URI
;
/**
* WebSocket工具类
* @author lizhi
* @date 2021/4/19 4:00 下午
*/
@Slf4j
public
class
MyWebSocketUtil
{
private
static
final
String
URL
=
"wss://ws.duibatest.com.cn/kws"
;
private
MyWebSocketUtil
()
{
}
public
static
void
main
(
String
[]
args
)
{
String
authKey
=
"zFNkBc7JtvLPL6ifAfXbcgYH7WrugVmhv4CXQVq1CN1Y2C8pcBXoPvUPFbkWj7HbdkFpe4oX6SLjczK3ruYpQ8EaQ5"
;
String
liveId
=
"Kj21MjMzMTE"
;
//连接
MyWebSocketClient
client
=
connect
();
//身份认证,识别用户信息
auth
(
client
,
authKey
);
//进入直播间
enter
(
client
,
liveId
);
//循环发送心跳,长时间不发消息,链接会断开
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
hb
(
client
);
ThreadSleepUtils
.
sleep
(
5000
);
}
//退出直播间
out
(
client
,
liveId
);
//无意义命令
gt
(
client
);
//关闭连接
close
(
client
);
}
/**
* 创建链接
* @param url 需要链接的地址
* @return WebSocket客户端
*/
public
static
MyWebSocketClient
connect
(
String
url
)
{
MyWebSocketClient
client
=
new
MyWebSocketClient
(
URI
.
create
(
url
));
client
.
connect
();
// 判断是否连接成功,未成功后面发送消息时会报错
while
(!
client
.
getReadyState
().
equals
(
ReadyState
.
OPEN
))
{
log
.
info
(
"连接中···请稍后"
);
ThreadSleepUtils
.
sleep
(
500
);
}
return
client
;
}
public
static
MyWebSocketClient
connect
()
{
return
connect
(
URL
);
}
/**
* 授权
* @param client WebSocket客户端
* @param authKey 用户加密信息
*/
public
static
void
auth
(
WebSocketClient
client
,
String
authKey
)
{
sendTextMsg
(
client
,
WebSocketConstant
.
AUTH_OP
+
WebSocketConstant
.
MESSAGE_BODY_SPLIT
+
authKey
);
}
/**
* 进入直播间
* @param client WebSocket客户端
* @param liveId 加密的直播ID
*/
public
static
void
enter
(
WebSocketClient
client
,
String
liveId
)
{
sendTextMsg
(
client
,
WebSocketConstant
.
ENTER_LIVE_OP
+
WebSocketConstant
.
MESSAGE_BODY_SPLIT
+
liveId
+
WebSocketConstant
.
MESSAGE_BODY_SPLIT
+
"2"
);
}
/**
* 退出直播间
* @param client WebSocket客户端
* @param liveId 加密的直播ID
*/
public
static
void
out
(
WebSocketClient
client
,
String
liveId
)
{
sendTextMsg
(
client
,
WebSocketConstant
.
OUT_LIVE_OP
+
WebSocketConstant
.
MESSAGE_BODY_SPLIT
+
liveId
);
}
/**
* 发送心跳
* @param client WebSocket客户端
*/
public
static
void
hb
(
WebSocketClient
client
)
{
sendTextMsg
(
client
,
WebSocketConstant
.
HEART_BEAT
);
}
/**
* 无意义命令,用来判断链接是否还可用
* @param client WebSocket客户端
*/
public
static
void
gt
(
WebSocketClient
client
)
{
sendTextMsg
(
client
,
WebSocketConstant
.
GREETING_OP
);
}
/**
* 关闭链接
* @param client WebSocket客户端
*/
public
static
void
close
(
WebSocketClient
client
)
{
client
.
closeConnection
(
0
,
"ok"
);
}
/**
* 发送消息
* @param client WebSocket客户端
* @param msg 要发送的消息
*/
private
static
void
sendTextMsg
(
WebSocketClient
client
,
String
msg
)
{
client
.
send
(
msg
);
}
static
class
WebSocketConstant
{
private
WebSocketConstant
()
{}
/**
* websocket消息体的指令和body分隔符
*/
public
static
final
String
MESSAGE_BODY_SPLIT
=
"\r\n"
;
/**
* websocket身份认证指令
*/
public
static
final
String
AUTH_OP
=
"th"
;
/**
* ws进入直播指令
*/
public
static
final
String
ENTER_LIVE_OP
=
"en"
;
/**
* ws退出直播指令
*/
public
static
final
String
OUT_LIVE_OP
=
"out"
;
/**
* 前端验证通信指令,无意义
*/
public
static
final
String
GREETING_OP
=
"gt"
;
/**
* 心跳
*/
public
static
final
String
HEART_BEAT
=
"/hb"
;
}
static
class
MyWebSocketClient
extends
WebSocketClient
{
public
MyWebSocketClient
(
URI
serverUri
)
{
super
(
serverUri
);
}
@Override
public
void
onOpen
(
ServerHandshake
serverHandshake
)
{
log
.
info
(
"WebSocketClient, onOpen"
);
}
@Override
public
void
onMessage
(
String
s
)
{
log
.
info
(
"WebSocketClient, onMessage, s={}"
,
s
);
}
@Override
public
void
onClose
(
int
code
,
String
reason
,
boolean
remote
)
{
log
.
info
(
"WebSocketClient, onClose, code={}, reason={}, remote={}"
,
code
,
reason
,
remote
);
}
@Override
public
void
onError
(
Exception
e
)
{
log
.
error
(
"WebSocketClient, onError, e:"
,
e
);
}
}
}
\ No newline at end of file
src/test/liveTestNG.xml
View file @
442e2d68
...
@@ -19,11 +19,17 @@
...
@@ -19,11 +19,17 @@
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"代理人首页"
>
<test
preserve-order=
"true"
name=
"中奖规则配置"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.agent.Procurator"
/>
<class
name=
"com.kjj.cases.live.manager.LotteryRule"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"代理人首页"
>
<classes>
<class
name=
"com.kjj.cases.live.agent.Procurator"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"代理人分享直播间"
>
<test
preserve-order=
"true"
name=
"代理人分享直播间"
>
<classes>
<classes>
...
@@ -41,17 +47,21 @@
...
@@ -41,17 +47,21 @@
<classes>
<classes>
<class
name=
"com.kjj.cases.live.lottery.DesignatedWinner"
/>
<class
name=
"com.kjj.cases.live.lottery.DesignatedWinner"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"直播前-我的客户页"
>
<test
preserve-order=
"true"
name=
"直播前-我的客户页"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.agent.LiveBefore"
/>
<class
name=
"com.kjj.cases.live.agent.LiveBefore"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"助播-开启直播"
>
<test
preserve-order=
"true"
name=
"助播-开启直播"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.anchor.OpenLive"
/>
<class
name=
"com.kjj.cases.live.anchor.OpenLive"
/>
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"直播中抽奖"
>
<test
preserve-order=
"true"
name=
"直播中抽奖"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.lottery.Lottery"
/>
<class
name=
"com.kjj.cases.live.lottery.Lottery"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment