Author: clebert.suconic(a)jboss.com
Date: 2009-11-27 22:03:48 -0500 (Fri, 27 Nov 2009)
New Revision: 8437
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java
Log:
Server should stop servers in case of failure so other tests will proceed
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2009-11-28
02:43:42 UTC (rev 8436)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2009-11-28
03:03:48 UTC (rev 8437)
@@ -17,8 +17,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicInteger;
import org.hornetq.core.client.ClientConsumer;
import org.hornetq.core.client.ClientMessage;
@@ -31,7 +29,6 @@
import org.hornetq.core.config.cluster.QueueConfiguration;
import org.hornetq.core.exception.HornetQException;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.FailureListener;
import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
@@ -74,7 +71,7 @@
return InVMConnectorFactory.class.getName();
}
}
-
+
// Fail bridge and reconnecting immediately
public void testFailoverAndReconnectImmediately() throws Exception
{
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java 2009-11-28
02:43:42 UTC (rev 8436)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java 2009-11-28
03:03:48 UTC (rev 8437)
@@ -13,6 +13,7 @@
package org.hornetq.tests.integration.cluster.bridge;
+import java.util.ArrayList;
import java.util.Map;
import org.hornetq.core.config.Configuration;
@@ -34,10 +35,43 @@
*/
public abstract class BridgeTestBase extends UnitTestCase
{
+
+ private ArrayList<HornetQServer> servers;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ servers = new ArrayList<HornetQServer>();
+ }
+
+ public void tearDown() throws Exception
+ {
+ for (HornetQServer server: servers)
+ {
+ try
+ {
+ if (server.isStarted())
+ {
+ server.stop();
+ }
+ }
+ catch (Throwable e)
+ {
+ // System.out -> junit report
+ System.out.println("Error while stopping server:");
+ e.printStackTrace(System.out);
+ }
+ }
+
+ super.tearDown();
+ }
+
protected HornetQServer createHornetQServer(final int id, final boolean netty, final
Map<String, Object> params)
{
return createHornetQServer(id, params, netty, false);
}
+
+
protected HornetQServer createHornetQServer(final int id,
final Map<String, Object> params,
@@ -71,6 +105,9 @@
.add(new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory",
params));
}
HornetQServer service = HornetQ.newHornetQServer(serviceConf, true);
+
+ servers.add(service);
+
return service;
}
Show replies by date