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
869223c8
Commit
869223c8
authored
Apr 30, 2021
by
张艳玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增宝箱裂变配置
parent
6e371fe5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
208 additions
and
12 deletions
+208
-12
TreasureAward.java
src/test/java/com/kjj/bean/manager/TreasureAward.java
+20
-0
TreasureCode.java
src/test/java/com/kjj/bean/manager/TreasureCode.java
+15
-0
TreasureRed.java
src/test/java/com/kjj/bean/manager/TreasureRed.java
+18
-0
WelfareList.java
src/test/java/com/kjj/bean/manager/WelfareList.java
+9
-0
AdminAuthorization.java
...est/java/com/kjj/cases/live/admin/AdminAuthorization.java
+2
-2
Treasure.java
src/test/java/com/kjj/cases/live/manager/Treasure.java
+110
-0
SignIn.java
src/test/java/com/kjj/cases/live/user/SignIn.java
+4
-2
BasicConfig.java
src/test/java/com/kjj/config/BasicConfig.java
+8
-0
MyWebSocketUtil.java
src/test/java/com/kjj/utils/MyWebSocketUtil.java
+11
-3
liveTestNG.xml
src/test/liveTestNG.xml
+11
-5
No files found.
src/test/java/com/kjj/bean/manager/TreasureAward.java
0 → 100644
View file @
869223c8
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
@Data
public
class
TreasureAward
{
private
String
awardName
;
private
long
welfareId
;
private
Integer
totalNum
;
private
long
relatedId
;
private
long
bizConfId
;
private
Integer
treasureType
;
private
Integer
ruleType
;
private
Integer
fixedNum
;
private
Integer
maxNum
;
private
Integer
treasureProbability
;
}
src/test/java/com/kjj/bean/manager/TreasureCode.java
0 → 100644
View file @
869223c8
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
@Data
public
class
TreasureCode
{
private
long
relatedId
;
private
long
bizConfId
;
private
Integer
treasureType
;
private
Integer
ruleType
;
private
Integer
fixedNum
;
private
Integer
maxNum
;
private
Integer
treasureProbability
;
}
src/test/java/com/kjj/bean/manager/TreasureRed.java
0 → 100644
View file @
869223c8
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
@Data
public
class
TreasureRed
{
private
Integer
redTotalAmount
;
private
Integer
totalNum
;
private
long
relatedId
;
private
long
bizConfId
;
private
Integer
treasureType
;
private
Integer
ruleType
;
private
Integer
fixedNum
;
private
Integer
maxNum
;
private
Integer
treasureProbability
;
}
src/test/java/com/kjj/bean/manager/WelfareList.java
0 → 100644
View file @
869223c8
package
com
.
kjj
.
bean
.
manager
;
import
lombok.Data
;
@Data
public
class
WelfareList
{
private
long
id
;
}
src/test/java/com/kjj/cases/live/admin/AdminAuthorization.java
View file @
869223c8
...
@@ -4,7 +4,7 @@ import static com.kjj.config.BasicConfig.*;
...
@@ -4,7 +4,7 @@ import static com.kjj.config.BasicConfig.*;
/**
/**
* 管理员授权
* 管理员授权
* @author
喜洋洋
* @author
嘿保险,ID:907
*/
*/
public
interface
AdminAuthorization
{
public
interface
AdminAuthorization
{
...
@@ -90,7 +90,7 @@ public interface AdminAuthorization {
...
@@ -90,7 +90,7 @@ public interface AdminAuthorization {
}
}
/**
/**
* 访客I(
喜洋洋
)授权 ID:946
* 访客I(
熊大
)授权 ID:946
*/
*/
default
void
visitorAuth8
()
{
default
void
visitorAuth8
()
{
network
.
agentCookies
.
put
(
"authKey"
,
VISITORKEY8
);
network
.
agentCookies
.
put
(
"authKey"
,
VISITORKEY8
);
...
...
src/test/java/com/kjj/cases/live/manager/Treasure.java
0 → 100644
View file @
869223c8
package
com
.
kjj
.
cases
.
live
.
manager
;
import
com.kjj.bean.manager.*
;
import
com.kjj.cases.live.admin.AdminAuthorization
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.constants.LiveConstants
;
import
com.kjj.utils.BaseUtils
;
import
com.kjj.utils.JsonUtil
;
import
io.restassured.response.Response
;
import
org.testng.Assert
;
import
org.testng.annotations.BeforeClass
;
import
org.testng.annotations.Test
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Treasure
implements
AdminAuthorization
{
@BeforeClass
public
void
setUp
()
{
BaseUtils
.
ssoLogin
();
}
public
List
<
WelfareList
>
id
;
@Test
(
description
=
"查询奖品列表"
,
priority
=
1
)
public
void
查询奖品列表
()
{
Map
<
String
,
Object
>
getListParam
=
new
HashMap
<>();
getListParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
// getListParam.put("liveId",2122 );
getListParam
.
put
(
"companyId"
,
101
);
// getListParam.put("companyId", 79);
getListParam
.
put
(
"pageIndex"
,
1
);
getListParam
.
put
(
"pageSize"
,
20
);
getListParam
.
put
(
"welfareType"
,
6
);
Response
response
=
network
.
getResponse
(
getListParam
,
BasicConfig
.
MANAGER_getList4Admin
);
List
<
WelfareList
>
list
=
JsonUtil
.
parseResponseToPageBean
(
response
,
WelfareList
.
class
);
System
.
out
.
println
(
list
);
this
.
id
=
list
;
Assert
.
assertNotNull
(
list
,
network
.
message
(
getListParam
,
BasicConfig
.
MANAGER_getList4Admin
,
"查询奖品列表失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"新增宝箱裂变配置"
,
priority
=
2
)
public
void
新增宝箱裂变配置
()
{
Map
<
String
,
Object
>
saveParam
=
new
HashMap
<>();
saveParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
saveParam
.
put
(
"openCondition"
,
1
);
saveParam
.
put
(
"openNum"
,
1
);
TreasureAward
treasureAward
=
new
TreasureAward
();
treasureAward
.
setWelfareId
(
this
.
id
.
get
(
0
).
getId
());
treasureAward
.
setAwardName
(
"宝箱锦鲤"
);
treasureAward
.
setTreasureProbability
(
2000
);
treasureAward
.
setTreasureType
(
3
);
treasureAward
.
setRuleType
(
1
);
treasureAward
.
setTotalNum
(
10
);
saveParam
.
put
(
"treasureAward"
,
treasureAward
);
TreasureRed
treasureRed
=
new
TreasureRed
();
treasureRed
.
setRedTotalAmount
(
100
);
treasureRed
.
setRuleType
(
2
);
treasureRed
.
setTotalNum
(
3
);
treasureRed
.
setTreasureProbability
(
4000
);
treasureRed
.
setTreasureType
(
2
);
saveParam
.
put
(
"treasureRed"
,
treasureRed
);
TreasureCode
treasureCode
=
new
TreasureCode
();
treasureCode
.
setFixedNum
(
1
);
treasureCode
.
setMaxNum
(
3
);
treasureCode
.
setRuleType
(
2
);
treasureCode
.
setTreasureProbability
(
4000
);
treasureCode
.
setTreasureType
(
1
);
saveParam
.
put
(
"treasureCode"
,
treasureCode
);
saveParam
.
put
(
"treasurePeriod"
,
3
);
Response
response
=
network
.
postResponse
(
saveParam
,
BasicConfig
.
MANAGER_saveTreasureConf
);
boolean
data
=
response
.
jsonPath
().
getBoolean
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
saveParam
,
BasicConfig
.
MANAGER_saveTreasureConf
,
"新增宝箱裂变配置失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"查询宝箱配置详情"
,
priority
=
3
)
public
void
查询宝箱配置详情
()
{
Map
<
String
,
Object
>
confDetailParam
=
new
HashMap
<>();
confDetailParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
Response
response
=
network
.
getResponse
(
confDetailParam
,
BasicConfig
.
MANAGER_confDetail
);
System
.
out
.
println
(
response
);
Integer
openCondition
=
response
.
jsonPath
().
getInt
(
"data.openCondition"
);
System
.
out
.
println
(
openCondition
);
Assert
.
assertTrue
(
openCondition
>
0
,
network
.
message
(
confDetailParam
,
BasicConfig
.
MANAGER_confDetail
,
"查询宝箱配置详情失败"
,
response
.
body
().
asString
()));
}
@Test
(
description
=
"开启宝箱"
,
priority
=
4
)
public
void
开启宝箱
()
{
Map
<
String
,
Object
>
switchStatusParam
=
new
HashMap
<>();
switchStatusParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
LIVE_ID
.
getKey
()));
switchStatusParam
.
put
(
"confStatus"
,
1
);
Response
response
=
network
.
postResponse
(
switchStatusParam
,
BasicConfig
.
MANAGER_switchStatus
);
boolean
data
=
response
.
jsonPath
().
getJsonObject
(
"data"
);
System
.
out
.
println
(
data
);
Assert
.
assertTrue
(
data
,
network
.
message
(
switchStatusParam
,
BasicConfig
.
MANAGER_switchStatus
,
"开启宝箱失败"
,
response
.
body
().
asString
()));
}
}
src/test/java/com/kjj/cases/live/user/SignIn.java
View file @
869223c8
...
@@ -27,11 +27,12 @@ public class SignIn implements AdminAuthorization {
...
@@ -27,11 +27,12 @@ public class SignIn implements AdminAuthorization {
//连接
//连接
WebSocketClient
client
=
MyWebSocketUtil
.
connect
();
WebSocketClient
client
=
MyWebSocketUtil
.
connect
();
Assert
.
assertNotNull
(
client
,
"WebSocket链接失败"
);
//身份认证,识别用户信息
//身份认证,识别用户信息
MyWebSocketUtil
.
auth
(
client
,
VISITORKEY
);
MyWebSocketUtil
.
auth
(
client
,
VISITORKEY
);
//进入直播间
//进入直播间
MyWebSocketUtil
.
enter
(
client
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
MyWebSocketUtil
.
enter
(
client
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
// MyWebSocketUtil.enter(client,"Kj21Mj
M2Nzk
" );
// MyWebSocketUtil.enter(client,"Kj21Mj
U5Njc
" );
//循环发送心跳,长时间不发消息,链接会断开
//循环发送心跳,长时间不发消息,链接会断开
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
MyWebSocketUtil
.
hb
(
client
);
MyWebSocketUtil
.
hb
(
client
);
...
@@ -39,6 +40,7 @@ public class SignIn implements AdminAuthorization {
...
@@ -39,6 +40,7 @@ public class SignIn implements AdminAuthorization {
}
}
//退出直播间
//退出直播间
MyWebSocketUtil
.
out
(
client
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
MyWebSocketUtil
.
out
(
client
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
// MyWebSocketUtil.out(client,"Kj21MjU5Njc" );
//无意义命令
//无意义命令
MyWebSocketUtil
.
gt
(
client
);
MyWebSocketUtil
.
gt
(
client
);
//关闭连接
//关闭连接
...
@@ -50,7 +52,7 @@ public class SignIn implements AdminAuthorization {
...
@@ -50,7 +52,7 @@ public class SignIn implements AdminAuthorization {
ThreadSleepUtils
.
sleep
(
500
);
ThreadSleepUtils
.
sleep
(
500
);
Map
<
String
,
Object
>
myLotteryCodeParam
=
new
HashMap
<>();
Map
<
String
,
Object
>
myLotteryCodeParam
=
new
HashMap
<>();
myLotteryCodeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
myLotteryCodeParam
.
put
(
"liveId"
,
LiveConstants
.
getValue
(
LiveConstants
.
StringKeyEnum
.
ENCODE_LIVE_ID
.
getKey
()));
// myLotteryCodeParam.put("liveId","Kj21Mj
M2Nzk
");
// myLotteryCodeParam.put("liveId","Kj21Mj
U5Njc
");
myLotteryCodeParam
.
put
(
"pageIndex"
,
1
);
myLotteryCodeParam
.
put
(
"pageIndex"
,
1
);
myLotteryCodeParam
.
put
(
"pageSize"
,
30
);
myLotteryCodeParam
.
put
(
"pageSize"
,
30
);
Response
myLotteryCodeRes
=
network
.
getResponse
(
myLotteryCodeParam
,
BasicConfig
.
MOBILE_MyLotteryCode
);
Response
myLotteryCodeRes
=
network
.
getResponse
(
myLotteryCodeParam
,
BasicConfig
.
MOBILE_MyLotteryCode
);
...
...
src/test/java/com/kjj/config/BasicConfig.java
View file @
869223c8
...
@@ -65,6 +65,14 @@ public class BasicConfig {
...
@@ -65,6 +65,14 @@ public class BasicConfig {
// *************** 免费领福利 ***************
// *************** 免费领福利 ***************
public
static
final
String
ANCHOR_listLiveFreeReward
=
MOBILE_HOST
+
"/kjy/live/lottery/listLiveFreeReward"
;
public
static
final
String
ANCHOR_listLiveFreeReward
=
MOBILE_HOST
+
"/kjy/live/lottery/listLiveFreeReward"
;
public
static
final
String
ANCHOR_receive
=
MOBILE_HOST
+
"/kjy/live/user/lottery/receive"
;
public
static
final
String
ANCHOR_receive
=
MOBILE_HOST
+
"/kjy/live/user/lottery/receive"
;
// *************** 宝箱裂变 ***************
public
static
final
String
MANAGER_getList4Admin
=
MANAGER_HOST
+
"/kjy/manager/welfare/pre/conf/getList4Admin"
;
public
static
final
String
MANAGER_saveTreasureConf
=
MANAGER_HOST
+
"/kjy/manager/live/treasure/saveTreasureConf"
;
public
static
final
String
MANAGER_confDetail
=
MANAGER_HOST
+
"/kjy/manager/live/treasure/confDetail"
;
public
static
final
String
MANAGER_switchStatus
=
MANAGER_HOST
+
"/kjy/manager/live/treasure/switchStatus"
;
// *************** 代理人指定中奖 ***************
// *************** 代理人指定中奖 ***************
public
static
final
String
MOBILE_getSpecifyAwardConf
=
MOBILE_HOST
+
"/conf/pre/specifyAward/getSpecifyAwardConf"
;
public
static
final
String
MOBILE_getSpecifyAwardConf
=
MOBILE_HOST
+
"/conf/pre/specifyAward/getSpecifyAwardConf"
;
public
static
final
String
MOBILE_getAgentParticipateCond
=
MOBILE_HOST
+
"/conf/pre/specifyAward/getAgentParticipateCond"
;
public
static
final
String
MOBILE_getAgentParticipateCond
=
MOBILE_HOST
+
"/conf/pre/specifyAward/getAgentParticipateCond"
;
...
...
src/test/java/com/kjj/utils/MyWebSocketUtil.java
View file @
869223c8
package
com
.
kjj
.
utils
;
package
com
.
kjj
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.java_websocket.client.WebSocketClient
;
import
org.java_websocket.client.WebSocketClient
;
import
org.java_websocket.enums.ReadyState
;
import
org.java_websocket.enums.ReadyState
;
import
org.java_websocket.handshake.ServerHandshake
;
import
org.java_websocket.handshake.ServerHandshake
;
...
@@ -51,10 +50,18 @@ public class MyWebSocketUtil {
...
@@ -51,10 +50,18 @@ public class MyWebSocketUtil {
public
static
MyWebSocketClient
connect
(
String
url
)
{
public
static
MyWebSocketClient
connect
(
String
url
)
{
MyWebSocketClient
client
=
new
MyWebSocketClient
(
URI
.
create
(
url
));
MyWebSocketClient
client
=
new
MyWebSocketClient
(
URI
.
create
(
url
));
client
.
connect
();
client
.
connect
();
int
maxCount
=
10
;
int
count
=
0
;
// 判断是否连接成功,未成功后面发送消息时会报错
// 判断是否连接成功,未成功后面发送消息时会报错
while
(!
client
.
getReadyState
().
equals
(
ReadyState
.
OPEN
))
{
while
(!
client
.
getReadyState
().
equals
(
ReadyState
.
OPEN
))
{
ThreadSleepUtils
.
sleep
(
500
);
ThreadSleepUtils
.
sleep
(
500
);
count
++;
if
(
count
>=
maxCount
)
{
System
.
out
.
println
(
"WebSocketClient, connect, fail, url="
+
url
);
return
null
;
}
}
}
System
.
out
.
println
(
"WebSocketClient, connect, url="
+
url
);
return
client
;
return
client
;
}
}
...
@@ -120,6 +127,7 @@ public class MyWebSocketUtil {
...
@@ -120,6 +127,7 @@ public class MyWebSocketUtil {
*/
*/
private
static
void
sendTextMsg
(
WebSocketClient
client
,
String
msg
)
{
private
static
void
sendTextMsg
(
WebSocketClient
client
,
String
msg
)
{
client
.
send
(
msg
);
client
.
send
(
msg
);
System
.
out
.
println
(
"WebSocketClient, sendTextMsg, msg="
+
msg
);
}
}
static
class
WebSocketConstant
{
static
class
WebSocketConstant
{
...
@@ -171,12 +179,12 @@ public class MyWebSocketUtil {
...
@@ -171,12 +179,12 @@ public class MyWebSocketUtil {
@Override
@Override
public
void
onMessage
(
String
s
)
{
public
void
onMessage
(
String
s
)
{
System
.
out
.
println
(
"WebSocketClient, onMessage, s="
+
s
);
System
.
out
.
println
(
"WebSocketClient, onMessage, s="
+
s
);
}
}
@Override
@Override
public
void
onClose
(
int
code
,
String
reason
,
boolean
remote
)
{
public
void
onClose
(
int
code
,
String
reason
,
boolean
remote
)
{
System
.
out
.
println
(
"WebSocketClient, onClose
, code="
+
code
+
"reason="
+
reason
+
", remote="
+
remote
);
System
.
out
.
println
(
"WebSocketClient, onClose
, code="
+
code
+
", reason="
+
reason
+
", remote="
+
remote
);
}
}
@Override
@Override
...
...
src/test/liveTestNG.xml
View file @
869223c8
...
@@ -19,6 +19,12 @@
...
@@ -19,6 +19,12 @@
</classes>
</classes>
</test>
</test>
<test
preserve-order=
"true"
name=
"宝箱裂变配置"
>
<classes>
<class
name=
"com.kjj.cases.live.manager.Treasure"
/>
</classes>
</test>
<test
preserve-order=
"true"
name=
"有奖答题配置"
>
<test
preserve-order=
"true"
name=
"有奖答题配置"
>
<classes>
<classes>
<class
name=
"com.kjj.cases.live.manager.QuesReward.Add"
/>
<class
name=
"com.kjj.cases.live.manager.QuesReward.Add"
/>
...
@@ -86,11 +92,11 @@
...
@@ -86,11 +92,11 @@
</classes>
</classes>
</test>
</test>
<!-- <test preserve-order="true" name="访客签到">--
>
<test
preserve-order=
"true"
name=
"访客签到"
>
<!-- <classes>--
>
<classes
>
<!-- <class name="com.kjj.cases.live.user.SignIn"/>--
>
<class
name=
"com.kjj.cases.live.user.SignIn"
/
>
<!-- </classes>--
>
</classes
>
<!-- </test>--
>
</test
>
<test
preserve-order=
"true"
name=
"直播中抽奖"
>
<test
preserve-order=
"true"
name=
"直播中抽奖"
>
<classes>
<classes>
...
...
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