Author: borges
Date: 2011-12-02 11:01:11 -0500 (Fri, 02 Dec 2011)
New Revision: 11816
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java
Log:
FIX test: server must have persistency enabled for test to make sense (and work).
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-02
15:45:51 UTC (rev 11815)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/AddressControlTest.java 2011-12-02
16:01:11 UTC (rev 11816)
@@ -57,6 +57,7 @@
private HornetQServer server;
protected ClientSession session;
private ServerLocator locator;
+ private ClientSessionFactory sf;
// Static --------------------------------------------------------
@@ -213,20 +214,22 @@
{
session.close();
server.stop();
+ server.getConfiguration().setPersistenceEnabled(true);
SimpleString address = RandomUtil.randomSimpleString();
AddressSettings addressSettings = new AddressSettings();
addressSettings.setPageSizeBytes(1024);
addressSettings.setMaxSizeBytes(10 * 1024);
- int NUMBER_MESSAGES_BEFORE_PAGING = 5;
+ final int NUMBER_MESSAGES_BEFORE_PAGING = 5;
server.getAddressSettingsRepository().addMatch(address.toString(),
addressSettings);
server.start();
-
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
- ClientSessionFactory sf = locator.createSessionFactory();
- session = sf.createSession(false, true, false);
+ ServerLocator locator2 = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory sf2 = locator2.createSessionFactory();
+ try
+ {
+ session = sf2.createSession(false, true, false);
session.start();
session.createQueue(address, address, true);
@@ -262,7 +265,13 @@
producer.send(msg);
session.commit();
- Assert.assertEquals(2, addressControl.getNumberOfPages());
+ Assert.assertEquals("# of pages is 2", 2,
addressControl.getNumberOfPages());
+ }
+ finally
+ {
+ closeSessionFactory(sf2);
+ closeServerLocator(locator2);
+ }
}
public void testGetNumberOfBytesPerPage() throws Exception
@@ -281,11 +290,19 @@
server.getAddressSettingsRepository().addMatch(address.toString(),
addressSettings);
server.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
- ClientSessionFactory sf = locator.createSessionFactory();
- session = sf.createSession(false, true, false);
- session.createQueue(address, address, true);
- Assert.assertEquals(1024, addressControl.getNumberOfBytesPerPage());
+ ServerLocator locator2 = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory sf2 = locator2.createSessionFactory();
+ try
+ {
+ session = sf2.createSession(false, true, false);
+ session.createQueue(address, address, true);
+ Assert.assertEquals(1024, addressControl.getNumberOfBytesPerPage());
+ }
+ finally
+ {
+ closeServerLocator(locator2);
+ closeSessionFactory(sf2);
+ }
}
// Package protected ---------------------------------------------
@@ -307,7 +324,7 @@
locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnNonDurableSend(true);
- ClientSessionFactory sf = locator.createSessionFactory();
+ sf = locator.createSessionFactory();
session = sf.createSession(false, true, false);
session.start();
}
@@ -317,12 +334,11 @@
{
if (session != null)
session.close();
-
+ closeSessionFactory(sf);
closeServerLocator(locator);
stopComponent(server);
server = null;
-
session = null;
super.tearDown();
Show replies by date