Commit 027eeafe authored by 赵然's avatar 赵然

zr

parent b71cf568
...@@ -35,7 +35,7 @@ public class 补给站 extends DuibaTestBase { ...@@ -35,7 +35,7 @@ public class 补给站 extends DuibaTestBase {
developerBJZ.ajaxDirectUp(appId,id); developerBJZ.ajaxDirectUp(appId,id);
//查询商品列表,验证商品是否上架成功 //查询商品列表,验证商品是否上架成功
Response response2 =developerObjectService.appItems(appId,title); Response response2 =developerObjectService.appItems(appId,title);
String appItemId = String.valueOf(response2.jsonPath().getString("data.list[0].id")); String appItemId = String.valueOf(response2.jsonPath().getString("data.list[0].id"));
Assert.assertEquals(response2.jsonPath().getString("data.list[0].title"), "测试至尊享版-实物3", "校验实物标题失败"); Assert.assertEquals(response2.jsonPath().getString("data.list[0].title"), "测试至尊享版-实物3", "校验实物标题失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].status"), "1", "校验实物状态失败"); Assert.assertEquals(response2.jsonPath().getString("data.list[0].status"), "1", "校验实物状态失败");
Assert.assertEquals(response2.jsonPath().getString("data.list[0].type"), "object", "校验实物类型失败"); Assert.assertEquals(response2.jsonPath().getString("data.list[0].type"), "object", "校验实物类型失败");
......
...@@ -36,14 +36,28 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase { ...@@ -36,14 +36,28 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase {
//指定用户 //指定用户
private static int uid = 4881; private static int uid = 4881;
private static int uid2 = 4882; private static int uid2 = 4882;
private static int uid3 = 2709; private static int uid3 = 4883;
private static int uid4 = 2709; private static int uid4 = 4884;
private static int uid5 = 4885;
private static int uid6 = 4886;
@BeforeClass @BeforeClass
public void before() { public void before() {
try { try {
//清除每日用户抽奖限制记录
RedisUtil.clearKey("AC_K001_36686_"+getTime(0)); RedisUtil.clearKey("AC_K001_36686_"+getTime(0));
//清除永久用户抽奖限制记录
jdbc.update("delete from ckvtable.tb_kvtable_0804 where vkey = 'activity-centerjoinNum_100109092_36708'"); jdbc.update("delete from ckvtable.tb_kvtable_0804 where vkey = 'activity-centerjoinNum_100109092_36708'");
//清除每日用户免费抽奖记录
RedisUtil.clearKey("AC_K002_36685_"+getTime(0));
//清除永久用户免费抽奖记录
jdbc.update("delete from ckvtable.tb_kvtable_0830 where vkey = 'activity-centerfreeNum_100109118_36731'");
//清除永久用户中奖一次记录
jdbc.update("delete from ckvtable.tb_kvtable_0831 where vkey = 'activity-centerwinOptionNum_100109119_36687_sigleLottery1'");
jdbc.update("delete from ckvtable.tb_kvtable_0831 where vkey = 'activity-centerwinOptionNum_100109119_36687_sigleLottery0'");
//清除每日用户中奖一次记录
jdbc.update("delete from credits_dev.single_lottery_order where consumer_id = '100109120' and prize_name = '自动化单抽实物'");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -94,6 +108,164 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase { ...@@ -94,6 +108,164 @@ public class 自有单抽限制_AccessTest extends DuibaTestBase {
logger.info("校验success、lotteryButtonStatus、message正确"); logger.info("校验success、lotteryButtonStatus、message正确");
} }
@Test
public void 每日免费抽奖限制() throws Exception{
//查询数据库,当前积分(抽奖扣积分流程校验)
Map<String,Object> mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits = String.valueOf(mapuser.get("credits"));
logger.info("第一次抽奖前积分:"+credits);
Map<String, String> map = new HashMap<>();
map.put("operationAcitvityId", "36685");
map.put("oaId", "36685");
map.put("token", "12321");
Response response = given().cookies(authorization.dafuwengLogin(uid3)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits2 = String.valueOf(mapuser.get("credits"));
logger.info("第一次抽奖后积分:"+credits2);
Assert.assertEquals(credits, credits2, "校验免费抽奖失败");
credits2 = String.valueOf(Integer.valueOf(credits2)-1);
Thread.sleep(1000);
response = given().cookies(authorization.dafuwengLogin(uid3)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid3);
String credits3 = String.valueOf(mapuser.get("credits"));
logger.info("第二次抽奖后积分:"+credits3);
Assert.assertEquals(credits3, credits2, "校验扣积分抽奖失败");
logger.info("校验每日一次免费抽奖限制正确");
}
@Test
public void 永久免费抽奖限制() throws Exception{
//查询数据库,当前积分(抽奖扣积分流程校验)
Map<String,Object> mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid4);
String credits = String.valueOf(mapuser.get("credits"));
logger.info("第一次抽奖前积分:"+credits);
Map<String, String> map = new HashMap<>();
map.put("operationAcitvityId", "36731");
map.put("oaId", "36731");
map.put("token", "12321");
Response response = given().cookies(authorization.dafuwengLogin(uid4)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid4);
String credits2 = String.valueOf(mapuser.get("credits"));
logger.info("第一次抽奖后积分:"+credits2);
Assert.assertEquals(credits, credits2, "校验免费抽奖失败");
credits2 = String.valueOf(Integer.valueOf(credits2)-1);
Thread.sleep(1000);
response = given().cookies(authorization.dafuwengLogin(uid4)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
//查询数据库,当前积分(抽奖扣积分流程校验)
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid4);
String credits3 = String.valueOf(mapuser.get("credits"));
logger.info("第二次抽奖后积分:"+credits3);
Assert.assertEquals(credits3, credits2, "校验扣积分抽奖失败");
logger.info("校验永久一次免费抽奖限制正确");
}
@Test
public void 每日用户中奖限制() throws Exception{
Map<String, String> map = new HashMap<>();
map.put("operationAcitvityId", "36688");
map.put("oaId", "36688");
map.put("token", "12321");
Response response = given().cookies(authorization.dafuwengLogin(uid6)).params(map).post(activityHost + "/singleLottery/doJoin");
String id =MatcherString.getString(response.asString(), "singleLotteryOrderId\":(.*?),", 1);
response = singleLotteryService.getOrderStatus(uid6,id,"iOS");
int i = 10;
while ("处理中".equals(response.jsonPath().getString("message")) && i > 0) {
Thread.sleep(500);
response = singleLotteryService.getOrderStatus(uid6,id,"iOS");
i--;
}
Assert.assertEquals(response.jsonPath().getString("descrption"),"自动化单抽实物","校验优惠券标题失败");
Assert.assertEquals(response.jsonPath().getString("lotteryType"), "object", "校验奖品类型失败");
Assert.assertEquals(response.jsonPath().getString("lotteryButtonStatus"), "1", "校验状态失败");
Assert.assertEquals(response.jsonPath().getString("message"), "成功", "校验message失败");
Thread.sleep(1000);
response = given().cookies(authorization.dafuwengLogin(uid6)).params(map).post(activityHost + "/singleLottery/doJoin");
String id2 =MatcherString.getString(response.asString(), "singleLotteryOrderId\":(.*?),", 1);
response.print();
response = singleLotteryService.getOrderStatus(uid6,id2,"iOS");
int n = 10;
while ("处理中".equals(response.jsonPath().getString("message")) && n > 0) {
Thread.sleep(500);
response = singleLotteryService.getOrderStatus(uid6,id2,"iOS");
response.print();
n--;
}
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
Assert.assertEquals(response.jsonPath().getString("lotteryButtonStatus"), "1", "校验状态失败");
Assert.assertNull(response.jsonPath().getString("descrption"), "校验奖项失败");
logger.info("校验每日用户中奖一次限制正确");
}
@Test
public void 永久用户中奖限制() throws Exception{
Map<String, String> map = new HashMap<>();
map.put("operationAcitvityId", "36687");
map.put("oaId", "36687");
map.put("token", "12321");
Response response = given().cookies(authorization.dafuwengLogin(uid5)).params(map).post(activityHost + "/singleLottery/doJoin");
String id =MatcherString.getString(response.asString(), "singleLotteryOrderId\":(.*?),", 1);
response = singleLotteryService.getOrderStatus(uid5,id,"iOS");
int i = 10;
while ("处理中".equals(response.jsonPath().getString("message")) && i > 0) {
Thread.sleep(500);
response = singleLotteryService.getOrderStatus(uid5,id,"iOS");
i--;
}
Assert.assertEquals(response.jsonPath().getString("descrption"),"自动化单抽实物","校验优惠券标题失败");
Assert.assertEquals(response.jsonPath().getString("lotteryType"), "object", "校验奖品类型失败");
Assert.assertEquals(response.jsonPath().getString("lotteryButtonStatus"), "1", "校验状态失败");
Assert.assertEquals(response.jsonPath().getString("message"), "成功", "校验message失败");
Thread.sleep(1000);
response = given().cookies(authorization.dafuwengLogin(uid5)).params(map).post(activityHost + "/singleLottery/doJoin");
String id2 =MatcherString.getString(response.asString(), "singleLotteryOrderId\":(.*?),", 1);
response.print();
response = singleLotteryService.getOrderStatus(uid5,id2,"iOS");
int n = 10;
while ("处理中".equals(response.jsonPath().getString("message")) && n > 0) {
Thread.sleep(500);
response = singleLotteryService.getOrderStatus(uid5,id2,"iOS");
response.print();
n--;
}
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
Assert.assertEquals(response.jsonPath().getString("lotteryButtonStatus"), "1", "校验状态失败");
Assert.assertNull(response.jsonPath().getString("descrption"), "校验奖项失败");
logger.info("校验永久用户中奖一次限制正确");
}
@Test @Test
public void 抽奖日期限制(){ public void 抽奖日期限制(){
......
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