Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
super-server
Rocketmq
提交
8c59640d
R
Rocketmq
项目概览
super-server
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rocketmq
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8c59640d
编写于
5月 14, 2019
作者:
H
hdchen
提交者:
dinglei
5月 14, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[RIP-10] modify test case of BrokerConsumeStatusSubCommand (#983)
上级
26878e9c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
6 deletion
+29
-6
tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java
...tmq/tools/command/broker/BrokerConsumeStatsSubCommad.java
+20
-3
tools/src/test/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommadTest.java
...tools/command/broker/BrokerConsumeStatsSubCommadTest.java
+9
-3
未找到文件。
tools/src/main/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommad.java
浏览文件 @
8c59640d
...
@@ -36,6 +36,24 @@ import org.apache.rocketmq.tools.command.SubCommandException;
...
@@ -36,6 +36,24 @@ import org.apache.rocketmq.tools.command.SubCommandException;
public
class
BrokerConsumeStatsSubCommad
implements
SubCommand
{
public
class
BrokerConsumeStatsSubCommad
implements
SubCommand
{
private
DefaultMQAdminExt
defaultMQAdminExt
;
private
DefaultMQAdminExt
createMQAdminExt
(
RPCHook
rpcHook
)
throws
SubCommandException
{
if
(
this
.
defaultMQAdminExt
!=
null
)
{
return
defaultMQAdminExt
;
}
else
{
defaultMQAdminExt
=
new
DefaultMQAdminExt
(
rpcHook
);
defaultMQAdminExt
.
setInstanceName
(
Long
.
toString
(
System
.
currentTimeMillis
()));
try
{
defaultMQAdminExt
.
start
();
}
catch
(
Exception
e
)
{
throw
new
SubCommandException
(
this
.
getClass
().
getSimpleName
()
+
" command failed"
,
e
);
}
return
defaultMQAdminExt
;
}
}
@Override
@Override
public
String
commandName
()
{
public
String
commandName
()
{
return
"brokerConsumeStats"
;
return
"brokerConsumeStats"
;
...
@@ -69,10 +87,9 @@ public class BrokerConsumeStatsSubCommad implements SubCommand {
...
@@ -69,10 +87,9 @@ public class BrokerConsumeStatsSubCommad implements SubCommand {
@Override
@Override
public
void
execute
(
CommandLine
commandLine
,
Options
options
,
RPCHook
rpcHook
)
throws
SubCommandException
{
public
void
execute
(
CommandLine
commandLine
,
Options
options
,
RPCHook
rpcHook
)
throws
SubCommandException
{
DefaultMQAdminExt
defaultMQAdminExt
=
new
DefaultMQAdminExt
(
rpcHook
);
defaultMQAdminExt
.
setInstanceName
(
Long
.
toString
(
System
.
currentTimeMillis
()));
try
{
try
{
defaultMQAdminExt
.
start
();
defaultMQAdminExt
=
createMQAdminExt
(
rpcHook
);
String
brokerAddr
=
commandLine
.
getOptionValue
(
'b'
).
trim
();
String
brokerAddr
=
commandLine
.
getOptionValue
(
'b'
).
trim
();
boolean
isOrder
=
false
;
boolean
isOrder
=
false
;
long
timeoutMillis
=
50000
;
long
timeoutMillis
=
50000
;
...
...
tools/src/test/java/org/apache/rocketmq/tools/command/broker/BrokerConsumeStatsSubCommadTest.java
浏览文件 @
8c59640d
...
@@ -49,6 +49,9 @@ import static org.mockito.Mockito.mock;
...
@@ -49,6 +49,9 @@ import static org.mockito.Mockito.mock;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
Mockito
.
when
;
public
class
BrokerConsumeStatsSubCommadTest
{
public
class
BrokerConsumeStatsSubCommadTest
{
private
static
BrokerConsumeStatsSubCommad
cmd
=
new
BrokerConsumeStatsSubCommad
();
private
static
DefaultMQAdminExt
defaultMQAdminExt
;
private
static
DefaultMQAdminExt
defaultMQAdminExt
;
private
static
DefaultMQAdminExtImpl
defaultMQAdminExtImpl
;
private
static
DefaultMQAdminExtImpl
defaultMQAdminExtImpl
;
private
static
MQClientInstance
mqClientInstance
=
MQClientManager
.
getInstance
().
getAndCreateMQClientInstance
(
new
ClientConfig
());
private
static
MQClientInstance
mqClientInstance
=
MQClientManager
.
getInstance
().
getAndCreateMQClientInstance
(
new
ClientConfig
());
...
@@ -81,10 +84,13 @@ public class BrokerConsumeStatsSubCommadTest {
...
@@ -81,10 +84,13 @@ public class BrokerConsumeStatsSubCommadTest {
public
static
void
terminate
()
{
public
static
void
terminate
()
{
}
}
@Ignore
@Test
@Test
public
void
testExecute
()
throws
SubCommandException
{
public
void
testExecute
()
throws
SubCommandException
,
IllegalAccessException
,
NoSuchFieldException
{
BrokerConsumeStatsSubCommad
cmd
=
new
BrokerConsumeStatsSubCommad
();
Field
field
=
BrokerConsumeStatsSubCommad
.
class
.
getDeclaredField
(
"defaultMQAdminExt"
);
field
.
setAccessible
(
true
);
field
.
set
(
cmd
,
defaultMQAdminExt
);
Options
options
=
ServerUtil
.
buildCommandlineOptions
(
new
Options
());
Options
options
=
ServerUtil
.
buildCommandlineOptions
(
new
Options
());
String
[]
subargs
=
new
String
[]
{
"-b 127.0.0.1:10911"
,
"-t 3000"
,
"-l 5"
,
"-o true"
};
String
[]
subargs
=
new
String
[]
{
"-b 127.0.0.1:10911"
,
"-t 3000"
,
"-l 5"
,
"-o true"
};
final
CommandLine
commandLine
=
final
CommandLine
commandLine
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录