use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq by apache.
the class BrokerControllerTest method testBrokerRestart.
/**
* Tests if the controller can be properly stopped and started.
*
* @throws Exception If fails.
*/
@Test
public void testBrokerRestart() throws Exception {
BrokerController brokerController = new BrokerController(new BrokerConfig(), new NettyServerConfig(), new NettyClientConfig(), new MessageStoreConfig());
assertThat(brokerController.initialize());
brokerController.start();
brokerController.shutdown();
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig 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);
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq by apache.
the class IntegrationTestBase method createAndStartBroker.
public static BrokerController createAndStartBroker(String nsAddr) {
String baseDir = createBaseDir();
BrokerConfig brokerConfig = new BrokerConfig();
NettyServerConfig nettyServerConfig = new NettyServerConfig();
NettyClientConfig nettyClientConfig = new NettyClientConfig();
MessageStoreConfig storeConfig = new MessageStoreConfig();
brokerConfig.setBrokerName(BROKER_NAME_PREFIX + BROKER_INDEX.getAndIncrement());
brokerConfig.setBrokerIP1("127.0.0.1");
brokerConfig.setNamesrvAddr(nsAddr);
brokerConfig.setEnablePropertyFilter(true);
storeConfig.setStorePathRootDir(baseDir);
storeConfig.setStorePathCommitLog(baseDir + SEP + "commitlog");
storeConfig.setHaListenPort(8000 + random.nextInt(1000));
storeConfig.setMapedFileSizeCommitLog(COMMIT_LOG_SIZE);
storeConfig.setMaxIndexNum(INDEX_NUM);
storeConfig.setMaxHashSlotNum(INDEX_NUM * 4);
nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
BrokerController brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
try {
Assert.assertTrue(brokerController.initialize());
logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
brokerController.start();
} catch (Exception e) {
logger.info("Broker start failed");
System.exit(1);
}
BROKER_CONTROLLERS.add(brokerController);
return brokerController;
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq-externals by apache.
the class RocketMQServerMock method startBroker.
private void startBroker() throws Exception {
System.setProperty(RemotingCommand.REMOTING_VERSION_KEY, Integer.toString(MQVersion.CURRENT_VERSION));
BrokerConfig brokerConfig = new BrokerConfig();
brokerConfig.setNamesrvAddr(getNameServerAddr());
brokerConfig.setBrokerId(MixAll.MASTER_ID);
NettyServerConfig nettyServerConfig = new NettyServerConfig();
nettyServerConfig.setListenPort(brokerPort);
NettyClientConfig nettyClientConfig = new NettyClientConfig();
MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, messageStoreConfig);
boolean initResult = brokerController.initialize();
if (!initResult) {
brokerController.shutdown();
throw new Exception("Broker init failure!");
}
brokerController.start();
}
use of org.apache.rocketmq.remoting.netty.NettyServerConfig in project rocketmq-externals by apache.
the class RocketMQServerMock method startNameServer.
private void startNameServer() throws Exception {
NamesrvConfig namesrvConfig = new NamesrvConfig();
NettyServerConfig nettyServerConfig = new NettyServerConfig();
nettyServerConfig.setListenPort(nameServerPort);
nameServerController = new NamesrvController(namesrvConfig, nettyServerConfig);
boolean initResult = nameServerController.initialize();
if (!initResult) {
nameServerController.shutdown();
throw new Exception("Namesvr init failure!");
}
nameServerController.start();
}
Aggregations