org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl Java Examples
The following examples show how to use
org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetBrokerConfigCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); Properties properties = new Properties(); properties.setProperty("maxMessageSize", "5000000"); properties.setProperty("flushDelayOffsetInterval", "15000"); properties.setProperty("serverSocketRcvBufSize", "655350"); when(mQClientAPIImpl.getBrokerConfig(anyString(), anyLong())).thenReturn(properties); }
Example #2
Source File: CleanExpiredCQSubCommandTest.java From DDMQ with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); when(mQClientAPIImpl.cleanExpiredConsumeQueue(anyString(), anyLong())).thenReturn(true); }
Example #3
Source File: CleanUnusedTopicCommandTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); when(mQClientAPIImpl.cleanUnusedTopicByAddr(anyString(), anyLong())).thenReturn(true); }
Example #4
Source File: WipeWritePermSubCommandTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, RemotingCommandException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); List<String> result = new ArrayList<>(); result.add("default-name-one"); result.add("default-name-two"); when(mqClientInstance.getMQClientAPIImpl().getNameServerAddressList()).thenReturn(result); when(mQClientAPIImpl.wipeWritePermOfBroker(anyString(), anyString(), anyLong())).thenReturn(6); }
Example #5
Source File: CleanUnusedTopicCommandTest.java From DDMQ with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); when(mQClientAPIImpl.cleanUnusedTopicByAddr(anyString(), anyLong())).thenReturn(true); }
Example #6
Source File: ProducerConnectionSubCommandTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); ProducerConnection producerConnection = new ProducerConnection(); Connection connection = new Connection(); connection.setClientAddr("127.0.0.1:9898"); connection.setClientId("PID_12345"); HashSet<Connection> connectionSet = new HashSet<>(); connectionSet.add(connection); producerConnection.setConnectionSet(connectionSet); when(mQClientAPIImpl.getProducerConnectionList(anyString(), anyString(), anyLong())).thenReturn(producerConnection); }
Example #7
Source File: ConsumerConnectionSubCommandTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); ConsumerConnection consumerConnection = new ConsumerConnection(); consumerConnection.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerConnection.setMessageModel(MessageModel.CLUSTERING); HashSet<Connection> connections = new HashSet<>(); connections.add(new Connection()); consumerConnection.setConnectionSet(connections); consumerConnection.setSubscriptionTable(new ConcurrentHashMap<String, SubscriptionData>()); consumerConnection.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); when(mQClientAPIImpl.getConsumerConnectionList(anyString(), anyString(), anyLong())).thenReturn(consumerConnection); }
Example #8
Source File: UpdateBrokerConfigSubCommandTest.java From DDMQ with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); }
Example #9
Source File: GetNamesrvConfigCommandTest.java From DDMQ with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); Map<String, Properties> propertiesMap = new HashMap<>(); List<String> nameServers = new ArrayList<>(); when(mQClientAPIImpl.getNameServerConfig(ArgumentMatchers.<String>anyList(), anyLong())).thenReturn(propertiesMap); }
Example #10
Source File: WipeWritePermSubCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, RemotingCommandException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); List<String> result = new ArrayList<>(); result.add("default-name-one"); result.add("default-name-two"); when(mqClientInstance.getMQClientAPIImpl().getNameServerAddressList()).thenReturn(result); when(mQClientAPIImpl.wipeWritePermOfBroker(anyString(), anyString(), anyLong())).thenReturn(6); }
Example #11
Source File: CleanUnusedTopicCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); when(mQClientAPIImpl.cleanUnusedTopicByAddr(anyString(), anyLong())).thenReturn(true); }
Example #12
Source File: GetConsumerStatusCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingException, MQClientException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); Map<String, Map<MessageQueue, Long>> consumerStatus = new HashMap<>(); when(mQClientAPIImpl.invokeBrokerToGetConsumerStatus(anyString(), anyString(), anyString(), anyString(), anyLong())).thenReturn(consumerStatus); }
Example #13
Source File: BrokerStatusSubCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); KVTable kvTable = new KVTable(); kvTable.setTable(new HashMap<String, String>()); when(mQClientAPIImpl.getBrokerRuntimeInfo(anyString(), anyLong())).thenReturn(kvTable); }
Example #14
Source File: CleanExpiredCQSubCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); when(mQClientAPIImpl.cleanExpiredConsumeQueue(anyString(), anyLong())).thenReturn(true); }
Example #15
Source File: BrokerConsumeStatsSubCommadTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); ConsumeStatsList consumeStatsList = new ConsumeStatsList(); consumeStatsList.setBrokerAddr("127.0l.0.1:10911"); consumeStatsList.setConsumeStatsList(new ArrayList<Map<String, List<ConsumeStats>>>()); consumeStatsList.setTotalDiff(123); when(mQClientAPIImpl.fetchConsumeStatsInBroker(anyString(), anyBoolean(), anyLong())).thenReturn(consumeStatsList); }
Example #16
Source File: BrokerStatusSubCommandTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); KVTable kvTable = new KVTable(); kvTable.setTable(new HashMap<String, String>()); when(mQClientAPIImpl.getBrokerRuntimeInfo(anyString(), anyLong())).thenReturn(kvTable); }
Example #17
Source File: SendMsgStatusCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); }
Example #18
Source File: UpdateBrokerConfigSubCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); }
Example #19
Source File: CleanExpiredCQSubCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); when(mQClientAPIImpl.cleanExpiredConsumeQueue(anyString(), anyLong())).thenReturn(true); }
Example #20
Source File: BrokerStatusSubCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); KVTable kvTable = new KVTable(); kvTable.setTable(new HashMap<String, String>()); when(mQClientAPIImpl.getBrokerRuntimeInfo(anyString(), anyLong())).thenReturn(kvTable); }
Example #21
Source File: CleanUnusedTopicCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); when(mQClientAPIImpl.cleanUnusedTopicByAddr(anyString(), anyLong())).thenReturn(true); }
Example #22
Source File: WipeWritePermSubCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, RemotingCommandException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); List<String> result = new ArrayList<>(); result.add("default-name-one"); result.add("default-name-two"); when(mqClientInstance.getMQClientAPIImpl().getNameServerAddressList()).thenReturn(result); when(mQClientAPIImpl.wipeWritePermOfBroker(anyString(), anyString(), anyLong())).thenReturn(6); }
Example #23
Source File: GetNamesrvConfigCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); Map<String, Properties> propertiesMap = new HashMap<>(); List<String> nameServers = new ArrayList<>(); when(mQClientAPIImpl.getNameServerConfig(ArgumentMatchers.<String>anyList(), anyLong())).thenReturn(propertiesMap); }
Example #24
Source File: ProducerConnectionSubCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); ProducerConnection producerConnection = new ProducerConnection(); Connection connection = new Connection(); connection.setClientAddr("127.0.0.1:9898"); connection.setClientId("PID_12345"); HashSet<Connection> connectionSet = new HashSet<>(); connectionSet.add(connection); producerConnection.setConnectionSet(connectionSet); when(mQClientAPIImpl.getProducerConnectionList(anyString(), anyString(), anyLong())).thenReturn(producerConnection); }
Example #25
Source File: ConsumerConnectionSubCommandTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); ConsumerConnection consumerConnection = new ConsumerConnection(); consumerConnection.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerConnection.setMessageModel(MessageModel.CLUSTERING); HashSet<Connection> connections = new HashSet<>(); connections.add(new Connection()); consumerConnection.setConnectionSet(connections); consumerConnection.setSubscriptionTable(new ConcurrentHashMap<String, SubscriptionData>()); consumerConnection.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); when(mQClientAPIImpl.getConsumerConnectionList(anyString(), anyString(), anyLong())).thenReturn(consumerConnection); }
Example #26
Source File: UpdateBrokerConfigSubCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); }
Example #27
Source File: SendMsgStatusCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); }
Example #28
Source File: GetBrokerConfigCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException, UnsupportedEncodingException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); Properties properties = new Properties(); properties.setProperty("maxMessageSize", "5000000"); properties.setProperty("flushDelayOffsetInterval", "15000"); properties.setProperty("serverSocketRcvBufSize", "655350"); when(mQClientAPIImpl.getBrokerConfig(anyString(), anyLong())).thenReturn(properties); }
Example #29
Source File: BrokerConsumeStatsSubCommadTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); ConsumeStatsList consumeStatsList = new ConsumeStatsList(); consumeStatsList.setBrokerAddr("127.0l.0.1:10911"); consumeStatsList.setConsumeStatsList(new ArrayList<Map<String, List<ConsumeStats>>>()); consumeStatsList.setTotalDiff(123); when(mQClientAPIImpl.fetchConsumeStatsInBroker(anyString(), anyBoolean(), anyLong())).thenReturn(consumeStatsList); }
Example #30
Source File: GetConsumerStatusCommandTest.java From rocketmq with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingException, MQClientException, MQBrokerException { mQClientAPIImpl = mock(MQClientAPIImpl.class); defaultMQAdminExt = new DefaultMQAdminExt(); defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000); Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance"); field.setAccessible(true); field.set(defaultMQAdminExtImpl, mqClientInstance); field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl"); field.setAccessible(true); field.set(mqClientInstance, mQClientAPIImpl); field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl"); field.setAccessible(true); field.set(defaultMQAdminExt, defaultMQAdminExtImpl); Map<String, Map<MessageQueue, Long>> consumerStatus = new HashMap<>(); when(mQClientAPIImpl.invokeBrokerToGetConsumerStatus(anyString(), anyString(), anyString(), anyString(), anyLong())).thenReturn(consumerStatus); }