Updated support for configurable Cursor types from the Destination Policy Map

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@500863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-01-28 19:39:30 +00:00
parent 0c0be94a31
commit b54ff7acff
1 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,62 @@
/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.broker.policy;
import javax.jms.Destination;
import org.apache.activemq.TestSupport;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.cursors.PendingMessageCursor;
import org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.xbean.BrokerFactoryBean;
import org.springframework.core.io.ClassPathResource;
/**
*
* @version $Revision: 2765 $
*/
public class DestinationCursorConfigTest extends TestSupport {
protected BrokerService createBroker() throws Exception {
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/policy/cursor.xml"));
factory.afterPropertiesSet();
BrokerService answer = factory.getBroker();
return answer;
}
public void testConfiguration() throws Exception{
BrokerService broker = createBroker();
super.topic=false;
ActiveMQDestination destination = (ActiveMQDestination)createDestination("org.apache.foo");
PolicyEntry entry=broker.getDestinationPolicy().getEntryFor(destination);
PendingQueueMessageStoragePolicy policy = entry.getPendingQueuePolicy();
assertNotNull(policy);
assert(policy instanceof VMPendingQueueMessageStoragePolicy);
super.topic=true;
destination = (ActiveMQDestination)createDestination("org.apache.foo");
entry=broker.getDestinationPolicy().getEntryFor(destination);
assertNotNull(policy);
assert(policy instanceof VMPendingSubscriberMessageStoragePolicy);
}
}