Author: borges
Date: 2012-02-15 11:39:59 -0500 (Wed, 15 Feb 2012)
New Revision: 12124
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
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessagePriorityTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
Log:
improve tearDown
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 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -15,8 +15,6 @@
import java.io.File;
import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -35,7 +33,6 @@
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.client.impl.ClientSessionInternal;
import org.hornetq.core.client.impl.Topology;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
@@ -82,18 +79,9 @@
protected static final String NETTY_CONNECTOR_FACTORY =
NettyConnectorFactory.class.getCanonicalName();
- private final Collection<ClientSessionFactory> sessionFactories = new
ArrayList<ClientSessionFactory>();
- private final Collection<ClientSession> clientSessions = new
ArrayList<ClientSession>();
-
@Override
protected void tearDown() throws Exception
{
- closeAllClientSessions();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
super.tearDown();
if (InVMRegistry.instance.size() > 0)
{
@@ -101,51 +89,7 @@
}
}
- /**
- *
- */
- protected void closeAllSessionFactories()
- {
- synchronized (sessionFactories)
- {
- for (ClientSessionFactory sf : sessionFactories)
- {
- closeSessionFactory(sf);
- }
- sessionFactories.clear();
- }
- }
- /**
- *
- */
- protected void closeAllClientSessions()
- {
- synchronized (clientSessions)
- {
- for (ClientSession cs : clientSessions)
- {
- if (cs == null)
- continue;
- try
- {
- if (cs instanceof ClientSessionInternal)
- {
- ((ClientSessionInternal)cs).cleanUp(false);
- }
- else
- {
- cs.close();
- }
- }
- catch (Exception e)
- {
- // no-op
- }
- }
- clientSessions.clear();
- }
- }
protected void waitForTopology(final HornetQServer server, final int nodes) throws
Exception
{
@@ -376,22 +320,6 @@
}
}
- protected ClientSession addClientSession(ClientSession session)
- {
- synchronized (clientSessions)
- {
- clientSessions.add(session);
- }
- return session;
- }
-
- protected void addSessionFactory(ClientSessionFactory sf)
- {
- synchronized (sessionFactories)
- {
- sessionFactories.add(sf);
- }
- }
protected HornetQServer createServer(final boolean realFiles,
final Configuration configuration,
final int pageSize,
@@ -661,13 +589,6 @@
}
}
- protected final ClientSessionFactory createSessionFactory(ServerLocator locator)
throws Exception
- {
- ClientSessionFactory sf = locator.createSessionFactory();
- addSessionFactory(sf);
- return sf;
- }
-
protected void createQueue(final String address, final String queue) throws Exception
{
ServerLocator locator = 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 2012-02-15
16:39:22 UTC (rev 12123)
+++ trunk/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -61,6 +61,7 @@
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -117,7 +118,7 @@
public static final String NETTY_CONNECTOR_FACTORY =
NettyConnectorFactory.class.getCanonicalName();
protected static final String CLUSTER_PASSWORD =
"UnitTestsClusterPassword";
-
+
private static final String OS_TYPE =
System.getProperty("os.name").toLowerCase();
// Attributes ----------------------------------------------------
@@ -129,6 +130,8 @@
private final Collection<HornetQServer> servers = new
ArrayList<HornetQServer>();
private final Collection<ServerLocator> locators = new
ArrayList<ServerLocator>();
+ private final Collection<ClientSessionFactory> sessionFactories = new
ArrayList<ClientSessionFactory>();
+ private final Collection<ClientSession> clientSessions = new
ArrayList<ClientSession>();
private boolean checkThread = true;
@@ -933,7 +936,12 @@
@Override
protected void tearDown() throws Exception
{
+ closeAllClientSessions();
+ closeAllSessionFactories();
+
+ closeAllServerLocatorsFactories();
+
synchronized (servers)
{
for (HornetQServer server : servers)
@@ -1446,14 +1454,6 @@
}
- protected HornetQServer addServer(HornetQServer server)
- {
- synchronized (servers)
- {
- servers.add(server);
- }
- return server;
- }
protected static final void stopComponent(HornetQComponent component)
{
if (component == null)
@@ -1469,6 +1469,22 @@
}
}
+ protected final ClientSessionFactory createSessionFactory(ServerLocator locator)
throws Exception
+ {
+ ClientSessionFactory sf = locator.createSessionFactory();
+ addSessionFactory(sf);
+ return sf;
+ }
+
+ protected HornetQServer addServer(HornetQServer server)
+ {
+ synchronized (servers)
+ {
+ servers.add(server);
+ }
+ return server;
+ }
+
protected final ServerLocator addServerLocator(ServerLocator locator)
{
synchronized (locators)
@@ -1478,6 +1494,63 @@
return locator;
}
+ protected ClientSession addClientSession(ClientSession session)
+ {
+ synchronized (clientSessions)
+ {
+ clientSessions.add(session);
+ }
+ return session;
+ }
+
+ protected void addSessionFactory(ClientSessionFactory sf)
+ {
+ synchronized (sessionFactories)
+ {
+ sessionFactories.add(sf);
+ }
+ }
+
+ protected void closeAllClientSessions()
+ {
+ synchronized (clientSessions)
+ {
+ for (ClientSession cs : clientSessions)
+ {
+ if (cs == null)
+ continue;
+ try
+ {
+ if (cs instanceof ClientSessionInternal)
+ {
+ ((ClientSessionInternal)cs).cleanUp(false);
+ }
+ else
+ {
+ cs.close();
+ }
+ }
+ catch (Exception e)
+ {
+ // no-op
+ }
+ }
+ clientSessions.clear();
+ }
+ }
+
+ protected void closeAllSessionFactories()
+ {
+ synchronized (sessionFactories)
+ {
+ for (ClientSessionFactory sf : sessionFactories)
+ {
+ closeSessionFactory(sf);
+ }
+ sessionFactories.clear();
+ }
+ }
+
protected void closeAllServerLocatorsFactories()
{
synchronized (locators)
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -15,7 +15,12 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -34,12 +39,10 @@
public void testConsumersRoundRobinCorrectly() throws Exception
{
HornetQServer server = createServer(false);
- try
- {
- server.start();
+ server.start();
ServerLocator locator = createInVMNonHALocator();
- ClientSessionFactory cf = locator.createSessionFactory();
- ClientSession session = cf.createSession(false, true, true);
+ ClientSessionFactory cf = createSessionFactory(locator);
+ ClientSession session = addClientSession(cf.createSession(false, true, true));
session.createQueue(addressA, queueA, false);
ClientConsumer[] consumers = new ClientConsumer[5];
@@ -74,16 +77,6 @@
cm.acknowledge();
}
}
- log.info("closing session");
- session.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -112,37 +112,6 @@
}
@Override
- protected void tearDown() throws Exception
- {
- if (clientSession != null)
- {
- try
- {
- clientSession.close();
- }
- catch (HornetQException e1)
- {
- //
- }
- }
- if (server != null && server.isStarted())
- {
- try
- {
- server.stop();
- }
- catch (Exception e1)
- {
- //
- }
- }
- server = null;
- clientSession = null;
-
- super.tearDown();
- }
-
- @Override
protected void setUp() throws Exception
{
super.setUp();
@@ -151,17 +120,19 @@
configuration.setSecurityEnabled(false);
TransportConfiguration transportConfig = new
TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
configuration.getAcceptorConfigurations().add(transportConfig);
- server = HornetQServers.newHornetQServer(configuration, false);
+ server = addServer(HornetQServers.newHornetQServer(configuration, false));
// start the server
server.start();
// then we create a client as normal
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator =
+ addServerLocator(HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(
+
ServiceTestBase.INVM_CONNECTOR_FACTORY)));
locator.setGroupID("grp1");
ClientSessionFactory sessionFactory = locator.createSessionFactory();
- clientSession = sessionFactory.createSession(false, true, true);
+ clientSession = addClientSession(sessionFactory.createSession(false, true, true));
clientSession.createQueue(qName, qName, null, false);
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingTest.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessageGroupingTest.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -536,38 +536,6 @@
}
@Override
- protected void tearDown() throws Exception
- {
- if (clientSession != null)
- {
- try
- {
- clientSession.close();
- }
- catch (HornetQException e1)
- {
- //
- }
- }
- if (server != null && server.isStarted())
- {
- try
- {
- server.stop();
- }
- catch (Exception e1)
- {
- //
- }
- }
- locator.close();
- server = null;
- clientSession = null;
-
- super.tearDown();
- }
-
- @Override
protected void setUp() throws Exception
{
super.setUp();
@@ -576,14 +544,16 @@
configuration.setSecurityEnabled(false);
TransportConfiguration transportConfig = new
TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
configuration.getAcceptorConfigurations().add(transportConfig);
- server = HornetQServers.newHornetQServer(configuration, false);
+ server = addServer(HornetQServers.newHornetQServer(configuration, false));
// start the server
server.start();
// then we create a client as normal
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator =
+ addServerLocator(HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(
+
UnitTestCase.INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = locator.createSessionFactory();
- clientSession = sessionFactory.createSession(false, true, true);
+ clientSession = addClientSession(sessionFactory.createSession(false, true, true));
clientSession.createQueue(qName, qName, null, false);
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessagePriorityTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessagePriorityTest.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/MessagePriorityTest.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -45,7 +45,7 @@
private static final Logger log = Logger.getLogger(MessagePriorityTest.class);
-
+
// Attributes ----------------------------------------------------
private HornetQServer server;
@@ -105,11 +105,11 @@
SimpleString address = RandomUtil.randomSimpleString();
session.createQueue(address, queue, false);
-
+
session.start();
ClientProducer producer = session.createProducer(address);
-
+
ClientConsumer consumer = session.createConsumer(queue);
for (int i = 0; i < 10; i++)
@@ -118,18 +118,18 @@
m.setPriority((byte)i);
producer.send(m);
}
-
+
//Wait for msgs to reach client side
-
+
Thread.sleep(1000);
-
+
// expect to consume message with higher priority first
for (int i = 9; i >= 0; i--)
{
ClientMessage m = consumer.receive(500);
-
+
log.info("received msg " + m.getPriority());
-
+
Assert.assertNotNull(m);
Assert.assertEquals(i, m.getPriority());
}
@@ -205,7 +205,7 @@
session.deleteQueue(queue);
}
-
+
//
https://jira.jboss.org/jira/browse/HORNETQ-275
public void testOutOfOrderAcknowledgement() throws Exception
{
@@ -226,7 +226,7 @@
m.setPriority((byte)i);
producer.send(m);
}
-
+
Thread.sleep(500);
// Now we wait a little bit to make sure the messages are in the client side
buffer
@@ -243,7 +243,7 @@
m.acknowledge();
consumer.close();
-
+
//Close and try and receive the other ones
consumer = session.createConsumer(queue);
@@ -261,13 +261,13 @@
m.acknowledge();
}
-
+
consumer.close();
session.deleteQueue(queue);
}
-
-
+
+
public void testManyMessages() throws Exception
{
SimpleString queue = RandomUtil.randomSimpleString();
@@ -276,7 +276,7 @@
session.createQueue(address, queue, false);
ClientProducer producer = session.createProducer(address);
-
+
for (int i = 0 ; i < 777; i++)
{
ClientMessage msg = session.createMessage(true);
@@ -284,7 +284,7 @@
msg.putBooleanProperty("fast", false);
producer.send(msg);
}
-
+
for (int i = 0 ; i < 333; i++)
{
ClientMessage msg = session.createMessage(true);
@@ -296,8 +296,8 @@
ClientConsumer consumer = session.createConsumer(queue);
session.start();
-
-
+
+
for (int i = 0 ; i < 333; i++)
{
ClientMessage msg = consumer.receive(5000);
@@ -305,7 +305,7 @@
msg.acknowledge();
assertTrue(msg.getBooleanProperty("fast"));
}
-
+
for (int i = 0 ; i < 777; i++)
{
ClientMessage msg = consumer.receive(5000);
@@ -317,11 +317,11 @@
consumer.close();
session.deleteQueue(queue);
-
+
session.close();
}
-
-
+
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@@ -334,35 +334,17 @@
Configuration config = createDefaultConfig();
config.getAcceptorConfigurations().add(new
TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()));
config.setSecurityEnabled(false);
- server = HornetQServers.newHornetQServer(config, false);
+ server = addServer(HornetQServers.newHornetQServer(config, false));
server.start();
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ locator =
+ addServerLocator(HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(
+
ServiceTestBase.INVM_CONNECTOR_FACTORY)));
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
- sf = locator.createSessionFactory();
- session = sf.createSession(false, true, true);
+ sf = createSessionFactory(locator);
+ session = addClientSession(sf.createSession(false, true, true));
}
- @Override
- protected void tearDown() throws Exception
- {
- sf.close();
-
- session.close();
-
- locator.close();
-
- server.stop();
-
- sf = null;
-
- session = null;
-
- server = null;
-
- super.tearDown();
- }
-
// Private -------------------------------------------------------
private static void expectMessage(final byte expectedPriority,
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/NewDeadLetterAddressTest.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -17,16 +17,21 @@
import org.hornetq.api.core.HornetQException;
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.impl.ConfigurationImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* A NewDeadLetterAddressTest
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
@@ -69,11 +74,13 @@
configuration.setSecurityEnabled(false);
TransportConfiguration transportConfig = new
TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
configuration.getAcceptorConfigurations().add(transportConfig);
- server = HornetQServers.newHornetQServer(configuration, false);
+ server = addServer(HornetQServers.newHornetQServer(configuration, false));
// start the server
server.start();
// then we create a client as normal
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator =
+ addServerLocator(HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(
+
UnitTestCase.INVM_CONNECTOR_FACTORY)));
ClientSessionFactory sessionFactory = locator.createSessionFactory();
clientSession = sessionFactory.createSession(false, true, false);
}
@@ -92,19 +99,6 @@
//
}
}
- locator.close();
- if (server != null && server.isStarted())
- {
- try
- {
- server.stop();
- }
- catch (Exception e1)
- {
- //
- }
- }
- server = null;
clientSession = null;
super.tearDown();
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTestBase.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -54,25 +54,7 @@
@Override
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);
- }
- }
-
servers = null;
-
InVMConnector.failOnCreateConnection = false;
super.tearDown();
@@ -129,7 +111,7 @@
{
service = new InVMNodeManagerServer(serviceConf, nodeManager);
}
-
+ addServer(service);
servers.add(service);
return service;
@@ -178,7 +160,7 @@
{
service = new InVMNodeManagerServer(serviceConf, nodeManager);
}
-
+ addServer(service);
servers.add(service);
return service;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -686,21 +686,6 @@
startServer();
}
- @Override
- protected void tearDown() throws Exception
- {
- if (liveService.isStarted())
- {
- liveService.stop();
- }
-
- liveService = null;
-
- liveTC = null;
-
- super.tearDown();
- }
-
private void startServer() throws Exception
{
Configuration liveConf = createBasicConfig();
@@ -735,7 +720,7 @@
bcConfigs1.add(bcConfig1);
liveConf.setBroadcastGroupConfigurations(bcConfigs1);
- liveService = HornetQServers.newHornetQServer(liveConf, false);
+ liveService = addServer(HornetQServers.newHornetQServer(liveConf, false));
liveService.start();
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2012-02-15
16:39:22 UTC (rev 12123)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/ExceptionListenerTest.java 2012-02-15
16:39:59 UTC (rev 12124)
@@ -28,7 +28,6 @@
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.jms.client.HornetQConnection;
@@ -39,7 +38,7 @@
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* A ExceptionListenerTest
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
@@ -66,12 +65,12 @@
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations()
.add(new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
- server = HornetQServers.newHornetQServer(conf, false);
+ server = addServer(HornetQServers.newHornetQServer(conf, false));
jmsServer = new JMSServerManagerImpl(server);
jmsServer.setContext(new NullInitialContext());
jmsServer.start();
jmsServer.createQueue(false, ExceptionListenerTest.Q_NAME, null, true,
ExceptionListenerTest.Q_NAME);
- cf = (HornetQConnectionFactory)
HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
+ cf = HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
cf.setBlockOnDurableSend(true);
cf.setPreAcknowledge(true);
}
@@ -81,20 +80,7 @@
{
jmsServer.stop();
cf = null;
- if (server != null && server.isStarted())
- {
- try
- {
- server.stop();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- server = null;
- }
-
server = null;
jmsServer = null;
cf = null;