Commit 9e68a745 authored by 钱雯君's avatar 钱雯君

add

parent 3687d94c
......@@ -49,14 +49,17 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
private String groupId = "6,7";
private Integer user01 = 3445;
private String consumerId01 = "100066364";//activity_order_con.tb_trade_center_activity_order_0060
private Integer user02 = 3446;
private String consumerId02 = "100066365";//activity_order_con.tb_trade_center_activity_order_0061
private Integer user03 = 3447;
private String consumerId03 = "100066366";//activity_order_con.tb_trade_center_activity_order_0062
private Integer user04 = 3448;
private String consumerId04 = "100066367";//activity_order_con.tb_trade_center_activity_order_0063
private Integer user01 = 4812;//appid=18816
private String consumerId01 = "100108112";//activity_order_con.tb_trade_center_activity_order_0848
private Integer user02 = 4813;//appid=18816
private String consumerId02 = "100108113";//activity_order_con.tb_trade_center_activity_order_0849
private Integer user03 = 4814;//appid=2239
private String consumerId03 = "100108114";//activity_order_con.tb_trade_center_activity_order_0850
private Integer user04 = 4815;//appid=2239
private String consumerId04 = "100108115";//activity_order_con.tb_trade_center_activity_order_0851
List<String> wins = new ArrayList<>();
List<String> loses = new ArrayList<>();
private String newBetId = "";
......@@ -78,8 +81,8 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
@Test
public void 瓜分红包_两个选项_押注人数不同_开奖测试(){
try {
public void 瓜分红包_两个选项_押注人数不同_开奖测试() throws Exception{
List<Map<String,Object>> pks = jdbc.findModeResult("select * from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
logger.info("pk活动信息为"+JSONObject.toJSONString(pks));
......@@ -87,13 +90,13 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
optionsIds.add(pks.get(i).get("id").toString());
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0060 where consumer_id = '100066364' and account_type = '6'\n");
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0848 where consumer_id = '100108112' and account_type = '6'\n");
Long use1_Acc1 = Long.valueOf(user01_account1.get("balance_amount").toString());
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0061 where consumer_id = '100066365' and account_type = '6'\n");
Map<String,Object> user02_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0849 where consumer_id = '100108113' and account_type = '6'\n");
Long use2_Acc1 = Long.valueOf(user02_account1.get("balance_amount").toString());
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0062 where consumer_id = '100066366' and account_type = '6'\n");
Map<String,Object> user03_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0850 where consumer_id = '100108114' and account_type = '6'\n");
Long use3_Acc1 = Long.valueOf(user03_account1.get("balance_amount").toString());
Map<String,Object> user04_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0063 where consumer_id = '100066367' and account_type = '6'\n");
Map<String,Object> user04_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0851 where consumer_id = '100108115' and account_type = '6'\n");
Long use4_Acc1 = Long.valueOf(user04_account1.get("balance_amount").toString());
......@@ -101,8 +104,12 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
//押注第二个选项:user03,user04
Response res1 = pkService.doJoin(user01,newBetId,optionsIds.get(0));
Response res2 = pkService.doJoin(user02,newBetId,optionsIds.get(1));
Response res3 = pkService.doJoin(user03,newBetId,optionsIds.get(1));
Response res3 = pkService.doJoin(user03,newBetId,optionsIds.get(0));
Response res4 = pkService.doJoin(user04,newBetId,optionsIds.get(1));
wins.add(consumerId01);
wins.add(consumerId03);
loses.add(consumerId02);
loses.add(consumerId04);
//修改开奖时间
this.modifyOpenPrizeTime(newBetId,60);
......@@ -115,60 +122,26 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数,4、校验account表的红包值加上去
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",newBetId);
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
Assert.assertEquals(betConfig.get("config_status").toString(),"4","配置表状态更新失败");
Map<String,Object> betGroupRelation = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = ?\n",newBetId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Response betList = pkActivityService.getMngBetList();
betList.prettyPrint();
List<BetMngVo> betMngVoList = betList.jsonPath().getList("data.page",BetMngVo.class);
for (BetMngVo bet:betMngVoList){
if (bet.getId().equals(newBetId)){
Assert.assertEquals(bet.getConfigStatus(),"4","开奖结果校验失败");
}
}
checkPKConfig();
checkPKResult("18816");
checkPKResult("2239");
checkUserOrder(wins,loses);
checkRecord(wins,loses);
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0060 where consumer_id = '100066364' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0061 where consumer_id = '100066365' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
Map<String,Object> user03_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0062 where consumer_id = '100066366' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user03_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
Map<String,Object> user04_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0063 where consumer_id = '100066367' and duiba_activity_id = ?\n",newBetId);
Assert.assertEquals(user04_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
logger.info("用户01获取的红包值为:"+user01_order.get("add_credits").toString()+",用户02获取的红包值为:"+user02_order.get("add_credits").toString());
logger.info("用户03获取的红包值为:"+user03_order.get("add_credits").toString()+",用户04获取的红包值为:"+user04_order.get("add_credits").toString());
Map<String,Object> bet1Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(0));
Assert.assertEquals(bet1Result.get("rank").toString(),"2","开始押注的选项获胜校验失败");
Map<String,Object> bet2Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ?\n",newBetId,optionsIds.get(1));
Assert.assertEquals(bet2Result.get("rank").toString(),"1","开始押注的选项获胜校验失败");
Long bet1Times = Long.valueOf(bet1Result.get("bet_times").toString());
Long bet2Times = Long.valueOf(bet2Result.get("bet_times").toString());
Assert.assertTrue(bet1Times<bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
Map<String,Object> user01_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0060 where consumer_id = '100066364' and account_type = '6'\n");
Map<String,Object> user01_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0848 where consumer_id = '100108112' and account_type = '6'\n");
Long use1_Acc2 = Long.valueOf(user01_account2.get("balance_amount").toString());
Assert.assertEquals(use1_Acc2,use1_Acc1,"用户1入账校验失败");
Map<String,Object> user02_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0061 where consumer_id = '100066365' and account_type = '6'\n");
Assert.assertEquals(use1_Acc2.toString(),String.valueOf(use1_Acc1+10),"用户1入账校验失败");
Map<String,Object> user02_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0849 where consumer_id = '100108113' and account_type = '6'\n");
Long use2_Acc2 = Long.valueOf(user02_account2.get("balance_amount").toString());
Assert.assertEquals(use2_Acc2.toString(),String.valueOf(use2_Acc1+10),"用户2入账校验失败");
Map<String,Object> user03_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0062 where consumer_id = '100066366' and account_type = '6'\n");
Assert.assertEquals(use2_Acc2,use2_Acc1,"用户2入账校验失败");
Map<String,Object> user03_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0850 where consumer_id = '100108114' and account_type = '6'\n");
Long use3_Acc2 = Long.valueOf(user03_account2.get("balance_amount").toString());
Assert.assertEquals(use3_Acc2.toString(),String.valueOf(use3_Acc1+10),"用户3入账校验失败");
Map<String,Object> user04_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0063 where consumer_id = '100066367' and account_type = '6'\n");
Map<String,Object> user04_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0851 where consumer_id = '100108115' and account_type = '6'\n");
Long use4_Acc2 = Long.valueOf(user04_account2.get("balance_amount").toString());
Assert.assertEquals(use4_Acc2.toString(),String.valueOf(use4_Acc1+10),"用户4入账校验失败");
Assert.assertEquals(use4_Acc2,use4_Acc1,"用户4入账校验失败");
}catch (Exception e){
e.printStackTrace();
}
}
......@@ -199,31 +172,77 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
}
// @Test
public void 调试(){
try {
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?","1179");
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
logger.info("betConfig的信息为:"+ betConfig.toString());
Response betList = pkActivityService.getMngBetList();
betList.prettyPrint();
List<BetMngVo> betMngVoList = betList.jsonPath().getList("data.page",BetMngVo.class);
for (BetMngVo bet:betMngVoList){
if (bet.getId().equals("1185")){
Assert.assertEquals(bet.getConfigStatus(),"4","开奖结果校验失败");
}
public void checkPKConfig() throws Exception{
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",newBetId);
logger.info("betConfig的信息为:"+ JSONObject.toJSONString(betConfig));
Assert.assertEquals(betConfig.get("config_status").toString(),"4","配置表状态更新失败");
Map<String,Object> betGroupRelation = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_group_relation where bet_id = ?\n",newBetId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Response betList = pkActivityService.getMngBetList();
betList.prettyPrint();
List<BetMngVo> betMngVoList = betList.jsonPath().getList("data.page",BetMngVo.class);
for (BetMngVo bet:betMngVoList){
if (bet.getId().equals(newBetId)){
Assert.assertEquals(bet.getConfigStatus(),"4","开奖结果校验失败");
}
}
}
public void checkPKResult(String appId) throws Exception{
Map<String,Object> bet1Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ? and app_id = ?\n",newBetId,optionsIds.get(0),appId);
Assert.assertEquals(bet1Result.get("rank").toString(),"1","开始押注的选项获胜校验失败");
Map<String,Object> bet2Result = jdbc.findSimpleResult("select * from bet_activity.tb_bet_result where bet_id = ? and option_id = ? and app_id = ?\n",newBetId,optionsIds.get(1),appId);
Assert.assertEquals(bet2Result.get("rank").toString(),"2","开始押注的选项获胜校验失败");
Long bet1Times = Long.valueOf(bet1Result.get("bet_times").toString());
Long bet2Times = Long.valueOf(bet2Result.get("bet_times").toString());
Assert.assertTrue(bet1Times>bet2Times,"活动获胜人数比失败人数多校验失败");
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
public void checkUserOrder(List<String> wins,List<String> loses) throws Exception{
for (int i=0;i<wins.size();i++){
String dbName = "activity_order_con.tb_trade_center_activity_order_"+ String.format("%04d", Long.parseLong(wins.get(i)) % 1024);
logger.info("用户的分表名dbName为"+dbName);
Map<String,Object> user_order = jdbc.findSimpleResult("select * from "+dbName+" where consumer_id = ? and duiba_activity_id = ?\n",wins.get(i),newBetId);
Long account = Long.valueOf(user_order.get("add_credits").toString());
Assert.assertEquals(account.toString(),"10","开奖后订单更新");
logger.info("用户"+wins.get(i)+"订单获取的红包值为:"+user_order.get("add_credits").toString());
}catch (Exception e){
e.printStackTrace();
}
for (int i=0;i<loses.size();i++){
String dbName = "activity_order_con.tb_trade_center_activity_order_"+ String.format("%04d", Long.parseLong(loses.get(i)) % 1024);
logger.info("用户的分表名dbName为"+dbName);
Map<String,Object> user_order = jdbc.findSimpleResult("select * from "+dbName+" where consumer_id = ? and duiba_activity_id = ?\n",loses.get(i),newBetId);
String account = user_order.get("add_credits").toString();
Assert.assertEquals(account.toString(),"","开奖后订单更新");
logger.info("用户"+loses.get(i)+"订单获取的红包值为:"+user_order.get("add_credits").toString());
}
}
public void checkRecord(List<String> wins,List<String> loses) throws Exception{
for (int i=0;i<wins.size();i++){
Map<String,Object> useRecord = jdbc.findSimpleResult("select * from act_record.tb_bet_record where bet_id = ? and consumer_id = ? \n",newBetId,wins.get(i));
Assert.assertEquals(useRecord.get("bonus").toString(), "10", "record表的红包值校验失败");
Assert.assertEquals(useRecord.get("exchange_status").toString(), "2", "record表的发奖状态校验失败");
logger.info("用户"+wins.get(i)+"订单获取的红包值为:"+useRecord.get("bonus").toString());
}
for (int i=0;i<loses.size();i++){
Map<String,Object> useRecord = jdbc.findSimpleResult("select * from act_record.tb_bet_record where bet_id = ? and consumer_id = ? \n",newBetId,loses.get(i));
Assert.assertEquals(useRecord.get("bonus").toString(), "0", "record表的红包值校验失败");
Assert.assertEquals(useRecord.get("exchange_status").toString(), "0", "record表的发奖状态校验失败");
logger.info("用户"+loses.get(i)+"订单获取的红包值为:"+useRecord.get("bonus").toString());
}
}
@AfterClass
public void tearDown() {
......@@ -232,6 +251,7 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id in (select id from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%')");
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where title like '【自动化】瓜分红包%'");
......
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