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)
Show replies by date