gemmellr commented on code in PR #5220: URL: https://github.com/apache/activemq-artemis/pull/5220#discussion_r1871147900
########## tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/connect/AMQPMirrorConnectionTest.java: ########## @@ -229,6 +271,173 @@ public void testBrokerAddsAddressAndQueue() throws Exception { } } + @Override + protected void configureAMQPAcceptorParameters(Map<String, Object> params) { + params.put("amqpMinLargeMessageSize", 100 * 1024); + } + + @Test + @Timeout(20) + public void testNoForwardBlocksMessagesAndControlsPropagation() throws Exception { + doTestNoForwardBlocksMessagesAndControlsPropagation(false, false); + } + + @Test + @Timeout(20) + public void testNoForwardBlocksMessagesAndControlsPropagationWithTunneling() throws Exception { + doTestNoForwardBlocksMessagesAndControlsPropagation(true, false); + } + + @Test + @Timeout(20) + public void testNoForwardBlocksLargeMessagesAndControlsPropagation() throws Exception { + doTestNoForwardBlocksMessagesAndControlsPropagation(false, true); + } + + @Test + @Timeout(20) + public void testNoForwardBlocksLargeMessagesAndControlsPropagationWithTunneling() throws Exception { + doTestNoForwardBlocksMessagesAndControlsPropagation(true, true); + } + + private void doTestNoForwardBlocksMessagesAndControlsPropagation(boolean tunneling, boolean longMessage) throws Exception { + final Map<String, Object> brokerProperties = new HashMap<>(); + brokerProperties.put(AMQPMirrorControllerSource.BROKER_ID.toString(), "Test-Broker"); + + final String[] capabilities; + ArrayList<String> capabilitiesList = new ArrayList<>(); + int messageFormat = 0; + + capabilitiesList.add("amq.mirror"); + if (tunneling) { + capabilitiesList.add(AmqpSupport.CORE_MESSAGE_TUNNELING_SUPPORT.toString()); + messageFormat = AMQP_TUNNELED_CORE_MESSAGE_FORMAT; + } + capabilities = capabilitiesList.toArray(new String[]{}); + + // Topology of the test: server -(noForward)-> server_2 -> peer_3 + try (ProtonTestServer peer_3 = new ProtonTestServer()) { + peer_3.expectSASLPlainConnect("user", "pass", "PLAIN", "ANONYMOUS"); + peer_3.expectOpen().respond(); + peer_3.expectBegin().respond(); + peer_3.expectAttach().ofSender() + .withName(Matchers.startsWith("$ACTIVEMQ_ARTEMIS_MIRROR")) + .withDesiredCapabilities(capabilities) + .respond() + .withOfferedCapabilities(capabilities) + .withPropertiesMap(brokerProperties); + peer_3.remoteFlow().withLinkCredit(10).queue(); + peer_3.start(); + + final URI remoteURI = peer_3.getServerURI(); + logger.info("Connect test started, peer listening on: {}", remoteURI); + + final int AMQP_PORT_2 = BROKER_PORT_NUM + 1; + final ActiveMQServer server_2 = createServer(AMQP_PORT_2, false); + { + AMQPBrokerConnectConfiguration amqpConnection = new AMQPBrokerConnectConfiguration(getTestMethodName() + "toPeer3", "tcp://" + remoteURI.getHost() + ":" + remoteURI.getPort()); + amqpConnection.setReconnectAttempts(0);// No reconnects + amqpConnection.setUser("user"); + amqpConnection.setPassword("pass"); + amqpConnection.addElement(new AMQPMirrorBrokerConnectionElement().addProperty(TUNNEL_CORE_MESSAGES, Boolean.toString(tunneling)).setQueueCreation(true).setAddressFilter(getQueueName() + ",sometest")); + server_2.getConfiguration().addAMQPConnection(amqpConnection); + + amqpConnection = new AMQPBrokerConnectConfiguration(getTestMethodName() + "toServer", "tcp://localhost:" + BROKER_PORT_NUM); + amqpConnection.addElement(new AMQPMirrorBrokerConnectionElement().setAddressFilter(getQueueName())); + server_2.getConfiguration().addAMQPConnection(amqpConnection); + } + + { + AMQPBrokerConnectConfiguration amqpConnection = new AMQPBrokerConnectConfiguration(getTestMethodName() + "toServer2", "tcp://localhost:" + AMQP_PORT_2).setRetryInterval(50); Review Comment: That doesnt change the need for setting a retry limit though. Its probably better to set the interval as well when setting the limit actually, so that you fully specify and thus control the resulting 'timeout' as it were. -- 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: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact