Commit 648b9661 authored by 马博's avatar 马博

Merge branch 'master' into mabo

parents 24284c55 aec12ea1
......@@ -88,7 +88,7 @@ public class 自有活动出奖_DuibaTest extends DuibaTestBase {
j--;
}
Assert.assertEquals(flowWork,"SupplierExchange-started","数据库主订单流程节点校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("biz_params")),"胡梦新:18258853242:浙江省:杭州市:西湖区:数娱大厦","数据库主订单biz_params校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("biz_params")),"胡梦新:18258853242:浙江:杭州市:西湖区:西溪街道:数娱大厦 ","数据库主订单biz_params校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("pay_status")),"none","数据库主订单pay_status校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("status")),"consume_success","数据库主订单status校验失败");
......
......@@ -387,7 +387,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建活动楼层皮肤" })
public void B_手机端活动() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -444,7 +444,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_手机端活动" })
public void C_删除活动楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......
......@@ -342,7 +342,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建优惠券楼层皮肤" })
public void B_优惠券手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -392,7 +392,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_优惠券手机端" })
public void C_删除优惠券楼层皮肤() throws Exception {
......
......@@ -230,7 +230,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建游戏楼层皮肤" })
public void B_游戏手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -272,7 +272,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_游戏手机端" })
public void C_删除游戏楼层皮肤() throws Exception {
......
......@@ -222,7 +222,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_创建icon楼层皮肤" })
public void B_icon添加图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -296,7 +296,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_icon添加图标" })
public void C_icon编辑图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -352,7 +352,7 @@ public class Icon_FloorTest extends DuibaTestBase {
Assert.assertEquals(map.get("logo"),"//yun.dui88.com/images/201806/9lz5ifre0h.png","今日必抢logo校验错误");
}
@Test
@Test(dependsOnMethods = { "C_icon编辑图标" })
public void D_icon删除图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -388,7 +388,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "D_icon删除图标" })
public void E_删除icon楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......
......@@ -362,7 +362,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_item创建楼层皮肤" })
public void B_item手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -404,7 +404,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_item手机端" })
public void C_item删除楼层皮肤() throws Exception {
......
......@@ -806,7 +806,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
response = floorService.switchOpenState(authorization.ssoLogin(),skinId,"true");
}
@Test
@Test(dependsOnMethods = { "A_Seckill创建楼层皮肤" })
public void B_Seckill手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -849,7 +849,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_Seckill手机端" })
public void C_Seckill删除楼层皮肤() throws Exception {
......
......@@ -244,7 +244,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_Showcase创建楼层皮肤" })
public void B_Showcase手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -289,7 +289,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_Showcase手机端" })
public void C_Showcase删除楼层皮肤() throws Exception {
......
......@@ -510,7 +510,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "A_sign创建楼层皮肤" })
public void B_sign手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -545,7 +545,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test
@Test(dependsOnMethods = { "B_sign手机端" })
public void C_sign删除楼层皮肤() throws Exception {
......
......@@ -170,7 +170,7 @@ public class 出奖订单测试_DuibaTest extends DuibaTestBase {
}
Assert.assertEquals(flowWork,"SupplierExchange-started","数据库主订单流程节点校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("item_id")),"27131","数据库主订单奖项id校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("biz_params")),"胡梦新:18258853242:浙江省:杭州市:西湖区:数娱大厦","数据库主订单biz_params校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("biz_params")),"胡梦新:18258853242:浙江:杭州市:西湖区:西溪街道:数娱大厦 ","数据库主订单biz_params校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("pay_status")),"prereduce","数据库主订单pay_status校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("status")),"consume_success","数据库主订单status校验失败");
......
......@@ -20,12 +20,14 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.sql.SQLException;
import java.util.Map;
public class 瓜分积分_作弊瓜分 extends DuibaTestBase {
public class 瓜分积分_作弊瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......@@ -186,6 +188,79 @@ public class 瓜分积分_作弊瓜分 extends DuibaTestBase {
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
@Test(dependsOnMethods = { "开奖" })
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"1","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Response response2 = pkService.popup(uid3);
response.prettyPrint();
Assert.assertEquals(response2.jsonPath().getString("data.prizeList"),null,"中奖弹窗积分校验失败");
Assert.assertEquals(response2.jsonPath().getString("data.show"),"false","展示弹窗校验失败");
}
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Response response = pkService.list(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"true","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.id"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"30","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.configStatus"),"4","活动状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"1.00","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.betType"),"1","活动押注类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.bonusType"),"4","活动瓜分类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.01","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"1","兑换状态校验失败");
response = pkService.list(uid3);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"false","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId2,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.0","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"0","兑换状态校验失败");
}
@AfterClass
public void afterclass() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",betId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",betId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
......
......@@ -3,7 +3,7 @@
* FileName: 瓜分积分测试_AccessTest
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
* Description: "appId": 21771
*/
package http.cases.PkMoudleTest;
......@@ -21,13 +21,15 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
public class 瓜分积分_实际瓜分 extends DuibaTestBase {
public class 瓜分积分_实际瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......@@ -188,6 +190,78 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
@Test(dependsOnMethods = { "开奖" })
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"7","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Response response2 = pkService.popup(uid3);
response.prettyPrint();
Assert.assertEquals(response2.jsonPath().getString("data.prizeList"),null,"中奖弹窗积分校验失败");
Assert.assertEquals(response2.jsonPath().getString("data.show"),"false","展示弹窗校验失败");
}
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Response response = pkService.list(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"true","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.id"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"30","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.configStatus"),"4","活动状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"1.00","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.betType"),"1","活动押注类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.bonusType"),"4","活动瓜分类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.07","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"1","兑换状态校验失败");
response = pkService.list(uid3);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"false","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId2,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.0","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"0","兑换状态校验失败");
}
@AfterClass
public void afterclass() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",betId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",betId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
......@@ -202,4 +276,6 @@ public class 瓜分积分_实际瓜分 extends DuibaTestBase {
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: 瓜分积分测试_AccessTest
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
*/
package http.cases.PkMoudleTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import http.service.hd.PkDevelopService;
import io.restassured.response.Response;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.sql.SQLException;
import java.util.Map;
public class 瓜分积分_实际瓜分_主胜方_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
@Autowired
PkService pkService;
@Autowired
PkActivityService pkActivityService;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid1 = 5171;
private static Integer uid2 = 5172;
private static Integer uid3 = 5173;
private static String betId;
private static String optionId1;
private static String optionId2;
@Test
public void 创建PK活动() throws Exception{
Response response = pkDevelopService.betEditor_right("18157163293","21832","4",null,"1","30","false","true");
Assert.assertEquals(response.jsonPath().getString("desc"),"成功","创建组件化pk活动失败");
response = pkService.getBetList(uid1);
response.print();
int i= 30;
while(i>0&&(response.jsonPath().getString("data.unbetList").equals("[]"))){
Thread.sleep(5000);
response = pkService.getBetList(uid1);
response.print();
i--;
}
betId = response.jsonPath().getString("data.unbetList[0].betConfig.id");
optionId1 = response.jsonPath().getString("data.unbetList[0].options[0].optionId");
optionId2 = response.jsonPath().getString("data.unbetList[0].options[1].optionId");
if(betId.equals(null)){
throw new Exception("楼层查询pk组件活动失败!");
}else {
logger.info("pk活动id 为:" + betId + ",投注id1为:" + optionId1 + ",投注id2为:" + optionId2);
}
}
@Test(dependsOnMethods = { "创建PK活动" })
public void 投注() throws Exception {
//查询数据库,投注前积分(抽奖扣积分流程校验)
Map<String,Object> mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
Map<String,Object> mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
Map<String,Object> mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits1 = String.valueOf(mapuser1.get("credits"));
String credits2 = String.valueOf(mapuser2.get("credits"));
String credits3 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1投注前积分:"+credits1);
logger.info("用户2投注前积分:"+credits2);
logger.info("用户3投注前积分:"+credits3);
//扣去1积分
credits1 = String.valueOf(Integer.valueOf(credits1)-1);
credits2 = String.valueOf(Integer.valueOf(credits2)-1);
credits3 = String.valueOf(Integer.valueOf(credits3)-1);
this.stake(uid1,betId,optionId1);
this.stake(uid2,betId,optionId1);
this.stake(uid3,betId,optionId2);
//查询数据库,投注前积分(抽奖扣积分流程校验)
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits4 = String.valueOf(mapuser1.get("credits"));
String credits5 = String.valueOf(mapuser2.get("credits"));
String credits6 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1投注后积分:"+credits4);
logger.info("用户2投注后积分:"+credits5);
logger.info("用户3投注后积分:"+credits6);
Assert.assertEquals(credits4,credits1);
Assert.assertEquals(credits5,credits2);
Assert.assertEquals(credits6,credits3);
}
@Test(dependsOnMethods = { "投注" })
public void 开奖() throws Exception {
//查询数据库,开奖前积分
Map<String,Object> mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
Map<String,Object> mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
Map<String,Object> mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits1 = String.valueOf(mapuser1.get("credits"));
String credits2 = String.valueOf(mapuser2.get("credits"));
String credits3 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1开奖前积分:"+credits1);
logger.info("用户2开奖前积分:"+credits2);
logger.info("用户3开奖前积分:"+credits3);
//增加积分: 30/(1+2)
credits3 = String.valueOf(Integer.valueOf(credits3)+6);
//修改开奖时间
this.modifyOpenPrizeTime(betId,60);
//调用开奖接口
Response doDrowRresponse = pkActivityService.doDraw();
Assert.assertEquals(doDrowRresponse.jsonPath().getString("success"),"true","开奖结果校验失败");
Assert.assertEquals(doDrowRresponse.jsonPath().getString("data"),"开奖中。。。","开奖messag校验失败");
Thread.sleep(8000);
//查询数据库,开奖后积分
mapuser1 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid1);
mapuser2 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid2);
mapuser3 = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits4 = String.valueOf(mapuser1.get("credits"));
String credits5 = String.valueOf(mapuser2.get("credits"));
String credits6 = String.valueOf(mapuser3.get("credits"));
logger.info("用户1开奖后积分:"+credits4);
logger.info("用户2开奖后积分:"+credits5);
logger.info("用户3开奖后积分:"+credits6);
Assert.assertEquals(credits4,credits1);
Assert.assertEquals(credits5,credits2);
Assert.assertEquals(credits6,credits3);
logger.info("投注者瓜分金额校验正确");
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数
Map<String,Object> betConfig = jdbc.findSimpleResult("select * from act_com_conf.tb_bet_config where id = ?",betId);
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",betId);
Assert.assertEquals(betGroupRelation.get("config_status").toString(),"4","pk关系表开奖状态更新失败");
logger.info("pk活动配置表状态更新为:"+betConfig.get("config_status").toString()+",pk关系表活动状态更新为:"+betGroupRelation.get("config_status").toString());
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0614 where consumer_id = '100114022' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"6","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0623 where consumer_id = '100114031' and duiba_activity_id = ?\n",betId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的积分值为:"+user01_order.get("add_credits").toString()+",用户03获取的积分值为:"+user02_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",betId,optionId1);
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",betId,optionId2);
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());
}
@Test(dependsOnMethods = { "开奖" })
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid3);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"6","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"4","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Response response2 = pkService.popup(uid1);
response.prettyPrint();
Assert.assertEquals(response2.jsonPath().getString("data.prizeList"),null,"中奖弹窗积分校验失败");
Assert.assertEquals(response2.jsonPath().getString("data.show"),"false","展示弹窗校验失败");
}
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Response response = pkService.list(uid3);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"true","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.id"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"30","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.configStatus"),"4","活动状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"1.00","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.betType"),"1","活动押注类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.bonusType"),"4","活动瓜分类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"2","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"3","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"37.5","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"1","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"5","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"62.5","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId2,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.06","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"1","兑换状态校验失败");
response = pkService.list(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"false","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.0","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"0","兑换状态校验失败");
}
@AfterClass
public void afterclass() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",betId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",betId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
// int x=20+(int)(Math.random()*100);
DateTime endTime = time1.minusMillis(x);
DateTimeFormatter format = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
// String endTimeStr = format.print(endTime.getMillis()).toString();
String endTimeStr = "2018-11-26 20:24:39";
logger.info("\ntime1="+ format.print(time1.getMillis())+"\n设置的开奖时间endTime="+ endTimeStr);
Boolean result1 = jdbc.update("update act_com_conf.tb_bet_config set end_time = ? where id = ?\n",endTimeStr,betId);
Boolean result2 = jdbc.update("update act_com_conf.tb_bet_group_relation set end_time = ? where bet_id = ?\n",endTimeStr,betId);
}
//押注通用接口
public void stake(Integer uid,String betId,String optionId) throws Exception {
Response doJoinResponse = pkService.doJoin(uid, betId, optionId);
doJoinResponse.prettyPrint();
Assert.assertEquals(doJoinResponse.jsonPath().getString("code"), "200", "校验押注失败");
String orderId = doJoinResponse.jsonPath().getString("data");
Response statusResponse = pkService.getOrderStatus(uid, 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(uid, orderId);
consumerStatus = statusResponse.jsonPath().getString("data.consumeStatus");
}
logger.info("用户:"+uid+"投注成功!");
}
}
\ No newline at end of file
......@@ -20,14 +20,16 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.Map;
public class 瓜分红包_作弊瓜分 extends DuibaTestBase {
public class 瓜分红包_作弊瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......@@ -126,7 +128,7 @@ public class 瓜分红包_作弊瓜分 extends DuibaTestBase {
logger.info("用户2开奖前红包余额:"+use2_Acc1);
logger.info("用户3开奖前红包余额:"+use3_Acc1);
//预期增加红包: 750
//预期增加红包: 1
DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
use1_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use1_Acc1),1));
use2_Acc1 = decimalFormat.format(this.sub(Double.valueOf(use2_Acc1),1));
......@@ -182,6 +184,80 @@ public class 瓜分红包_作弊瓜分 extends DuibaTestBase {
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
@Test(dependsOnMethods = { "开奖" })
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"1","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"2","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.totalBonus"),"0.01","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Response response2 = pkService.popup(uid3);
response.prettyPrint();
Assert.assertEquals(response2.jsonPath().getString("data.prizeList"),null,"中奖弹窗积分校验失败");
Assert.assertEquals(response2.jsonPath().getString("data.show"),"false","展示弹窗校验失败");
}
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Response response = pkService.list(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"true","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.id"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"10","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.configStatus"),"4","活动状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"0","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.betType"),"1","活动押注类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.bonusType"),"2","活动瓜分类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"544","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.9","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"269","活动投注人数校验失败");
// Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.1","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.01","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"2","兑换状态校验失败");
response = pkService.list(uid3);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"false","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId2,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.0","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"0","兑换状态校验失败");
}
@AfterClass
public void afterclass() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",betId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",betId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
......
......@@ -20,14 +20,16 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.Map;
public class 瓜分红包_实际瓜分 extends DuibaTestBase {
public class 瓜分红包_实际瓜分_AccessTest extends DuibaTestBase {
@Autowired
PkDevelopService pkDevelopService;
......@@ -187,6 +189,80 @@ public class 瓜分红包_实际瓜分 extends DuibaTestBase {
logger.info("选项1的押注人数为:"+bet1Result.get("bet_times").toString()+",选项2的押注人数为:"+bet2Result.get("bet_times").toString());
}
@Test(dependsOnMethods = { "开奖" })
public void 出奖弹层校验() throws Exception {
Response response = pkService.popup(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].totalBonus"),"750","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.prizeList[0].bonusType"),"2","中奖弹窗类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.totalBonus"),"7.5","中奖弹窗积分校验失败");
Assert.assertEquals(response.jsonPath().getString("data.show"),"true","展示弹窗校验失败");
Response response2 = pkService.popup(uid3);
response.prettyPrint();
Assert.assertEquals(response2.jsonPath().getString("data.prizeList"),null,"中奖弹窗积分校验失败");
Assert.assertEquals(response2.jsonPath().getString("data.show"),"false","展示弹窗校验失败");
}
@Test(dependsOnMethods = { "出奖弹层校验" })
public void 战绩页校验() throws Exception {
Response response = pkService.list(uid1);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"true","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.id"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.shareExp"),"30","活动瓜分金额校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.configStatus"),"4","活动状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.creditsValue"),"1.00","活动消耗校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.betType"),"1","活动押注类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].betConfig.bonusType"),"2","活动瓜分类型校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].optionId"),optionId1,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].rank"),"1","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].betTimes"),"4","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[0].scale"),"66.7","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].resultStatus"),"4","活动选项结果状态校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].optionId"),optionId2,"活动投注id1校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].rank"),"2","活动投注结果校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].betTimes"),"2","活动投注人数校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].options[1].scale"),"33.3","活动投注人数比例校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId1,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"7.5","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"2","兑换状态校验失败");
response = pkService.list(uid3);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("data.list[0].userWin"),"false","中奖记录校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.betId"),betId,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.optionId"),optionId2,"活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.bonus"),"0.0","活动id校验失败");
Assert.assertEquals(response.jsonPath().getString("data.list[0].record.exchangeStatus"),"0","兑换状态校验失败");
}
@AfterClass
public void afterclass() {
try {
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",betId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",betId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",betId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",betId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",betId);
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
......
......@@ -11,21 +11,48 @@ package http.cases.PkMoudleTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.PkService;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import utils.ExcelDataProvider;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import static io.restassured.RestAssured.given;
public class 配置测试_AccessTest extends DuibaTestBase {
@Value("${activity.host}")
String activityHost;
@Autowired
PkService pkService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid = 5028;//
@DataProvider
public Object[][] providerMethod(Method method){
Object[][] result = null;
if(method.getName().equals("重复投注测试")) {
result = new Object[][]{
new Object[]{"3758"},
new Object[]{"3757"},
};
}
return result;
}
@Test
public void 配置测试() throws Exception{
......@@ -98,8 +125,102 @@ public class 配置测试_AccessTest extends DuibaTestBase {
Assert.assertEquals(optionImg4,"//yun.dui88.com/images/201812/ifh1kvaq9m.jpg","校验选项2 图片失败");
Assert.assertEquals(optionName4,"分红包选项二","校验选项2 title失败");
//已投注配置
String betType3 = response.jsonPath().getString("data.betedList[0].betConfig.betType");
String bonusType3 = response.jsonPath().getString("data.betedList[0].betConfig.bonusType");
String configStatus3 = response.jsonPath().getString("data.betedList[0].betConfig.configStatus");
String creditsValue3 = response.jsonPath().getString("data.betedList[0].betConfig.creditsValue");
String id3 = response.jsonPath().getString("data.betedList[0].betConfig.id");
String shareExp3 = response.jsonPath().getString("data.betedList[0].betConfig.shareExp");
String title3 = response.jsonPath().getString("data.betedList[0].betConfig.title");
String unitName3 = response.jsonPath().getString("data.betedList[0].betConfig.unitName");
//选项获取
String optionId5 = response.jsonPath().getString("data.betedList[0].options[0].optionId");
String optionImg5 = response.jsonPath().getString("data.betedList[0].options[0].optionImg");
String optionName5 = response.jsonPath().getString("data.betedList[0].options[0].optionName");
String chooseThisOption5 = response.jsonPath().getString("data.betedList[0].options[0].chooseThisOption");
String optionId6 = response.jsonPath().getString("data.betedList[0].options[1].optionId");
String optionImg6 = response.jsonPath().getString("data.betedList[0].options[1].optionImg");
String optionName6 = response.jsonPath().getString("data.betedList[0].options[1].optionName");
String chooseThisOption6 = response.jsonPath().getString("data.betedList[0].options[1].chooseThisOption");
Assert.assertEquals(betType3,"1","校验押注类型失败"); //'押注类型 1-单选单次,2-多选无限制'
Assert.assertEquals(bonusType3,"4","校验瓜分类型失败");//'瓜分类型1瓜分经验2瓜分红包3发奖品4瓜分积分'
Assert.assertEquals(configStatus3,"3","校验投注活动的状态失败");//'投注活动的状态:1关闭不可见2关闭可见3开启4结束'
Assert.assertEquals(creditsValue3,"0","校验积分价值失败");//积分价值
Assert.assertEquals(id3,"1799","校验pk id失败");
Assert.assertTrue(new BigDecimal(shareExp3).compareTo(new BigDecimal("50"))==0,"校验瓜分的经验池失败");//瓜分的经验池
Assert.assertEquals(title3,"待投注","校验投注活动标题失败");//投注活动标题
Assert.assertEquals(unitName3,"元宝","校验消耗类型失败");
Assert.assertEquals(optionId5,"3757","校验选项1 id失败");
Assert.assertEquals(optionImg5,"//yun.dui88.com/images/201812/2sv582lhyo.png","校验选项1 图片失败");
Assert.assertEquals(optionName5,"1","校验选项1 title失败");
Assert.assertEquals(chooseThisOption5,"false","校验选项1选择情况失败");
Assert.assertEquals(optionId6,"3758","校验选项2 id失败");
Assert.assertEquals(optionImg6,"//yun.dui88.com/images/201812/hyhd36w6be.png","校验选项2 图片失败");
Assert.assertEquals(optionName6,"2","校验选项2 title失败");
Assert.assertEquals(chooseThisOption6,"true","校验选项2选择情况失败");
logger.info("pk组件分红包、分积分配置校验正确!");
}
@Test
public void 投注积分不足(){
String url = activityHost + "/betActivity2/doJoin";
Map<String,Object> map = new HashMap<>();
map.put("betId","1355");
map.put("optionId","2869");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(url);
Assert.assertEquals(response.jsonPath().getString("success"),"false","校验success失败");
Assert.assertEquals(response.jsonPath().getString("code"),"100009","校验错误码失败");
Assert.assertEquals(response.jsonPath().getString("desc"),"积分不足","校验desc失败");
logger.info("投注积分不足校验成功!");
}
@Test(dataProvider = "providerMethod")
public void 重复投注测试(String optionId){
String url = activityHost + "/betActivity2/doJoin";
Map<String,Object> map = new HashMap<>();
map.put("betId","1799");
map.put("optionId",optionId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(url);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("success"),"false","校验success失败");
Assert.assertEquals(response.jsonPath().getString("code"),"100011","校验错误码失败");
Assert.assertEquals(response.jsonPath().getString("desc"),"活动已参加","校验desc失败");
logger.info("重复投注校验成功!");
}
@Test
public void 未登录投注(){
//获取未登录场景cookie
Response responses = authorization.autoLogin();
//进行接口测试传参
Map<String,String> cookies = responses.getCookies();
String url = activityHost + "/betActivity2/doJoin";
Map<String,Object> map = new HashMap<>();
map.put("betId","1355");
map.put("optionId","2869");
Response response = given().cookies(cookies).params(map).post(url);
response.prettyPrint();
Assert.assertEquals(response.jsonPath().getString("success"),"false","校验success失败");
Assert.assertEquals(response.jsonPath().getString("code"),"00000001","校验错误码失败");
Assert.assertEquals(response.jsonPath().getString("desc"),"用户未登录","校验desc失败");
logger.info("未登录投注校验成功!");
}
}
\ No newline at end of file
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* FileName: pk_开奖_瓜分红包_押注人数不同测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
......
......@@ -18,10 +18,12 @@ import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.GetCookieUtil;
import utils.GetDbName;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -49,17 +51,22 @@ 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_押注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 = "";
private List<String> orderIds = new ArrayList<>();
// private List<String> orderIds = new ArrayList<>();
private List<Map<String,String>> orderIds = new ArrayList<>();
@BeforeMethod
public void clearUp() {
......@@ -77,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());
......@@ -88,7 +95,10 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
doJoinResponse.prettyPrint();
Assert.assertEquals(doJoinResponse.jsonPath().getString("code"),"200","校验押注是否成功且不是第一次押注失败");
String orderId = doJoinResponse.jsonPath().getString("data");
orderIds.add(orderId);
Map<String,String> orderIdMap = new HashMap<>();
orderIdMap.put("consumerId",uid01_consumerId);
orderIdMap.put("orderId",orderId);
orderIds.add(orderIdMap);
Response statusResponse = pkService.getOrderStatus(uid01,orderId);
statusResponse.prettyPrint();
String consumerStatus = statusResponse.jsonPath().getString("data.consumeStatus");
......@@ -114,9 +124,144 @@ 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{
Map<String,Object> user = jdbc.findSimpleResult("select * from dafuweng.user where id=?\n",uid03);
Map<String,Object> consumer = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where id=?\n",uid03_consumerId);
Long userCredit = Long.parseLong(user.get("credits").toString());
Long consumerCredit = Long.parseLong(consumer.get("credits").toString());
Response doJoinResponse = pkService.doJoin(uid03,"82","163");
doJoinResponse.prettyPrint();
Assert.assertEquals(doJoinResponse.jsonPath().getString("code"),"200","校验押注是否成功且不是第一次押注失败");
String orderId = doJoinResponse.jsonPath().getString("data");
Map<String,String> orderIdMap = new HashMap<>();
orderIdMap.put("consumerId",uid03_consumerId);
orderIdMap.put("orderId",orderId);
orderIds.add(orderIdMap);
Response statusResponse = pkService.getOrderStatus(uid03,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(uid03,orderId);
consumerStatus = statusResponse.jsonPath().getString("data.consumeStatus");
}
Assert.assertEquals(consumerStatus,"2","校验押注是否成功,扣积分是否成功失败");
Map<String,Object> user1 = jdbc.findSimpleResult("select * from dafuweng.user where id=?\n",uid03);
Map<String,Object> consumer1 = jdbc.findSimpleResult("select * from new_consumer.consumer_0010 where id=?\n",uid03_consumerId);
String userCredit1 = user1.get("credits").toString();
String consumerCredit1 = consumer1.get("credits").toString();
Assert.assertEquals(userCredit1,String.valueOf(userCredit-0),"user积分扣除校验失败");
Assert.assertEquals(consumerCredit1,String.valueOf(consumerCredit-0),"consumer积分扣除校验失败");
logger.info("校验积分消耗成功,原积分值="+userCredit+",消耗后积分值为"+userCredit1);
//参加过一次之后,不能再参加该pk活动
Response doJoinResponse1 = pkService.doJoin2(uid03,"82","163");
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 押注_积分不足测试() throws Exception {
......@@ -163,6 +308,7 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
Assert.assertEquals(doJoinResponse.jsonPath().getString("code").toString(),"100060");
}
public Map<String,String> createUser() throws Exception{
Map<String,String> map = new HashMap<>();
......@@ -186,14 +332,23 @@ public class pk_押注测试_AccessTest extends DuibaTestBase {
}
@AfterMethod
// @AfterMethod
@AfterClass
public void tearDown() {
try {
Boolean result = jdbc.update("delete from act_record.tb_bet_record where bet_id = '124' and partner_user_id = '3416'\n");
for (String orderId:orderIds){
Boolean result2 = jdbc.update("delete from activity_order_con.tb_trade_center_activity_order_0735 where order_num = ?\n",orderId);
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<>();
String dbName1 = GetDbName.getDbName("activity_order_con.tb_trade_center_activity_order_",orderId.get("consumerId"),"1");
String sql1 = "delete from "+dbName1+" where order_num = ? ";
logger.info("清理的sql为:"+sql1);
Boolean result3 = jdbc.update(sql1,orderId.get("orderId"));
}
clear(consumerIds);
......
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* FileName: pk_开奖_瓜分红包_押注人数不同测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
......@@ -38,7 +38,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分优惠券_AccessTest extends DuibaTestBase {
public class pk_瓜分优惠券_AccessTest extends DuibaTestBase {
@Autowired
PkService pkService;
......@@ -50,14 +50,14 @@ public class pk_开奖_瓜分优惠券_AccessTest extends DuibaTestBase {
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private String groupId = "147";
private Integer user01 = 4907;//appid=18816
private String consumerId01 = "100109082";//activity_order_con.tb_trade_center_activity_order_0794
private Integer user02 = 4908;//appid=18816
private String consumerId02 = "100109083";//activity_order_con.tb_trade_center_activity_order_0795
private Integer user03 = 4909;//appid=2239
private String consumerId03 = "100109084";//activity_order_con.tb_trade_center_activity_order_0796
private Integer user01 = 5197;//appid=18816
private String consumerId01 = "100114055";//activity_order_con.tb_trade_center_activity_order_0794
private Integer user02 = 5198;//appid=18816
private String consumerId02 = "100114056";//activity_order_con.tb_trade_center_activity_order_0795
private Integer user03 = 5199;//appid=2239
private String consumerId03 = "100114057";//activity_order_con.tb_trade_center_activity_order_0796
List<String> wins = new ArrayList<>();
List<String> loses = new ArrayList<>();
......@@ -132,7 +132,7 @@ public class pk_开奖_瓜分优惠券_AccessTest extends DuibaTestBase {
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数,4、校验account表的红包值加上去
checkPKConfig();
checkPKResult("18816");
checkPKResult("21835");
checkUserOrder(wins,loses);
checkRecord(wins,loses);
......
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* FileName: pk_开奖_瓜分红包_押注人数不同测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
......@@ -23,9 +23,11 @@ import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.GetDbName;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -37,7 +39,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTestBase {
public class pk_瓜分红包_投放两个app_AccessTest extends DuibaTestBase {
@Autowired
PkService pkService;
......@@ -47,16 +49,17 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "6,7";
//146-pk测试3,pk测试4
private String groupId = "146";
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
private Integer user01 = 5193;//appid=21833
private String consumerId01 = "100114050";//activity_order_con.tb_trade_center_activity_order_0848
private Integer user02 = 5194;//appid=21833
private String consumerId02 = "100114051";//activity_order_con.tb_trade_center_activity_order_0849
private Integer user03 = 5195;//appid=21834
private String consumerId03 = "100114052";//activity_order_con.tb_trade_center_activity_order_0850
private Integer user04 = 5196;//appid=21834
private String consumerId04 = "100114053";//activity_order_con.tb_trade_center_activity_order_0851
List<String> wins = new ArrayList<>();
List<String> loses = new ArrayList<>();
......@@ -90,13 +93,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_0848 where consumer_id = '100108112' and account_type = '6'\n");
Map<String,Object> user01_account1 = this.accountInfo(consumerId01);
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_0849 where consumer_id = '100108113' and account_type = '6'\n");
Map<String,Object> user02_account1 = this.accountInfo(consumerId02);
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_0850 where consumer_id = '100108114' and account_type = '6'\n");
Map<String,Object> user03_account1 = this.accountInfo(consumerId03);
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_0851 where consumer_id = '100108115' and account_type = '6'\n");
Map<String,Object> user04_account1 = this.accountInfo(consumerId04);
Long use4_Acc1 = Long.valueOf(user04_account1.get("balance_amount").toString());
......@@ -123,21 +126,21 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数,4、校验account表的红包值加上去
checkPKConfig();
checkPKResult("18816");
checkPKResult("2239");
checkPKResult("21833");
checkPKResult("21834");
checkUserOrder(wins,loses);
checkRecord(wins,loses);
Map<String,Object> user01_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0848 where consumer_id = '100108112' and account_type = '6'\n");
Map<String,Object> user01_account2 = this.accountInfo(consumerId01);
Long use1_Acc2 = Long.valueOf(user01_account2.get("balance_amount").toString());
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");
Map<String,Object> user02_account2 = this.accountInfo(consumerId02);
Long use2_Acc2 = Long.valueOf(user02_account2.get("balance_amount").toString());
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");
Map<String,Object> user03_account2 = this.accountInfo(consumerId03);
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_0851 where consumer_id = '100108115' and account_type = '6'\n");
Map<String,Object> user04_account2 = this.accountInfo(consumerId04);
Long use4_Acc2 = Long.valueOf(user04_account2.get("balance_amount").toString());
Assert.assertEquals(use4_Acc2,use4_Acc1,"用户4入账校验失败");
......@@ -145,6 +148,25 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
}
public Map<String,Object> accountInfo(String consumerId) throws Exception{
Map<String,Object> map = new HashMap<>();
String dbName1 = GetDbName.getDbName("consumer_accounts.tb_consumer_account_",consumerId,"1");
String sql1 = "select * from "+dbName1+" where consumer_id = ? and account_type = '6'";
map = jdbc.findSimpleResult(sql1,consumerId);
return map;
}
public Map<String,Object> orderInfo(String consumerId,String betId) throws Exception{
Map<String,Object> map = new HashMap<>();
String dbName1 = GetDbName.getDbName("activity_order_con.tb_trade_center_activity_order_",consumerId,"1");
String sql1 = "select * from "+dbName1+" where consumer_id = ? and duiba_activity_id = ?\n";
map = jdbc.findSimpleResult(sql1,consumerId,betId);
return map;
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
Response betResponse = pkActivityService.betForSetUp(bounsType,endTime);
......@@ -249,12 +271,17 @@ public class pk_开奖_瓜分红包_投放两个app_AccessTest extends DuibaTest
try {
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 '【自动化】瓜分红包%'");
// 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 '【自动化】瓜分红包%'");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",newBetId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",newBetId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",newBetId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",newBetId);
} catch (SQLException e) {
......
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* FileName: pk_开奖_瓜分红包_押注人数不同测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
......@@ -10,29 +10,24 @@ package http.cases.PkTest;
import base.DuibaLog;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSONObject;
import http.model.BetMngVo;
import http.model.BetMobileVo;
import http.service.Activity.PkService;
import http.service.Manager.PkActivityService;
import io.restassured.response.Response;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.MatcherString;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.DateTime;
import utils.GetDbName;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -44,7 +39,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends DuibaTestBase {
public class pk_瓜分红包_押注人数不同测试_AccessTest extends DuibaTestBase {
@Autowired
PkService pkService;
......@@ -54,16 +49,16 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private String groupId = "132";
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 = 5165;
private String consumerId01 = "100114015";//activity_order_con.tb_trade_center_activity_order_0060
private Integer user02 = 5166;
private String consumerId02 = "100114016";//activity_order_con.tb_trade_center_activity_order_0061
private Integer user03 = 5167;
private String consumerId03 = "100114017";//activity_order_con.tb_trade_center_activity_order_0062
private Integer user04 = 5168;
private String consumerId04 = "100114018";//activity_order_con.tb_trade_center_activity_order_0063
private String newBetId = "";
......@@ -94,13 +89,13 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
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 = this.accountInfo(consumerId01);
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 = this.accountInfo(consumerId02);
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 = this.accountInfo(consumerId03);
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 = this.accountInfo(consumerId04);
Long use4_Acc1 = Long.valueOf(user04_account1.get("balance_amount").toString());
......@@ -137,13 +132,13 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
}
}
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);
Map<String,Object> user01_order = this.orderInfo(consumerId01,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);
Map<String,Object> user02_order = this.orderInfo(consumerId02,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);
Map<String,Object> user03_order = this.orderInfo(consumerId03,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);
Map<String,Object> user04_order = this.orderInfo(consumerId04,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());
......@@ -157,22 +152,39 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
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 = this.accountInfo(consumerId01);
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");
Map<String,Object> user02_account2 = this.accountInfo(consumerId02);
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");
Map<String,Object> user03_account2 = this.accountInfo(consumerId03);
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 = this.accountInfo(consumerId04);
Long use4_Acc2 = Long.valueOf(user04_account2.get("balance_amount").toString());
Assert.assertEquals(use4_Acc2.toString(),String.valueOf(use4_Acc1+10),"用户4入账校验失败");
}
public Map<String,Object> accountInfo(String consumerId) throws Exception{
Map<String,Object> map = new HashMap<>();
String dbName1 = GetDbName.getDbName("consumer_accounts.tb_consumer_account_",consumerId,"1");
String sql1 = "select * from "+dbName1+" where consumer_id = ? and account_type = '6'";
map = jdbc.findSimpleResult(sql1,consumerId);
return map;
}
public Map<String,Object> orderInfo(String consumerId,String betId) throws Exception{
Map<String,Object> map = new HashMap<>();
String dbName1 = GetDbName.getDbName("activity_order_con.tb_trade_center_activity_order_",consumerId,"1");
String sql1 = "select * from "+dbName1+" where consumer_id = ? and duiba_activity_id = ?\n";
map = jdbc.findSimpleResult(sql1,consumerId,betId);
return map;
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
......@@ -185,7 +197,6 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
Response modifyStatusResponse = pkActivityService.modifySatus(betId);
}
public void modifyOpenPrizeTime(String betId,int x) throws Exception{
DateTime time1 = new DateTime();
......@@ -232,11 +243,17 @@ public class pk_开奖_瓜分红包_押注人数不同测试_AccessTest extends
try {
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 '【自动化】瓜分红包%'");
// 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 '【自动化】瓜分红包%'");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",newBetId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",newBetId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",newBetId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",newBetId);
......
/**
* Copyright (C), 2015-2018
* FileName: pk_开奖_瓜分红包_押注人数不同测试_AccessTest
* FileName: pk_开奖_瓜分红包_押注人数不同测试
* Author: qianwenjun
* Date: 2018/8/9 20:13
* Description:
......@@ -23,10 +23,11 @@ import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.MatcherString;
import utils.GetDbName;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -38,7 +39,7 @@ import java.util.Map;
* @create 2018/8/9
* @since 1.0.0
*/
public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends DuibaTestBase {
public class pk_瓜分红包_押注人数相同测试_AccessTest extends DuibaTestBase {
@Autowired
PkService pkService;
......@@ -48,12 +49,12 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
private static DuibaLog logger = DuibaLog.getLogger();
private String groupId = "7";
private String groupId = "129";//appId=21830
private Integer user01 = 4784;
private String consumerId01 = "100108068";//activity_order_con.tb_trade_center_activity_order_0804
private Integer user02 = 4785;
private String consumerId02 = "100108069";//activity_order_con.tb_trade_center_activity_order_0805
private Integer user01 = 5156;
private String consumerId01 = "100114000";//activity_order_con.tb_trade_center_activity_order_0804
private Integer user02 = 5157;
private String consumerId02 = "100114001";//activity_order_con.tb_trade_center_activity_order_0805
private String newBetId = "";
......@@ -84,9 +85,10 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
}
logger.info("pk活动id为:"+newBetId+",选项id为:"+ optionsIds.toString());
Map<String,Object> user01_account1 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0804 where consumer_id = '100108068' and account_type = '6'\n");
Map<String,Object> user01_account1 = this.accountInfo(consumerId01);
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_0805 where consumer_id = '100108069' and account_type = '6'\n");
Map<String,Object> user02_account1 = this.accountInfo(consumerId02);
Long use2_Acc1 = Long.valueOf(user02_account1.get("balance_amount").toString());
......@@ -102,7 +104,7 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
Response doDrowRresponse = pkActivityService.doDraw();
Assert.assertEquals(doDrowRresponse.jsonPath().getString("success"),"true","开奖结果校验失败");
Assert.assertEquals(doDrowRresponse.jsonPath().getString("data"),"开奖中。。。","开奖messag校验失败");
Thread.sleep(8000);
Thread.sleep(16000);
//校验点
//1、pk活动表配置的状态更新为4;2、订单表的addCredits字段为瓜分的红包值;3、先押注 的选项为胜方,胜负的额押注人数>负方的押注人数
......@@ -121,9 +123,9 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
}
}
Map<String,Object> user01_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0804 where consumer_id = '100108068' and duiba_activity_id = ?\n",newBetId);
Map<String,Object> user01_order = this.orderInfo(consumerId01,newBetId);
Assert.assertEquals(user01_order.get("add_credits").toString(),"10","开奖后发奖值校验失败");
Map<String,Object> user02_order = jdbc.findSimpleResult("select * from activity_order_con.tb_trade_center_activity_order_0805 where consumer_id = '100108069' and duiba_activity_id = ?\n",newBetId);
Map<String,Object> user02_order = this.orderInfo(consumerId02,newBetId);
Assert.assertEquals(user02_order.get("add_credits").toString(),"","开奖后发奖值校验失败");
logger.info("用户01获取的红包值为:"+user01_order.get("add_credits").toString()+",用户02获取的红包值为:"+user02_order.get("add_credits").toString());
......@@ -136,10 +138,10 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
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_0804 where consumer_id = '100108068' and account_type = '6'\n");
Map<String,Object> user01_account2 = this.accountInfo(consumerId01);
Long use1_Acc2 = Long.valueOf(user01_account2.get("balance_amount").toString());
Assert.assertEquals(use1_Acc2.toString(),String.valueOf(use1_Acc1+10),"用户2入账校验失败");
Map<String,Object> user02_account2 = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0805 where consumer_id = '100108069' and account_type = '6'\n");
Map<String,Object> user02_account2 = this.accountInfo(consumerId02);
Long use2_Acc2 = Long.valueOf(user02_account2.get("balance_amount").toString());
Assert.assertEquals(use2_Acc2,use2_Acc1,"用户2入账校验失败");
......@@ -147,6 +149,23 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
public Map<String,Object> accountInfo(String consumerId) throws Exception{
Map<String,Object> map = new HashMap<>();
String dbName1 = GetDbName.getDbName("consumer_accounts.tb_consumer_account_",consumerId,"1");
String sql1 = "select * from "+dbName1+" where consumer_id = ? and account_type = '6'";
map = jdbc.findSimpleResult(sql1,consumerId);
return map;
}
public Map<String,Object> orderInfo(String consumerId,String betId) throws Exception{
Map<String,Object> map = new HashMap<>();
String dbName1 = GetDbName.getDbName("activity_order_con.tb_trade_center_activity_order_",consumerId,"1");
String sql1 = "select * from "+dbName1+" where consumer_id = ? and duiba_activity_id = ?\n";
map = jdbc.findSimpleResult(sql1,consumerId,betId);
return map;
}
public void createPk(String bounsType,String endTime,String groupId) throws Exception {
......@@ -184,11 +203,17 @@ public class pk_开奖_瓜分红包_押注人数相同测试_AccessTest extends
try {
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 '【自动化】瓜分红包%'");
// 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 '【自动化】瓜分红包%'");
Boolean result1 = jdbc.update("delete from act_com_conf.tb_bet_option where bet_id = ?",newBetId);
Boolean result4 = jdbc.update("delete from act_record.tb_bet_record where bet_id = ?",newBetId);
Boolean result5 = jdbc.update("delete from bet_activity.tb_bet_result where bet_id = ?",newBetId);
Boolean result2 = jdbc.update("delete from act_com_conf.tb_bet_group_relation where bet_id = ?",newBetId);
Boolean result3 = jdbc.update("delete from act_com_conf.tb_bet_config where id = ?",newBetId);
......
......@@ -47,7 +47,7 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
private String endTime = "2021-12-31 23:55:00";
private Map<String,Object> betIds = new HashMap<>();
private String groupId = "5";
private String groupId = "147";
......@@ -62,7 +62,7 @@ public class pk_管理端测试_AccessTest extends DuibaTestBase {
Response newBetList = pkActivityService.getMngBetList();
String newTotal = newBetList.jsonPath().getString("data.params.total");
logger.info("创建之前的列表中条数为:"+oldTotal+"创建之后的列表中条数为:"+newTotal);
Assert.assertEquals(String.valueOf(Long.valueOf(newTotal)-1L),oldTotal,"新建之后列表获取数据校验失败");
// Assert.assertEquals(String.valueOf(Long.valueOf(newTotal)-1L),oldTotal,"新建之后列表获取数据校验失败");
List<BetMngVo> betList = newBetList.jsonPath().getList("data.page",BetMngVo.class);
logger.info("betIds"+JSON.toJSONString(betIds));
......
/**
* Copyright (C), 2015-2018
* FileName: 天天秒杀_秒杀详情测试_SeckillTest
* FileName: 天天秒杀_秒杀详情测试
* Author: qianwenjun
* Date: 2018/6/20 11:46
* Description:
......@@ -36,7 +36,7 @@ import static io.restassured.RestAssured.given;
* @create 2018/6/20
* @since 1.0.0
*/
public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
public class 天天秒杀_秒杀详情测试 extends DuibaTestBase {
@Autowired
SeckillService seckillService;
......@@ -103,16 +103,19 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"4","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"2","校验秒杀活动状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1));
String addrProvince = dESCrypto.decrypt3DE(MatcherString.getString(response.asString(),"\"addrProvince\":\"(.*?)\",",1));
String addrCity = dESCrypto.decrypt3DE(MatcherString.getString(response.asString(),"\"addrCity\":\"(.*?)\",",1));
String addrArea = dESCrypto.decrypt3DE(MatcherString.getString(response.asString(),"\"addrArea\":\"(.*?)\",",1));
String addrDetail = dESCrypto.decrypt3DE(MatcherString.getString(response.asString(),"\"addrDetail\":\"(.*?)\",",1));
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
Response addResponse = seckillService.getDefaultAddress(uid_Nomal);
addResponse.prettyPrint();
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1));
String addrProvince = dESCrypto.decrypt3DE(MatcherString.getString(addResponse.asString(),"\"addrProvince\": \"(.*?)\",",1));
String addrCity = dESCrypto.decrypt3DE(MatcherString.getString(addResponse.asString(),"\"addrCity\": \"(.*?)\",",1));
String addrArea = dESCrypto.decrypt3DE(MatcherString.getString(addResponse.asString(),"\"addrArea\": \"(.*?)\",",1));
String addrDetail = dESCrypto.decrypt3DE(MatcherString.getString(addResponse.asString(),"\"addrDetail\": \"(.*?)\",",1));
Assert.assertEquals(addrProvince,"浙江省","校验收货地址-省信息失败");
Assert.assertEquals(addrCity,"杭州市","校验收货地址-市信息失败");
Assert.assertEquals(addrArea,"西湖区","校验收货地址-区信息失败");
......@@ -129,12 +132,15 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"8","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"5","校验秒杀活动状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1));
Response addResponse = seckillService.getDefaultAddress(uid_Nomal);
addResponse.prettyPrint();
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1));
}
......@@ -146,12 +152,15 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"10","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"7","校验秒杀活动状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1));
Response addResponse = seckillService.getDefaultAddress(uid_Nomal);
addResponse.prettyPrint();
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1));
}
......@@ -169,16 +178,19 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"9","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"6","校验秒杀活动状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1));
Response addResponse = seckillService.getDefaultAddress(uid_Nomal);
addResponse.prettyPrint();
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1));
}
//@Test
@Test
public void 秒杀活动页面详情_马上兑换测试() {
Response response = seckillService.ajaxInitPage("24830",uid_Nomal,true);
......@@ -186,12 +198,15 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"6","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"3","校验秒杀活动状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1));
Response addResponse = seckillService.getDefaultAddress(uid_Nomal);
addResponse.prettyPrint();
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1));
}
......@@ -203,12 +218,14 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"7","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"4","校验秒杀活动状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1));
Response addResponse = seckillService.getDefaultAddress(uid_Nomal);
addResponse.prettyPrint();
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1),"胡梦新","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1),"18258853242","校验秒杀活动addrPhone失败");
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1));
}
......@@ -220,12 +237,14 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"2","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"2","校验秒杀活动状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1),"钱雯君","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1),"18243476362","校验秒杀活动addrPhone失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\",",1));
Response addResponse = seckillService.getDefaultAddress(uid_LackIntgral);
addResponse.prettyPrint();
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1),"钱雯君","校验秒杀活动addrName失败");
Assert.assertEquals(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1),"18243476362","校验秒杀活动addrPhone失败");
logger.info("校验收货人信息成功:收货人addrName="+MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\",",1)+
"收货人电话addrPhone="+MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\",",1));
Response response1 = seckillService.ajaxInitPage("24796",uid_Nomal,true);
}
......@@ -249,12 +268,15 @@ public class 天天秒杀_秒杀详情测试_SeckillTest extends DuibaTestBase {
Assert.assertEquals(MatcherString.getString(response.asString(),"\"success\":(.*?),",1),"true","校验详情查询结果失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1),"5","校验按钮状态失败");
Assert.assertEquals(MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1),"2","校验秒杀活动状态失败");
Assert.assertTrue(MatcherString.getString(response.asString(),"\"addrArea\":\"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(response.asString(),"\"addrCity\":\"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(response.asString(),"\"addrDetail\":\"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(response.asString(),"\"addrName\":\"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(response.asString(),"\"addrPhone\":\"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(response.asString(),"\"addrProvince\":\"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Response addResponse = seckillService.getDefaultAddress(uid_NoAddress);
addResponse.prettyPrint();
Assert.assertTrue(MatcherString.getString(addResponse.asString(),"\"addrArea\": \"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(addResponse.asString(),"\"addrCity\": \"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(addResponse.asString(),"\"addrDetail\": \"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(addResponse.asString(),"\"addrName\": \"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(addResponse.asString(),"\"addrPhone\": \"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
Assert.assertTrue(MatcherString.getString(addResponse.asString(),"\"addrProvince\": \"(.*?)\"",1).isEmpty(),"校验地址信息为空失败");
logger.info("校验页面详情信息成功:按钮状态btnStatus="+MatcherString.getString(response.asString(),"\"btnStatus\":(.*?),",1)+
",活动状态activityStatus="+MatcherString.getString(response.asString(),"\"activityStatus\":(.*?),",1));
logger.info("校验收货人和收货地址信息为空成功");
......
......@@ -173,7 +173,7 @@ public class SingleLottery_AccessTest extends DuibaTestBase {
}
Assert.assertEquals(flowWork,"SupplierExchange-started","数据库主订单流程节点校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("item_id")),"27131","数据库主订单奖项id校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("biz_params")),"胡梦新:18258853242:浙江省:杭州市:西湖区:数娱大厦","数据库主订单biz_params校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("biz_params")),"胡梦新:18258853242:浙江:杭州市:西湖区:西溪街道:数娱大厦 ","数据库主订单biz_params校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("pay_status")),"prereduce","数据库主订单pay_status校验失败");
Assert.assertEquals(String.valueOf(selectResult2.get("status")),"consume_success","数据库主订单status校验失败");
......
......@@ -38,7 +38,45 @@ public class PkService {
String activityHost;
private DuibaLog logger = DuibaLog.getLogger();
public Response popup(Integer uid) throws Exception{
String url = activityHost + "/betActivity2/popup";
Map<String,Object> map = new HashMap<>();
map.put("pageNo","1");
map.put("pageSize","6");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url);
// response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("手机端获取pk结果接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("手机端获取pk结果接口失败,返回信息:"+response.asString());
}
return response;
}
public Response list(Integer uid) throws Exception{
String url = activityHost + "/betRecord2/list";
Map<String,Object> map = new HashMap<>();
map.put("pageNo","1");
map.put("pageSize","6");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url);
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("战绩页接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("战绩页接口失败,返回信息:"+response.asString());
}
return response;
}
public Response getBetList(Integer uid) throws Exception{
String url = activityHost + "/betActivity2/list";
......
......@@ -56,6 +56,7 @@ public class Authorization {
private static Map<String,String> hdCookiesMabo;
private static Map<String,String> hdCookiesSaas;
private static Map<String,Map> hdCookiesSaasByApp = new ConcurrentHashMap<>();
private static Map<String,Map> hdCookiesSaasNew = new ConcurrentHashMap<>();
private static Map<String,Map> hdCookiesCommon = new ConcurrentHashMap<>();
private static Map<String,String> openbsCookies;
private Map<String,String> ssoCookies =null;
......@@ -241,6 +242,7 @@ public class Authorization {
return hdCookiesMabo;
}
//密码为wxs123456 (支持账号 wxs@duiba.com.cn,尽量不要用)
public Map hdLoginSaas(){
int i=10;
while((hdCookiesSaas==null||hdCookiesSaas.size()==0)&&i>0) {
......@@ -261,6 +263,7 @@ public class Authorization {
return hdCookiesSaas;
}
//密码为wxs123456 (支持 账号为wxs@duiba.com.cn 下的任意appId)
public Map hdLoginSaas(String appId){
int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasByApp.toString());
......@@ -278,7 +281,7 @@ public class Authorization {
Map<String,String> map = response.getCookies();
logger.info("cookies:"+map.toString());
hdCookies=new HashMap<>(response.getCookies());
if(hdCookies!=null||hdCookies.size()!=0) {
if(hdCookies!=null&&hdCookies.size()!=0) {
//取消安全校验
hdCookies.remove("csrf_token");
hdCookies.put("appId", appId);
......@@ -292,7 +295,44 @@ public class Authorization {
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasByApp.toString());
return hdCookies;
}
//密码为duibaduiba123
//密码为duibaduiba123(支持任意手机账号下的任意APPId)
public Map hdLoginSaasNew(String account,String appId){
String path = "/doLoginNew";
int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasNew.toString());
Map<String,String> hdCookies = hdCookiesSaasNew.get(appId);
while((hdCookies==null||hdCookies.size()==0)&&i>0) {
Response token=this.hdGetToken();
String url = PROTOCOL + hdHost + path;
Map<String,String> cookies=token.getCookies();
Map<String, String> paras = new HashMap<>();
paras.put("account", account);
paras.put("password", SecurityUtils.getMD5("Dct7xTdGPvbUL1eOtSWoB9ySZNY="+from(token.asString()).getString("data.loginsToken")));
paras.put("redirect", "/redirectApp");
paras.put("isAutoLogin", "true");
paras.put("validate","22");
Response response = given().cookies(cookies).params(paras).post(url);
response.prettyPrint();
Map<String,String> map = response.getCookies();
logger.info("cookies:"+map.toString());
hdCookies=new HashMap<>(response.getCookies());
if(hdCookies!=null&&hdCookies.size()!=0) {
//取消安全校验
hdCookies.remove("csrf_token");
hdCookies.put("appId", appId);
hdCookies.put("duibaAppId", appId);
logger.info("cookies2:"+hdCookies.toString());
hdCookiesSaasNew.put(appId,hdCookies);
}
i--;
}
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasNew.toString());
return hdCookies;
}
//密码为duibaduiba123 (支持任意邮箱账号)
public Map hdLoginCommon(String email){
int i=10;
Map<String,String> hdCookies = hdCookiesCommon.get(email);
......@@ -307,7 +347,7 @@ public class Authorization {
paras.put("isAutoLogin", "true");
Response response = given().cookies(cookies).params(paras).post(url);
hdCookies=new HashMap<>(response.getCookies());
if(hdCookies!=null||hdCookies.size()!=0){
if(hdCookies!=null&&hdCookies.size()!=0){
hdCookies.remove("csrf_token");
hdCookiesCommon.put(email,hdCookies);
}
......@@ -337,14 +377,13 @@ public class Authorization {
Response response = given().cookies(cookies).params(paras).post(url);
response.prettyPrint();
hdCookies=new HashMap<>(response.getCookies());
if(hdCookies!=null||hdCookies.size()!=0){
if(hdCookies!=null&&hdCookies.size()!=0){
hdCookies.remove("csrf_token");
hdCookiesCommon.put(account,hdCookies);
}
i--;
}
//取消安全校验
// logger.info(hdCookies);
return hdCookies;
}
......@@ -366,6 +405,7 @@ public class Authorization {
Map<String, String> paras = new HashMap<>();
paras.put("email", ssoName);
paras.put("password", ssoPassword);
paras.put("loginTimeout", "1");
paras.put("systemId", "1");
paras.put("redirect", "http://mng.duibatest.com.cn/AItem/index.htm");
......
......@@ -25,6 +25,9 @@ public class SeckillService {
@Value("${home.host}")
private String homeHost;
@Value("${activity.host}")
String activityHost;
@Autowired
Authorization authorization;
......@@ -183,6 +186,15 @@ public class SeckillService {
}
public Response getDefaultAddress(Integer uid) {
String url = activityHost + "/gaw/address/getDefaultAddress";
Map<String,Object> map = new HashMap<>();
// map.put("id",id);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).get(url);
return response;
}
public Boolean checkNomal(String api,Response response) {
......
......@@ -40,8 +40,6 @@ public class PkDevelopService {
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
public Response betEditor(String appId,String bonusType,String bonusAmount,String creditsValue,String shareExp) throws Exception{
String data = PublicMethod.data();
......@@ -100,6 +98,64 @@ public class PkDevelopService {
return betResponse;
}
public Response betEditor_right(String account,String appId,String bonusType,String bonusAmount,String creditsValue,String shareExp,String loser,String winner) throws Exception{
String data = PublicMethod.data();
String url = "http://" + hdHost + "/visual-editor/bet/post";
//创建投注项
List<BetOptionVo> betOptionVoList = new ArrayList<>();
BetOptionVo betOptionVo1 = new BetOptionVo();
BetOptionVo betOptionVo2 = new BetOptionVo();
betOptionVo1.setOptionImg("//yun.dui88.com/images/201812/75j84chnkg.jpg");
betOptionVo1.setOptionName("1");
betOptionVo1.setRightAnswer(loser);
betOptionVo2.setOptionImg("//yun.dui88.com/images/201812/4f51vmzfpu.png");
betOptionVo2.setOptionName("2");
betOptionVo2.setRightAnswer(winner);
betOptionVoList.add(betOptionVo1);
betOptionVoList.add(betOptionVo2);
//创建活动配置
List<BetDevelopVo> betDevelopVoList = new ArrayList<>();
BetDevelopVo betDevelopVo = new BetDevelopVo();
betDevelopVo.setBetOptionDtoList(betOptionVoList);
betDevelopVo.setBetType("1");
betDevelopVo.setBonusType(bonusType);
if (bonusType.equals("2")){
betDevelopVo.setTitle("【自动化】组件pk_瓜分红包"+data);
}else if (bonusType.equals("4")){
betDevelopVo.setTitle("【自动化】组件pk_瓜分积分"+data);
}
betDevelopVo.setBonusAmount(bonusAmount);
betDevelopVo.setConfigStatus("3");
betDevelopVo.setCreditsValue(creditsValue);
betDevelopVo.setEndTime("2029-12-31 00:00");
betDevelopVo.setShareExp(shareExp);
betDevelopVoList.add(betDevelopVo);
Map<String,Object> para = new HashMap<>();
para.put("list",betDevelopVoList);
para.put("rules","自动化规则自动化规则");
para.put("title","组件pk自动化_主胜方");
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(para));
Response betResponse = given().contentType("application/json;charset=UTF-8").cookies(authorization.hdLoginSaasNew(account,appId)).body(jsonParam).post(url);
betResponse.prettyPrint();
try{
Assert.assertEquals(betResponse.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}catch(Error er){
throw new Exception("创建pk活动接口失败,返回信息:"+betResponse.asString());
}
return betResponse;
}
public Response doDraw() throws Exception{
String url = "http://" + ManagerHost + "/newmanager/betOpenPrize/doDraw";
Map<String,Object> para = new HashMap<>();
......
......@@ -7,6 +7,8 @@
*/
package utils;
import base.DuibaLog;
/**
* 〈〉
*
......@@ -16,6 +18,7 @@ package utils;
*/
public class GetDbName {
private static DuibaLog looger = DuibaLog.getLogger();
public static String getDbName(String prex,String consumerId,String type){
String dbName = "";
......@@ -25,6 +28,7 @@ public class GetDbName {
}else if (type.equals("2")){
dbName = prex + String.format("%04d", Long.parseLong(consumerId) / 10000000);
}
looger.info("dbName为:"+dbName);
return dbName;
}
......
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