since https://issues.apache.org/jira/browse/AMQ-4495 always pulls in maxPageSize messages and allows for exceeding the MemoryLimit we must adjust the test case to account for that.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1485383 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-05-22 20:00:46 +00:00
parent 649876b931
commit 48b404869f
1 changed files with 24 additions and 9 deletions

View File

@ -16,9 +16,25 @@
*/
package org.apache.activemq.usecases;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.net.URI;
import java.util.Enumeration;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.QueueBrowser;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnector;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.PolicyMap;
import org.apache.activemq.command.ActiveMQQueue;
import org.junit.After;
import org.junit.Before;
@ -26,13 +42,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.*;
import java.io.IOException;
import java.net.URI;
import java.util.Enumeration;
import static org.junit.Assert.assertEquals;
public class QueueBrowsingTest {
private static final Logger LOG = LoggerFactory.getLogger(QueueBrowsingTest.class);
@ -40,7 +49,7 @@ public class QueueBrowsingTest {
private BrokerService broker;
private URI connectUri;
private ActiveMQConnectionFactory factory;
private final int maxPageSize = 100;
@Before
public void startBroker() throws Exception {
@ -49,6 +58,12 @@ public class QueueBrowsingTest {
broker.deleteAllMessages();
broker.start();
broker.waitUntilStarted();
PolicyEntry policy = new PolicyEntry();
policy.setMaxPageSize(maxPageSize);
broker.setDestinationPolicy(new PolicyMap());
broker.getDestinationPolicy().setDefaultEntry(policy);
connectUri = connector.getConnectUri();
factory = new ActiveMQConnectionFactory(connectUri);
}
@ -194,6 +209,6 @@ public class QueueBrowsingTest {
}
browser.close();
assertEquals(3, received);
assertEquals(maxPageSize + 2, received);
}
}