clebertsuconic commented on code in PR #5158: URL: https://github.com/apache/activemq-artemis/pull/5158#discussion_r1723793127
########## tests/smoke-tests/src/test/java/org/apache/activemq/artemis/tests/smoke/brokerConnection/MirrorInfiniteRetryReplicaTest.java: ########## @@ -0,0 +1,309 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.activemq.artemis.tests.smoke.brokerConnection; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.Session; +import javax.jms.TextMessage; +import java.io.File; +import java.io.StringWriter; +import java.lang.invoke.MethodHandles; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import org.apache.activemq.artemis.api.core.management.SimpleManagement; +import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectionAddressType; +import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase; +import org.apache.activemq.artemis.tests.util.CFUtil; +import org.apache.activemq.artemis.util.ServerUtil; +import org.apache.activemq.artemis.utils.FileUtil; +import org.apache.activemq.artemis.utils.TestParameters; +import org.apache.activemq.artemis.utils.Wait; +import org.apache.activemq.artemis.utils.cli.helper.HelperCreate; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class MirrorInfiniteRetryReplicaTest extends SmokeTestBase { + + private static final String TEST_NAME = "LATE_RETRY_MIRROR_SOAK"; + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + // Set this to true and log4j will be configured with some relevant log.trace for the AckManager at the server's + private static final boolean REUSE_SERVERS = Boolean.parseBoolean(TestParameters.testProperty(TEST_NAME, "REUSE_SERVERS", "false")); + + /* + * Time each consumer takes to process a message received to allow some messages accumulating. + * This sleep happens right before the commit. + */ + private static final String QUEUE_NAME = "queueTest"; + + private static String body; + + static { + StringWriter writer = new StringWriter(); + while (writer.getBuffer().length() < 30 * 1024) { + writer.append("The sky is blue, ..... watch out for poop from the birds though!..."); + } + body = writer.toString(); + } + + public static final String DC1_NODE = "AckLateRetrySoakTest/DC1"; + public static final String DC2_NODE = "AckLateRetrySoakTest/DC2"; + public static final String DC2_REPLICA_NODE = "AckLateRetrySoakTest/DC2_REPLICA"; + public static final String DC1_REPLICA_NODE = "AckLateRetrySoakTest/DC1_REPLICA"; + + volatile Process processDC1; + volatile Process processDC2; + volatile Process processDC1_REPLICA; + volatile Process processDC2_REPLICA; + + @AfterEach + public void destroyServers() throws Exception { + if (processDC2_REPLICA != null) { + processDC2_REPLICA.destroyForcibly(); + processDC2_REPLICA.waitFor(1, TimeUnit.MINUTES); + processDC2_REPLICA = null; + } + if (processDC1_REPLICA != null) { + processDC1_REPLICA.destroyForcibly(); + processDC1_REPLICA.waitFor(1, TimeUnit.MINUTES); + processDC1_REPLICA = null; + } + if (processDC1 != null) { + processDC1.destroyForcibly(); + processDC1.waitFor(1, TimeUnit.MINUTES); + processDC1 = null; + } + if (processDC2 != null) { + processDC2.destroyForcibly(); + processDC2.waitFor(1, TimeUnit.MINUTES); + processDC2 = null; + } + } + + private static final String DC1_IP = "localhost:61616"; + private static final String DC1_BACKUP_IP = "localhost:61617"; + private static final String DC2_IP = "localhost:61618"; + private static final String DC2_BACKUP_IP = "localhost:61619"; + + private static String uri(String ip) { + return "tcp://" + ip; + } + + private static String uriWithAlternate(String ip, String alternate) { + return "tcp://" + ip + "#tcp://" + alternate; + } + + private static void createMirroredServer(String serverName, + String connectionName, + String mirrorURI, + int porOffset, Review Comment: fixed this with a separate commit as it's over everywhere.. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
