Author: ataylor
Date: 2011-12-05 09:48:36 -0500 (Mon, 05 Dec 2011)
New Revision: 11835
Modified:
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AckBatchSizeTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AcknowledgeTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AutogroupIdTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java
Log:
test suite refactor
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-05
14:44:39 UTC (rev 11834)
+++
trunk/hornetq-core/src/test/java/org/hornetq/tests/util/ServiceTestBase.java 2011-12-05
14:48:36 UTC (rev 11835)
@@ -457,7 +457,16 @@
}
}
+
+
protected HornetQServer createServer(final boolean realFiles,
+ Configuration conf,
+ MBeanServer mbeanServer)
+ {
+ return createServer(realFiles, conf, mbeanServer, new HashMap<String,
AddressSettings>());
+ }
+
+ protected HornetQServer createServer(final boolean realFiles,
final Configuration configuration,
final MBeanServer mbeanServer,
final Map<String, AddressSettings>
settings)
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AckBatchSizeTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AckBatchSizeTest.java 2011-12-05
14:44:39 UTC (rev 11834)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AckBatchSizeTest.java 2011-12-05
14:48:36 UTC (rev 11835)
@@ -47,7 +47,7 @@
private int getMessageEncodeSize(final SimpleString address) throws Exception
{
ServerLocator locator = createInVMNonHALocator();
- ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSessionFactory cf = createSessionFactory(locator);
ClientSession session = cf.createSession(false, true, true);
ClientMessage message = session.createMessage(false);
// we need to set the destination so we can calculate the encodesize correctly
@@ -66,7 +66,7 @@
int numMessages = 100;
locator.setAckBatchSize(numMessages * getMessageEncodeSize(addressA));
locator.setBlockOnAcknowledge(true);
- ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, true, true);
@@ -106,7 +106,7 @@
ServerLocator locator = createInVMNonHALocator();
locator.setAckBatchSize(0);
locator.setBlockOnAcknowledge(true);
- ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true);
int numMessages = 100;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AcknowledgeTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AcknowledgeTest.java 2011-12-05
14:44:39 UTC (rev 11834)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AcknowledgeTest.java 2011-12-05
14:48:36 UTC (rev 11835)
@@ -53,7 +53,7 @@
ServerLocator locator = createInVMNonHALocator();
locator.setAckBatchSize(0);
locator.setBlockOnAcknowledge(true);
- ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -85,7 +85,7 @@
server.start();
ServerLocator locator = createInVMNonHALocator();
- ClientSessionFactory cf = locator.createSessionFactory();;
+ ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -125,7 +125,7 @@
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
locator.setAckBatchSize(0);
- ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -174,7 +174,7 @@
ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
locator.setAckBatchSize(0);
- ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSessionFactory cf = createSessionFactory(locator);
ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AutogroupIdTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AutogroupIdTest.java 2011-12-05
14:44:39 UTC (rev 11834)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/AutogroupIdTest.java 2011-12-05
14:48:36 UTC (rev 11835)
@@ -60,7 +60,7 @@
ServerLocator locator = createInVMNonHALocator();
locator.setAutoGroup(true);
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
session.createQueue(groupTestQ, groupTestQ, null, false);
@@ -110,7 +110,7 @@
ServerLocator locator = createInVMNonHALocator();
locator.setAutoGroup(true);
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
session.createQueue(groupTestQ, groupTestQ, null, false);
@@ -163,7 +163,7 @@
ServerLocator locator = createInVMNonHALocator();
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java 2011-12-05
14:44:39 UTC (rev 11834)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AcceptorControlTest.java 2011-12-05
14:48:36 UTC (rev 11835)
@@ -35,6 +35,8 @@
import org.hornetq.tests.integration.SimpleNotificationService;
import org.hornetq.tests.util.RandomUtil;
+import javax.management.MBeanServer;
+
/**
* A AcceptorControlTest
*
@@ -46,10 +48,6 @@
*/
public class AcceptorControlTest extends ManagementTestBase
{
-
- private HornetQServer service;
- private ServerLocator locator;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -66,7 +64,7 @@
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(acceptorConfig);
- service = HornetQServers.newHornetQServer(conf, mbeanServer, false);
+ HornetQServer service = createServer(false, conf, mbeanServer);
service.start();
AcceptorControl acceptorControl =
createManagementControl(acceptorConfig.getName());
@@ -84,17 +82,15 @@
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(acceptorConfig);
- service = HornetQServers.newHornetQServer(conf, mbeanServer, false);
+ HornetQServer service = createServer(false, conf, mbeanServer);
service.start();
AcceptorControl acceptorControl =
createManagementControl(acceptorConfig.getName());
// started by the server
Assert.assertTrue(acceptorControl.isStarted());
- locator =
- HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(
-
InVMConnectorFactory.class.getName()));
- ClientSessionFactory sf = locator.createSessionFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
Assert.assertNotNull(session);
session.close();
@@ -116,8 +112,8 @@
Assert.assertTrue(acceptorControl.isStarted());
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(InVMConnectorFactory.class.getName()));
- sf = locator.createSessionFactory();
+ locator = createInVMNonHALocator();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true);
Assert.assertNotNull(session);
session.close();
@@ -146,7 +142,7 @@
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(acceptorConfig);
- service = HornetQServers.newHornetQServer(conf, mbeanServer, false);
+ HornetQServer service = createServer(false, conf, mbeanServer);
service.start();
AcceptorControl acceptorControl =
createManagementControl(acceptorConfig.getName());
@@ -178,14 +174,6 @@
// Protected -----------------------------------------------------
- @Override
- protected void tearDown() throws Exception
- {
- stopComponent(service);
- closeServerLocator(locator);
- super.tearDown();
- }
-
protected AcceptorControl createManagementControl(final String name) throws Exception
{
return ManagementControlHelper.createAcceptorControl(name, mbeanServer);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java 2011-12-05
14:44:39 UTC (rev 11834)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java 2011-12-05
14:48:36 UTC (rev 11835)
@@ -318,13 +318,13 @@
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(new
TransportConfiguration(InVMAcceptorFactory.class.getName()));
- server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
+ server = createServer(false, conf, mbeanServer);
server.start();
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator = createInVMNonHALocator();
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnNonDurableSend(true);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, false);
session.start();
}
@@ -334,11 +334,6 @@
{
if (session != null)
session.close();
- closeSessionFactory(sf);
- closeServerLocator(locator);
- stopComponent(server);
-
- server = null;
session = null;
super.tearDown();
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java 2011-12-05
14:44:39 UTC (rev 11834)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlUsingCoreTest.java 2011-12-05
14:48:36 UTC (rev 11835)
@@ -182,13 +182,13 @@
conf.setSecurityEnabled(false);
conf.setJMXManagementEnabled(true);
conf.getAcceptorConfigurations().add(new
TransportConfiguration(InVMAcceptorFactory.class.getName()));
- server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
+ server = createServer(false, conf, mbeanServer);
server.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = createInVMNonHALocator();
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnNonDurableSend(true);
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
session = sf.createSession(false, true, false);
session.start();
}
@@ -204,13 +204,7 @@
protected void tearDown() throws Exception
{
session.close();
-
- server.stop();
-
session = null;
-
- server = null;
-
super.tearDown();
}