Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
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
马博
test-platform
Commits
34179289
Commit
34179289
authored
Dec 17, 2018
by
qwj-github
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
a82dca90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
6 deletions
+97
-6
pk_押注测试_AccessTest.java
src/test/java/http/cases/PkTest/pk_押注测试_AccessTest.java
+97
-6
No files found.
src/test/java/http/cases/PkTest/pk_押注测试_AccessTest.java
View file @
34179289
...
...
@@ -51,14 +51,16 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
static
Integer
uid01
=
3416
;
//【勿动】pk01_测试押注
private
static
Integer
uid01
=
3416
;
//【勿动】pk01_测试押注
瓜分经验
private
static
String
uid01_consumerId
=
"100066015"
;
private
static
Integer
uid02
=
3417
;
//【勿动】pk02_积分不足_测试押注
private
static
String
uid02_consumerId
=
"100066016"
;
private
static
Integer
uid03
=
5244
;
//【勿动】pk02_
积分不足_测试押注
private
static
Integer
uid03
=
5244
;
//【勿动】pk02_
押注0积分活动
private
static
String
uid03_consumerId
=
"100117002"
;
private
static
Integer
uid04
=
5247
;
//【勿动】pk02_测试押注瓜分红包
private
static
String
uid04_consumerId
=
"100117005"
;
private
static
Integer
uid05
=
5248
;
//【勿动】pk02_测试押注瓜分红包
private
static
String
uid05_consumerId
=
"100117006"
;
private
String
consumerIds
=
""
;
...
...
@@ -82,7 +84,7 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
@Test
public
void
押注
_
红包
活动测试
()
throws
Exception
{
public
void
押注
_
瓜分经验
pk
活动测试
()
throws
Exception
{
Map
<
String
,
Object
>
user
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=?\n"
,
uid01
);
Map
<
String
,
Object
>
consumer
=
jdbc
.
findSimpleResult
(
"select * from new_consumer.consumer_0010 where id=?\n"
,
uid01_consumerId
);
Long
userCredit
=
Long
.
parseLong
(
user
.
get
(
"credits"
).
toString
());
...
...
@@ -122,9 +124,96 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验参加结果失败"
);
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"code"
),
"100011"
,
"校验参加失败错误码失败"
);
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"desc"
),
"活动已参加"
,
"校验参加失败描述失败"
);
}
@Test
public
void
押注
_
瓜分红包
pk
活动测试
()
throws
Exception
{
Map
<
String
,
Object
>
user
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=?\n"
,
uid04
);
Map
<
String
,
Object
>
consumer
=
jdbc
.
findSimpleResult
(
"select * from new_consumer.consumer_0010 where id=?\n"
,
uid04_consumerId
);
Long
userCredit
=
Long
.
parseLong
(
user
.
get
(
"credits"
).
toString
());
Long
consumerCredit
=
Long
.
parseLong
(
consumer
.
get
(
"credits"
).
toString
());
Response
doJoinResponse
=
pkService
.
doJoin
(
uid04
,
"122"
,
"243"
);
doJoinResponse
.
prettyPrint
();
Assert
.
assertEquals
(
doJoinResponse
.
jsonPath
().
getString
(
"code"
),
"200"
,
"校验押注是否成功且不是第一次押注失败"
);
String
orderId
=
doJoinResponse
.
jsonPath
().
getString
(
"data"
);
Map
<
String
,
String
>
orderIdMap
=
new
HashMap
<>();
orderIdMap
.
put
(
"consumerId"
,
uid04_consumerId
);
orderIdMap
.
put
(
"orderId"
,
orderId
);
orderIds
.
add
(
orderIdMap
);
Response
statusResponse
=
pkService
.
getOrderStatus
(
uid04
,
orderId
);
statusResponse
.
prettyPrint
();
String
consumerStatus
=
statusResponse
.
jsonPath
().
getString
(
"data.consumeStatus"
);
int
i
=
8
;
while
(
i
>
0
&
consumerStatus
.
equals
(
"1"
)){
Thread
.
sleep
(
1000
);
statusResponse
=
pkService
.
getOrderStatus
(
uid04
,
orderId
);
consumerStatus
=
statusResponse
.
jsonPath
().
getString
(
"data.consumeStatus"
);
}
Assert
.
assertEquals
(
consumerStatus
,
"2"
,
"校验押注是否成功,扣积分是否成功失败"
);
Map
<
String
,
Object
>
user1
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=?\n"
,
uid04
);
Map
<
String
,
Object
>
consumer1
=
jdbc
.
findSimpleResult
(
"select * from new_consumer.consumer_0010 where id=?\n"
,
uid04_consumerId
);
String
userCredit1
=
user1
.
get
(
"credits"
).
toString
();
String
consumerCredit1
=
consumer1
.
get
(
"credits"
).
toString
();
Assert
.
assertEquals
(
userCredit1
,
String
.
valueOf
(
userCredit
-
100
),
"user积分扣除校验失败"
);
Assert
.
assertEquals
(
consumerCredit1
,
String
.
valueOf
(
consumerCredit
-
100
),
"consumer积分扣除校验失败"
);
logger
.
info
(
"校验积分消耗成功,原积分值="
+
userCredit
+
",消耗后积分值为"
+
userCredit1
);
//参加过一次之后,不能再参加该pk活动
Response
doJoinResponse1
=
pkService
.
doJoin2
(
uid04
,
"122"
,
"243"
);
doJoinResponse1
.
prettyPrint
();
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验参加结果失败"
);
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"code"
),
"100011"
,
"校验参加失败错误码失败"
);
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"desc"
),
"活动已参加"
,
"校验参加失败描述失败"
);
}
@Test
public
void
押注
_
瓜分优惠券
pk
活动测试
()
throws
Exception
{
Map
<
String
,
Object
>
user
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=?\n"
,
uid05
);
Map
<
String
,
Object
>
consumer
=
jdbc
.
findSimpleResult
(
"select * from new_consumer.consumer_0010 where id=?\n"
,
uid05_consumerId
);
Long
userCredit
=
Long
.
parseLong
(
user
.
get
(
"credits"
).
toString
());
Long
consumerCredit
=
Long
.
parseLong
(
consumer
.
get
(
"credits"
).
toString
());
Response
doJoinResponse
=
pkService
.
doJoin
(
uid05
,
"83"
,
"165"
);
doJoinResponse
.
prettyPrint
();
Assert
.
assertEquals
(
doJoinResponse
.
jsonPath
().
getString
(
"code"
),
"200"
,
"校验押注是否成功且不是第一次押注失败"
);
String
orderId
=
doJoinResponse
.
jsonPath
().
getString
(
"data"
);
Map
<
String
,
String
>
orderIdMap
=
new
HashMap
<>();
orderIdMap
.
put
(
"consumerId"
,
uid05_consumerId
);
orderIdMap
.
put
(
"orderId"
,
orderId
);
orderIds
.
add
(
orderIdMap
);
Response
statusResponse
=
pkService
.
getOrderStatus
(
uid05
,
orderId
);
statusResponse
.
prettyPrint
();
String
consumerStatus
=
statusResponse
.
jsonPath
().
getString
(
"data.consumeStatus"
);
int
i
=
8
;
while
(
i
>
0
&
consumerStatus
.
equals
(
"1"
)){
Thread
.
sleep
(
1000
);
statusResponse
=
pkService
.
getOrderStatus
(
uid05
,
orderId
);
consumerStatus
=
statusResponse
.
jsonPath
().
getString
(
"data.consumeStatus"
);
}
Assert
.
assertEquals
(
consumerStatus
,
"2"
,
"校验押注是否成功,扣积分是否成功失败"
);
Map
<
String
,
Object
>
user1
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=?\n"
,
uid05
);
Map
<
String
,
Object
>
consumer1
=
jdbc
.
findSimpleResult
(
"select * from new_consumer.consumer_0010 where id=?\n"
,
uid05_consumerId
);
String
userCredit1
=
user1
.
get
(
"credits"
).
toString
();
String
consumerCredit1
=
consumer1
.
get
(
"credits"
).
toString
();
Assert
.
assertEquals
(
userCredit1
,
String
.
valueOf
(
userCredit
-
50
),
"user积分扣除校验失败"
);
Assert
.
assertEquals
(
consumerCredit1
,
String
.
valueOf
(
consumerCredit
-
50
),
"consumer积分扣除校验失败"
);
logger
.
info
(
"校验积分消耗成功,原积分值="
+
userCredit
+
",消耗后积分值为"
+
userCredit1
);
//参加过一次之后,不能再参加该pk活动
Response
doJoinResponse1
=
pkService
.
doJoin2
(
uid05
,
"83"
,
"166"
);
doJoinResponse1
.
prettyPrint
();
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"success"
),
"false"
,
"校验参加结果失败"
);
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"code"
),
"100011"
,
"校验参加失败错误码失败"
);
Assert
.
assertEquals
(
doJoinResponse1
.
jsonPath
().
getString
(
"desc"
),
"活动已参加"
,
"校验参加失败描述失败"
);
}
@Test
public
void
押注
_0
积分
pk
活动
()
throws
Exception
{
...
...
@@ -148,7 +237,7 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
int
i
=
8
;
while
(
i
>
0
&
consumerStatus
.
equals
(
"1"
)){
Thread
.
sleep
(
1000
);
statusResponse
=
pkService
.
getOrderStatus
(
uid0
1
,
orderId
);
statusResponse
=
pkService
.
getOrderStatus
(
uid0
3
,
orderId
);
consumerStatus
=
statusResponse
.
jsonPath
().
getString
(
"data.consumeStatus"
);
}
Assert
.
assertEquals
(
consumerStatus
,
"2"
,
"校验押注是否成功,扣积分是否成功失败"
);
...
...
@@ -251,6 +340,8 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
Boolean
result
=
jdbc
.
update
(
"delete from act_record.tb_bet_record where bet_id = '124' and partner_user_id = '3416'\n"
);
Boolean
result2
=
jdbc
.
update
(
"delete from act_record.tb_bet_record where bet_id = '82' and partner_user_id = '5244'\n"
);
Boolean
result4
=
jdbc
.
update
(
"delete from act_record.tb_bet_record where bet_id = '122' and partner_user_id = '5247'\n"
);
Boolean
result5
=
jdbc
.
update
(
"delete from act_record.tb_bet_record where bet_id = '83' and partner_user_id = '5248'\n"
);
for
(
Map
<
String
,
String
>
orderId:
orderIds
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
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