AMQ-7118 - Override hostname for naming to allow tests to apss on all

platforms
This commit is contained in:
Jeff Genender 2019-01-07 17:03:20 -07:00
parent b86c666c40
commit 273afef47c
1 changed files with 7 additions and 0 deletions

View File

@ -16,9 +16,11 @@
*/ */
package org.apache.activemq.bugs; package org.apache.activemq.bugs;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerFactory; import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.command.ConnectionId;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -51,6 +53,7 @@ public class AMQ7118Test {
private final String xbean = "xbean:"; private final String xbean = "xbean:";
private final String confBase = "src/test/resources/org/apache/activemq/bugs/amq7118"; private final String confBase = "src/test/resources/org/apache/activemq/bugs/amq7118";
int checkpointIndex = 0; int checkpointIndex = 0;
protected long idGenerator;
private static final ActiveMQConnectionFactory ACTIVE_MQ_CONNECTION_FACTORY = new ActiveMQConnectionFactory(WIRE_LEVEL_ENDPOINT); 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 { public void setupProducerConnection() throws Exception {
producerConnection = ACTIVE_MQ_CONNECTION_FACTORY.createConnection(); 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(); producerConnection.start();
pSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); pSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
} }