fixed bad failing test

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@515657 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-03-07 17:37:13 +00:00
parent ec14f6569d
commit f8d86bce28
1 changed files with 26 additions and 16 deletions

View File

@ -16,11 +16,10 @@
*/
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.PendingSubscriberMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy;
@ -29,13 +28,23 @@ import org.apache.activemq.xbean.BrokerFactoryBean;
import org.springframework.core.io.ClassPathResource;
/**
*
* @version $Revision: 2765 $
*/
public class DestinationCursorConfigTest extends TestSupport {
protected BrokerService broker;
@Override
protected void setUp() throws Exception {
broker = createBroker();
super.setUp();
}
@Override
protected void tearDown() throws Exception {
broker.stop();
super.tearDown();
}
protected BrokerService createBroker() throws Exception {
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/policy/cursor.xml"));
factory.afterPropertiesSet();
@ -43,20 +52,21 @@ public class DestinationCursorConfigTest extends TestSupport {
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);
public void testQueueConfiguration() throws Exception {
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);
assertTrue("Policy is: " + policy, policy instanceof VMPendingQueueMessageStoragePolicy);
}
public void testTopicConfiguration() throws Exception {
super.topic = true;
ActiveMQDestination destination = (ActiveMQDestination) createDestination("org.apache.foo");
PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
PendingSubscriberMessageStoragePolicy policy = entry.getPendingSubscriberPolicy();
assertNotNull(policy);
assert(policy instanceof VMPendingSubscriberMessageStoragePolicy);
assertTrue("subscriberPolicy is: " + policy, policy instanceof VMPendingSubscriberMessageStoragePolicy);
}
}