JBoss hornetq SVN: r11872 - in trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster: topology and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 10:28:10 -0500 (Wed, 07 Dec 2011)
New Revision: 11872
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
Log:
Fix tearDown broken at refactoring.
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-07 11:59:15 UTC (rev 11871)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-07 15:28:10 UTC (rev 11872)
@@ -531,7 +531,7 @@
throw new IllegalArgumentException("No sf at " + node);
}
- ClientSession session = sf.createSession(false, true, true);
+ ClientSession session = addClientSession(sf.createSession(false, true, true));
String filterString = null;
@@ -572,6 +572,8 @@
protected void closeAllConsumers()
{
+ if (consumers == null)
+ return;
for (int i = 0; i < consumers.length; i++)
{
ConsumerHolder holder = consumers[i];
@@ -589,10 +591,10 @@
{
if (sfs != null)
{
- for (int i = 0; i < sfs.length; i++)
- {
- closeSessionFactory(sfs[i]);
- sfs[i] = null;
+ for (int i = 0; i < sfs.length; i++)
+ {
+ closeSessionFactory(sfs[i]);
+ sfs[i] = null;
}
}
super.closeAllSessionFactories();
@@ -1413,7 +1415,7 @@
locators[node].setBlockOnNonDurableSend(true);
locators[node].setBlockOnDurableSend(true);
- ClientSessionFactory sf = locators[node].createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locators[node]);
ClientSession session = sf.createSession();
session.close();
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-12-07 11:59:15 UTC (rev 11871)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-12-07 15:28:10 UTC (rev 11872)
@@ -13,20 +13,18 @@
package org.hornetq.tests.integration.cluster.distribution;
-import org.hornetq.core.logging.Logger;
/**
* A ClusteredRequestResponseTest
- *
+ *
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
+ *
* Created 3 Feb 2009 09:10:43
*
*
*/
public class ClusteredRequestResponseTest extends ClusterTestBase
{
- private static final Logger log = Logger.getLogger(ClusteredRequestResponseTest.class);
@Override
protected void setUp() throws Exception
@@ -46,7 +44,7 @@
setupCluster();
startServers(0, 1, 2, 3, 4);
-
+
for (int i = 0 ; i < 5; i++)
{
waitForTopology(servers[i], 5);
@@ -94,7 +92,7 @@
setupCluster();
startServers(0, 1, 2, 3, 4);
-
+
for (int i = 0 ; i < 5; i++)
{
waitForTopology(servers[i], 5);
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-07 11:59:15 UTC (rev 11871)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-07 15:28:10 UTC (rev 11872)
@@ -66,6 +66,14 @@
setupCluster();
}
+ @Override
+ protected void tearDown() throws Exception
+ {
+ stopServers(0, 1, 2, 3, 4);
+
+ super.tearDown();
+ }
+
/**
* Check that the actual list of received nodeIDs correspond to the expected order of nodes
*/
13 years
JBoss hornetq SVN: r11871 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:59:15 -0500 (Wed, 07 Dec 2011)
New Revision: 11871
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
Log:
Keep track of created locators.
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-12-07 11:58:59 UTC (rev 11870)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-12-07 11:59:15 UTC (rev 11871)
@@ -63,6 +63,7 @@
ServerLocator locator = HornetQClient.createServerLocatorWithHA(new DiscoveryGroupConfiguration(groupAddress, groupPort));
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
+ addServerLocator(locator);
return locator;
}
}
13 years
JBoss hornetq SVN: r11870 - trunk/hornetq-core/src/test/java/org/hornetq/tests/util.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:58:59 -0500 (Wed, 07 Dec 2011)
New Revision: 11870
Modified:
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
Log:
Move server closing utilities to UnitTestCase
Modified: trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-12-07 11:58:43 UTC (rev 11869)
+++ trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-12-07 11:58:59 UTC (rev 11870)
@@ -81,7 +81,6 @@
protected static final String NETTY_CONNECTOR_FACTORY = NettyConnectorFactory.class.getCanonicalName();
private final Collection<ServerLocator> locators = new ArrayList<ServerLocator>();
- private final Collection<HornetQServer> servers = new ArrayList<HornetQServer>();
private final Collection<ClientSessionFactory> sessionFactories = new ArrayList<ClientSessionFactory>();
private final Collection<ClientSession> clientSessions = new ArrayList<ClientSession>();
@@ -94,15 +93,6 @@
closeAllServerLocatorsFactories();
- synchronized (servers)
- {
- for (HornetQServer server : servers)
- {
- stopComponent(server);
- }
- servers.clear();
- }
-
super.tearDown();
// checkFreePort(5445);
// checkFreePort(5446);
@@ -114,7 +104,7 @@
}
/**
- *
+ *
*/
protected void closeAllServerLocatorsFactories()
{
@@ -129,7 +119,7 @@
}
/**
- *
+ *
*/
protected void closeAllSessionFactories()
{
@@ -144,7 +134,7 @@
}
/**
- *
+ *
*/
protected void closeAllClientSessions()
{
@@ -405,15 +395,6 @@
}
}
- protected HornetQServer addServer(HornetQServer server)
- {
- synchronized (servers)
- {
- servers.add(server);
- }
- return server;
- }
-
protected ClientSession addClientSession(ClientSession session)
{
synchronized (clientSessions)
@@ -705,15 +686,22 @@
addSessionFactory(sf);
return sf;
}
+
protected void createQueue(final String address, final String queue) throws Exception
{
ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession();
- session.createQueue(address, queue);
- session.close();
- sf.close();
- locator.close();
+ try
+ {
+ session.createQueue(address, queue);
+ }
+ finally
+ {
+ session.close();
+ sf.close();
+ locator.close();
+ }
}
protected ServerLocator createInVMNonHALocator()
Modified: trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-12-07 11:58:43 UTC (rev 11869)
+++ trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-12-07 11:58:59 UTC (rev 11870)
@@ -31,6 +31,7 @@
import java.net.ServerSocket;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -125,6 +126,8 @@
// There is a verification about thread leakages. We only fail a single thread when this happens
private static Set<Thread> alreadyFailedThread = new HashSet<Thread>();
+ private final Collection<HornetQServer> servers = new ArrayList<HornetQServer>();
+
private boolean checkThread = true;
protected void disableCheckThread()
@@ -923,6 +926,16 @@
@Override
protected void tearDown() throws Exception
{
+
+ synchronized (servers)
+ {
+ for (HornetQServer server : servers)
+ {
+ stopComponent(server);
+ }
+ servers.clear();
+ }
+
List<ClientSessionFactoryImpl.CloseRunnable> closeRunnables = new ArrayList<ClientSessionFactoryImpl.CloseRunnable>(ClientSessionFactoryImpl.CLOSE_RUNNABLES);
ArrayList<Exception> exceptions = new ArrayList<Exception>();
try
@@ -1426,6 +1439,14 @@
}
+ protected HornetQServer addServer(HornetQServer server)
+ {
+ synchronized (servers)
+ {
+ servers.add(server);
+ }
+ return server;
+ }
protected static final void stopComponent(HornetQComponent component)
{
if (component == null)
13 years
JBoss hornetq SVN: r11869 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:58:43 -0500 (Wed, 07 Dec 2011)
New Revision: 11869
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
Check for null array
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-07 11:58:27 UTC (rev 11868)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-07 11:58:43 UTC (rev 11869)
@@ -587,10 +587,13 @@
@Override
protected void closeAllSessionFactories()
{
+ if (sfs != null)
+ {
for (int i = 0; i < sfs.length; i++)
{
closeSessionFactory(sfs[i]);
sfs[i] = null;
+ }
}
super.closeAllSessionFactories();
}
13 years
JBoss hornetq SVN: r11868 - in trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration: jms and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:58:27 -0500 (Wed, 07 Dec 2011)
New Revision: 11868
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/PersistentDivertTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java
Log:
Make sure created server is closed.
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/PersistentDivertTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/PersistentDivertTest.java 2011-12-07 11:37:56 UTC (rev 11867)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/PersistentDivertTest.java 2011-12-07 11:58:27 UTC (rev 11868)
@@ -19,11 +19,15 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.DivertConfiguration;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.tests.util.ServiceTestBase;
@@ -33,15 +37,13 @@
* A PersistentDivertTest
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
+ *
* Created 14 Jan 2009 14:05:01
*
*
*/
public class PersistentDivertTest extends ServiceTestBase
{
- private static final Logger log = Logger.getLogger(DivertTest.class);
-
final int minLargeMessageSize = HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE * 2;
public void testPersistentDivert() throws Exception
@@ -100,11 +102,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
locator.setBlockOnNonDurableSend(true);
@@ -234,8 +236,6 @@
session.close();
sf.close();
-
- messagingService.stop();
}
/**
@@ -305,11 +305,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
@@ -362,7 +362,7 @@
messagingService.start();
- ServerLocator locator2 = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator2 = createInVMNonHALocator();
locator2.setBlockOnDurableSend(true);
sf = locator2.createSessionFactory();
@@ -458,7 +458,7 @@
messagingService.start();
- ServerLocator locator3 = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator3 = createInVMNonHALocator();
locator3.setBlockOnDurableSend(true);
sf = locator3.createSessionFactory();
@@ -484,14 +484,6 @@
session.close();
sf.close();
-
- locator3.close();
-
- locator2.close();
-
- locator.close();
-
- messagingService.stop();
}
}
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java 2011-12-07 11:37:56 UTC (rev 11867)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java 2011-12-07 11:58:27 UTC (rev 11868)
@@ -35,7 +35,6 @@
import org.hornetq.api.core.TransportConfiguration;
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.netty.NettyAcceptorFactory;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
@@ -91,6 +90,8 @@
private Listener listener;
+ private HornetQServer server;
+
// Static --------------------------------------------------------
// Attributes ----------------------------------------------------
@@ -160,7 +161,7 @@
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
- HornetQServer server = HornetQServers.newHornetQServer(conf, false);
+ server = HornetQServers.newHornetQServer(conf, false);
JMSConfiguration configuration = new JMSConfigurationImpl();
context = new InVMContext();
@@ -190,9 +191,12 @@
protected void tearDown() throws Exception
{
serverManager.stop();
-
+ stopComponent(server);
serverManager = null;
-
+ if (connection != null)
+ {
+ connection.close();
+ }
connection = null;
super.tearDown();
@@ -286,7 +290,7 @@
try
{
- int counter = msg.getIntProperty("counter");
+ msg.getIntProperty("counter");
}
catch (JMSException e)
{
13 years
JBoss hornetq SVN: r11867 - in trunk: tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:37:56 -0500 (Wed, 07 Dec 2011)
New Revision: 11867
Modified:
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
Close locators & factories in ServiceT.B. before closing the servers at ClusterT.B.
Modified: trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-12-07 11:30:46 UTC (rev 11866)
+++ trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-12-07 11:37:56 UTC (rev 11867)
@@ -88,34 +88,36 @@
@Override
protected void tearDown() throws Exception
{
- synchronized (clientSessions)
+ closeAllClientSessions();
+
+ closeAllSessionFactories();
+
+ closeAllServerLocatorsFactories();
+
+ synchronized (servers)
{
- for (ClientSession cs : clientSessions)
+ for (HornetQServer server : servers)
{
- try
- {
- if (cs != null)
- {
- cs.close();
- }
- }
- catch (Exception e)
- {
- // no-op
- }
+ stopComponent(server);
}
- clientSessions.clear();
+ servers.clear();
}
- synchronized (sessionFactories)
+ super.tearDown();
+// checkFreePort(5445);
+// checkFreePort(5446);
+// checkFreePort(5447);
+ if (InVMRegistry.instance.size() > 0)
{
- for (ClientSessionFactory sf : sessionFactories)
- {
- closeSessionFactory(sf);
- }
- sessionFactories.clear();
+ fail("InVMREgistry size > 0");
}
+ }
+ /**
+ *
+ */
+ protected void closeAllServerLocatorsFactories()
+ {
synchronized (locators)
{
for (ServerLocator locator : locators)
@@ -124,23 +126,45 @@
}
locators.clear();
}
+ }
- synchronized (servers)
+ /**
+ *
+ */
+ protected void closeAllSessionFactories()
+ {
+ synchronized (sessionFactories)
{
- for (HornetQServer server : servers)
+ for (ClientSessionFactory sf : sessionFactories)
{
- stopComponent(server);
+ closeSessionFactory(sf);
}
- servers.clear();
+ sessionFactories.clear();
}
+ }
- super.tearDown();
-// checkFreePort(5445);
-// checkFreePort(5446);
-// checkFreePort(5447);
- if (InVMRegistry.instance.size() > 0)
+ /**
+ *
+ */
+ protected void closeAllClientSessions()
+ {
+ synchronized (clientSessions)
{
- fail("InVMREgistry size > 0");
+ for (ClientSession cs : clientSessions)
+ {
+ try
+ {
+ if (cs != null)
+ {
+ cs.close();
+ }
+ }
+ catch (Exception e)
+ {
+ // no-op
+ }
+ }
+ clientSessions.clear();
}
}
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-07 11:30:46 UTC (rev 11866)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-07 11:37:56 UTC (rev 11867)
@@ -584,6 +584,7 @@
}
}
+ @Override
protected void closeAllSessionFactories()
{
for (int i = 0; i < sfs.length; i++)
@@ -591,8 +592,10 @@
closeSessionFactory(sfs[i]);
sfs[i] = null;
}
+ super.closeAllSessionFactories();
}
+ @Override
protected void closeAllServerLocatorsFactories()
{
for (int i = 0; i < locators.length; i++)
@@ -600,6 +603,7 @@
closeServerLocator(locators[i]);
locators[i] = null;
}
+ super.closeAllServerLocatorsFactories();
}
protected void closeSessionFactory(final int node)
13 years
JBoss hornetq SVN: r11866 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:30:46 -0500 (Wed, 07 Dec 2011)
New Revision: 11866
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/DivertTest.java
Log:
Keep track of all created servers to make sure we don't leak threads.
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/DivertTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/DivertTest.java 2011-12-07 11:23:31 UTC (rev 11865)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/divert/DivertTest.java 2011-12-07 11:30:46 UTC (rev 11866)
@@ -19,29 +19,29 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.DivertConfiguration;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.tests.util.ServiceTestBase;
-import org.hornetq.tests.util.UnitTestCase;
/**
* A DivertTest
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
+ *
* Created 14 Jan 2009 14:05:01
*
*
*/
public class DivertTest extends ServiceTestBase
{
- private static final Logger log = Logger.getLogger(DivertTest.class);
-
private static final int TIMEOUT = 500;
public void testSingleNonExclusiveDivert() throws Exception
@@ -68,12 +68,12 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
-
+ ServerLocator locator = createInVMNonHALocator();
+
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -113,7 +113,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -126,7 +126,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -164,12 +164,12 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
-
+ ServerLocator locator = createInVMNonHALocator();
+
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -221,7 +221,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -234,7 +234,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -247,7 +247,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -260,7 +260,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -298,11 +298,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -336,7 +336,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -374,11 +374,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -428,7 +428,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -492,11 +492,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -645,11 +645,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -787,11 +787,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -921,11 +921,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -976,11 +976,11 @@
// for (int i = 0; i < numMessages; i++)
// {
// ClientMessage message = consumer1.receive(200);
- //
+ //
// assertNotNull(message);
- //
+ //
// assertEquals((Integer)i, (Integer)message.getProperty(propKey));
- //
+ //
// message.acknowledge();
// }
@@ -992,7 +992,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1005,7 +1005,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1018,7 +1018,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1042,7 +1042,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1106,11 +1106,11 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -1162,7 +1162,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
@@ -1177,7 +1177,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
@@ -1192,7 +1192,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
@@ -1209,7 +1209,7 @@
Assert.assertNotNull(message);
- Assert.assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1267,13 +1267,13 @@
conf.setDivertConfigurations(divertConfs);
- HornetQServer messagingService = HornetQServers.newHornetQServer(conf, false);
+ HornetQServer messagingService = addServer(HornetQServers.newHornetQServer(conf, false));
messagingService.start();
// Only the first and third should be deployed
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();;
ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
13 years
JBoss hornetq SVN: r11865 - in trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration: cluster/restart and 2 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:23:31 -0500 (Wed, 07 Dec 2011)
New Revision: 11865
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
Log:
More tearDown improvements, and some reverts from previous refactorings
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2011-12-07 11:02:18 UTC (rev 11864)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2011-12-07 11:23:31 UTC (rev 11865)
@@ -1119,6 +1119,9 @@
{
InVMConnector.resetFailures();
+ closeServerLocator(locator);
+ stopComponent(service);
+
Assert.assertEquals(0, InVMRegistry.instance.size());
super.tearDown();
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java 2011-12-07 11:02:18 UTC (rev 11864)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java 2011-12-07 11:23:31 UTC (rev 11865)
@@ -26,7 +26,7 @@
public class ClusterRestartTest extends ClusterTestBase
{
Logger log = Logger.getLogger(ClusterRestartTest.class);
-
+
public void testRestartWithQueuesCreateInDiffOrder() throws Exception
{
setupServer(0, isFileStorage(), isNetty());
@@ -41,9 +41,6 @@
System.out.println("server 0 = " + getServer(0).getNodeID());
System.out.println("server 1 = " + getServer(1).getNodeID());
- try
- {
-
setupSessionFactory(0, isNetty(), -1);
setupSessionFactory(1, isNetty());
@@ -79,30 +76,19 @@
// Waiting some time after stopped
Thread.sleep(2000);
startServers(0);
-
+
waitForBindings(0, "queues.testaddress", 1, 1, true);
waitForBindings(1, "queues.testaddress", 1, 0, true);
waitForBindings(0, "queues.testaddress", 1, 0, false);
waitForBindings(1, "queues.testaddress", 1, 1, false);
-
+
printBindings(2);
sendInRange(1, "queues.testaddress", 10, 20, false, null);
verifyReceiveAllInRange(0, 20, 0);
System.out.println("*****************************************************************************");
- }
- finally
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
- }
}
public void testRestartWithQueuesCreateInDiffOrder2() throws Exception
@@ -118,11 +104,7 @@
System.out.println("server 0 = " + getServer(0).getNodeID());
System.out.println("server 1 = " + getServer(1).getNodeID());
-
- try
- {
-
- setupSessionFactory(0, isNetty(), -1);
+ setupSessionFactory(0, isNetty(), -1);
setupSessionFactory(1, isNetty());
// create some dummy queues to ensure that the test queue has a high numbered binding
@@ -160,24 +142,13 @@
waitForBindings(1, "queues.testaddress", 1, 0, true);
waitForBindings(0, "queues.testaddress", 1, 0, false);
waitForBindings(1, "queues.testaddress", 1, 0, false);
-
+
printBindings(2);
addConsumer(0, 1, "queue10", null);
addConsumer(1, 0, "queue10", null);
verifyReceiveRoundRobin(0, 20, 0, 1);
System.out.println("*****************************************************************************");
- }
- finally
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
- }
}
private void printBindings(final int num) throws Exception
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java 2011-12-07 11:02:18 UTC (rev 11864)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java 2011-12-07 11:23:31 UTC (rev 11865)
@@ -57,7 +57,7 @@
protected ServerLocator createHAServerLocator()
{
TransportConfiguration tc = createTransportConfiguration(isNetty(), false, generateParams(0, isNetty()));
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(tc);
+ ServerLocator locator = addServerLocator(HornetQClient.createServerLocatorWithHA(tc));
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
return locator;
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-07 11:02:18 UTC (rev 11864)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-07 11:23:31 UTC (rev 11865)
@@ -66,14 +66,6 @@
setupCluster();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopServers(0, 1, 2, 3, 4);
-
- super.tearDown();
- }
-
/**
* Check that the actual list of received nodeIDs correspond to the expected order of nodes
*/
@@ -100,7 +92,7 @@
{
ok = (ok && actual.contains(nodeIDs[element]));
}
- if (ok)
+ if (ok)
{
return;
}
@@ -131,7 +123,7 @@
{
if (e.getCode() == HornetQException.OBJECT_CLOSED || e.getCode() == HornetQException.UNBLOCKED)
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
return sf.createSession();
}
else
@@ -171,17 +163,17 @@
Thread.sleep(10);
}
while (System.currentTimeMillis() - start < WAIT_TIMEOUT);
-
+
log.error(clusterDescription(servers[node]));
throw new IllegalStateException("Timed out waiting for cluster connections ");
}
-
+
public void testReceiveNotificationsWhenOtherNodesAreStartedAndStopped() throws Throwable
{
startServers(0);
ServerLocator locator = createHAServerLocator();
-
+
((ServerLocatorImpl)locator).getTopology().setOwner("testReceive");
final List<String> nodes = new ArrayList<String>();
@@ -190,7 +182,7 @@
locator.addClusterTopologyListener(new ClusterTopologyListener()
{
- public void nodeUP(final long uniqueEventID,
+ public void nodeUP(final long uniqueEventID,
String nodeID,
Pair<TransportConfiguration, TransportConfiguration> connectorPair,
boolean last)
@@ -226,7 +218,7 @@
}
});
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
startServers(1, 4, 3, 2);
String[] nodeIDs = getNodeIDs(0, 1, 2, 3, 4);
@@ -246,9 +238,9 @@
checkContains(new int[] { 0 }, nodeIDs, nodes);
sf.close();
-
+
locator.close();
-
+
stopServers(0);
}
@@ -265,7 +257,7 @@
locator.addClusterTopologyListener(new ClusterTopologyListener()
{
- public void nodeUP(final long uniqueEventID,
+ public void nodeUP(final long uniqueEventID,
String nodeID,
Pair<TransportConfiguration, TransportConfiguration> connectorPair,
boolean last)
@@ -287,13 +279,13 @@
}
});
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
assertTrue("Was not notified that all servers are UP", upLatch.await(10, SECONDS));
checkContains(new int[] { 0, 1, 2, 3, 4 }, nodeIDs, nodes);
ClientSession session = sf.createSession();
-
+
waitForClusterConnections(0, 4);
waitForClusterConnections(1, 4);
waitForClusterConnections(2, 4);
@@ -317,12 +309,12 @@
checkContains(new int[] { 1 }, nodeIDs, nodes);
stopServers(1);
-
+
assertTrue("Was not notified that all servers are DOWN", downLatch.await(10, SECONDS));
checkContains(new int[] {}, nodeIDs, nodes);
sf.close();
-
+
locator.close();
}
@@ -358,7 +350,7 @@
}
});
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
assertTrue("Was not notified that all servers are UP", upLatch.await(10, SECONDS));
checkContains(new int[] { 0, 1, 2, 3, 4 }, nodeIDs, nodes);
@@ -370,7 +362,7 @@
waitForClusterConnections(4, 4);
ClientSession session = sf.createSession();
-
+
stopServers(0);
assertFalse(servers[0].isStarted());
session = checkSessionOrReconnect(session, locator);
@@ -403,10 +395,10 @@
{
}
-
+
locator.close();
}
-
+
public void testMultipleClientSessionFactories() throws Throwable
{
startServers(0, 1, 2, 3, 4);
@@ -420,7 +412,7 @@
locator.addClusterTopologyListener(new ClusterTopologyListener()
{
- public void nodeUP(final long uniqueEventID, String nodeID,
+ public void nodeUP(final long uniqueEventID, String nodeID,
Pair<TransportConfiguration, TransportConfiguration> connectorPair,
boolean last)
{
@@ -465,12 +457,12 @@
}
assertTrue("Was not notified that all servers are Down", ok);
checkContains(new int[] { 0 }, nodeIDs, nodes);
-
+
for (ClientSessionFactory sf : sfs)
{
sf.close();
}
-
+
locator.close();
stopServers(0);
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2011-12-07 11:02:18 UTC (rev 11864)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/BridgeTestBase.java 2011-12-07 11:23:31 UTC (rev 11865)
@@ -45,6 +45,7 @@
import org.hornetq.api.jms.management.TopicControl;
import org.hornetq.core.config.Configuration;
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.TransportConstants;
import org.hornetq.core.server.HornetQServer;
@@ -63,7 +64,7 @@
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* A BridgeTestBase
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
@@ -114,8 +115,7 @@
conf0.setJournalDirectory(getJournalDir(0, false));
conf0.setBindingsDirectory(getBindingsDir(0, false));
conf0.setSecurityEnabled(false);
- conf0.getAcceptorConfigurations()
- .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
+ conf0.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()));
server0 = HornetQServers.newHornetQServer(conf0, false);
context0 = new InVMContext();
@@ -129,8 +129,8 @@
conf1.setBindingsDirectory(getBindingsDir(1, false));
params1 = new HashMap<String, Object>();
params1.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
- conf1.getAcceptorConfigurations()
- .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory", params1));
+ conf1.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName(),
+ params1));
server1 = HornetQServers.newHornetQServer(conf1, false);
@@ -177,14 +177,11 @@
checkNoSubscriptions(sourceTopic, 0);
- jmsServer0.stop();
+ stopComponent(jmsServer0);
+ stopComponent(jmsServer1);
+ stopComponent(server1);
+ stopComponent(server0);
- jmsServer1.stop();
-
- server1.stop();
-
- server0.stop();
-
cff0 = cff1 = null;
cff0xa = cff1xa = null;
@@ -210,10 +207,10 @@
context0 = null;
context1 = null;
-
+
// Shutting down Arjuna threads
TxControl.disable(true);
-
+
TransactionReaper.terminate(false);
super.tearDown();
@@ -225,7 +222,7 @@
{
public ConnectionFactory createConnectionFactory() throws Exception
{
- HornetQConnectionFactory cf = (HornetQConnectionFactory)HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
+ HornetQConnectionFactory cf = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,
new TransportConfiguration(InVMConnectorFactory.class.getName()));
// Note! We disable automatic reconnection on the session factory. The bridge needs to do the reconnection
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2011-12-07 11:02:18 UTC (rev 11864)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/bridge/JMSBridgeReconnectionTest.java 2011-12-07 11:23:31 UTC (rev 11865)
@@ -21,10 +21,6 @@
/**
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
*/
public class JMSBridgeReconnectionTest extends BridgeTestBase
{
13 years
JBoss hornetq SVN: r11864 - in trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration: clientcrash and 1 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-07 06:02:18 -0500 (Wed, 07 Dec 2011)
New Revision: 11864
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java
Log:
Use stopServer(int...) at ClusterTestBase
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-12-06 21:31:11 UTC (rev 11863)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-12-07 11:02:18 UTC (rev 11864)
@@ -355,7 +355,7 @@
clientSession.rollback();
}
ClientMessage m = clientConsumer.receive(500);
- Assert.assertNull(m);
+ Assert.assertNull("not expecting a message", m);
clientConsumer.close();
clientConsumer = clientSession.createConsumer(deadLetterQueue);
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java 2011-12-06 21:31:11 UTC (rev 11863)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java 2011-12-07 11:02:18 UTC (rev 11864)
@@ -17,16 +17,13 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.util.SpawnedVMSupport;
@@ -148,7 +145,7 @@
Assert.assertNotNull("no message received", messageFromClient);
Assert.assertEquals(ClientCrashTest.MESSAGE_TEXT_FROM_CLIENT, messageFromClient.getBodyBuffer().readString());
- assertEquals(2, messageFromClient.getDeliveryCount());
+ assertEquals("delivery count", 2, messageFromClient.getDeliveryCount());
session.close();
@@ -161,7 +158,7 @@
{
super.setUp();
- locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(NettyConnectorFactory.class.getName()));
+ locator = createNettyNonHALocator();
addServerLocator(locator);
locator.setClientFailureCheckPeriod(ClientCrashTest.PING_PERIOD);
locator.setConnectionTTL(ClientCrashTest.CONNECTION_TTL);
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-06 21:31:11 UTC (rev 11863)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-07 11:02:18 UTC (rev 11864)
@@ -183,7 +183,7 @@
{
// no-op
}
- stopComponent(servers[i]);
+ stopServers(i);
}
for (int i = 0; i < MAX_SERVERS; i++)
{
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java 2011-12-06 21:31:11 UTC (rev 11863)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/NettySymmetricClusterWithBackupTest.java 2011-12-07 11:02:18 UTC (rev 11864)
@@ -22,7 +22,6 @@
package org.hornetq.tests.integration.cluster.distribution;
-import org.hornetq.core.logging.Logger;
/**
* A NettySymmetricClusterWithBackupTest
@@ -33,8 +32,7 @@
*/
public class NettySymmetricClusterWithBackupTest extends SymmetricClusterWithBackupTest
{
- private Logger log = Logger.getLogger(NettySymmetricClusterWithBackupTest.class);
-
+
@Override
protected boolean isNetty()
{
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java 2011-12-06 21:31:11 UTC (rev 11863)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java 2011-12-07 11:02:18 UTC (rev 11864)
@@ -39,20 +39,6 @@
setupServers();
}
- @Override
- protected void tearDown() throws Exception
- {
- log.info("#test tearDown");
- try
- {
- stopServers();
- }
- finally
- {
- super.tearDown();
- }
- }
-
protected boolean isNetty()
{
return false;
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java 2011-12-06 21:31:11 UTC (rev 11863)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java 2011-12-07 11:02:18 UTC (rev 11864)
@@ -248,7 +248,7 @@
verifyReceiveRoundRobinInSomeOrder(10, 26, 27);
}
- //@Override
+ @Override
public void _testStartStopServers() throws Exception
{
setupCluster();
13 years
JBoss hornetq SVN: r11862 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: borges
Date: 2011-12-06 10:52:32 -0500 (Tue, 06 Dec 2011)
New Revision: 11862
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ExpiryAddressTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
Log:
Fix tests broken during refactoring of tearDown()
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-12-06 15:02:45 UTC (rev 11861)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-12-06 15:52:32 UTC (rev 11862)
@@ -34,6 +34,7 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.server.Queue;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.RandomUtil;
@@ -48,6 +49,7 @@
private static final Logger log = Logger.getLogger(DeadLetterAddressTest.class);
private HornetQServer server;
+
private ClientSession clientSession;
private ServerLocator locator;
@@ -249,7 +251,7 @@
clientSession.createQueue(dla, dlq, null, false);
clientSession.createQueue(qName, qName, null, false);
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
- ClientSessionFactory sessionFactory = createSessionFactory(locator);
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession sendSession = sessionFactory.createSession(false, true, true);
ClientProducer producer = sendSession.createProducer(qName);
Map<String, Long> origIds = new HashMap<String, Long>();
@@ -468,7 +470,8 @@
configuration.setSecurityEnabled(false);
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
configuration.getAcceptorConfigurations().add(transportConfig);
- server = createServer(false, configuration);
+ server = addServer(HornetQServers.newHornetQServer(configuration, false));
+ // start the server
server.start();
// then we create a client as normal
locator =
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ExpiryAddressTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ExpiryAddressTest.java 2011-12-06 15:02:45 UTC (rev 11861)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ExpiryAddressTest.java 2011-12-06 15:52:32 UTC (rev 11862)
@@ -27,6 +27,7 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
@@ -313,7 +314,7 @@
configuration.setSecurityEnabled(false);
TransportConfiguration transportConfig = new TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
configuration.getAcceptorConfigurations().add(transportConfig);
- server = createServer(false, configuration);
+ server = addServer(HornetQServers.newHornetQServer(configuration, false));
// start the server
server.start();
// then we create a client as normal
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/IncompatibleVersionTest.java 2011-12-06 15:02:45 UTC (rev 11861)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/IncompatibleVersionTest.java 2011-12-06 15:52:32 UTC (rev 11862)
@@ -83,7 +83,11 @@
protected void tearDown() throws Exception
{
connection.destroy();
- super.tearDown();
+
+ locator.close();
+
+ server.stop();
+ // You CANNOT CALL super.tearDown();
}
public void testCompatibleClientVersion() throws Exception
13 years