gemmellr commented on a change in pull request #3969:
URL: https://github.com/apache/activemq-artemis/pull/3969#discussion_r817968168
##########
File path:
tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
##########
@@ -123,4 +124,20 @@ public void testAutoStart() throws Exception {
assertTrue(server.getRemotingService().getAcceptor("start").isStarted());
assertFalse(server.getRemotingService().getAcceptor("noStart").isStarted());
}
+
+ @Test
+ public void testActualPort() throws Exception {
+ String acceptor1Name = RandomUtil.randomString();
+ String acceptor2Name = RandomUtil.randomString();
+ String acceptor3Name = RandomUtil.randomString();
+ ActiveMQServer server = createServer(false, createDefaultInVMConfig());
+ server.getConfiguration().addAcceptorConfiguration(acceptor1Name,
"tcp://127.0.0.1:0");
+ server.getConfiguration().addAcceptorConfiguration(acceptor2Name,
"tcp://127.0.0.1:0");
+ server.getConfiguration().addAcceptorConfiguration(acceptor3Name,
"tcp://127.0.0.1:61616");
+ server.start();
Review comment:
Yep I think it will be (thats what prompted my comment about the
volatile) so that is a good point.
##########
File path:
tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java
##########
@@ -123,4 +124,20 @@ public void testAutoStart() throws Exception {
assertTrue(server.getRemotingService().getAcceptor("start").isStarted());
assertFalse(server.getRemotingService().getAcceptor("noStart").isStarted());
}
+
+ @Test
+ public void testActualPort() throws Exception {
+ String acceptor1Name = RandomUtil.randomString();
+ String acceptor2Name = RandomUtil.randomString();
+ String acceptor3Name = RandomUtil.randomString();
+ ActiveMQServer server = createServer(false, createDefaultInVMConfig());
+ server.getConfiguration().addAcceptorConfiguration(acceptor1Name,
"tcp://127.0.0.1:0");
+ server.getConfiguration().addAcceptorConfiguration(acceptor2Name,
"tcp://127.0.0.1:0");
+ server.getConfiguration().addAcceptorConfiguration(acceptor3Name,
"tcp://127.0.0.1:61616");
+ server.start();
+
assertTrue(((NettyAcceptor)server.getRemotingService().getAcceptor(acceptor1Name)).getActualPort()
!= 0);
Review comment:
Having to get the remoting service from the server, then the acceptor
from that, then cast the acceptor to NettyAcceptor to then use this is still
all a bit ugly. Even getting rid of the last bit if nothing else would be a
decent improvement. The 'invm' acceptor seems to have an 'id' concept, could it
return that for this and let the interface have a method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]