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);