[hornetq-commits] JBoss hornetq SVN: r11750 - in branches/Branch_2_2_AS7: src/main/org/hornetq/core/protocol/core/impl and 10 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 23 16:54:39 EST 2011


Author: clebert.suconic at jboss.com
Date: 2011-11-23 16:54:38 -0500 (Wed, 23 Nov 2011)
New Revision: 11750

Added:
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java
Removed:
   branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/InVMNodeManager.java
Modified:
   branches/Branch_2_2_AS7/build-hornetq.xml
   branches/Branch_2_2_AS7/build.xml
   branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
   branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
   branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
   branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
   branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java
   branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
Log:
moving changes from EAP

Modified: branches/Branch_2_2_AS7/build-hornetq.xml
===================================================================
--- branches/Branch_2_2_AS7/build-hornetq.xml	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/build-hornetq.xml	2011-11-23 21:54:38 UTC (rev 11750)
@@ -1660,62 +1660,62 @@
       </javac>
    </target>
 
-   <target name="performance-tests" depends="jar, compile-unit-tests">
+   <target name="performance-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/performance/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-   <target name="integration-tests" depends="jar, compile-unit-tests">
+   <target name="integration-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/integration/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-    <target name="management-tests" depends="jar, compile-unit-tests">
+    <target name="management-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/integration/management/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
 
-    <target name="jms-management-tests" depends="jar, compile-unit-tests">
+    <target name="jms-management-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/integration/jms/server/management/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-    <target name="spring-tests" depends="jar, compile-unit-tests">
+    <target name="spring-tests" depends="compile-unit-tests">
        <antcall inheritall="true" inheritrefs="true" target="tests">
           <param name="tests.param" value="**/org/hornetq/tests/integration/spring/*${test-mask}.class"/>
        </antcall>
     </target>
 
-   <target name="failover-tests" depends="jar, compile-unit-tests">
+   <target name="failover-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/integration/cluster/failover/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-   <target name="distribution-tests" depends="jar, compile-unit-tests">
+   <target name="distribution-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/integration/cluster/distribution/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-    <target name="cluster-tests" depends="jar, compile-unit-tests">
+    <target name="cluster-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/integration/cluster/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-   <target name="concurrent-tests" depends="jar, compile-unit-tests">
+   <target name="concurrent-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/concurrent/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-   <target name="unit-tests" depends="jar, compile-unit-tests">
+   <target name="unit-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/unit/**/*${test-mask}.class"/>
          <!-- if tests.validate.error is defined, it will fail the build in case of any test failure -->
@@ -1723,13 +1723,13 @@
       </antcall>
    </target>
 
-   <target name="timing-tests" depends="jar, compile-unit-tests">
+   <target name="timing-tests" depends="compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/hornetq/tests/timing/**/*${test-mask}.class"/>
       </antcall>
    </target>
 
-   <target name="tests" depends="jar, compile-unit-tests">
+   <target name="tests">
       <echo message=""/>
       <echo message="Running unit tests, fork=${junit.fork}, junit.batchtest.fork=${junit.batchtest.fork}"/>
       <echo message="classpath is:${toString:unit.test.execution.classpath}"/>
@@ -1957,9 +1957,9 @@
       </junit>
    </target>
 
-   <target name="all-tests" depends="unit-tests, integration-tests, concurrent-tests, stress-tests, jms-tests, joram-tests, rest-tests"/>
+   <target name="all-tests" depends="jar, unit-tests, integration-tests, concurrent-tests, stress-tests, jms-tests, joram-tests, rest-tests"/>
 
-   <target name="hudson-tests" depends="unit-tests, integration-tests, concurrent-tests, timing-tests, jms-tests, joram-tests"/>
+   <target name="hudson-tests" depends="jar, unit-tests, integration-tests, concurrent-tests, timing-tests, jms-tests, joram-tests"/>
 
    <target name="compile-reports">
       <mkdir dir="${test.stylesheets.dir}"/>

Modified: branches/Branch_2_2_AS7/build.xml
===================================================================
--- branches/Branch_2_2_AS7/build.xml	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/build.xml	2011-11-23 21:54:38 UTC (rev 11750)
@@ -303,6 +303,7 @@
    </target>
 
    <target name="jms-tests" depends="createthirdparty">
+      <ant antfile="build-hornetq.xml" target="jar"/>
       <ant antfile="build-hornetq.xml" target="jms-tests"/>
       <ant antfile="build-hornetq.xml" target="compile-reports"/>
    </target>

Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -177,17 +177,16 @@
                      return "Remote Proxy on channel " + Integer.toHexString(System.identityHashCode(this));
                   }
                };
-               
-               final boolean isCC = msg.isClusterConnection();
+
                if (acceptorUsed.getClusterConnection() != null)
                {
-                  acceptorUsed.getClusterConnection().addClusterTopologyListener(listener, isCC);
+                  acceptorUsed.getClusterConnection().addClusterTopologyListener(listener);
                   
                   rc.addCloseListener(new CloseListener()
                   {
                      public void connectionClosed()
                      {
-                        acceptorUsed.getClusterConnection().removeClusterTopologyListener(listener, isCC);
+                        acceptorUsed.getClusterConnection().removeClusterTopologyListener(listener);
                      }
                   });
                }

Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/ClusterConnection.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/ClusterConnection.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -42,9 +42,9 @@
    
    void nodeAnnounced(long eventUID, String nodeID, Pair<TransportConfiguration, TransportConfiguration> connectorPair, boolean backup);
 
-   void addClusterTopologyListener(ClusterTopologyListener listener, boolean clusterConnection);
+   void addClusterTopologyListener(ClusterTopologyListener listener);
    
-   void removeClusterTopologyListener(ClusterTopologyListener listener, boolean clusterConnection);
+   void removeClusterTopologyListener(ClusterTopologyListener listener);
    
    /**
     * @return a Map of node ID and addresses

Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -246,7 +246,7 @@
 
       clusterConnector = new StaticClusterConnector(tcConfigs);
 
-      backupServerLocator = clusterConnector.createServerLocator(false);
+      backupServerLocator = clusterConnector.createServerLocator();
 
       if (backupServerLocator != null)
       {
@@ -356,7 +356,7 @@
 
       clusterConnector = new DiscoveryClusterConnector(dg);
 
-      backupServerLocator = clusterConnector.createServerLocator(true);
+      backupServerLocator = clusterConnector.createServerLocator();
 
       if (backupServerLocator != null)
       {
@@ -507,7 +507,7 @@
       return topology.getMember(manager.getNodeId());
    }
 
-   public void addClusterTopologyListener(final ClusterTopologyListener listener, final boolean clusterConnection)
+   public void addClusterTopologyListener(final ClusterTopologyListener listener)
    {
       topology.addClusterTopologyListener(listener);
 
@@ -515,7 +515,7 @@
       topology.sendTopology(listener);
    }
 
-   public void removeClusterTopologyListener(final ClusterTopologyListener listener, final boolean clusterConnection)
+   public void removeClusterTopologyListener(final ClusterTopologyListener listener)
    {
       topology.removeClusterTopologyListener(listener);
    }
@@ -642,7 +642,7 @@
          backupServerLocator = null;
       }
 
-      serverLocator = clusterConnector.createServerLocator(true);
+      serverLocator = clusterConnector.createServerLocator();
 
       if (serverLocator != null)
       {
@@ -680,7 +680,7 @@
             this.serverLocator.setRetryInterval(retryInterval);
          }
 
-         serverLocator.addClusterTopologyListener(this);
+         addClusterTopologyListener(this);
 
          serverLocator.setAfterConnectionInternalListener(this);
 
@@ -1567,7 +1567,7 @@
 
    interface ClusterConnector
    {
-      ServerLocatorInternal createServerLocator(boolean includeTopology);
+      ServerLocatorInternal createServerLocator();
    }
 
    private class StaticClusterConnector implements ClusterConnector
@@ -1579,7 +1579,7 @@
          this.tcConfigs = tcConfigs;
       }
 
-      public ServerLocatorInternal createServerLocator(boolean includeTopology)
+      public ServerLocatorInternal createServerLocator()
       {
          if (tcConfigs != null && tcConfigs.length > 0)
          {
@@ -1587,7 +1587,7 @@
             {
                log.debug(ClusterConnectionImpl.this + "Creating a serverLocator for " + Arrays.toString(tcConfigs));
             }
-            ServerLocatorImpl locator = new ServerLocatorImpl(includeTopology ? topology : null, true, tcConfigs);
+            ServerLocatorImpl locator = new ServerLocatorImpl(topology, true, tcConfigs);
             locator.setClusterConnection(true);
             return locator;
          }
@@ -1617,9 +1617,9 @@
          this.dg = dg;
       }
 
-      public ServerLocatorInternal createServerLocator(boolean includeTopology)
+      public ServerLocatorInternal createServerLocator()
       {
-         ServerLocatorImpl locator = new ServerLocatorImpl(includeTopology ? topology : null, true, dg);
+         ServerLocatorImpl locator = new ServerLocatorImpl(topology, true, dg);
          return locator;
 
       }

Deleted: branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/InVMNodeManager.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/InVMNodeManager.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/InVMNodeManager.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -399,12 +399,29 @@
                // We execute this on the same executor to make sure the force delivery message is written after
                // any delivery is completed
 
-               ServerMessage forcedDeliveryMessage = new ServerMessageImpl(storageManager.generateUniqueID(), 50);
-
-               forcedDeliveryMessage.putLongProperty(ClientConsumerImpl.FORCED_DELIVERY_MESSAGE, sequence);
-               forcedDeliveryMessage.setAddress(messageQueue.getName());
-
-               callback.sendMessage(forcedDeliveryMessage, id, 0);
+               synchronized (lock)
+               {
+                  if (transferring)
+                  {
+                     // Case it's transferring (reattach), we will retry later
+                     messageQueue.getExecutor().execute(new Runnable()
+                     {
+                        public void run()
+                        {
+                           forceDelivery(sequence);
+                        }
+                     });
+                  }
+                  else
+                  {
+                     ServerMessage forcedDeliveryMessage = new ServerMessageImpl(storageManager.generateUniqueID(), 50);
+      
+                     forcedDeliveryMessage.putLongProperty(ClientConsumerImpl.FORCED_DELIVERY_MESSAGE, sequence);
+                     forcedDeliveryMessage.setAddress(messageQueue.getName());
+      
+                     callback.sendMessage(forcedDeliveryMessage, id, 0);
+                  }
+               }
             }
             catch (Exception e)
             {

Modified: branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
===================================================================
--- branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -283,7 +283,7 @@
    @Override
    public String toString()
    {
-      return "ServerMessage[messageID=" + messageID + ",priority=" + this.getPriority() + 
+      return "ServerMessage[messageID=" + messageID + ",priority=" + this.getPriority() + ", bodySize=" + this.getBodyBuffer().capacity() +
           ",expiration=" + (this.getExpiration() != 0 ? new java.util.Date(this.getExpiration()) : 0) + 
           ", durable=" + durable + ", address=" + getAddress()  + ",properties=" + properties.toString() + "]@" + System.identityHashCode(this);
    }

Modified: branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/NodeManagerTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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;
 

Modified: branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/reattach/NettyMultiThreadRandomReattachTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -13,10 +13,14 @@
 
 package org.hornetq.tests.integration.cluster.reattach;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.hornetq.api.core.TransportConfiguration;
 import org.hornetq.api.core.client.HornetQClient;
 import org.hornetq.api.core.client.ServerLocator;
 import org.hornetq.core.config.Configuration;
+import org.hornetq.core.remoting.impl.netty.TransportConstants;
 import org.hornetq.core.server.HornetQServers;
 
 /**
@@ -37,8 +41,12 @@
       liveConf.setJMXManagementEnabled(false);
       liveConf.setSecurityEnabled(false);
       liveConf.getAcceptorConfigurations().clear();
+      
+      Map<String, Object> connectionParams = new HashMap<String, Object>();
+      connectionParams.put(TransportConstants.USE_NIO_PROP_NAME, true);
+
       liveConf.getAcceptorConfigurations()
-              .add(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory"));
+              .add(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory", connectionParams));
       liveServer = HornetQServers.newHornetQServer(liveConf, false);
       liveServer.start();
    }
@@ -46,11 +54,15 @@
    @Override
    protected ServerLocator createLocator() throws Exception
    {
-      ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory")) ;
+      Map<String, Object> connectionParams = new HashMap<String, Object>();
+      connectionParams.put(TransportConstants.USE_NIO_PROP_NAME, true);
+
+
+      ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory", connectionParams)) ;
       locator.setReconnectAttempts(-1);
       locator.setConfirmationWindowSize(1024 * 1024);
       locator.setAckBatchSize(0);
       return  locator;
    }
-
+   
 }

Added: branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java	                        (rev 0)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/cluster/util/InVMNodeManager.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -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_AS7/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java	2011-11-23 21:01:00 UTC (rev 11749)
+++ branches/Branch_2_2_AS7/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java	2011-11-23 21:54:38 UTC (rev 11750)
@@ -40,14 +40,12 @@
 import org.hornetq.core.client.impl.ClientSessionInternal;
 import org.hornetq.core.config.ClusterConnectionConfiguration;
 import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
 import org.hornetq.core.logging.Logger;
 import org.hornetq.core.remoting.impl.invm.InVMRegistry;
 import org.hornetq.core.remoting.impl.invm.TransportConstants;
 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 +53,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