Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tiku_APP_APITest
Overview
Overview
Details
Activity
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
shuai
tiku_APP_APITest
Commits
14feab10
Commit
14feab10
authored
Mar 22, 2019
by
wff66504
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
506999c8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
241 additions
and
1 deletions
+241
-1
getEstimateInfo.java
tiku_App/src/com/offcn/api/tk/newApp/getEstimateInfo.java
+114
-0
getEstimatePaperJson.java
...App/src/com/offcn/api/tk/newApp/getEstimatePaperJson.java
+112
-0
system.xml
tiku_App/src/resources/system.xml
+15
-1
No files found.
tiku_App/src/com/offcn/api/tk/newApp/getEstimateInfo.java
0 → 100644
View file @
14feab10
package
com
.
offcn
.
api
.
tk
.
newApp
;
import
io.restassured.path.json.JsonPath
;
import
io.restassured.response.Response
;
import
java.util.HashMap
;
import
com.offcn.TestUnti.ListUtil
;
import
com.offcn.TestUnti.MapUtil
;
import
com.offcn.TestUnti.RequestDataUtils
;
import
com.offcn.TestUnti.StringUtils
;
import
com.offcn.interfaces.API
;
import
com.offcn.process.TK
;
public
class
getEstimateInfo
extends
TK
implements
API
{
public
String
parameter
;
//参数集合
public
String
user_id
;
//用户id
public
String
exam_id
;
//考试id
public
String
exam_type
;
//考试类型
public
String
page
;
//页码数,默认为1
public
String
pagesize
;
//这个一页取10个数据,定死了
@Override
public
void
initialize
(
HashMap
<
String
,
Object
>
data
)
{
if
(!
isProduct
&&
data
.
get
(
"CleanDB"
).
toString
().
contains
(
"Y"
))
{
cleanUser_FromDB
();
//清除注册用户根据user_id
}
}
@Override
public
HashMap
<
String
,
Object
>
handleInput
(
HashMap
<
String
,
Object
>
data
)
{
parameter
=
MapUtil
.
getValue
(
"parameter"
,
data
);
user_id
=
MapUtil
.
getParameter_accurate
(
parameter
,
"user_id"
).
trim
();
exam_id
=
MapUtil
.
getParameter_accurate
(
parameter
,
"exam_id"
).
trim
();
exam_type
=
MapUtil
.
getParameter_accurate
(
parameter
,
"exam_type"
).
trim
();
page
=
MapUtil
.
getParameter_accurate
(
parameter
,
"page"
).
trim
();
pagesize
=
MapUtil
.
getParameter_accurate
(
parameter
,
"pagesize"
).
trim
();
if
((!
user_id
.
equals
(
""
))
&&
user_id
.
equals
(
"code"
))
{
user_id
=
ListUtil
.
getListValue
(
user_idList
,
0
);
parameter
=
parameter
.
replace
(
"\"user_id\":code"
,
"\"user_id\":\""
+
user_id
+
"\""
);
}
data
.
put
(
"parameter"
,
parameter
);
return
data
;
}
@Override
public
Response
SendRequest
(
HashMap
<
String
,
Object
>
data
,
String
Url
,
String
Request
)
{
Response
re
=
RequestDataUtils
.
Post_token
(
data
,
Url
,
tk_token
);
return
re
;
}
@Override
public
String
handleOutput
(
Response
re
,
HashMap
<
String
,
Object
>
data
)
{
JsonPath
jp
=
re
.
body
().
jsonPath
();
boolean
result
=
true
;
String
failReason
=
""
;
String
json
=
StringUtils
.
decodeUnicode
(
re
.
asString
());
if
((
data
.
get
(
"statusCode"
)
!=
null
)
&&
(!
data
.
get
(
"statusCode"
).
toString
()
.
equals
(
String
.
valueOf
(
re
.
getStatusCode
()))))
{
result
=
result
&&
false
;
failReason
=
failReason
+
"statusCode is expected "
+
data
.
get
(
"statusCode"
).
toString
()
+
" but actually "
+
String
.
valueOf
(
re
.
getStatusCode
())
+
". "
;
}
if
(
json
.
length
()
!=
0
)
{
String
msg
=
jp
.
getString
(
"message"
);
String
code
=
jp
.
getString
(
"retcode"
);
if
((
data
.
get
(
"code"
)
!=
null
)
&&
(
code
!=
null
)
&&
(!
code
.
equals
(
data
.
get
(
"code"
).
toString
())))
{
result
=
result
&&
false
;
failReason
=
failReason
+
"code is expected "
+
data
.
get
(
"code"
).
toString
()
+
" but actually "
+
jp
.
getString
(
"code"
)
+
"."
;
}
if
((
data
.
get
(
"msg"
)
!=
null
)
&&
(
msg
!=
null
)
&&
(!
msg
.
equals
(
data
.
get
(
"msg"
).
toString
())))
{
result
=
result
&&
false
;
failReason
=
failReason
+
"msg is expected "
+
data
.
get
(
"msg"
).
toString
()
+
" but actually "
+
jp
.
getString
(
"msg"
)
+
"."
;
}
if
(
data
.
get
(
"custom"
)
!=
null
&&
jp
.
getString
(
"data"
)!=
null
){
String
custom
=
data
.
get
(
"custom"
).
toString
();
String
[]
ArrayString
=
StringUtils
.
getArrayString
(
custom
,
","
);
if
(!
StringUtils
.
VerificationString
(
jp
.
getString
(
"data"
),
ArrayString
)){
result
=
result
&&
false
;
failReason
=
failReason
+
"custom is expected "
+
data
.
get
(
"custom"
).
toString
()
+
" but actually "
+
jp
.
getString
(
"data"
)
+
"."
;
}
}
if
(
"接口响应成功!"
.
equals
(
msg
)){
}
}
if
(
result
)
return
"Pass"
;
else
return
"Fail:"
+
failReason
;
}
}
tiku_App/src/com/offcn/api/tk/newApp/getEstimatePaperJson.java
0 → 100644
View file @
14feab10
package
com
.
offcn
.
api
.
tk
.
newApp
;
import
io.restassured.path.json.JsonPath
;
import
io.restassured.response.Response
;
import
java.util.HashMap
;
import
com.offcn.TestUnti.ListUtil
;
import
com.offcn.TestUnti.MapUtil
;
import
com.offcn.TestUnti.RequestDataUtils
;
import
com.offcn.TestUnti.StringUtils
;
import
com.offcn.interfaces.API
;
import
com.offcn.process.TK
;
public
class
getEstimatePaperJson
extends
TK
implements
API
{
public
String
parameter
;
//参数集合
public
String
user_id
;
//用户id
public
String
paper_id
;
//试卷id
public
String
record_id
;
//做题记录id
public
String
examine_paper_id
;
//估分考试下的考试科目id
@Override
public
void
initialize
(
HashMap
<
String
,
Object
>
data
)
{
if
(!
isProduct
&&
data
.
get
(
"CleanDB"
).
toString
().
contains
(
"Y"
))
{
cleanUser_FromDB
();
//清除注册用户根据user_id
}
}
@Override
public
HashMap
<
String
,
Object
>
handleInput
(
HashMap
<
String
,
Object
>
data
)
{
parameter
=
MapUtil
.
getValue
(
"parameter"
,
data
);
user_id
=
MapUtil
.
getParameter_accurate
(
parameter
,
"user_id"
).
trim
();
paper_id
=
MapUtil
.
getParameter_accurate
(
parameter
,
"paper_id"
).
trim
();
record_id
=
MapUtil
.
getParameter_accurate
(
parameter
,
"record_id"
).
trim
();
examine_paper_id
=
MapUtil
.
getParameter_accurate
(
parameter
,
"examine_paper_id"
).
trim
();
if
((!
user_id
.
equals
(
""
))
&&
user_id
.
equals
(
"code"
))
{
user_id
=
ListUtil
.
getListValue
(
user_idList
,
0
);
parameter
=
parameter
.
replace
(
"\"user_id\":code"
,
"\"user_id\":\""
+
user_id
+
"\""
);
}
data
.
put
(
"parameter"
,
parameter
);
return
data
;
}
@Override
public
Response
SendRequest
(
HashMap
<
String
,
Object
>
data
,
String
Url
,
String
Request
)
{
Response
re
=
RequestDataUtils
.
Post_token
(
data
,
Url
,
tk_token
);
return
re
;
}
@Override
public
String
handleOutput
(
Response
re
,
HashMap
<
String
,
Object
>
data
)
{
JsonPath
jp
=
re
.
body
().
jsonPath
();
boolean
result
=
true
;
String
failReason
=
""
;
String
json
=
StringUtils
.
decodeUnicode
(
re
.
asString
());
if
((
data
.
get
(
"statusCode"
)
!=
null
)
&&
(!
data
.
get
(
"statusCode"
).
toString
()
.
equals
(
String
.
valueOf
(
re
.
getStatusCode
()))))
{
result
=
result
&&
false
;
failReason
=
failReason
+
"statusCode is expected "
+
data
.
get
(
"statusCode"
).
toString
()
+
" but actually "
+
String
.
valueOf
(
re
.
getStatusCode
())
+
". "
;
}
if
(
json
.
length
()
!=
0
)
{
String
msg
=
jp
.
getString
(
"message"
);
String
code
=
jp
.
getString
(
"retcode"
);
if
((
data
.
get
(
"code"
)
!=
null
)
&&
(
code
!=
null
)
&&
(!
code
.
equals
(
data
.
get
(
"code"
).
toString
())))
{
result
=
result
&&
false
;
failReason
=
failReason
+
"code is expected "
+
data
.
get
(
"code"
).
toString
()
+
" but actually "
+
jp
.
getString
(
"code"
)
+
"."
;
}
if
((
data
.
get
(
"msg"
)
!=
null
)
&&
(
msg
!=
null
)
&&
(!
msg
.
equals
(
data
.
get
(
"msg"
).
toString
())))
{
result
=
result
&&
false
;
failReason
=
failReason
+
"msg is expected "
+
data
.
get
(
"msg"
).
toString
()
+
" but actually "
+
jp
.
getString
(
"msg"
)
+
"."
;
}
if
(
data
.
get
(
"custom"
)
!=
null
&&
jp
.
getString
(
"data"
)!=
null
){
String
custom
=
data
.
get
(
"custom"
).
toString
();
String
[]
ArrayString
=
StringUtils
.
getArrayString
(
custom
,
","
);
if
(!
StringUtils
.
VerificationString
(
jp
.
getString
(
"data"
),
ArrayString
)){
result
=
result
&&
false
;
failReason
=
failReason
+
"custom is expected "
+
data
.
get
(
"custom"
).
toString
()
+
" but actually "
+
jp
.
getString
(
"data"
)
+
"."
;
}
}
if
(
"接口响应成功!"
.
equals
(
msg
)){
}
}
if
(
result
)
return
"Pass"
;
else
return
"Fail:"
+
failReason
;
}
}
tiku_App/src/resources/system.xml
View file @
14feab10
...
@@ -49,7 +49,21 @@
...
@@ -49,7 +49,21 @@
<sqlpwd>
7b467efW#$%f5c50aa3d
</sqlpwd>
<sqlpwd>
7b467efW#$%f5c50aa3d
</sqlpwd>
</system>
</system>
<system
name=
"tknewApp"
>
<!-- 题库新接口 -->
<access_token_uri>
http://106.75.5.205:8082/uaa/oauth/token
</access_token_uri>
<client_id>
bestbuy-acceptance
</client_id>
<client_secret>
bestbuy-acceptance
</client_secret>
<grant_type>
client_credentials
</grant_type>
<isProduct>
false
</isProduct>
<RM_URI>
http://tiku.t.eoffcn.com
</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>
10.10.229.48
</redis_URI>
<redis_db_index>
5
</redis_db_index>
<sqlurl>
jdbc:mysql://39.105.124.219:3312/tiku?useUnicode=true
&
characterEncoding=UTF-8
&
zeroDateTimeBehavior=convertToNull
</sqlurl>
<sqlname>
testTest
</sqlname>
<sqlpwd>
7b467efW#$%f5c50aa3d
</sqlpwd>
</system>
<system
name=
"nwn"
>
<!-- nwn -->
<system
name=
"nwn"
>
<!-- nwn -->
<access_token_uri>
http://106.75.5.205:8082/uaa/oauth/token
</access_token_uri>
<access_token_uri>
http://106.75.5.205:8082/uaa/oauth/token
</access_token_uri>
...
...
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