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
......@@ -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:
......
/**
* 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,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));
......
......@@ -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