AMQ-7118 ensure message size and usage is constant for the test, fix failure
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ7118Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ7118Test.java
index d637fb9..774422f 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ7118Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ7118Test.java
@@ -16,11 +16,9 @@
*/
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;
@@ -53,7 +51,6 @@
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);
@@ -61,6 +58,7 @@
public void setup() throws Exception {
deleteData(new File("target/data"));
createBroker();
+ ACTIVE_MQ_CONNECTION_FACTORY.setConnectionIDPrefix("bla");
}
@After
@@ -70,10 +68,6 @@
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);
}
@@ -139,11 +133,11 @@
LOG.info("All messages Consumed.");
//Clean up the log files and be sure its stable
- checkFiles(true, 2, "db-33.log");
- checkFiles(true, 3, "db-34.log");
- checkFiles(true, 2, "db-34.log");
- checkFiles(true, 2, "db-34.log");
- checkFiles(true, 2, "db-34.log");
+ checkFiles(true, 2, "db-30.log");
+ checkFiles(true, 3, "db-31.log");
+ checkFiles(true, 2, "db-31.log");
+ checkFiles(true, 2, "db-31.log");
+ checkFiles(true, 2, "db-31.log");
broker.stop();
broker.waitUntilStopped();
diff --git a/activemq-unit-tests/src/test/resources/org/apache/activemq/bugs/amq7118/activemq.xml b/activemq-unit-tests/src/test/resources/org/apache/activemq/bugs/amq7118/activemq.xml
index b610ae0..e27e937 100644
--- a/activemq-unit-tests/src/test/resources/org/apache/activemq/bugs/amq7118/activemq.xml
+++ b/activemq-unit-tests/src/test/resources/org/apache/activemq/bugs/amq7118/activemq.xml
@@ -24,7 +24,7 @@
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
- <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="target/data">
+ <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" brokerId="brokerId" dataDirectory="target/data">
<destinationPolicy>
<policyMap>