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; package org.apache.activemq.broker.policy;
import javax.jms.Destination;
import org.apache.activemq.TestSupport; import org.apache.activemq.TestSupport;
import org.apache.activemq.broker.BrokerService; 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.PendingQueueMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.PendingSubscriberMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.PolicyEntry; import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy; import org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy;
import org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy; import org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy;
@ -29,12 +28,22 @@ import org.apache.activemq.xbean.BrokerFactoryBean;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
/** /**
*
* @version $Revision: 2765 $ * @version $Revision: 2765 $
*/ */
public class DestinationCursorConfigTest extends TestSupport { 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 { protected BrokerService createBroker() throws Exception {
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/policy/cursor.xml")); BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/broker/policy/cursor.xml"));
@ -43,20 +52,21 @@ public class DestinationCursorConfigTest extends TestSupport {
return answer; return answer;
} }
public void testConfiguration() throws Exception{ public void testQueueConfiguration() throws Exception {
BrokerService broker = createBroker(); super.topic = false;
super.topic=false; ActiveMQDestination destination = (ActiveMQDestination) createDestination("org.apache.foo");
ActiveMQDestination destination = (ActiveMQDestination)createDestination("org.apache.foo"); PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
PolicyEntry entry=broker.getDestinationPolicy().getEntryFor(destination);
PendingQueueMessageStoragePolicy policy = entry.getPendingQueuePolicy(); PendingQueueMessageStoragePolicy policy = entry.getPendingQueuePolicy();
assertNotNull(policy); assertNotNull(policy);
assert(policy instanceof VMPendingQueueMessageStoragePolicy); assertTrue("Policy is: " + policy, policy instanceof VMPendingQueueMessageStoragePolicy);
}
super.topic=true; public void testTopicConfiguration() throws Exception {
destination = (ActiveMQDestination)createDestination("org.apache.foo"); super.topic = true;
entry=broker.getDestinationPolicy().getEntryFor(destination); ActiveMQDestination destination = (ActiveMQDestination) createDestination("org.apache.foo");
PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
PendingSubscriberMessageStoragePolicy policy = entry.getPendingSubscriberPolicy();
assertNotNull(policy); assertNotNull(policy);
assert(policy instanceof VMPendingSubscriberMessageStoragePolicy); assertTrue("subscriberPolicy is: " + policy, policy instanceof VMPendingSubscriberMessageStoragePolicy);
} }
} }