You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2007/03/07 18:37:14 UTC

svn commit: r515657 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java

Author: jstrachan
Date: Wed Mar  7 09:37:13 2007
New Revision: 515657

URL: http://svn.apache.org/viewvc?view=rev&rev=515657
Log:
fixed bad failing test

Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java?view=diff&rev=515657&r1=515656&r2=515657
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/policy/DestinationCursorConfigTest.java Wed Mar  7 09:37:13 2007
@@ -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.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 @@
         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);
     }
 }