Commit 31ebddd4 authored by 钱雯君's avatar 钱雯君

Merge branch 'develop' into qwj_181029

parents 718f7570 45efea03
......@@ -261,6 +261,12 @@
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>cn.com.duiba.tool</groupId>
<artifactId>java-gitlab-api</artifactId>
<version>1.3.8</version>
</dependency>
</dependencies>
<build>
......
......@@ -2,6 +2,7 @@ package base;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.gitlab.api.models.GitlabProjectMerges;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;
......@@ -52,6 +53,15 @@ public class DingdingResult {
names.addAll(Arrays.asList(getNames));
Map<String,String> params = new HashMap<>();
params.put("jobName",getJob());
changes = Postman.sendFindTestApp(params);
GitlabProjectMerges gitlabProjectMerges = GitlabUtils.getMessage("credits-group",changes);
changes = changes+" 提交者:"+gitlabProjectMerges.getAuthor().getName()+" 描述:"+gitlabProjectMerges.getDescription();
/*从jenkins上获取项目变更
Map<String,String> resentChanges=BeTested.getChangesWithin(30,changeMap);
System.out.println(resentChanges);
if(resentChanges!=null&&resentChanges.size()>0){
......@@ -77,7 +87,7 @@ public class DingdingResult {
if(changes.length()>140){
changes=changes.substring(0,141)+"……";
}
//project="tuia-media";
*/
this.total=total;
this.passCount=passCount;
this.skipCount=skipCount;
......@@ -125,14 +135,16 @@ public class DingdingResult {
result.put("skipCount",this.total);
result.put("failCount",0);
}
result.put("changes",this.changes+"<br>");
// result.put("changes",this.changes+"<br>");
result.put("changes",this.changes);
if(this.failCount>0||exceptionServices.size()>0||exceptionMessage.size()>0){
try{
String name = this.changes.split("—")[1].split("/")[0];
names.add(name);
}catch(Exception e){
System.out.println(e);
}
// try{
// String name = this.changes.split("—")[1].split("/")[0];
// names.add(name);
// }catch(Exception e){
// System.out.println(e);
// }
}else {
names.clear();
......
package base;
import org.gitlab.api.GitlabAPI;
import org.gitlab.api.models.GitabProjectLatelyChangeQry;
import org.gitlab.api.models.GitlabProject;
import org.gitlab.api.models.GitlabProjectMerges;
import java.io.IOException;
import java.util.List;
/**
* Created by mabo on 2018/12/5
*/
public class GitlabUtils {
public static final String GIT_URL = "http://gitlab2.dui88.com";
public static final String SECRET = "rCyBy1sQ-JckquyFmo4c";
public static GitlabProjectMerges getMessage(String namespace,String projectname){
GitlabAPI gitlabAPI = GitlabAPI.connect(GitlabUtils.GIT_URL, GitlabUtils.SECRET);
GitlabProject gitlabProject= null;
try {
gitlabProject = gitlabAPI.getProject(namespace,projectname);
// gitlabProject = gitlabAPI.getProject("credits-group","hdtool-web");
} catch (IOException e) {
e.printStackTrace();
}
GitabProjectLatelyChangeQry qry = new GitabProjectLatelyChangeQry();
qry.setId(gitlabProject.getId());
qry.setTargetBranch("develop");
List<GitlabProjectMerges> projectMerges = null;
try {
projectMerges = gitlabAPI.getLatelyMergeInfo(qry);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(projectMerges.size());
GitlabProjectMerges gitlabProjectMerges = projectMerges.get(0);
return gitlabProjectMerges;
}
public static void main(String[] args) throws IOException {
// GitlabAPI gitlabAPI = GitlabAPI.connect(GitlabUtils.GIT_URL, GitlabUtils.SECRET);
// GitlabProject gitlabProject=gitlabAPI.getProject("credits-group","hdtool-web");
//
// GitabProjectLatelyChangeQry qry = new GitabProjectLatelyChangeQry();
// qry.setId(gitlabProject.getId());
// qry.setTargetBranch("develop");
// List<GitlabProjectMerges> projectMerges = gitlabAPI.getLatelyMergeInfo(qry);
// System.out.println(projectMerges.size());
// GitlabProjectMerges gitlabProjectMerges = projectMerges.get(0);
GitlabProjectMerges gitlabProjectMerges = getMessage("credits-group","trade-access-web");
System.out.println(gitlabProjectMerges.getDescription());
System.out.println(gitlabProjectMerges.getAuthor().getName());
System.out.println(gitlabProjectMerges.getAuthor().getUsername());
System.out.println(gitlabProjectMerges.getAuthor().getId());
}
}
......@@ -25,6 +25,7 @@ public class Postman {
final static String testPlatformUrl = "http://101.37.27.82:8080/insert";
final static String miriaUrl = "http://miria-aliyun.duibatest.com.cn/autoTest/finish";
final static String miriaUrlTesting = "http://miria-aliyun.duibatest.com.cn/autoTest/testing";
final static String miriaUrlFindTestApp = "http://miria-aliyun.duibatest.com.cn/autoTest/findTestApp";
//dingdingUrl="http://www.json.cn/";
private static Logger logger = LogManager.getLogger(Postman.class);
......@@ -67,6 +68,15 @@ public class Postman {
System.out.println("miriaUrl:"+miriaUrlTesting);
System.out.println("miria响应结果:"+response.asString());
}
public static String sendFindTestApp(Map result){
Response response=given().params(result).get(miriaUrlFindTestApp);
System.out.println("jobName:"+result.get("jobName"));
System.out.println("miriaUrl:"+miriaUrlTesting);
System.out.println("miria响应结果:"+response.asString());
String value = response.jsonPath().getString("value");
return value;
}
public static Boolean getName(){
Calendar c = Calendar.getInstance();
Date date = new Date();
......
......@@ -393,7 +393,7 @@ public class Item_FloorTest extends DuibaTestBase {
JsonPath jsonPath=from(s.substring(s.indexOf("{"),s.length()-1));
List<Map> list = jsonPath.getList("list",Map.class);
Assert.assertEquals(list.size(),listDev.size(),"开发者配置和手机端展示数量不符");
// Assert.assertEquals(list.size(),listDev.size(),"开发者配置和手机端展示数量不符");
......
package http.cases.SingleLotteryTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.SingleLotteryService;
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.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import utils.MatcherString;
import utils.RedisUtil;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import static io.restassured.RestAssured.given;
/**
* Created by zhaoran on 2018/6/8.
*/
public class 自有单抽限制_AccessTest extends DuibaTestBase {
@Autowired
SingleLotteryService singleLotteryService;
@Autowired
Authorization authorization;
@Value("${activity.host}")
String activityHost;
@Value("${manager.host}")
private static DuibaLog logger = DuibaLog.getLogger();
//指定用户
private static int uid = 4881;
private static int uid2 = 4882;
private static int uid3 = 2709;
private static int uid4 = 2709;
@BeforeClass
public void before() {
try {
RedisUtil.clearKey("AC_K001_36686_"+getTime(0));
jdbc.update("delete from ckvtable.tb_kvtable_0804 where vkey = 'activity-centerjoinNum_100109092_36708'");
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void 每日用户抽奖限制() throws Exception{
Map<String, String> map = new HashMap<>();
map.put("operationAcitvityId", "36686");
map.put("oaId", "36686");
map.put("token", "12321");
Response response = given().cookies(authorization.dafuwengLogin(uid2)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
Thread.sleep(1000);
response = given().cookies(authorization.dafuwengLogin(uid2)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "false", "校验success失败");
Assert.assertEquals(response.jsonPath().getString("lotteryButtonStatus"), "8", "校验状态失败");
Assert.assertEquals(response.jsonPath().getString("message"), "今日已抽完", "校验信息失败");
logger.info("校验success、lotteryButtonStatus、message正确");
}
@Test
public void 永久用户抽奖限制() throws Exception{
Map<String, String> map = new HashMap<>();
map.put("operationAcitvityId", "36708");
map.put("oaId", "36708");
map.put("token", "12321");
Response response = given().cookies(authorization.dafuwengLogin(uid2)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "true", "校验success失败");
Thread.sleep(1000);
response = given().cookies(authorization.dafuwengLogin(uid2)).params(map).post(activityHost + "/singleLottery/doJoin");
response.print();
Assert.assertEquals(response.jsonPath().getString("success"), "false", "校验success失败");
Assert.assertEquals(response.jsonPath().getString("lotteryButtonStatus"), "2", "校验状态失败");
Assert.assertEquals(response.jsonPath().getString("message"), "已抽完", "校验信息失败");
logger.info("校验success、lotteryButtonStatus、message正确");
}
@Test
public void 抽奖日期限制(){
Map<String, String> map = new HashMap<>();
map.put("operationAcitvityId", "36689");
map.put("oaId", "36689");
map.put("token", "12321");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(activityHost + "/singleLottery/doJoin");
//response.prettyPeek();
Assert.assertEquals(response.jsonPath().getString("success"), "false", "校验success失败");
Assert.assertEquals(response.jsonPath().getString("lotteryButtonStatus"), "4", "校验状态失败");
Assert.assertEquals(response.jsonPath().getString("message"), "已结束", "校验信息失败");
logger.info("校验success、lotteryButtonStatus、message正确");
}
public String getTime(int amount){
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd", Locale.ENGLISH);
Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, amount);
date = calendar.getTime();
// System.out.println(dateFormat.format(date));
String time = dateFormat.format(date);
// System.out.println(time);
return time;
}
}
\ No newline at end of file
package http.cases.WalletTest;
import base.DuibaTestBase;
import org.testng.annotations.BeforeClass;
import utils.RedisUtil;
import http.service.Activity.SeedRedPacketService;
import http.service.Activity.WalletAccountService;
......@@ -28,6 +29,15 @@ public class 种红包_AccessTest extends DuibaTestBase{
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
@BeforeClass
public void beforeclass() {
try {
//前置操作,确保土地是空地状态
seedRedPacketService.updateUserLand("19380","1","1","100066444","3");
} catch (Exception e) {
logger.info("数据前后置操作异常");
}
}
@Test
public void 种红包() throws Exception {
......
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