[jboss-cvs] JBoss Messaging SVN: r3761 - in branches/Branch_Stable: tests/src/org/jboss/test/messaging/jms/server/destination/base and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 21 12:41:31 EST 2008


Author: timfox
Date: 2008-02-21 12:41:31 -0500 (Thu, 21 Feb 2008)
New Revision: 3761

Modified:
   branches/Branch_Stable/src/main/org/jboss/jms/server/destination/QueueService.java
   branches/Branch_Stable/src/main/org/jboss/jms/server/destination/TopicService.java
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/server/destination/base/DestinationManagementTestBase.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-1235


Modified: branches/Branch_Stable/src/main/org/jboss/jms/server/destination/QueueService.java
===================================================================
--- branches/Branch_Stable/src/main/org/jboss/jms/server/destination/QueueService.java	2008-02-21 17:37:28 UTC (rev 3760)
+++ branches/Branch_Stable/src/main/org/jboss/jms/server/destination/QueueService.java	2008-02-21 17:41:31 UTC (rev 3761)
@@ -82,6 +82,17 @@
          		throw new IllegalStateException("Cannot deploy queue " + destination.getName() + " it is already deployed");
          	}
          	
+         	//Sanity check - currently it is not possible to change the clustered attribute of a destination
+         	//See http://jira.jboss.org/jira/browse/JBMESSAGING-1235
+         	
+         	if (destination.isClustered() != queue.isClustered())
+         	{
+         		throw new IllegalArgumentException("Queue " + destination.getName() + " is already deployed as clustered = " +
+         				                             queue.isClustered() + " so cannot redeploy as clustered=" + destination.isClustered() +
+         				                             " . You must delete the destination first before redeploying");
+         		
+         	}
+         	
             queue.setPagingParams(destination.getFullSize(),
                                   destination.getPageSize(),
                                   destination.getDownCacheSize());  

Modified: branches/Branch_Stable/src/main/org/jboss/jms/server/destination/TopicService.java
===================================================================
--- branches/Branch_Stable/src/main/org/jboss/jms/server/destination/TopicService.java	2008-02-21 17:37:28 UTC (rev 3760)
+++ branches/Branch_Stable/src/main/org/jboss/jms/server/destination/TopicService.java	2008-02-21 17:41:31 UTC (rev 3761)
@@ -74,6 +74,14 @@
          while (iter.hasNext())
          {
             Queue queue = (Queue)iter.next();
+            
+            if (destination.isClustered() != queue.isClustered())
+         	{
+         		throw new IllegalArgumentException("Topic " + destination.getName() + " is already deployed as clustered = " +
+         				                             queue.isClustered() + " so cannot redeploy as clustered=" + destination.isClustered() +
+         				                             " . You must delete the destination first before redeploying");
+         		
+         	}
                      
             //TODO We need to set the paging params this way since the post office doesn't store them
             //instead we should never create queues inside the postoffice - only do it at deploy time

Modified: branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/server/destination/base/DestinationManagementTestBase.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/server/destination/base/DestinationManagementTestBase.java	2008-02-21 17:37:28 UTC (rev 3760)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/server/destination/base/DestinationManagementTestBase.java	2008-02-21 17:41:31 UTC (rev 3761)
@@ -382,6 +382,40 @@
       assertFalse(destinationIsDeployed(destinationName, isQueue()));
    }
    
+   public void testChangeClustered() throws Exception
+   {
+   	if (this.isQueue())
+   	{
+         ServerManagement.deployQueue("blobQueue", null, 1000, 100, 100, 0, true);
+         
+         ServerManagement.undeployQueue("blobQueue");
+         
+         try
+         {
+         	ServerManagement.deployQueue("blobQueue", null, 1000, 100, 100, 0, false);
+         }
+         catch (Exception e)
+         {
+         	//Ok
+         }
+   	}
+   	else
+   	{
+   		ServerManagement.deployTopic("blobTopic", null, 1000, 100, 100, 0, true);
+         
+         ServerManagement.undeployTopic("blobTopic");
+         
+         try
+         {
+         	ServerManagement.deployTopic("blobTopic", null, 1000, 100, 100, 0, false);
+         }
+         catch (Exception e)
+         {
+         	//Ok
+         }
+   	}      
+   }
+   
    public void testDestroyDestinationProgrammatically() throws Exception
    {
       ObjectName serverPeerObjectName = ServerManagement.getServerPeerObjectName();




More information about the jboss-cvs-commits mailing list