mirror of https://github.com/apache/activemq.git
tidy up the setting of the default policy
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@512259 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1cc049c5d0
commit
9ba5e1921c
|
@ -83,20 +83,20 @@ public class BrokerTestSupport extends CombinationTestSupport {
|
|||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
broker = createBroker();
|
||||
setDefaultPolicy(broker);
|
||||
PolicyMap policyMap = new PolicyMap();
|
||||
policyMap.setDefaultEntry(getDefaultPolicy());
|
||||
broker.setDestinationPolicy(policyMap);
|
||||
broker.start();
|
||||
}
|
||||
|
||||
protected void setDefaultPolicy(BrokerService brokerService) {
|
||||
PolicyEntry policy = new PolicyEntry();
|
||||
protected PolicyEntry getDefaultPolicy() {
|
||||
PolicyEntry policy = new PolicyEntry();
|
||||
policy.setDispatchPolicy(new RoundRobinDispatchPolicy());
|
||||
policy.setSubscriptionRecoveryPolicy(new FixedCountSubscriptionRecoveryPolicy());
|
||||
PolicyMap pMap = new PolicyMap();
|
||||
pMap.setDefaultEntry(policy);
|
||||
|
||||
broker.setDestinationPolicy(pMap);
|
||||
return policy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected BrokerService createBroker() throws Exception {
|
||||
BrokerService broker = BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=false"));
|
||||
return broker;
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.activemq.command.Message;
|
|||
import org.apache.activemq.command.MessageAck;
|
||||
import org.apache.activemq.command.ProducerInfo;
|
||||
import org.apache.activemq.command.SessionInfo;
|
||||
import org.apache.activemq.broker.region.policy.FixedCountSubscriptionRecoveryPolicy;
|
||||
import org.apache.activemq.broker.region.policy.PolicyMap;
|
||||
import org.apache.activemq.broker.region.policy.PolicyEntry;
|
||||
import org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy;
|
||||
|
@ -67,17 +68,15 @@ public class MessageExpirationTest extends BrokerTestSupport {
|
|||
protected BrokerService createBroker() throws Exception {
|
||||
BrokerService broker = new BrokerService();
|
||||
broker.setPersistent(false);
|
||||
|
||||
// lets disable spooling
|
||||
PolicyEntry policy = new PolicyEntry();
|
||||
policy.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
|
||||
|
||||
PolicyMap map = new PolicyMap();
|
||||
map.setDefaultEntry(policy);
|
||||
broker.setDestinationPolicy(map);
|
||||
|
||||
return broker;
|
||||
}
|
||||
|
||||
protected PolicyEntry getDefaultPolicy() {
|
||||
PolicyEntry policy = super.getDefaultPolicy();
|
||||
//disable spooling
|
||||
policy.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
|
||||
return policy;
|
||||
}
|
||||
|
||||
public void testMessagesWaitingForUssageDecreaseExpire() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue