From f7e9206ae55068b9c6cc5928741f849f3df19fbf Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Fri, 23 Feb 2007 10:46:43 +0000 Subject: [PATCH] Add a default policy entry, now that FixedSizeSubsctionRecoveryPolicy is no longer set by default on a Topic. It was a memory issue for large messages. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@510899 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/broker/BrokerTestSupport.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java index 85195fc009..947d74eecd 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java @@ -30,6 +30,10 @@ import javax.jms.MessageNotWriteableException; import org.apache.activemq.CombinationTestSupport; import org.apache.activemq.broker.region.RegionBroker; +import org.apache.activemq.broker.region.policy.FixedCountSubscriptionRecoveryPolicy; +import org.apache.activemq.broker.region.policy.PolicyEntry; +import org.apache.activemq.broker.region.policy.PolicyMap; +import org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQTextMessage; import org.apache.activemq.command.ConnectionId; @@ -79,11 +83,23 @@ public class BrokerTestSupport extends CombinationTestSupport { protected void setUp() throws Exception { super.setUp(); broker = createBroker(); + setDefaultPolicy(broker); broker.start(); } + + protected void setDefaultPolicy(BrokerService brokerService) { + PolicyEntry policy = new PolicyEntry(); + policy.setDispatchPolicy(new RoundRobinDispatchPolicy()); + policy.setSubscriptionRecoveryPolicy(new FixedCountSubscriptionRecoveryPolicy()); + PolicyMap pMap = new PolicyMap(); + pMap.setDefaultEntry(policy); + + broker.setDestinationPolicy(pMap); + } protected BrokerService createBroker() throws Exception { - return BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=false")); + BrokerService broker = BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=false")); + return broker; } protected void tearDown() throws Exception {