Author: ataylor
Date: 2010-11-22 05:53:44 -0500 (Mon, 22 Nov 2010)
New Revision: 9918
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
fixed tests to close server locator and small fixes
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -173,7 +173,7 @@
return globalThreadPool;
}
- private static synchronized ScheduledExecutorService getGlobalScheduledThreadPool()
+ public static synchronized ScheduledExecutorService getGlobalScheduledThreadPool()
{
if (globalScheduledThreadPool == null)
{
@@ -533,7 +533,7 @@
threadPool,
scheduledThreadPool,
interceptors);
- factory.connect(reconnectAttempts, failoverOnInitialConnection);
+ factory.connect(initialConnectAttempts, failoverOnInitialConnection);
}
catch (HornetQException e)
{
@@ -1216,7 +1216,7 @@
{
return topology;
}
-
+
public void addClusterTopologyListener(final ClusterTopologyListener listener)
{
topologyListeners.add(listener);
@@ -1232,6 +1232,20 @@
return pairs.get(live);
}
+ public static void shutdown()
+ {
+ if (globalScheduledThreadPool != null)
+ {
+ globalScheduledThreadPool.shutdown();
+ globalScheduledThreadPool = null;
+ }
+ if (globalThreadPool != null)
+ {
+ globalThreadPool.shutdown();
+ globalThreadPool = null;
+ }
+ }
+
class StaticConnector implements Serializable
{
private List<Connector> connectors;
@@ -1251,7 +1265,7 @@
{
throw new HornetQException(HornetQException.INTERNAL_ERROR, "Failed to
initialise session factory", e);
}
-
+
ClientSessionFactory csf = null;
createConnectors();
@@ -1337,7 +1351,7 @@
super.finalize();
}
-
+
class Connector implements Callable<ClientSessionFactory>
{
private TransportConfiguration initialConnector;
@@ -1391,7 +1405,7 @@
public void disconnect()
{
interrupted = true;
-
+
if (factory != null)
{
factory.causeExit();
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -51,7 +51,7 @@
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
+ *
* Created 12 Nov 2008 11:37:35
*
*
@@ -66,7 +66,7 @@
// Attributes ----------------------------------------------------
protected final ServerLocatorInternal serverLocator;
-
+
private final UUID nodeUUID;
private final SimpleString name;
@@ -125,7 +125,7 @@
final StorageManager storageManager) throws Exception
{
this.serverLocator = serverLocator;
-
+
this.nodeUUID = nodeUUID;
this.name = name;
@@ -210,6 +210,11 @@
{
csf.close();
}
+
+ if(serverLocator != null)
+ {
+ serverLocator.close();
+ }
}
executor.execute(new StopRunnable());
@@ -312,7 +317,7 @@
}
// Consumer implementation ---------------------------------------
-
+
/* Hook for processing message before forwarding */
protected ServerMessage beforeForward(ServerMessage message)
{
@@ -341,7 +346,7 @@
{
message = transformer.transform(message);
}
-
+
return message;
}
@@ -366,7 +371,7 @@
refs.add(ref);
message = beforeForward(message);
-
+
SimpleString dest;
if (forwardingAddress != null)
@@ -460,7 +465,7 @@
BridgeImpl.log.error("Failed to cancel refs", e);
}
}
-
+
/* Hook for doing extra stuff after connection */
protected void afterConnect() throws Exception
{
@@ -488,7 +493,7 @@
BridgeImpl.log.info("Connecting bridge " + name + " to its
destination [" + nodeUUID.toString() + "]");
try
- {
+ {
csf = createSessionFactory();
// Session is pre-acknowledge
session = (ClientSessionInternal)csf.createSession(user, password, false,
true, true, true, 1);
@@ -592,7 +597,7 @@
{
queue.deliverAsync();
}
-
+
log.info("stopped bridge " + name);
}
catch (Exception e)
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -356,6 +356,7 @@
try
{
backupSessionFactory.close();
+ backupSessionFactory.getServerLocator().close();
}
catch (Exception e)
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -15,12 +15,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.ScheduledExecutorService;
import javax.management.MBeanServer;
@@ -474,7 +469,8 @@
public Object[] getResources(final Class<?> resourceType)
{
List<Object> resources = new ArrayList<Object>();
- for (Object entry : registry.values())
+ Collection<Object> clone = new ArrayList<Object>(registry.values());
+ for (Object entry : clone)
{
if (resourceType.isAssignableFrom(entry.getClass()))
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -43,6 +43,7 @@
private HornetQServer server;
private ClientSession clientSession;
+ private ServerLocator locator;
public void testBasicSend() throws Exception
{
@@ -465,7 +466,7 @@
// start the server
server.start();
// then we create a client as normal
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sessionFactory = locator.createSessionFactory();
clientSession = sessionFactory.createSession(false, true, false);
}
@@ -484,6 +485,17 @@
//
}
}
+ if(locator != null)
+ {
+ try
+ {
+ locator.close();
+ }
+ catch (Exception e)
+ {
+ //
+ }
+ }
if (server != null && server.isStarted())
{
try
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -32,6 +32,7 @@
public HornetQServer server;
private volatile boolean ackReceived;
+ private ServerLocator locator;
public void testHang() throws Exception
{
@@ -46,7 +47,6 @@
server.getRemotingService().addInterceptor(new AckInterceptor(server));
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
@@ -115,8 +115,19 @@
}
@Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+
+ locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ }
+
+ @Override
protected void tearDown() throws Exception
{
+ locator.close();
+
super.tearDown();
server = null;
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -41,6 +41,7 @@
private HornetQServer server;
private ClientSession session;
+ private ServerLocator locator;
// Static --------------------------------------------------------
@@ -80,7 +81,7 @@
config.setSecurityEnabled(false);
server = HornetQServers.newHornetQServer(config, false);
server.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
sf = locator.createSessionFactory();
session = sf.createSession(false, true, true);
}
@@ -94,6 +95,8 @@
sf.close();
+ locator.close();
+
server.stop();
server = null;
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -64,10 +64,6 @@
public void testSimpleConsumerBrowser() throws Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
-
-
-
locator.setBlockOnNonDurableSend(true);
sf = locator.createSessionFactory();
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -44,6 +44,7 @@
private HornetQServer service;
private ClientSessionFactory sf;
+ private ServerLocator locator;
// Static --------------------------------------------------------
@@ -85,7 +86,6 @@
SimpleString requestAddress = RandomUtil.randomSimpleString();
SimpleString requestQueue = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -119,7 +119,6 @@
SimpleString requestAddress = RandomUtil.randomSimpleString();
SimpleString requestQueue = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -150,7 +149,6 @@
{
final SimpleString requestAddress = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -174,7 +172,6 @@
SimpleString requestAddress = RandomUtil.randomSimpleString();
SimpleString requestQueue = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -225,7 +222,7 @@
service = HornetQServers.newHornetQServer(conf, false);
service.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
sf = locator.createSessionFactory();
}
@@ -236,6 +233,10 @@
sf.close();
+ locator.close();
+
+ locator = null;
+
sf = null;
service = null;
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -405,6 +405,10 @@
session.close();
+ locator.close();
+
+ locator = null;
+
server.stop();
session = null;
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -80,138 +80,144 @@
}
HornetQServer server1 = createClusteredServerWithParams(isNetty(), 1, true,
server1Params);
- final String testAddress = "testAddress";
- final String queueName0 = "queue0";
- final String forwardAddress = "forwardAddress";
- final String queueName1 = "queue1";
+ try
+ {
+ final String testAddress = "testAddress";
+ final String queueName0 = "queue0";
+ final String forwardAddress = "forwardAddress";
+ final String queueName1 = "queue1";
- Map<String, TransportConfiguration> connectors = new HashMap<String,
TransportConfiguration>();
- TransportConfiguration server0tc = new TransportConfiguration(getConnector(),
server0Params);
- TransportConfiguration server1tc = new TransportConfiguration(getConnector(),
server1Params);
- connectors.put(server1tc.getName(), server1tc);
+ Map<String, TransportConfiguration> connectors = new HashMap<String,
TransportConfiguration>();
+ TransportConfiguration server0tc = new TransportConfiguration(getConnector(),
server0Params);
+ TransportConfiguration server1tc = new TransportConfiguration(getConnector(),
server1Params);
+ connectors.put(server1tc.getName(), server1tc);
- server0.getConfiguration().setConnectorConfigurations(connectors);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
+ ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(server1tc.getName());
- final String bridgeName = "bridge1";
+ final String bridgeName = "bridge1";
- BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
- queueName0,
- forwardAddress,
- null,
- null,
- 1000,
- 1d,
- 0,
- true,
- 1024,
-
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-
staticConnectors,
- false,
-
ConfigurationImpl.DEFAULT_CLUSTER_USER,
-
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
+ BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
+ queueName0,
+
forwardAddress,
+ null,
+ null,
+ 1000,
+ 1d,
+ 0,
+ true,
+ 1024,
+
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+
staticConnectors,
+ false,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
- List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
- bridgeConfigs.add(bridgeConfiguration);
- server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
+ List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
+ bridgeConfigs.add(bridgeConfiguration);
+ server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
- CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress,
queueName0, null, true);
- List<CoreQueueConfiguration> queueConfigs0 = new
ArrayList<CoreQueueConfiguration>();
- queueConfigs0.add(queueConfig0);
- server0.getConfiguration().setQueueConfigurations(queueConfigs0);
+ CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress,
queueName0, null, true);
+ List<CoreQueueConfiguration> queueConfigs0 = new
ArrayList<CoreQueueConfiguration>();
+ queueConfigs0.add(queueConfig0);
+ server0.getConfiguration().setQueueConfigurations(queueConfigs0);
- CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress,
queueName1, null, true);
- List<CoreQueueConfiguration> queueConfigs1 = new
ArrayList<CoreQueueConfiguration>();
- queueConfigs1.add(queueConfig1);
- server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+ CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress,
queueName1, null, true);
+ List<CoreQueueConfiguration> queueConfigs1 = new
ArrayList<CoreQueueConfiguration>();
+ queueConfigs1.add(queueConfig1);
+ server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
- server0.start();
+ server1.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc,
server1tc);
- ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc,
server1tc);
+ ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
- ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
+ ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ ClientProducer producer0 = session0.createProducer(new
SimpleString(testAddress));
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- session1.start();
+ session1.start();
- final int numMessages = 10;
+ final int numMessages = 10;
- final SimpleString propKey = new SimpleString("testkey");
+ final SimpleString propKey = new SimpleString("testkey");
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ message.putIntProperty(propKey, i);
- producer0.send(message);
- }
+ producer0.send(message);
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(200);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(200);
- Assert.assertNotNull(message);
+ Assert.assertNotNull(message);
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- message.acknowledge();
- }
+ message.acknowledge();
+ }
- Assert.assertNull(consumer1.receiveImmediate());
+ Assert.assertNull(consumer1.receiveImmediate());
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- bridge.stop();
+ bridge.stop();
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ message.putIntProperty(propKey, i);
- producer0.send(message);
- }
+ producer0.send(message);
+ }
- Assert.assertNull(consumer1.receiveImmediate());
+ Assert.assertNull(consumer1.receiveImmediate());
- bridge.start();
+ bridge.start();
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- Assert.assertNotNull(message);
+ Assert.assertNotNull(message);
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- message.acknowledge();
- }
+ message.acknowledge();
+ }
- Assert.assertNull(consumer1.receiveImmediate());
+ Assert.assertNull(consumer1.receiveImmediate());
- session0.close();
+ session0.close();
- session1.close();
+ session1.close();
- sf0.close();
+ sf0.close();
- sf1.close();
+ sf1.close();
+ }
+ finally
+ {
+ server0.stop();
- server0.stop();
+ server1.stop();
+ }
- server1.stop();
}
public void testTargetServerUpAndDown() throws Exception
@@ -411,6 +417,8 @@
session0.close();
sf0.close();
+
+ locator.close();
}
finally
{
@@ -441,123 +449,130 @@
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
- Map<String, TransportConfiguration> connectors = new HashMap<String,
TransportConfiguration>();
- TransportConfiguration server0tc = new TransportConfiguration(getConnector(),
server0Params);
- TransportConfiguration server1tc = new TransportConfiguration(getConnector(),
server1Params);
- connectors.put(server1tc.getName(), server1tc);
+ try
+ {
+ Map<String, TransportConfiguration> connectors = new HashMap<String,
TransportConfiguration>();
+ TransportConfiguration server0tc = new TransportConfiguration(getConnector(),
server0Params);
+ TransportConfiguration server1tc = new TransportConfiguration(getConnector(),
server1Params);
+ connectors.put(server1tc.getName(), server1tc);
- server0.getConfiguration().setConnectorConfigurations(connectors);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
+ ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(server1tc.getName());
- final String bridgeName = "bridge1";
+ final String bridgeName = "bridge1";
- BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
- queueName0,
- forwardAddress,
- null,
- null,
- 1000,
- 1d,
- 0,
- false,
- 1024,
-
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-
staticConnectors,
- false,
-
ConfigurationImpl.DEFAULT_CLUSTER_USER,
-
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
+ BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
+ queueName0,
+
forwardAddress,
+ null,
+ null,
+ 1000,
+ 1d,
+ 0,
+ false,
+ 1024,
+
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+
staticConnectors,
+ false,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
- List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
- bridgeConfigs.add(bridgeConfiguration);
- server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
+ List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
+ bridgeConfigs.add(bridgeConfiguration);
+ server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
- CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress,
queueName0, null, true);
- List<CoreQueueConfiguration> queueConfigs0 = new
ArrayList<CoreQueueConfiguration>();
- queueConfigs0.add(queueConfig0);
- server0.getConfiguration().setQueueConfigurations(queueConfigs0);
+ CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress,
queueName0, null, true);
+ List<CoreQueueConfiguration> queueConfigs0 = new
ArrayList<CoreQueueConfiguration>();
+ queueConfigs0.add(queueConfig0);
+ server0.getConfiguration().setQueueConfigurations(queueConfigs0);
- CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress,
queueName1, null, true);
- List<CoreQueueConfiguration> queueConfigs1 = new
ArrayList<CoreQueueConfiguration>();
- queueConfigs1.add(queueConfig1);
- server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+ CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress,
queueName1, null, true);
+ List<CoreQueueConfiguration> queueConfigs1 = new
ArrayList<CoreQueueConfiguration>();
+ queueConfigs1.add(queueConfig1);
+ server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- // Don't start server 1 yet
+ // Don't start server 1 yet
- server0.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc,
server1tc);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc,
server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientProducer producer0 = session0.createProducer(new
SimpleString(testAddress));
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ final int numMessages = 10;
- final int numMessages = 10;
+ final SimpleString propKey = new SimpleString("testkey");
- final SimpleString propKey = new SimpleString("testkey");
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ // Wait a bit
+ Thread.sleep(1000);
- // Wait a bit
- Thread.sleep(1000);
+ // JMSBridge should be stopped since retries = 0
- // JMSBridge should be stopped since retries = 0
+ server1.start();
+ ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- server1.start();
- ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ session1.start();
- session1.start();
+ // Won't be received since the bridge was deactivated
+ Assert.assertNull(consumer1.receiveImmediate());
- // Won't be received since the bridge was deactivated
- Assert.assertNull(consumer1.receiveImmediate());
+ // Now start the bridge manually
- // Now start the bridge manually
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ bridge.start();
- bridge.start();
+ // Messages should now be received
- // Messages should now be received
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ session1.close();
- session1.close();
+ sf1.close();
- sf1.close();
+ session0.close();
- session0.close();
+ sf0.close();
- sf0.close();
+ locator.close();
+ }
+ finally
+ {
+ server0.stop();
- server0.stop();
+ server1.stop();
+ }
- server1.stop();
}
public void testManualStopStart() throws Exception
@@ -581,172 +596,179 @@
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
- Map<String, TransportConfiguration> connectors = new HashMap<String,
TransportConfiguration>();
- TransportConfiguration server0tc = new TransportConfiguration(getConnector(),
server0Params);
- TransportConfiguration server1tc = new TransportConfiguration(getConnector(),
server1Params);
- connectors.put(server1tc.getName(), server1tc);
+ try
+ {
+ Map<String, TransportConfiguration> connectors = new HashMap<String,
TransportConfiguration>();
+ TransportConfiguration server0tc = new TransportConfiguration(getConnector(),
server0Params);
+ TransportConfiguration server1tc = new TransportConfiguration(getConnector(),
server1Params);
+ connectors.put(server1tc.getName(), server1tc);
- server0.getConfiguration().setConnectorConfigurations(connectors);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
+ ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(server1tc.getName());
- final String bridgeName = "bridge1";
+ final String bridgeName = "bridge1";
- BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
- queueName0,
- forwardAddress,
- null,
- null,
- 1000,
- 1d,
- 1,
- true,
- 1024,
-
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-
staticConnectors,
- false,
-
ConfigurationImpl.DEFAULT_CLUSTER_USER,
-
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
+ BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
+ queueName0,
+
forwardAddress,
+ null,
+ null,
+ 1000,
+ 1d,
+ 1,
+ true,
+ 1024,
+
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+
staticConnectors,
+ false,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
- List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
- bridgeConfigs.add(bridgeConfiguration);
- server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
+ List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
+ bridgeConfigs.add(bridgeConfiguration);
+ server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
- CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress,
queueName0, null, true);
- List<CoreQueueConfiguration> queueConfigs0 = new
ArrayList<CoreQueueConfiguration>();
- queueConfigs0.add(queueConfig0);
- server0.getConfiguration().setQueueConfigurations(queueConfigs0);
+ CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress,
queueName0, null, true);
+ List<CoreQueueConfiguration> queueConfigs0 = new
ArrayList<CoreQueueConfiguration>();
+ queueConfigs0.add(queueConfig0);
+ server0.getConfiguration().setQueueConfigurations(queueConfigs0);
- CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress,
queueName1, null, true);
- List<CoreQueueConfiguration> queueConfigs1 = new
ArrayList<CoreQueueConfiguration>();
- queueConfigs1.add(queueConfig1);
- server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+ CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress,
queueName1, null, true);
+ List<CoreQueueConfiguration> queueConfigs1 = new
ArrayList<CoreQueueConfiguration>();
+ queueConfigs1.add(queueConfig1);
+ server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
+ server1.start();
- server0.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc,
server1tc);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc,
server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientProducer producer0 = session0.createProducer(new
SimpleString(testAddress));
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ final int numMessages = 10;
- final int numMessages = 10;
+ final SimpleString propKey = new SimpleString("testkey");
- final SimpleString propKey = new SimpleString("testkey");
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
+ ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- producer0.send(message);
- }
- ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ session1.start();
- session1.start();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ // Now stop the bridge manually
- // Now stop the bridge manually
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ BridgeStartTest.log.info("stopping bridge manually");
- BridgeStartTest.log.info("stopping bridge manually");
+ bridge.stop();
- bridge.stop();
+ for (int i = numMessages; i < numMessages * 2; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = numMessages; i < numMessages * 2; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ bridge.start();
- bridge.start();
+ BridgeStartTest.log.info("started bridge");
- BridgeStartTest.log.info("started bridge");
+ // The previous messages will get resent, but with duplicate detection they will
be rejected
+ // at the target
- // The previous messages will get resent, but with duplicate detection they will be
rejected
- // at the target
+ for (int i = numMessages; i < numMessages * 2; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = numMessages; i < numMessages * 2; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ bridge.stop();
- bridge.stop();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ bridge.start();
- bridge.start();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ session1.close();
- session1.close();
+ sf1.close();
- sf1.close();
+ session0.close();
- session0.close();
+ sf0.close();
- sf0.close();
+ locator.close();
+ }
+ finally
+ {
+ server0.stop();
- server0.stop();
+ server1.stop();
+ }
- server1.stop();
}
@Override
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -214,6 +214,8 @@
sf1.close();
+ locator.close();
+
}
finally
{
@@ -428,6 +430,8 @@
sf0.close();
sf1.close();
+
+ locator.close();
}
finally
@@ -577,6 +581,8 @@
sf1.close();
+ locator.close();
+
server0.stop();
server1.stop();
@@ -699,6 +705,8 @@
sf1.close();
+ locator.close();
+
}
finally
{
@@ -841,6 +849,8 @@
sf1.close();
+ locator.close();
+
}
finally
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -115,6 +115,18 @@
consumers = new ConsumerHolder[ClusterTestBase.MAX_CONSUMERS];
+ for (ServerLocator locator : locators)
+ {
+ try
+ {
+ locator.close();
+ }
+ catch (Exception e)
+ {
+ //
+ }
+ }
+
nodeManagers = null;
super.tearDown();
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -1052,16 +1052,6 @@
@Override
protected void tearDown() throws Exception
{
- if(locators != null)
- {
- for (ServerLocator locator : locators)
- {
- if(locator != null)
- {
- System.out.println("ClusteredGroupingTest.tearDown");
- }
- }
- }
super.tearDown(); //To change body of overridden methods use File | Settings |
File Templates.
}
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -362,7 +362,7 @@
protected ServerLocatorInternal getServerLocator() throws Exception
{
- ServerLocator locator =
HornetQClient.createServerLocatorWithHA(getConnectorTransportConfiguration(true));// ,
getConnectorTransportConfiguration(false));
+ ServerLocator locator =
HornetQClient.createServerLocatorWithHA(getConnectorTransportConfiguration(true),
getConnectorTransportConfiguration(false));
return (ServerLocatorInternal) locator;
}
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -19,6 +19,7 @@
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.core.server.impl.InVMNodeManager;
import org.hornetq.tests.util.ServiceTestBase;
/**
@@ -71,7 +72,11 @@
if (fileStorage)
{
- server = HornetQServers.newHornetQServer(configuration);
+ if(nodeManagers[backupNode] == null)
+ {
+ nodeManagers[backupNode] = new InVMNodeManager();
+ }
+ server = createInVMFailoverServer(true, configuration,
nodeManagers[backupNode]);
}
else
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -80,22 +80,8 @@
closeSessionFactory(0);
- final CountDownLatch latch = new CountDownLatch(1);
-
- class MyListener implements FailureListener
- {
- public void connectionFailed(final HornetQException me, boolean failedOver)
- {
- latch.countDown();
- }
- }
-
- Map<String, MessageFlowRecord> records =
((ClusterConnectionImpl)getServer(1).getClusterManager()
-
.getClusterConnection(new SimpleString("cluster1"))).getRecords();
- RemotingConnection rc =
records.get("0").getBridge().getForwardingConnection();
- rc.addFailureListener(new MyListener());
- fail(rc, latch);
-
+ servers[0].kill();
+
waitForServerRestart(2);
setupSessionFactory(2, isNetty());
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -36,6 +36,7 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.server.HornetQServer;
@@ -99,6 +100,13 @@
}
}
super.tearDown(); //To change body of overridden methods use File | Settings |
File Templates.
+ checkFreePort(5445);
+ checkFreePort(5446);
+ checkFreePort(5447);
+ if(InVMRegistry.instance.size() > 0)
+ {
+ System.exit(0);
+ }
}
protected static Map<String, Object> generateParams(final int node, final
boolean netty)
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-11-20
18:29:51 UTC (rev 9917)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-11-22
10:53:44 UTC (rev 9918)
@@ -434,7 +434,8 @@
}
catch (Exception e)
{
- Assert.fail("port " + port + " is already bound");
+ System.out.println("port " + port + " is already
bound");
+ System.exit(0);
}
finally
{