[ISSUE #38]update rocketmq version. (#39)

Co-authored-by: zhangjidi2016 <zhangjidi@cmss.chinamobile.com>
This commit is contained in:
zhangjidi2016
2021-11-05 09:04:59 +08:00
committed by GitHub
parent ef7b97e96a
commit 2160e23b91
4 changed files with 60 additions and 14 deletions

View File

@@ -90,7 +90,7 @@
<commons-lang.version>2.6</commons-lang.version>
<commons-io.version>2.4</commons-io.version>
<commons-cli.version>1.2</commons-cli.version>
<rocketmq.version>4.9.0</rocketmq.version>
<rocketmq.version>4.9.2</rocketmq.version>
<surefire.version>2.19.1</surefire.version>
<aspectj.version>1.9.6</aspectj.version>
<lombok.version>1.18.12</lombok.version>

View File

@@ -235,6 +235,12 @@ public class MQAdminExtImpl implements MQAdminExt {
return MQAdminInstance.threadLocalMQAdminExt().wipeWritePermOfBroker(namesrvAddr, brokerName);
}
@Override
public int addWritePermOfBroker(String namesrvAddr,
String brokerName) throws RemotingCommandException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException, InterruptedException, MQClientException {
return MQAdminInstance.threadLocalMQAdminExt().addWritePermOfBroker(namesrvAddr, brokerName);
}
@Override
public void putKVConfig(String namespace, String key, String value) {
MQAdminInstance.threadLocalMQAdminExt().putKVConfig(namespace, key, value);
@@ -511,9 +517,21 @@ public class MQAdminExtImpl implements MQAdminExt {
}
@Override
public TopicConfigSerializeWrapper getAllTopicGroup(String brokerAddr,
public SubscriptionGroupWrapper getUserSubscriptionGroup(String brokerAddr,
long timeoutMillis) throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
return MQAdminInstance.threadLocalMQAdminExt().getAllTopicGroup(brokerAddr, timeoutMillis);
return MQAdminInstance.threadLocalMQAdminExt().getUserSubscriptionGroup(brokerAddr, timeoutMillis);
}
@Override
public TopicConfigSerializeWrapper getAllTopicConfig(String brokerAddr,
long timeoutMillis) throws InterruptedException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
return MQAdminInstance.threadLocalMQAdminExt().getAllTopicConfig(brokerAddr, timeoutMillis);
}
@Override
public TopicConfigSerializeWrapper getUserTopicConfig(String brokerAddr, boolean specialTopic,
long timeoutMillis) throws InterruptedException, RemotingException, MQBrokerException, MQClientException {
return MQAdminInstance.threadLocalMQAdminExt().getUserTopicConfig(brokerAddr, specialTopic, timeoutMillis);
}
@Override

View File

@@ -135,10 +135,10 @@ public class TopicServiceImpl extends AbstractCommonService implements TopicServ
ClusterInfo clusterInfo = null;
try {
clusterInfo = mqAdminExt.examineBrokerClusterInfo();
return mqAdminExt.examineTopicConfig(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), topic);
} catch (Exception e) {
throw Throwables.propagate(e);
}
return mqAdminExt.examineTopicConfig(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), topic);
}
@Override

View File

@@ -758,16 +758,6 @@ public class MQAdminExtImplTest {
Assert.assertNotNull(wrapper);
}
@Test
public void testGetAllTopicGroup() throws Exception {
assertNotNull(mqAdminExtImpl);
{
when(defaultMQAdminExt.getAllTopicGroup(anyString(), anyLong())).thenReturn(new TopicConfigSerializeWrapper());
}
TopicConfigSerializeWrapper wrapper = mqAdminExtImpl.getAllTopicGroup(brokerAddr, 5000L);
Assert.assertNotNull(wrapper);
}
@Test
public void testUpdateConsumeOffset() throws Exception {
assertNotNull(mqAdminExtImpl);
@@ -801,4 +791,42 @@ public class MQAdminExtImplTest {
Assert.assertFalse(mqAdminExtImpl.resumeCheckHalfMessage("topic_test", "7F000001ACC018B4AAC2116AF6500000"));
}
@Test
public void testAddWritePermOfBroker() throws Exception {
assertNotNull(mqAdminExtImpl);
{
when(defaultMQAdminExt.addWritePermOfBroker(anyString(), anyString())).thenReturn(6);
}
Assert.assertEquals(mqAdminExtImpl.addWritePermOfBroker("127.0.0.1:9876", "broker-a"), 6);
}
@Test
public void testGetUserSubscriptionGroup() throws Exception {
assertNotNull(mqAdminExtImpl);
SubscriptionGroupWrapper wrapper = new SubscriptionGroupWrapper();
{
when(defaultMQAdminExt.getUserSubscriptionGroup(anyString(), anyLong())).thenReturn(wrapper);
}
Assert.assertEquals(mqAdminExtImpl.getUserSubscriptionGroup("127.0.0.1:10911", 3000), wrapper);
}
@Test
public void testGetAllTopicConfig() throws Exception {
assertNotNull(mqAdminExtImpl);
TopicConfigSerializeWrapper wrapper = new TopicConfigSerializeWrapper();
{
when(defaultMQAdminExt.getAllTopicConfig(anyString(), anyLong())).thenReturn(wrapper);
}
Assert.assertEquals(mqAdminExtImpl.getAllTopicConfig("127.0.0.1:10911", 3000), wrapper);
}
@Test
public void testGetUserTopicConfig() throws Exception {
assertNotNull(mqAdminExtImpl);
TopicConfigSerializeWrapper wrapper = new TopicConfigSerializeWrapper();
{
when(defaultMQAdminExt.getUserTopicConfig(anyString(), anyBoolean(), anyLong())).thenReturn(wrapper);
}
Assert.assertEquals(mqAdminExtImpl.getUserTopicConfig("127.0.0.1:10911", true, 3000), wrapper);
}
}