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