Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马博
test-platform
Commits
86458923
Commit
86458923
authored
Dec 11, 2018
by
赵然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zr
parent
af1990f8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
322 additions
and
1 deletion
+322
-1
瓜分积分_AccessTest.java
src/test/java/http/cases/PkMoudleTest/瓜分积分_AccessTest.java
+44
-0
BetDevelopVo.java
src/test/java/http/model/BetDevelopVo.java
+138
-0
BetOptionVo.java
src/test/java/http/model/BetOptionVo.java
+7
-1
PkDevelopService.java
src/test/java/http/service/hd/PkDevelopService.java
+133
-0
No files found.
src/test/java/http/cases/PkMoudleTest/瓜分积分_AccessTest.java
0 → 100644
View file @
86458923
/**
* 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
http.service.Activity.PkMoudleService
;
import
http.service.hd.PkDevelopService
;
import
io.restassured.response.Response
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
java.math.BigDecimal
;
public
class
瓜分积分
_AccessTest
extends
DuibaTestBase
{
@Autowired
PkMoudleService
pkMoudleService
;
@Autowired
PkDevelopService
pkDevelopService
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
private
static
Integer
uid
=
5029
;
//
//@Test
public
void
创建
PK
活动
()
throws
Exception
{
Response
response
=
pkDevelopService
.
betEditor
(
"21771"
,
"4"
,
null
,
"30"
);
Assert
.
assertEquals
(
response
.
jsonPath
().
getString
(
"desc"
),
"成功"
,
"创建组件化pk活动失败"
);
}
}
\ No newline at end of file
src/test/java/http/model/BetDevelopVo.java
0 → 100644
View file @
86458923
/**
* Copyright (C), 2015-2018
* FileName: BetMngVo
* Author: qianwenjun
* Date: 2018/8/5 10:12
* Description:
*/
package
http
.
model
;
import
java.util.List
;
/**
* @author 赵然
* @create 2018/12/11
* @since 1.0.0
*/
public
class
BetDevelopVo
{
public
List
<
BetOptionVo
>
getBetOptionDtoList
()
{
return
betOptionDtoList
;
}
public
void
setBetOptionDtoList
(
List
<
BetOptionVo
>
betOptionDtoList
)
{
this
.
betOptionDtoList
=
betOptionDtoList
;
}
private
List
<
BetOptionVo
>
betOptionDtoList
;
private
String
betType
;
//'押注类型 1-单选单次,2-多选无限制'
private
String
bonusAmount
;
//'每人实际分得金额'
private
String
bonusType
;
//'瓜分类型1瓜分经验2瓜分红包3发奖品4瓜分积分'
private
String
configStatus
;
//'投注活动的状态:1关闭不可见2关闭可见3开启4结束'
private
String
creditsValue
;
//'积分价值'
private
String
endTime
;
//'活动结束时间'
private
String
shareExp
;
//'瓜分的经验池'
private
String
startTime
;
// '活动开始时间'
private
String
title
;
//'投注活动标题'
// private String id; //主键
// private String pluginId; //'发奖品时需要填插件id'
// private String prizeLimit; //'发奖品时的发放上限'
// public String getPluginId() {
// return pluginId;
// }
//
// public void setPluginId(String pluginId) {
// this.pluginId = pluginId;
// }
//
// public String getPrizeLimit() {
// return prizeLimit;
// }
// public void setPrizeLimit(String prizeLimit) {
// this.prizeLimit = prizeLimit;
// }
public
String
getBetType
()
{
return
betType
;
}
public
void
setBetType
(
String
betType
)
{
this
.
betType
=
betType
;
}
public
String
getBonusAmount
()
{
return
bonusAmount
;
}
public
void
setBonusAmount
(
String
bonusAmount
)
{
this
.
bonusAmount
=
bonusAmount
;
}
public
String
getBonusType
()
{
return
bonusType
;
}
public
void
setBonusType
(
String
bonusType
)
{
this
.
bonusType
=
bonusType
;
}
public
String
getConfigStatus
()
{
return
configStatus
;
}
public
void
setConfigStatus
(
String
configStatus
)
{
this
.
configStatus
=
configStatus
;
}
public
String
getCreditsValue
()
{
return
creditsValue
;
}
public
void
setCreditsValue
(
String
creditsValue
)
{
this
.
creditsValue
=
creditsValue
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
String
getShareExp
()
{
return
shareExp
;
}
public
void
setShareExp
(
String
shareExp
)
{
this
.
shareExp
=
shareExp
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
}
\ No newline at end of file
src/test/java/http/model/BetOptionVo.java
View file @
86458923
...
...
@@ -19,7 +19,7 @@ public class BetOptionVo {
private
String
optionImg
;
private
String
optionName
;
private
String
rightAnswer
;
public
String
getOptionImg
()
{
return
optionImg
;
...
...
@@ -37,5 +37,11 @@ public class BetOptionVo {
this
.
optionName
=
optionName
;
}
public
String
getRightAnswer
()
{
return
rightAnswer
;
}
public
void
setRightAnswer
(
String
rightAnswer
)
{
this
.
rightAnswer
=
rightAnswer
;
}
}
\ No newline at end of file
src/test/java/http/service/hd/PkDevelopService.java
0 → 100644
View file @
86458923
package
http
.
service
.
hd
;
import
base.DuibaLog
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
http.model.BetOptionVo
;
import
http.model.BetDevelopVo
;
import
http.service.Authorization
;
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.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.testng.Assert
;
import
utils.MatcherString
;
import
utils.PublicMethod
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* @author zhaoran
* @create 2018/12/11
* @since 1.0.0
*/
@Service
public
class
PkDevelopService
{
@Value
(
"${hdserver.host}"
)
String
hdHost
;
@Value
(
"${manager.host}"
)
String
ManagerHost
;
@Autowired
Authorization
authorization
;
private
DuibaLog
logger
=
DuibaLog
.
getLogger
();
public
Response
betEditor
(
String
appId
,
String
bonusType
,
String
bonusAmount
,
String
shareExp
)
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
(
null
);
betOptionVo2
.
setOptionImg
(
"//yun.dui88.com/images/201812/4f51vmzfpu.png"
);
betOptionVo2
.
setOptionName
(
"2"
);
betOptionVo2
.
setRightAnswer
(
null
);
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
(
"1"
);
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
.
hdLoginSaas
(
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
<>();
// para.put("pageNo","1");
// para.put("pageSize","20");
Response
doDrawResponse
=
given
().
cookies
(
authorization
.
ssoLogin
()).
params
(
para
).
get
(
url
);
try
{
Assert
.
assertEquals
(
doDrawResponse
.
jsonPath
().
getString
(
"success"
),
"true"
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"pk活动开奖接口失败,返回信息:"
+
doDrawResponse
.
asString
());
}
catch
(
Error
er
){
throw
new
Exception
(
"pk活动开奖接口失败,返回信息:"
+
doDrawResponse
.
asString
());
}
return
doDrawResponse
;
}
// public static void main(String[] args) throws Exception{
// String endTime = "2021-12-31 23:55:00";
// PkActivityService pkActivityService = new PkActivityService();
//
// Response betResponse = pkActivityService.bet("2",endTime);
// String betId = MatcherString.getString(betResponse.asString(),"\"data\":(.*?)}",1);
// Response betRelation = pkActivityService.betGroupRelation(betId,endTime);
// Response modifyStatusResponse = pkActivityService.modifySatus(betId);
//
// }
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment