Commit 34179289 authored by qwj-github's avatar qwj-github

add

parent a82dca90
......@@ -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(uid01,orderId);
statusResponse = pkService.getOrderStatus(uid03,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<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment