use of org.apache.rocketmq.common.namesrv.NamesrvConfig in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.
the class ClusterTestRequestProcessorTest method init.
@Before
public void init() throws NoSuchFieldException, IllegalAccessException, RemotingException, MQClientException, InterruptedException {
NamesrvController namesrvController = new NamesrvController(new NamesrvConfig(), new NettyServerConfig());
clusterTestProcessor = new ClusterTestRequestProcessor(namesrvController, "default-producer");
mQClientAPIImpl = mock(MQClientAPIImpl.class);
DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000);
ctx = mock(ChannelHandlerContext.class);
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 = ClusterTestRequestProcessor.class.getDeclaredField("adminExt");
field.setAccessible(true);
field.set(clusterTestProcessor, defaultMQAdminExt);
TopicRouteData topicRouteData = new TopicRouteData();
List<BrokerData> brokerDatas = new ArrayList<>();
HashMap<Long, String> brokerAddrs = new HashMap<>();
brokerAddrs.put(1234l, "127.0.0.1:10911");
BrokerData brokerData = new BrokerData();
brokerData.setCluster("default-cluster");
brokerData.setBrokerName("default-broker");
brokerData.setBrokerAddrs(brokerAddrs);
brokerDatas.add(brokerData);
topicRouteData.setBrokerDatas(brokerDatas);
when(mQClientAPIImpl.getTopicRouteInfoFromNameServer(anyString(), anyLong())).thenReturn(topicRouteData);
}
use of org.apache.rocketmq.common.namesrv.NamesrvConfig in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.
the class DefaultRequestProcessorTest method init.
@Before
public void init() throws Exception {
namesrvConfig = new NamesrvConfig();
nettyServerConfig = new NettyServerConfig();
routeInfoManager = new RouteInfoManager();
namesrvController = new NamesrvController(namesrvConfig, nettyServerConfig);
Field field = NamesrvController.class.getDeclaredField("routeInfoManager");
field.setAccessible(true);
field.set(namesrvController, routeInfoManager);
defaultRequestProcessor = new DefaultRequestProcessor(namesrvController);
registerRouteInfoManager();
logger = mock(Logger.class);
when(logger.isInfoEnabled()).thenReturn(false);
setFinalStatic(DefaultRequestProcessor.class.getDeclaredField("log"), logger);
}
use of org.apache.rocketmq.common.namesrv.NamesrvConfig in project rocketmq by apache.
the class DefaultRequestProcessorTest method init.
@Before
public void init() throws Exception {
namesrvConfig = new NamesrvConfig();
nettyServerConfig = new NettyServerConfig();
routeInfoManager = new RouteInfoManager();
namesrvController = new NamesrvController(namesrvConfig, nettyServerConfig);
Field field = NamesrvController.class.getDeclaredField("routeInfoManager");
field.setAccessible(true);
field.set(namesrvController, routeInfoManager);
defaultRequestProcessor = new DefaultRequestProcessor(namesrvController);
registerRouteInfoManager();
logger = mock(Logger.class);
when(logger.isInfoEnabled()).thenReturn(false);
setFinalStatic(DefaultRequestProcessor.class.getDeclaredField("log"), logger);
}
Aggregations