Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DuibaTestToolV2.1
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
赵然
DuibaTestToolV2.1
Commits
dfe90516
Commit
dfe90516
authored
Nov 30, 2018
by
赵然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zr
parent
ced8db91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
0 deletions
+113
-0
HbaseService.java
src/main/com/atguigu/springmvc/common/HbaseService.java
+62
-0
HbaseModule.java
src/main/com/atguigu/springmvc/handlers/HbaseModule.java
+51
-0
No files found.
src/main/com/atguigu/springmvc/common/HbaseService.java
0 → 100644
View file @
dfe90516
/**
* Copyright (C), 2015-2018
* FileName: HbaseService
* Author: qianwenjun
* Date: 2018/8/27 18:20
* Description:
*/
package
main
.
com
.
atguigu
.
springmvc
.
common
;
import
io.restassured.response.Response
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
io
.
restassured
.
RestAssured
.
given
;
/**
* 〈〉
*
* @author qianwenjun
* @create 2018/8/27
* @since 1.0.0
*/
@Service
public
class
HbaseService
{
private
static
String
activtyHost
=
"http://activity.m.duibatest.com.cn"
;
public
static
Response
getHBASEKey
(
String
key
,
String
reverse
)
{
String
url
=
activtyHost
+
"/aaw/hb/get"
;
Map
<
String
,
Object
>
parm
=
new
HashMap
<>();
parm
.
put
(
"key"
,
key
);
if
(
reverse
.
equals
(
""
)||
reverse
.
equals
(
null
)||
reverse
.
isEmpty
()){
parm
.
put
(
"reverse"
,
"false"
);
}
else
{
parm
.
put
(
"reverse"
,
reverse
);
}
Response
response
=
given
().
params
(
parm
).
get
(
url
);
return
response
;
}
public
static
Response
reset
(
String
key
,
String
lvalue
,
String
reverse
)
{
String
url
=
activtyHost
+
"/aaw/hb/reset/lvalue"
;
Map
<
String
,
Object
>
parm
=
new
HashMap
<>();
parm
.
put
(
"key"
,
key
);
parm
.
put
(
"lvalue"
,
lvalue
);
if
(
reverse
.
equals
(
""
)||
reverse
.
equals
(
null
)||
reverse
.
isEmpty
()){
parm
.
put
(
"reverse"
,
"false"
);
}
else
{
parm
.
put
(
"reverse"
,
reverse
);
}
Response
response
=
given
().
params
(
parm
).
get
(
url
);
return
response
;
}
}
\ No newline at end of file
src/main/com/atguigu/springmvc/handlers/HbaseModule.java
0 → 100644
View file @
dfe90516
package
main
.
com
.
atguigu
.
springmvc
.
handlers
;
import
io.restassured.response.Response
;
import
main.com.atguigu.springmvc.common.HbaseService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.HashMap
;
import
java.util.Map
;
@Controller
public
class
HbaseModule
{
/**
* 功能:Hbase查改操作
* @return
*/
@RequestMapping
(
value
=
"/doHbase"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Map
urlLink
(
HttpServletRequest
request
)
throws
Exception
{
String
select
=
request
.
getParameter
(
"select"
);
String
reverse
=
request
.
getParameter
(
"reverse"
);
if
(
reverse
.
equals
(
null
)
||
reverse
.
equals
(
""
)
||
reverse
.
isEmpty
()){
reverse
=
"false"
;
}
String
key
=
request
.
getParameter
(
"key"
);
String
value
=
request
.
getParameter
(
"value"
);
System
.
out
.
println
(
"select为:"
+
select
);
System
.
out
.
println
(
"reverse为:"
+
reverse
);
System
.
out
.
println
(
"key为:"
+
key
);
System
.
out
.
println
(
"value为:"
+
value
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
if
(
select
.
equals
(
"search"
)){
Response
response
=
HbaseService
.
getHBASEKey
(
key
,
reverse
);
map
.
put
(
"message"
,
response
.
asString
());
}
if
(
select
.
equals
(
"reset"
)){
Response
response
=
HbaseService
.
reset
(
key
,
value
,
reverse
);
map
.
put
(
"message"
,
response
.
asString
());
}
return
map
;
}
}
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