AMQ-7118 - Override hostname for naming to allow tests to apss on all
authorJeff Genender <jgenender@savoirtech.com>
Tue, 8 Jan 2019 00:03:20 +0000 (17:03 -0700)
committerJeff Genender <jgenender@savoirtech.com>
Tue, 8 Jan 2019 00:07:08 +0000 (17:07 -0700)
platforms

activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ7118Test.java

index 0e845d2..d637fb9 100644 (file)
  */
 package org.apache.activemq.bugs;
 
+import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.command.ConnectionId;
 import org.apache.commons.lang.StringUtils;
 import org.junit.After;
 import org.junit.Before;
@@ -51,6 +53,7 @@ public class AMQ7118Test {
     private final String xbean = "xbean:";
     private final String confBase = "src/test/resources/org/apache/activemq/bugs/amq7118";
     int checkpointIndex = 0;
+    protected long idGenerator;
 
     private static final ActiveMQConnectionFactory ACTIVE_MQ_CONNECTION_FACTORY = new ActiveMQConnectionFactory(WIRE_LEVEL_ENDPOINT);
 
@@ -67,6 +70,10 @@ public class AMQ7118Test {
 
     public void setupProducerConnection() throws Exception {
         producerConnection = ACTIVE_MQ_CONNECTION_FACTORY.createConnection();
+
+        //Small hack to be sure the message IDs are the same across platforms when testing
+        ((ActiveMQConnection)producerConnection).getConnectionInfo().setConnectionId(new ConnectionId("connection:" + (++idGenerator)));
+
         producerConnection.start();
         pSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
     }