Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
Rocketmq
提交
d9c398f8
R
Rocketmq
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
Rocketmq
与 Fork 源项目一致
Fork自
Apache RocketMQ / Rocketmq
通知
1
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看板
提交
d9c398f8
编写于
1月 22, 2017
作者:
S
stevenschew
提交者:
yukon
1月 22, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ROCKETMQ-57] Add unit test for DefaultMQAdminExt
上级
b29c318c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
37 addition
and
12 deletion
+37
-12
tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java
...rg/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java
+37
-12
未找到文件。
tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java
浏览文件 @
d9c398f8
...
@@ -16,18 +16,45 @@
...
@@ -16,18 +16,45 @@
*/
*/
package
org.apache.rocketmq.tools.admin
;
package
org.apache.rocketmq.tools.admin
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.TreeMap
;
import
java.util.TreeSet
;
import
java.util.concurrent.ConcurrentHashMap
;
import
org.apache.rocketmq.client.ClientConfig
;
import
org.apache.rocketmq.client.ClientConfig
;
import
org.apache.rocketmq.client.exception.MQBrokerException
;
import
org.apache.rocketmq.client.exception.MQBrokerException
;
import
org.apache.rocketmq.client.exception.MQClientException
;
import
org.apache.rocketmq.client.exception.MQClientException
;
import
org.apache.rocketmq.client.impl.MQClientAPIImpl
;
import
org.apache.rocketmq.client.impl.MQClientAPIImpl
;
import
org.apache.rocketmq.client.impl.MQClientManager
;
import
org.apache.rocketmq.client.impl.MQClientManager
;
import
org.apache.rocketmq.client.impl.factory.MQClientInstance
;
import
org.apache.rocketmq.client.impl.factory.MQClientInstance
;
import
org.apache.rocketmq.common.admin.*
;
import
org.apache.rocketmq.common.admin.ConsumeStats
;
import
org.apache.rocketmq.common.admin.OffsetWrapper
;
import
org.apache.rocketmq.common.admin.TopicOffset
;
import
org.apache.rocketmq.common.admin.TopicStatsTable
;
import
org.apache.rocketmq.common.consumer.ConsumeFromWhere
;
import
org.apache.rocketmq.common.consumer.ConsumeFromWhere
;
import
org.apache.rocketmq.common.message.MessageExt
;
import
org.apache.rocketmq.common.message.MessageExt
;
import
org.apache.rocketmq.common.message.MessageQueue
;
import
org.apache.rocketmq.common.message.MessageQueue
;
import
org.apache.rocketmq.common.namesrv.NamesrvUtil
;
import
org.apache.rocketmq.common.namesrv.NamesrvUtil
;
import
org.apache.rocketmq.common.protocol.body.*
;
import
org.apache.rocketmq.common.protocol.body.ClusterInfo
;
import
org.apache.rocketmq.common.protocol.body.Connection
;
import
org.apache.rocketmq.common.protocol.body.ConsumeStatsList
;
import
org.apache.rocketmq.common.protocol.body.ConsumeStatus
;
import
org.apache.rocketmq.common.protocol.body.ConsumerConnection
;
import
org.apache.rocketmq.common.protocol.body.ConsumerRunningInfo
;
import
org.apache.rocketmq.common.protocol.body.GroupList
;
import
org.apache.rocketmq.common.protocol.body.KVTable
;
import
org.apache.rocketmq.common.protocol.body.ProcessQueueInfo
;
import
org.apache.rocketmq.common.protocol.body.ProducerConnection
;
import
org.apache.rocketmq.common.protocol.body.QueueTimeSpan
;
import
org.apache.rocketmq.common.protocol.body.SubscriptionGroupWrapper
;
import
org.apache.rocketmq.common.protocol.body.TopicList
;
import
org.apache.rocketmq.common.protocol.heartbeat.ConsumeType
;
import
org.apache.rocketmq.common.protocol.heartbeat.ConsumeType
;
import
org.apache.rocketmq.common.protocol.heartbeat.MessageModel
;
import
org.apache.rocketmq.common.protocol.heartbeat.MessageModel
;
import
org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData
;
import
org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData
;
...
@@ -35,7 +62,11 @@ import org.apache.rocketmq.common.protocol.route.BrokerData;
...
@@ -35,7 +62,11 @@ import org.apache.rocketmq.common.protocol.route.BrokerData;
import
org.apache.rocketmq.common.protocol.route.QueueData
;
import
org.apache.rocketmq.common.protocol.route.QueueData
;
import
org.apache.rocketmq.common.protocol.route.TopicRouteData
;
import
org.apache.rocketmq.common.protocol.route.TopicRouteData
;
import
org.apache.rocketmq.common.subscription.SubscriptionGroupConfig
;
import
org.apache.rocketmq.common.subscription.SubscriptionGroupConfig
;
import
org.apache.rocketmq.remoting.exception.*
;
import
org.apache.rocketmq.remoting.exception.RemotingCommandException
;
import
org.apache.rocketmq.remoting.exception.RemotingConnectException
;
import
org.apache.rocketmq.remoting.exception.RemotingException
;
import
org.apache.rocketmq.remoting.exception.RemotingSendRequestException
;
import
org.apache.rocketmq.remoting.exception.RemotingTimeoutException
;
import
org.apache.rocketmq.tools.admin.api.MessageTrack
;
import
org.apache.rocketmq.tools.admin.api.MessageTrack
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -43,13 +74,10 @@ import org.junit.Test;
...
@@ -43,13 +74,10 @@ import org.junit.Test;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
import
org.mockito.junit.MockitoJUnitRunner
;
import
org.mockito.junit.MockitoJUnitRunner
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
ArgumentMatchers
.*;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyBoolean
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyLong
;
import
static
org
.
mockito
.
ArgumentMatchers
.
anyString
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
static
org
.
mockito
.
Mockito
.
when
;
...
@@ -88,7 +116,6 @@ public class DefaultMQAdminExtTest {
...
@@ -88,7 +116,6 @@ public class DefaultMQAdminExtTest {
topicList
.
setTopicList
(
topicSet
);
topicList
.
setTopicList
(
topicSet
);
when
(
mQClientAPIImpl
.
getTopicListFromNameServer
(
anyLong
())).
thenReturn
(
topicList
);
when
(
mQClientAPIImpl
.
getTopicListFromNameServer
(
anyLong
())).
thenReturn
(
topicList
);
List
<
BrokerData
>
brokerDatas
=
new
ArrayList
<>();
List
<
BrokerData
>
brokerDatas
=
new
ArrayList
<>();
HashMap
<
Long
,
String
>
brokerAddrs
=
new
HashMap
<>();
HashMap
<
Long
,
String
>
brokerAddrs
=
new
HashMap
<>();
brokerAddrs
.
put
(
1234
l
,
"127.0.0.1:10911"
);
brokerAddrs
.
put
(
1234
l
,
"127.0.0.1:10911"
);
...
@@ -210,7 +237,6 @@ public class DefaultMQAdminExtTest {
...
@@ -210,7 +237,6 @@ public class DefaultMQAdminExtTest {
assertThat
(
result
.
getProperty
(
"serverSocketRcvBufSize"
)).
isEqualTo
(
"655350"
);
assertThat
(
result
.
getProperty
(
"serverSocketRcvBufSize"
)).
isEqualTo
(
"655350"
);
}
}
@Test
@Test
public
void
testFetchAllTopicList
()
throws
RemotingException
,
MQClientException
,
InterruptedException
{
public
void
testFetchAllTopicList
()
throws
RemotingException
,
MQClientException
,
InterruptedException
{
TopicList
topicList
=
defaultMQAdminExtImpl
.
fetchAllTopicList
();
TopicList
topicList
=
defaultMQAdminExtImpl
.
fetchAllTopicList
();
...
@@ -296,7 +322,6 @@ public class DefaultMQAdminExtTest {
...
@@ -296,7 +322,6 @@ public class DefaultMQAdminExtTest {
assertThat
(
kvs
.
getTable
().
get
(
"cluster-name"
)).
isEqualTo
(
"default-cluster"
);
assertThat
(
kvs
.
getTable
().
get
(
"cluster-name"
)).
isEqualTo
(
"default-cluster"
);
}
}
@Test
@Test
public
void
testQueryTopicConsumeByWho
()
throws
InterruptedException
,
RemotingException
,
MQClientException
,
MQBrokerException
{
public
void
testQueryTopicConsumeByWho
()
throws
InterruptedException
,
RemotingException
,
MQClientException
,
MQBrokerException
{
GroupList
groupList
=
defaultMQAdminExtImpl
.
queryTopicConsumeByWho
(
"UnitTest"
);
GroupList
groupList
=
defaultMQAdminExtImpl
.
queryTopicConsumeByWho
(
"UnitTest"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录