[hornetq-commits] JBoss hornetq SVN: r11735 - in branches/Branch_2_2_EAP: tests/src/org/hornetq/tests/integration/cluster and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Nov 21 20:50:41 EST 2011


Author: clebert.suconic at jboss.com
Date: 2011-11-21 20:50:41 -0500 (Mon, 21 Nov 2011)
New Revision: 11735

Added:
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java
Removed:
   branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/InVMNodeManager.java
Modified:
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
Log:
Moving InVMNodeManager to test packages as it was supposed to be done (no semantic changes on this commit)

Deleted: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/InVMNodeManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/InVMNodeManager.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/InVMNodeManager.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -1,144 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- *  Red Hat licenses this file to you under the Apache License, version
- *  2.0 (the "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *     http://www.apache.org/licenses/LICENSE-2.0
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- *  implied.  See the License for the specific language governing
- *  permissions and limitations under the License.
- */
-
-package org.hornetq.core.server.impl;
-
-import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.server.NodeManager;
-import org.hornetq.utils.UUIDGenerator;
-
-import java.util.concurrent.Semaphore;
-
-import static org.hornetq.core.server.impl.InVMNodeManager.State.*;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.com">Andy Taylor</a>
- *         Date: Oct 13, 2010
- *         Time: 3:55:47 PM
- */
-public class InVMNodeManager extends NodeManager
-{
-
-   private Semaphore liveLock;
-
-   private Semaphore backupLock;
-
-   public enum State {LIVE, PAUSED, FAILING_BACK, NOT_STARTED}
-
-   public State state = NOT_STARTED;
-
-   public InVMNodeManager()
-   {
-      liveLock = new Semaphore(1);
-      backupLock = new Semaphore(1);
-      uuid = UUIDGenerator.getInstance().generateUUID();
-      nodeID = new SimpleString(uuid.toString());
-   }
-
-   @Override
-   public void awaitLiveNode() throws Exception
-   {
-      do
-      {
-         while (state == NOT_STARTED)
-         {
-            Thread.sleep(2000);
-         }
-
-         liveLock.acquire();
-
-         if (state == PAUSED)
-         {
-            liveLock.release();
-            Thread.sleep(2000);
-         }
-         else if (state == FAILING_BACK)
-         {
-            liveLock.release();
-            Thread.sleep(2000);
-         }
-         else if (state == LIVE)
-         {
-            break;
-         }
-      }
-      while (true);
-   }
-
-   @Override
-   public void startBackup() throws Exception
-   {
-      backupLock.acquire();
-   }
-
-   @Override
-   public void startLiveNode() throws Exception
-   {
-      state = FAILING_BACK;
-      liveLock.acquire();
-      state = LIVE;
-   }
-
-   @Override
-   public void pauseLiveServer() throws Exception
-   {
-      state = PAUSED;
-      liveLock.release();
-   }
-
-   @Override
-   public void crashLiveServer() throws Exception
-   {
-      //overkill as already set to live
-      state = LIVE;
-      liveLock.release();
-   }
-
-   @Override
-   public void stopBackup() throws Exception
-   {
-      backupLock.release();
-   }
-
-   @Override
-   public void releaseBackup()
-   {
-      releaseBackupNode();
-   }
-
-   @Override
-   public boolean isAwaitingFailback() throws Exception
-   {
-      return state == FAILING_BACK; 
-   }
-
-   @Override
-   public boolean isBackupLive() throws Exception
-   {
-      return liveLock.availablePermits() == 0;
-   }
-
-   @Override
-   public void interrupt()
-   {
-      //To change body of implemented methods use File | Settings | File Templates.
-   }
-
-   private void releaseBackupNode()
-   {
-      if(backupLock != null)
-      {
-         backupLock.release();
-      }
-   }
-}

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -14,7 +14,7 @@
 package org.hornetq.tests.integration.cluster;
 
 import org.hornetq.core.server.NodeManager;
-import org.hornetq.core.server.impl.InVMNodeManager;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.util.ServiceTestBase;
 
 import java.util.ArrayList;

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -41,8 +41,8 @@
 import org.hornetq.core.server.NodeManager;
 import org.hornetq.core.server.cluster.Bridge;
 import org.hornetq.core.server.cluster.impl.BridgeImpl;
-import org.hornetq.core.server.impl.InVMNodeManager;
 import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 
 /**
  * A BridgeReconnectTest

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -57,7 +57,7 @@
 import org.hornetq.core.server.cluster.RemoteQueueBinding;
 import org.hornetq.core.server.group.GroupingHandler;
 import org.hornetq.core.server.group.impl.GroupingHandlerConfiguration;
-import org.hornetq.core.server.impl.InVMNodeManager;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.util.ServiceTestBase;
 import org.hornetq.tests.util.UnitTestCase;
 

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -34,8 +34,8 @@
 import org.hornetq.core.client.impl.ServerLocatorInternal;
 import org.hornetq.core.config.ClusterConnectionConfiguration;
 import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.impl.InVMNodeManager;
 import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 
 /**
  * @author <a href="mailto:andy.taylor at jboss.com">Andy Taylor</a>

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -21,8 +21,8 @@
 import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
 import org.hornetq.core.client.impl.ServerLocatorInternal;
 import org.hornetq.core.config.ClusterConnectionConfiguration;
-import org.hornetq.core.server.impl.InVMNodeManager;
 import org.hornetq.jms.client.HornetQTextMessage;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.integration.cluster.util.TestableServer;
 
 import java.util.ArrayList;

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -41,7 +41,7 @@
 import org.hornetq.core.remoting.impl.invm.InVMRegistry;
 import org.hornetq.core.remoting.impl.invm.TransportConstants;
 import org.hornetq.core.server.NodeManager;
-import org.hornetq.core.server.impl.InVMNodeManager;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.integration.cluster.util.SameProcessHornetQServer;
 import org.hornetq.tests.integration.cluster.util.TestableServer;
 import org.hornetq.tests.util.ServiceTestBase;

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -26,7 +26,7 @@
 import org.hornetq.core.config.ClusterConnectionConfiguration;
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.server.NodeManager;
-import org.hornetq.core.server.impl.InVMNodeManager;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.integration.cluster.util.SameProcessHornetQServer;
 import org.hornetq.tests.integration.cluster.util.TestableServer;
 

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -24,8 +24,8 @@
 import org.hornetq.core.config.ClusterConnectionConfiguration;
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.security.Role;
-import org.hornetq.core.server.impl.InVMNodeManager;
 import org.hornetq.spi.core.security.HornetQSecurityManager;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.integration.cluster.util.TestableServer;
 
 /**

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -27,7 +27,7 @@
 import org.hornetq.core.config.Configuration;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.server.NodeManager;
-import org.hornetq.core.server.impl.InVMNodeManager;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.integration.cluster.util.SameProcessHornetQServer;
 import org.hornetq.tests.integration.cluster.util.TestableServer;
 

Copied: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java (from rev 11733, branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/InVMNodeManager.java)
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java	                        (rev 0)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *  Red Hat licenses this file to you under the Apache License, version
+ *  2.0 (the "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ *  implied.  See the License for the specific language governing
+ *  permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.util;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.core.server.NodeManager;
+import org.hornetq.utils.UUIDGenerator;
+
+import java.util.concurrent.Semaphore;
+
+import static org.hornetq.tests.integration.cluster.util.InVMNodeManager.State.*;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.com">Andy Taylor</a>
+ *         Date: Oct 13, 2010
+ *         Time: 3:55:47 PM
+ */
+public class InVMNodeManager extends NodeManager
+{
+
+   private Semaphore liveLock;
+
+   private Semaphore backupLock;
+
+   public enum State {LIVE, PAUSED, FAILING_BACK, NOT_STARTED}
+
+   public State state = NOT_STARTED;
+
+   public InVMNodeManager()
+   {
+      liveLock = new Semaphore(1);
+      backupLock = new Semaphore(1);
+      uuid = UUIDGenerator.getInstance().generateUUID();
+      nodeID = new SimpleString(uuid.toString());
+   }
+
+   @Override
+   public void awaitLiveNode() throws Exception
+   {
+      do
+      {
+         while (state == NOT_STARTED)
+         {
+            Thread.sleep(2000);
+         }
+
+         liveLock.acquire();
+
+         if (state == PAUSED)
+         {
+            liveLock.release();
+            Thread.sleep(2000);
+         }
+         else if (state == FAILING_BACK)
+         {
+            liveLock.release();
+            Thread.sleep(2000);
+         }
+         else if (state == LIVE)
+         {
+            break;
+         }
+      }
+      while (true);
+   }
+
+   @Override
+   public void startBackup() throws Exception
+   {
+      backupLock.acquire();
+   }
+
+   @Override
+   public void startLiveNode() throws Exception
+   {
+      state = FAILING_BACK;
+      liveLock.acquire();
+      state = LIVE;
+   }
+
+   @Override
+   public void pauseLiveServer() throws Exception
+   {
+      state = PAUSED;
+      liveLock.release();
+   }
+
+   @Override
+   public void crashLiveServer() throws Exception
+   {
+      //overkill as already set to live
+      state = LIVE;
+      liveLock.release();
+   }
+
+   @Override
+   public void stopBackup() throws Exception
+   {
+      backupLock.release();
+   }
+
+   @Override
+   public void releaseBackup()
+   {
+      releaseBackupNode();
+   }
+
+   @Override
+   public boolean isAwaitingFailback() throws Exception
+   {
+      return state == FAILING_BACK; 
+   }
+
+   @Override
+   public boolean isBackupLive() throws Exception
+   {
+      return liveLock.availablePermits() == 0;
+   }
+
+   @Override
+   public void interrupt()
+   {
+      //To change body of implemented methods use File | Settings | File Templates.
+   }
+
+   private void releaseBackupNode()
+   {
+      if(backupLock != null)
+      {
+         backupLock.release();
+      }
+   }
+}

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java	2011-11-21 23:39:18 UTC (rev 11734)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java	2011-11-22 01:50:41 UTC (rev 11735)
@@ -47,7 +47,6 @@
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.NodeManager;
 import org.hornetq.core.server.impl.HornetQServerImpl;
-import org.hornetq.core.server.impl.InVMNodeManager;
 import org.hornetq.jms.client.HornetQConnectionFactory;
 import org.hornetq.jms.client.HornetQDestination;
 import org.hornetq.jms.client.HornetQSession;
@@ -55,6 +54,7 @@
 import org.hornetq.jms.server.impl.JMSServerManagerImpl;
 import org.hornetq.spi.core.protocol.RemotingConnection;
 import org.hornetq.spi.core.security.HornetQSecurityManager;
+import org.hornetq.tests.integration.cluster.util.InVMNodeManager;
 import org.hornetq.tests.integration.jms.server.management.JMSUtil;
 import org.hornetq.tests.unit.util.InVMContext;
 import org.hornetq.tests.util.RandomUtil;



More information about the hornetq-commits mailing list