[jboss-cvs] JBoss Messaging SVN: r5961 - in branches/Branch_1_4: src/main/org/jboss/messaging/core/impl/postoffice and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 2 09:34:00 EST 2009


Author: gaohoward
Date: 2009-03-02 09:34:00 -0500 (Mon, 02 Mar 2009)
New Revision: 5961

Added:
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeManagementTest.java
Modified:
   branches/Branch_1_4/integration/EAP4/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java
   branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
   branches/Branch_1_4/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java
Log:
JBMESSAGING-1516


Modified: branches/Branch_1_4/integration/EAP4/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java
===================================================================
--- branches/Branch_1_4/integration/EAP4/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2009-03-02 14:13:16 UTC (rev 5960)
+++ branches/Branch_1_4/integration/EAP4/tests-src/org/jboss/test/messaging/tools/container/LocalTestServer.java	2009-03-02 14:34:00 UTC (rev 5961)
@@ -513,6 +513,11 @@
       return serverPeerObjectName;
    }
 
+   public ObjectName getPostOfficeObjectName()
+   {
+      return postOfficeObjectName;
+   }
+
    public Set getConnectorSubsystems() throws Exception
    {
       RemotingJMXWrapper remoting = (RemotingJMXWrapper)sc.getService(ServiceContainer.REMOTING_OBJECT_NAME);

Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2009-03-02 14:13:16 UTC (rev 5960)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2009-03-02 14:34:00 UTC (rev 5961)
@@ -240,6 +240,16 @@
       
    // Constructors ---------------------------------------------------------------------------------
 
+   public boolean isFailoverOnNodeLeave()
+   {
+      return failoverOnNodeLeave;
+   }
+
+   public void setFailoverOnNodeLeave(boolean failoverOnNodeLeave)
+   {
+      this.failoverOnNodeLeave = failoverOnNodeLeave;
+   }
+
    /*
     * Constructor for a non clustered post office
     */

Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java	2009-03-02 14:13:16 UTC (rev 5960)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/jmx/MessagingPostOfficeService.java	2009-03-02 14:34:00 UTC (rev 5961)
@@ -326,17 +326,23 @@
    
 	public boolean isFailoverOnNodeLeave()
 	{
-		return failoverOnNodeLeave;
+	   if (started)
+	   {
+		   return postOffice.isFailoverOnNodeLeave();
+	   }
+	   return failoverOnNodeLeave;
 	}
 
-	public void setFailoverOnNodeLeave(boolean failoverOnNodeLeave)
+	public void setFailoverOnNodeLeave(boolean fover)
 	{
-		if (started)
-      {
-         log.warn("Cannot set attribute when service is started");
-         return;
-      }
-		this.failoverOnNodeLeave = failoverOnNodeLeave;
+	   if (started)
+	   {
+	      postOffice.setFailoverOnNodeLeave(fover);
+	   }
+	   else
+	   {
+	      failoverOnNodeLeave = fover;
+	   }
 	}
 
    

Added: branches/Branch_1_4/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeManagementTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeManagementTest.java	                        (rev 0)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeManagementTest.java	2009-03-02 14:34:00 UTC (rev 5961)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.test.messaging.core.postoffice;
+
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.core.PostOfficeTestBase;
+import org.jboss.test.messaging.jms.JMSTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
+
+/**
+ * A PostOfficeManagementTest
+ *
+ * @author <a href="mailto:hgao at redhat.com">Howard Gao</a>
+ *
+ *
+ */
+public class PostOfficeManagementTest extends MessagingTestCase
+{
+
+   /**
+    * @param name
+    */
+   public PostOfficeManagementTest(String name)
+   {
+      super(name);
+   }
+   
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      
+      ServerManagement.stop();
+      
+      ServerManagement.start("all");
+            
+   }
+
+   public void tearDown() throws Exception
+   {
+      super.tearDown();
+      
+      ServerManagement.stop();
+   }
+   
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+   public void testDeployAndPropertyChange() throws Exception
+   {
+      ObjectName poName = ServerManagement.getServer(0).getPostOfficeObjectName();
+      boolean failoverOnNodeLeave = ((Boolean)ServerManagement.getAttribute(poName, "FailoverOnNodeLeave")).booleanValue();
+      assertFalse(failoverOnNodeLeave);
+      ServerManagement.setAttribute(poName, "FailoverOnNodeLeave", "true");
+      failoverOnNodeLeave = ((Boolean)ServerManagement.getAttribute(poName, "FailoverOnNodeLeave")).booleanValue();
+      assertTrue(failoverOnNodeLeave);
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   // Inner classes -------------------------------------------------
+
+}

Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2009-03-02 14:13:16 UTC (rev 5960)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/RMITestServer.java	2009-03-02 14:34:00 UTC (rev 5961)
@@ -303,6 +303,11 @@
       return server.getServerPeerObjectName();
    }
 
+   public ObjectName getPostOfficeObjectName() throws Exception
+   {
+      return server.getPostOfficeObjectName();
+   }
+
    public boolean isStarted() throws Exception
    {
       return server.isStarted();

Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java	2009-03-02 14:13:16 UTC (rev 5960)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/tools/container/Server.java	2009-03-02 14:34:00 UTC (rev 5961)
@@ -296,4 +296,6 @@
 
    void deployConnectionFactory(String objectName, String[] jndiBindings, boolean strictTck) throws Exception;
 
+   ObjectName getPostOfficeObjectName() throws Exception;
+
 }




More information about the jboss-cvs-commits mailing list