activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r399701 - in /incubator/activemq/trunk/activemq-ra/src: main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java test/java/org/apache/activemq/ra/ActiveMQActivationSpecTest.java
Date Thu, 04 May 2006 13:42:08 GMT
Author: chirino
Date: Thu May  4 06:42:06 2006
New Revision: 399701

URL: http://svn.apache.org/viewcvs?rev=399701&view=rev
Log:
Applied John Sission's patch: https://issues.apache.org/activemq/browse/AMQ-705 Thanks John!

Modified:
    incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java
    incubator/activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQActivationSpecTest.java

Modified: incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java?rev=399701&r1=399700&r2=399701&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java
(original)
+++ incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java
Thu May  4 06:42:06 2006
@@ -381,6 +381,13 @@
     }
 
     private boolean isValidSubscriptionDurability(List errorMessages) {
+        // subscriptionDurability only applies to Topics
+        if ( DURABLE_SUBSCRIPTION.equals(subscriptionDurability) &&
+             getDestinationType() != null && !Topic.class.getName().equals(getDestinationType()))
{
+            errorMessages.add("subscriptionDurability cannot be set to: "+DURABLE_SUBSCRIPTION+"
when destinationType is set to "+
+                Queue.class.getName()+" as it is only valid when destinationType is set to
"+Topic.class.getName()+".");
+            return false;
+        }
         if (NON_DURABLE_SUBSCRIPTION.equals(subscriptionDurability) || DURABLE_SUBSCRIPTION.equals(subscriptionDurability))
             return true;
         errorMessages.add("subscriptionDurability must be set to: "+NON_DURABLE_SUBSCRIPTION+"
or "+DURABLE_SUBSCRIPTION+".");

Modified: incubator/activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQActivationSpecTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQActivationSpecTest.java?rev=399701&r1=399700&r2=399701&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQActivationSpecTest.java
(original)
+++ incubator/activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/ActiveMQActivationSpecTest.java
Thu May  4 06:42:06 2006
@@ -197,14 +197,25 @@
 
 //----------- durable subscriber tests    
     public void testValidDurableSubscriber() {
+        activationSpec.setDestinationType(Topic.class.getName());
         activationSpec.setSubscriptionDurability(ActiveMQActivationSpec.DURABLE_SUBSCRIPTION);
         activationSpec.setClientId("foobar");
         activationSpec.setSubscriptionName("foobar");
         assertActivationSpecValid();        
         assertTrue(activationSpec.isDurableSubscription());
     }
+
+    public void testDurableSubscriberWithQueueDestinationTypeFailure() {
+        activationSpec.setDestinationType(Queue.class.getName());
+        activationSpec.setSubscriptionDurability(ActiveMQActivationSpec.DURABLE_SUBSCRIPTION);
+        activationSpec.setClientId("foobar");
+        activationSpec.setSubscriptionName("foobar");
+        PropertyDescriptor[] expected = {subscriptionDurabilityProperty};
+        assertActivationSpecInvalid(expected);
+    }
     
     public void testDurableSubscriberNoClientIdNoSubscriptionNameFailure() {
+        activationSpec.setDestinationType(Topic.class.getName());
         activationSpec.setSubscriptionDurability(ActiveMQActivationSpec.DURABLE_SUBSCRIPTION);
         activationSpec.setClientId(null);
         assertNull(activationSpec.getClientId());
@@ -215,6 +226,7 @@
     }    
     
     public void testDurableSubscriberEmptyClientIdEmptySubscriptionNameFailure() {
+        activationSpec.setDestinationType(Topic.class.getName());
         activationSpec.setSubscriptionDurability(ActiveMQActivationSpec.DURABLE_SUBSCRIPTION);
         activationSpec.setClientId(EMPTY_STRING);
         assertNull(activationSpec.getClientId());



Mime
View raw message