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
8a039d82
Commit
8a039d82
authored
Dec 19, 2019
by
wangxiaoshuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wxs
parent
c6d89476
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
84 additions
and
23 deletions
+84
-23
策略价会员商品自有优惠券_兑换流程测试.java
.../http/cases/ExchangeTest/自定义会员商品/策略价会员商品自有优惠券_兑换流程测试.java
+0
-0
策略价会员商品自有卡密_兑换流程测试.java
...a/http/cases/ExchangeTest/自定义会员商品/策略价会员商品自有卡密_兑换流程测试.java
+0
-0
策略价会员商品自有实物_兑换流程测试.java
...a/http/cases/ExchangeTest/自定义会员商品/策略价会员商品自有实物_兑换流程测试.java
+0
-0
自有新优惠券_兑换限制测试_ExchangeTest.java
...es/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
+4
-5
自有新卡密_兑换限制测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新卡密_兑换限制测试_ExchangeTest.java
+4
-3
自有新实物_兑换流程测试_ExchangeTest.java
...ses/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
+26
-12
gawService.java
src/test/java/http/service/app/gawService.java
+49
-2
testservice.java
src/test/java/http/service/testservice.java
+1
-1
No files found.
src/test/java/http/cases/ExchangeTest/自定义会员商品/策略价会员商品自有优惠券_兑换流程测试.java
0 → 100644
View file @
8a039d82
This diff is collapsed.
Click to expand it.
src/test/java/http/cases/ExchangeTest/自定义会员商品/策略价会员商品自有卡密_兑换流程测试.java
0 → 100644
View file @
8a039d82
This diff is collapsed.
Click to expand it.
src/test/java/http/cases/ExchangeTest/自定义会员商品/策略价会员商品自有实物_兑换流程测试.java
0 → 100644
View file @
8a039d82
This diff is collapsed.
Click to expand it.
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新优惠券_兑换限制测试_ExchangeTest.java
View file @
8a039d82
...
@@ -35,6 +35,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -35,6 +35,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
private
int
uid
=
7003
;
private
int
uid
=
7003
;
private
String
consumerId
=
"100144145"
;
private
String
consumerId
=
"100144145"
;
private
boolean
bl
=
false
;
private
String
url
=
"http://activity.m.duibatest.com.cn"
;
private
String
url
=
"http://activity.m.duibatest.com.cn"
;
...
@@ -362,14 +363,13 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -362,14 +363,13 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
@Test
@Test
public
void
会员等级测试
()
throws
Exception
{
public
void
会员等级测试
()
throws
Exception
{
String
appItemId
=
"193848"
;
String
appItemId
=
"193848"
;
String
message
=
""
;
String
message
=
""
;
//会员等级无法兑换
//会员等级无法兑换
try
{
try
{
Thread
.
sleep
(
4000
);
Thread
.
sleep
(
4000
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
45
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
45
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -379,7 +379,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -379,7 +379,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
//会员等级可兑换,vip=5
//会员等级可兑换,vip=5
Thread
.
sleep
(
4000
);
Thread
.
sleep
(
4000
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
generateSignAutoLogin
(
"3tzVcss7SnAvA5ppT1m1rMPhaBcD"
,
7083
,
1
),
appItemId
,
45
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
generateSignAutoLogin
(
"3tzVcss7SnAvA5ppT1m1rMPhaBcD"
,
7083
,
1
),
appItemId
,
45
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
Assert
.
assertTrue
(
message
.
contains
(
"未达到会员等级要求"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"未达到会员等级要求"
),
"校验message失败"
);
...
@@ -524,7 +524,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -524,7 +524,7 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
//优惠券兑换
//优惠券兑换
Thread
.
sleep
(
4000
);
Thread
.
sleep
(
4000
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
skuId
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
skuId
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
...
@@ -656,7 +656,6 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
...
@@ -656,7 +656,6 @@ public class 自有新优惠券_兑换限制测试_ExchangeTest extends CheckTem
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
status
=
response
.
jsonPath
().
getString
(
"data.status"
);
i
--;
i
--;
}
}
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060747299329170094"
);
mapStock
=
jdbc
.
findSimpleResult
(
"SELECT * FROM stock.tb_stock WHERE stock_id = 1060747299329170094"
);
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
newStock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
String
result
=
String
.
valueOf
(
Integer
.
valueOf
(
stock
)-
1
);
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新卡密_兑换限制测试_ExchangeTest.java
View file @
8a039d82
...
@@ -44,6 +44,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
...
@@ -44,6 +44,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
private
int
uid
=
7004
;
private
int
uid
=
7004
;
private
String
consumerId
=
"100144146"
;
private
String
consumerId
=
"100144146"
;
private
boolean
bl
=
false
;
private
String
url
=
"http://activity.m.duibatest.com.cn"
;
private
String
url
=
"http://activity.m.duibatest.com.cn"
;
...
@@ -326,7 +327,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
...
@@ -326,7 +327,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
//兑换
//兑换
try
{
try
{
Thread
.
sleep
(
4000
);
Thread
.
sleep
(
4000
);
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
skuId
);
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
skuId
,
bl
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
message
=
e
.
getMessage
();
message
=
e
.
getMessage
();
...
@@ -384,7 +385,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
...
@@ -384,7 +385,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
//会员等级无法兑换
//会员等级无法兑换
try
{
try
{
Thread
.
sleep
(
4000
);
Thread
.
sleep
(
4000
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
86
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
dafuwengLogin
(
uid
),
appItemId
,
86
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -394,7 +395,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
...
@@ -394,7 +395,7 @@ public class 自有新卡密_兑换限制测试_ExchangeTest extends CheckTemple
//会员等级可兑换,vip=5
//会员等级可兑换,vip=5
Thread
.
sleep
(
4000
);
Thread
.
sleep
(
4000
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
generateSignAutoLogin
(
"3tzVcss7SnAvA5ppT1m1rMPhaBcD"
,
7083
,
1
),
appItemId
,
86
);
Response
response
=
gawService
.
couponExchange
(
authorization
.
generateSignAutoLogin
(
"3tzVcss7SnAvA5ppT1m1rMPhaBcD"
,
7083
,
1
),
appItemId
,
86
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
Assert
.
assertTrue
(
message
.
contains
(
"未达到会员等级要求"
),
"校验message失败"
);
Assert
.
assertTrue
(
message
.
contains
(
"未达到会员等级要求"
),
"校验message失败"
);
...
...
src/test/java/http/cases/ExchangeTest/自有_商品兑换限制/自有新实物_兑换流程测试_ExchangeTest.java
View file @
8a039d82
...
@@ -71,11 +71,12 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -71,11 +71,12 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
skuId
=
"17"
;
String
skuId
=
"17"
;
String
actualCredits
=
"1"
;
String
actualCredits
=
"1"
;
String
credits
=
"1"
;
String
credits
=
"1"
;
boolean
bl
=
false
;
try
{
try
{
//第一次兑换
//第一次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
@@ -99,7 +100,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -99,7 +100,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
//第二次兑换
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -125,10 +126,12 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -125,10 +126,12 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
skuId
=
"24"
;
String
skuId
=
"24"
;
String
actualCredits
=
"2"
;
String
actualCredits
=
"2"
;
String
credits
=
"2"
;
String
credits
=
"2"
;
boolean
bl
=
false
;
try
{
try
{
//第一次兑换
//第一次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
logger
.
info
(
"********1"
+
"111111"
);
logger
.
info
(
"********1"
+
"111111"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
...
@@ -152,7 +155,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -152,7 +155,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
//第二次兑换
//第二次兑换
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
logger
.
info
(
"********2"
);
logger
.
info
(
"********2"
);
response
.
prettyPrint
();
response
.
prettyPrint
();
...
@@ -181,10 +184,12 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -181,10 +184,12 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
skuId
=
"25"
;
String
skuId
=
"25"
;
String
actualCredits
=
"3"
;
String
actualCredits
=
"3"
;
String
credits
=
"3"
;
String
credits
=
"3"
;
boolean
bl
=
false
;
try
{
try
{
//第一次兑换
//第一次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
@@ -206,7 +211,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -206,7 +211,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
// logger.info("商品兑换按钮:" + exchangeText);
// logger.info("商品兑换按钮:" + exchangeText);
//第二次兑换
//第二次兑换
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -233,10 +239,13 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -233,10 +239,13 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
skuId
=
"26"
;
String
skuId
=
"26"
;
String
actualCredits
=
"5"
;
String
actualCredits
=
"5"
;
String
credits
=
"5"
;
String
credits
=
"5"
;
boolean
bl
=
false
;
try
{
try
{
//第一次兑换
//第一次兑换
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
@@ -258,7 +267,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -258,7 +267,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
// logger.info("商品兑换按钮:" + exchangeText);
// logger.info("商品兑换按钮:" + exchangeText);
//第二次兑换
//第二次兑换
try
{
try
{
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -336,6 +346,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -336,6 +346,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
skuId
=
"33"
;
String
skuId
=
"33"
;
String
actualCredits
=
"8"
;
String
actualCredits
=
"8"
;
String
credits
=
"8"
;
String
credits
=
"8"
;
boolean
bl
=
false
;
jdbc
.
update
(
"UPDATE stock.tb_stock set stock = 0 where stock_id = 940298957084170033"
);
jdbc
.
update
(
"UPDATE stock.tb_stock set stock = 0 where stock_id = 940298957084170033"
);
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
...
@@ -347,7 +359,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -347,7 +359,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
try
{
try
{
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
@@ -448,10 +460,10 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -448,10 +460,10 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
appItemId
=
"197041"
;
String
appItemId
=
"197041"
;
String
itemId
=
null
;
String
itemId
=
null
;
String
skuId
=
"159"
;
String
skuId
=
"159"
;
boolean
bl
=
false
;
//实物兑换,积分传0
//实物兑换,积分传0
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
"0"
,
"0"
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
"0"
,
"0"
,
bl
);
response
.
prettyPrint
();
response
.
prettyPrint
();
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
...
@@ -506,6 +518,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -506,6 +518,8 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
skuId
=
"183"
;
String
skuId
=
"183"
;
String
credits
=
"10"
;
String
credits
=
"10"
;
String
actualCredits
=
"10"
;
String
actualCredits
=
"10"
;
boolean
bl
=
false
;
//查询兑换前的库存
//查询兑换前的库存
//stock_id 通过表tb_app_item_sku 来查询
//stock_id 通过表tb_app_item_sku 来查询
...
@@ -513,7 +527,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
...
@@ -513,7 +527,7 @@ public class 自有新实物_兑换流程测试_ExchangeTest extends CheckTemple
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
String
stock
=
String
.
valueOf
(
mapStock
.
get
(
"stock"
));
logger
.
info
(
"兑换前的库存:"
+
stock
);
logger
.
info
(
"兑换前的库存:"
+
stock
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
Response
response
=
gawService
.
objectExchange
(
uid
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
bl
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
String
orderId
=
response
.
jsonPath
().
getString
(
"data.orderId"
);
//获取兑换结果
//获取兑换结果
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
response
=
tawService
.
orderStatus
(
orderId
,
uid
);
...
...
src/test/java/http/service/app/gawService.java
View file @
8a039d82
...
@@ -125,7 +125,7 @@ public class gawService {
...
@@ -125,7 +125,7 @@ public class gawService {
//普通自有新实物兑换接口
//普通自有新实物兑换接口
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
,
String
skuId
,
String
credits
,
String
actualCredits
)
throws
Exception
{
public
Response
objectExchange
(
int
uid
,
String
appItemId
,
String
itemId
,
String
skuId
,
String
credits
,
String
actualCredits
,
boolean
bl
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
...
@@ -147,6 +147,7 @@ public class gawService {
...
@@ -147,6 +147,7 @@ public class gawService {
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
map
.
put
(
"vipFlag"
,
bl
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
...
@@ -227,6 +228,51 @@ public class gawService {
...
@@ -227,6 +228,51 @@ public class gawService {
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
// response.prettyPrint();
try
{
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"/gaw/objectExchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"/gaw/objectExchange/create接口返回异常,返回信息:"
+
response
.
asString
());
}
return
response
;
}
//会员商品优惠券兑换接口
public
Response
couponExchange2
(
int
uid
,
String
appItemId
,
String
credits
,
String
actualCredits
,
int
skuId
,
boolean
bl
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
Map
>
list
=
new
ArrayList
<>();
mapList
.
put
(
"skuId"
,
skuId
);
mapList
.
put
(
"appItemId"
,
appItemId
);
mapList
.
put
(
"credits"
,
credits
);
mapList
.
put
(
"price"
,
0
);
list
.
add
(
mapList
);
map
.
put
(
"remark"
,
""
);
//买家留言
map
.
put
(
"degreeId"
,
""
);
map
.
put
(
"actualPrice"
,
"0"
);
//总金额
map
.
put
(
"actualCredits"
,
actualCredits
);
//总积分
map
.
put
(
"itemParam"
,
list
.
toArray
());
map
.
put
(
"payType"
,
"3"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
map
.
put
(
"vipFlag"
,
bl
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
logger
.
info
(
"请求优惠券兑换接口:"
+
"/gaw/couponExchange/create"
);
Response
response
=
given
().
contentType
(
"application/json; charset=UTF-8"
).
cookies
(
authorization
.
dafuwengLogin
(
uid
)).
body
(
jsonParam
).
post
(
"http://"
+
goodsHost
+
"/gaw/couponExchange/create"
);
// Response saveResponse = given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).params(map).post("http://"+goodsHost+"/gaw/objectExchange/create");
// response.prettyPrint();
// response.prettyPrint();
try
{
try
{
...
@@ -284,7 +330,7 @@ public class gawService {
...
@@ -284,7 +330,7 @@ public class gawService {
}
}
//优惠券兑换接口
//优惠券兑换接口
public
Response
couponExchange
(
Map
cookie
,
String
appItemId
,
int
skuId
)
throws
Exception
{
public
Response
couponExchange
(
Map
cookie
,
String
appItemId
,
int
skuId
,
boolean
bl
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
...
@@ -305,6 +351,7 @@ public class gawService {
...
@@ -305,6 +351,7 @@ public class gawService {
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"expressPrice"
,
"0"
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"validate"
,
""
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
map
.
put
(
"token"
,
"yrJRr7Cddp2YeQd"
);
map
.
put
(
"vipFlag"
,
bl
);
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
JSONObject
jsonParam
=
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
map
));
...
...
src/test/java/http/service/testservice.java
View file @
8a039d82
...
@@ -74,7 +74,7 @@ public class testservice extends AbstractTestNGSpringContextTestsDuiba {
...
@@ -74,7 +74,7 @@ public class testservice extends AbstractTestNGSpringContextTestsDuiba {
Thread
.
sleep
(
3000
);
Thread
.
sleep
(
3000
);
Response
response
=
gawService
.
objectExchange
(
1
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
);
Response
response
=
gawService
.
objectExchange
(
1
,
appItemId
,
itemId
,
skuId
,
credits
,
actualCredits
,
false
);
response
.
prettyPrint
();
response
.
prettyPrint
();
//(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=2)
//(enabled=true, dataProvider="testdp", threadPoolSize=1, invocationCount=2)
...
...
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