Author: borges
Date: 2011-12-06 06:41:24 -0500 (Tue, 06 Dec 2011)
New Revision: 11853
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerCloseTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerFilterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeliveryOrderTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/xa/BasicXaTest.java
trunk/tests/soak-tests/src/test/java/org/hornetq/tests/soak/client/ClientNonDivertedSoakTest.java
Log:
Mostly deleting unnecessary tearDown code (but also improving tearDown in general)
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerCloseTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerCloseTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerCloseTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -26,7 +26,6 @@
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
@@ -35,17 +34,13 @@
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class ConsumerCloseTest extends ServiceTestBase
{
- // Constants -----------------------------------------------------
- private static final Logger log = Logger.getLogger(ConsumerCloseTest.class);
-
- // Attributes ----------------------------------------------------
-
+ private ClientSessionFactory sf;
private HornetQServer server;
private ClientSession session;
@@ -156,45 +151,21 @@
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();
address = RandomUtil.randomSimpleString();
queue = RandomUtil.randomSimpleString();
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ locator =
+ addServerLocator(HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(
+
ServiceTestBase.INVM_CONNECTOR_FACTORY)));
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
- session = sf.createSession(false, true, true);
+ session = addClientSession(sf.createSession(false, true, true));
session.createQueue(address, queue, false);
-
}
- private ClientSessionFactory sf;
-
- @Override
- protected void tearDown() throws Exception
- {
- session.deleteQueue(queue);
-
- session.close();
-
- sf.close();
-
- locator.close();
-
- server.stop();
-
- session = null;
- sf = null;
- server = null;
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerFilterTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerFilterTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerFilterTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -24,7 +24,7 @@
import org.hornetq.tests.util.ServiceTestBase;
/**
- *
+ *
* A ConsumerFilterTest
*
* @author Tim Fox
@@ -36,6 +36,9 @@
private static final Logger log = Logger.getLogger(ConsumerFilterTest.class);
private HornetQServer server;
+ private ClientSession session;
+ private ClientProducer producer;
+ private ClientConsumer consumer;
@Override
protected void setUp() throws Exception
@@ -45,34 +48,23 @@
server = createServer(false);
server.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- server.stop();
-
- server = null;
-
- super.tearDown();
- }
-
- public void testNonMatchingMessagesFollowedByMatchingMessages() throws Exception
- {
ServerLocator locator = createInVMNonHALocator();
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
- ClientSession session = sf.createSession();
+ session = sf.createSession();
session.start();
-
session.createQueue("foo", "foo");
- ClientProducer producer = session.createProducer("foo");
+ producer = session.createProducer("foo");
+ consumer = session.createConsumer("foo",
"animal='giraffe'");
+ }
- ClientConsumer consumer = session.createConsumer("foo",
"animal='giraffe'");
+ public void testNonMatchingMessagesFollowedByMatchingMessages() throws Exception
+ {
+
ClientMessage message = session.createMessage(false);
message.putStringProperty("animal", "hippo");
@@ -96,30 +88,13 @@
assertEquals("giraffe", received.getStringProperty("animal"));
assertNull(consumer.receiveImmediate());
-
+
session.close();
-
- sf.close();
-
- locator.close();
}
public void testNonMatchingMessagesFollowedByMatchingMessagesMany() throws Exception
{
- ServerLocator locator = createInVMNonHALocator();
- ClientSessionFactory sf = locator.createSessionFactory();
-
- ClientSession session = sf.createSession();
-
- session.start();
-
- session.createQueue("foo", "foo");
-
- ClientProducer producer = session.createProducer("foo");
-
- ClientConsumer consumer = session.createConsumer("foo",
"animal='giraffe'");
-
for (int i = 0; i < QueueImpl.MAX_DELIVERIES_IN_LOOP * 2; i++)
{
ClientMessage message = session.createMessage(false);
@@ -148,105 +123,83 @@
assertEquals("giraffe",
received.getStringProperty("animal"));
}
-
+
assertNull(consumer.receiveImmediate());
session.close();
-
- sf.close();
-
- locator.close();
}
-
+
public void testTwoConsumers() throws Exception
{
- ServerLocator locator = createInVMNonHALocator();
-
- ClientSessionFactory sf = locator.createSessionFactory();
-
- ClientSession session = sf.createSession();
-
- session.start();
-
- session.createQueue("foo", "foo");
-
- ClientProducer producer = session.createProducer("foo");
-
- ClientConsumer consumer1 = session.createConsumer("foo",
"animal='giraffe'");
-
ClientConsumer consumer2 = session.createConsumer("foo",
"animal='elephant'");
//Create and consume message that matches the first consumer's filter
-
+
ClientMessage message = session.createMessage(false);
message.putStringProperty("animal", "giraffe");
producer.send(message);
-
- ClientMessage received = consumer1.receive(10000);
-
+
+ ClientMessage received = consumer.receive(10000);
+
assertNotNull(received);
-
+
assertEquals("giraffe", received.getStringProperty("animal"));
-
- assertNull(consumer1.receiveImmediate());
+
+ assertNull(consumer.receiveImmediate());
assertNull(consumer2.receiveImmediate());
-
+
//Create and consume another message that matches the first consumer's filter
message = session.createMessage(false);
message.putStringProperty("animal", "giraffe");
-
+
producer.send(message);
-
- received = consumer1.receive(10000);
-
+
+ received = consumer.receive(10000);
+
assertNotNull(received);
-
+
assertEquals("giraffe", received.getStringProperty("animal"));
-
- assertNull(consumer1.receiveImmediate());
+
+ assertNull(consumer.receiveImmediate());
assertNull(consumer2.receiveImmediate());
-
+
//Create and consume a message that matches the second consumer's filter
-
+
message = session.createMessage(false);
-
+
message.putStringProperty("animal", "elephant");
-
+
producer.send(message);
-
+
received = consumer2.receive(10000);
-
+
assertNotNull(received);
-
+
assertEquals("elephant",
received.getStringProperty("animal"));
-
- assertNull(consumer1.receiveImmediate());
+
+ assertNull(consumer.receiveImmediate());
assertNull(consumer2.receiveImmediate());
-
+
//Create and consume another message that matches the second consumer's filter
-
+
message = session.createMessage(false);
-
+
message.putStringProperty("animal", "elephant");
-
+
producer.send(message);
-
+
received = consumer2.receive(1000);
-
+
assertNotNull(received);
-
+
assertEquals("elephant",
received.getStringProperty("animal"));
-
- assertNull(consumer1.receiveImmediate());
+
+ assertNull(consumer.receiveImmediate());
assertNull(consumer2.receiveImmediate());
-
+
session.close();
-
- sf.close();
-
- locator.close();
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ConsumerTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -20,8 +20,13 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.client.*;
-import org.hornetq.core.logging.Logger;
+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.MessageHandler;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.protocol.core.Packet;
import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
@@ -35,8 +40,6 @@
*/
public class ConsumerTest extends ServiceTestBase
{
- private static final Logger log = Logger.getLogger(ConsumerTest.class);
-
private HornetQServer server;
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
@@ -49,28 +52,13 @@
super.setUp();
server = createServer(false);
-
server.start();
-
locator = createInVMNonHALocator();
}
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
-
- server.stop();
-
- server = null;
-
- super.tearDown();
- }
-
-
public void testConsumerAckImmediateAutoCommitTrue() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true, true);
@@ -104,7 +92,7 @@
public void testConsumerAckImmediateAutoCommitFalse() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, false, true);
@@ -138,7 +126,7 @@
public void testConsumerAckImmediateAckIgnored() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true, true);
@@ -176,7 +164,7 @@
public void testConsumerAckImmediateCloseSession() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true, true);
@@ -216,7 +204,7 @@
public void testAcksWithSmallSendWindow() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -248,7 +236,7 @@
ServerLocator locator = createInVMNonHALocator();
locator.setConfirmationWindowSize(100);
locator.setAckBatchSize(-1);
- ClientSessionFactory sfReceive = locator.createSessionFactory();
+ ClientSessionFactory sfReceive = createSessionFactory(locator);
ClientSession sessionRec = sfReceive.createSession(false, true, true);
ClientConsumer consumer = sessionRec.createConsumer(QUEUE);
consumer.setMessageHandler(new MessageHandler()
@@ -270,21 +258,21 @@
sessionRec.close();
locator.close();
}
-
+
//
https://jira.jboss.org/browse/HORNETQ-410
public void testConsumeWithNoConsumerFlowControl() throws Exception
{
-
+
ServerLocator locator = createInVMNonHALocator();
-
+
locator.setConsumerWindowSize(-1);
-
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
+
ClientSession session = sf.createSession(false, true, true);
session.createQueue(QUEUE, QUEUE, null, false);
-
+
session.start();
ClientProducer producer = session.createProducer(QUEUE);
@@ -296,25 +284,25 @@
ClientMessage message = createTextMessage(session, "m" + i);
producer.send(message);
}
-
+
ClientConsumer consumer = session.createConsumer(QUEUE);
-
+
for (int i = 0; i < numMessages; i++)
{
ClientMessage message = consumer.receive(10000);
assertNotNull(message);
message.acknowledge();
}
-
+
session.close();
sf.close();
locator.close();
-
+
}
public void testClearListener() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -337,7 +325,7 @@
public void testNoReceiveWithListener() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -378,7 +366,7 @@
{
locator.setConsumerWindowSize(10000);
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createTransactedSession();
@@ -406,8 +394,6 @@
ClientConsumer consumer = session.createConsumer(QUEUE);
session.start();
- int commited = 0;
- int rollbacked = 0;
for (int i = 0; i < 110; i++)
{
ClientMessage message = consumer.receive();
@@ -419,12 +405,10 @@
if (count % 2 == 0 && !redelivered)
{
session.rollback();
- rollbacked++;
}
else
{
session.commit();
- commited++;
}
}
@@ -439,7 +423,7 @@
locator.setConsumerWindowSize(10000);
locator.setMinLargeMessageSize(1000);
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createTransactedSession();
@@ -467,8 +451,6 @@
ClientConsumer consumer = session.createConsumer(QUEUE);
session.start();
- int commited = 0;
- int rollbacked = 0;
for (int i = 0; i < 110; i++)
{
ClientMessage message = consumer.receive();
@@ -480,12 +462,10 @@
if (count % 2 == 0 && !redelivered)
{
session.rollback();
- rollbacked++;
}
else
{
session.commit();
- commited++;
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -34,7 +34,6 @@
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.server.Queue;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.RandomUtil;
@@ -49,7 +48,6 @@
private static final Logger log = Logger.getLogger(DeadLetterAddressTest.class);
private HornetQServer server;
-
private ClientSession clientSession;
private ServerLocator locator;
@@ -148,10 +146,10 @@
class TestHandler implements MessageHandler
{
- private CountDownLatch latch;
+ private final CountDownLatch latch;
int count = 0;
- private ClientSession clientSession;
+ private final ClientSession clientSession;
public TestHandler(CountDownLatch latch, ClientSession clientSession)
{
@@ -251,7 +249,7 @@
clientSession.createQueue(dla, dlq, null, false);
clientSession.createQueue(qName, qName, null, false);
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
- ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession sendSession = sessionFactory.createSession(false, true, true);
ClientProducer producer = sendSession.createProducer(qName);
Map<String, Long> origIds = new HashMap<String, Long>();
@@ -470,54 +468,13 @@
configuration.setSecurityEnabled(false);
TransportConfiguration transportConfig = new
TransportConfiguration(UnitTestCase.INVM_ACCEPTOR_FACTORY);
configuration.getAcceptorConfigurations().add(transportConfig);
- server = HornetQServers.newHornetQServer(configuration, false);
- // start the server
+ server = createServer(false, configuration);
server.start();
// then we create a client as normal
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
- ClientSessionFactory sessionFactory = locator.createSessionFactory();
- clientSession = sessionFactory.createSession(false, true, false);
+ locator =
+ addServerLocator(HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(
+
UnitTestCase.INVM_CONNECTOR_FACTORY)));
+ ClientSessionFactory sessionFactory = createSessionFactory(locator);
+ clientSession = addClientSession(sessionFactory.createSession(false, true,
false));
}
-
- @Override
- protected void tearDown() throws Exception
- {
- if (clientSession != null)
- {
- try
- {
- clientSession.close();
- }
- catch (HornetQException e1)
- {
- //
- }
- }
- if(locator != null)
- {
- try
- {
- locator.close();
- }
- catch (Exception e)
- {
- //
- }
- }
- 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/client/DeliveryOrderTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeliveryOrderTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/DeliveryOrderTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -20,7 +20,13 @@
import org.hornetq.api.core.HornetQException;
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.MessageHandler;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -39,28 +45,22 @@
private ServerLocator locator;
+ private HornetQServer server;
+
+ private ClientSessionFactory cf;
+
@Override
protected void setUp() throws Exception
{
super.setUp();
locator = createInVMNonHALocator();
+ server = createServer(false);
+ server.start();
+ cf = createSessionFactory(locator);
}
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
- locator = null;
- super.tearDown();
- }
-
public void testSendDeliveryOrderOnCommit() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
- ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, false, true);
ClientProducer cp = sendSession.createProducer(addressA);
int numMessages = 1000;
@@ -85,24 +85,10 @@
Assert.assertEquals(i, cm.getBodyBuffer().readInt());
}
sendSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
}
- }
- }
public void testReceiveDeliveryOrderOnRollback() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
- locator = createInVMNonHALocator();
- ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, false);
ClientProducer cp = sendSession.createProducer(addressA);
int numMessages = 1000;
@@ -131,24 +117,10 @@
Assert.assertEquals(i, cm.getBodyBuffer().readInt());
}
sendSession.close();
- }
- finally
- {
- locator.close();
- if (server.isStarted())
- {
- server.stop();
}
- }
- }
public void testMultipleConsumersMessageOrder() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
- ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession recSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -179,15 +151,7 @@
}
sendSession.close();
recSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
}
- }
- }
class Receiver implements MessageHandler
{
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -817,19 +817,4 @@
}
}
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- clearData();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- clearData();
- super.tearDown();
- }
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -36,7 +36,6 @@
import org.hornetq.core.config.BridgeConfiguration;
import org.hornetq.core.config.CoreQueueConfiguration;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.DuplicateIDCache;
import org.hornetq.core.postoffice.impl.PostOfficeImpl;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
@@ -63,7 +62,6 @@
*/
public class BridgeTest extends ServiceTestBase
{
- private static final Logger log = Logger.getLogger(BridgeTest.class);
protected boolean isNetty()
{
@@ -1714,19 +1712,4 @@
}
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- clearData();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- clearData();
- super.tearDown();
- }
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -129,7 +129,8 @@
}
- protected TestableServer createServer(Configuration config)
+ @Override
+ protected TestableServer createTestableServer(Configuration config)
{
return new SameProcessHornetQServer(
createInVMFailoverServer(true, config,
nodeManager, config.isBackup() ? 2 : 1));
@@ -186,7 +187,7 @@
backupConfig.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
ReplicatedBackupUtils.createClusterConnectionConf(backupConfig,
backupConnector.getName(),
liveConnector.getName());
- backupServer = createServer(backupConfig);
+ backupServer = createTestableServer(backupConfig);
liveConfig = super.createDefaultConfig();
liveConfig.getAcceptorConfigurations().clear();
@@ -196,7 +197,7 @@
liveConfig.setClustered(true);
ReplicatedBackupUtils.createClusterConnectionConf(liveConfig,
liveConnector.getName());
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
- liveServer = createServer(liveConfig);
+ liveServer = createTestableServer(liveConfig);
}
protected void createReplicatedConfigs()
@@ -221,11 +222,11 @@
backupConfig.setLargeMessagesDirectory(backupConfig.getLargeMessagesDirectory() +
sufix);
backupConfig.setSecurityEnabled(false);
- backupServer = createServer(backupConfig);
+ backupServer = createTestableServer(backupConfig);
liveConfig.getAcceptorConfigurations().clear();
liveConfig.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
- liveServer = createServer(liveConfig);
+ liveServer = createTestableServer(liveConfig);
}
@Override
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -14,7 +14,12 @@
import junit.framework.Assert;
-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.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -44,7 +49,6 @@
protected void setUp() throws Exception
{
super.setUp();
- clearData();
initServer();
}
@@ -67,29 +71,9 @@
locator = createInVMNonHALocator();
}
- @Override
- protected void tearDown() throws Exception
- {
- if (server != null)
- {
- try
- {
- server.getAddressSettingsRepository().removeMatch(qName);
-
- server.stop();
- server = null;
- }
- catch (Exception e)
- {
- // ignore
- }
- }
- super.tearDown();
- }
-
public void testDelayedRedeliveryDefaultOnClose() throws Exception
{
- ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession session = sessionFactory.createSession(false, false, false);
session.createQueue(qName, qName, null, true);
@@ -155,12 +139,12 @@
session3.commit();
session3.close();
- sessionFactory.close();
+
}
public void testDelayedRedeliveryDefaultOnRollback() throws Exception
{
- ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession session = sessionFactory.createSession(false, false, false);
session.createQueue(qName, qName, null, true);
@@ -214,12 +198,12 @@
session2.commit();
session2.close();
- sessionFactory.close();
+
}
public void testDelayedRedeliveryWithStart() throws Exception
{
- ClientSessionFactory sessionFactory = locator.createSessionFactory();
+ ClientSessionFactory sessionFactory = createSessionFactory(locator);
ClientSession session = sessionFactory.createSession(false, false, false);
session.createQueue(qName, qName, null, true);
@@ -251,8 +235,8 @@
// Now rollback
long now = System.currentTimeMillis();
-
+
session2.rollback();
session2.close();
@@ -265,12 +249,12 @@
initServer();
- sessionFactory = locator.createSessionFactory();
+ sessionFactory = createSessionFactory(locator);
session2 = sessionFactory.createSession(false, false, false);
-
+
consumer2 = session2.createConsumer(qName);
-
+
Thread.sleep(3000);
session2.start();
@@ -292,7 +276,7 @@
session2.commit();
session2.close();
- sessionFactory.close();
+
}
// Private -------------------------------------------------------
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/xa/BasicXaTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/xa/BasicXaTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/xa/BasicXaTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -80,73 +80,19 @@
messagingService.start();
locator = createInVMNonHALocator();
- sessionFactory = locator.createSessionFactory();
+ sessionFactory = createSessionFactory(locator);
- clientSession = sessionFactory.createSession(true, false, false);
+ clientSession = addClientSession(sessionFactory.createSession(true, false,
false));
clientSession.createQueue(atestq, atestq, null, true);
}
- @Override
- protected void tearDown() throws Exception
- {
- if (clientSession != null)
- {
- try
- {
- clientSession.close();
- }
- catch (HornetQException e1)
- {
- //
- }
- }
- if(sessionFactory != null)
- {
- try
- {
- sessionFactory.close();
- }
- catch (Exception e)
- {
- //
- }
- }
- if(locator != null)
- {
- try
- {
- locator.close();
- }
- catch (Exception e)
- {
- //
- }
- }
- if (messagingService != null && messagingService.isStarted())
- {
- try
- {
- messagingService.stop();
- }
- catch (Exception e1)
- {
- //
- }
- }
- messagingService = null;
- clientSession = null;
-
- super.tearDown();
- }
-
-
public void testSendWithoutXID() throws Exception
{
// Since both resources have same RM, TM will probably use 1PC optimization
ServerLocator locator = createInVMNonHALocator();
- ClientSessionFactory factory = locator.createSessionFactory();
+ ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session = null;
@@ -181,7 +127,7 @@
// Since both resources have same RM, TM will probably use 1PC optimization
- ClientSessionFactory factory = locator.createSessionFactory();
+ ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session = null;
@@ -228,8 +174,6 @@
}
finally
{
- factory.close();
-
session.close();
}
}
@@ -239,7 +183,7 @@
public void testIsSameRM() throws Exception
{
ServerLocator locator = createNettyNonHALocator();
- ClientSessionFactory nettyFactory = locator.createSessionFactory();
+ ClientSessionFactory nettyFactory = createSessionFactory(locator);
validateRM(nettyFactory, nettyFactory);
validateRM(sessionFactory, sessionFactory);
validateRM(nettyFactory, sessionFactory);
@@ -532,7 +476,7 @@
messagingService.start();
- sessionFactory = locator.createSessionFactory();
+ sessionFactory = createSessionFactory(locator);
xid = newXID();
session = sessionFactory.createSession(true, false, false);
@@ -559,7 +503,7 @@
messagingService.start();
- sessionFactory = locator.createSessionFactory();
+ sessionFactory = createSessionFactory(locator);
xid = newXID();
session = sessionFactory.createSession(true, false, false);
@@ -573,7 +517,7 @@
messagingService.start();
// This is not really necessary... But since the server has stopped, I would prefer
to keep recreating the factory
- sessionFactory = locator.createSessionFactory();
+ sessionFactory = createSessionFactory(locator);
session = sessionFactory.createSession(true, false, false);
Modified:
trunk/tests/soak-tests/src/test/java/org/hornetq/tests/soak/client/ClientNonDivertedSoakTest.java
===================================================================
---
trunk/tests/soak-tests/src/test/java/org/hornetq/tests/soak/client/ClientNonDivertedSoakTest.java 2011-12-06
11:40:53 UTC (rev 11852)
+++
trunk/tests/soak-tests/src/test/java/org/hornetq/tests/soak/client/ClientNonDivertedSoakTest.java 2011-12-06
11:41:24 UTC (rev 11853)
@@ -72,8 +72,8 @@
ServerLocator locator = createFactory(ClientNonDivertedSoakTest.IS_NETTY);
- ClientSessionFactory sf = locator.createSessionFactory();
-
+ ClientSessionFactory sf = createSessionFactory(locator);
+
ClientSession session = sf.createSession();
session.createQueue(ClientNonDivertedSoakTest.ADDRESS,
ClientNonDivertedSoakTest.ADDRESS, true);
@@ -81,23 +81,16 @@
session.close();
sf.close();
-
+
locator.close();
}
- @Override
- protected void tearDown() throws Exception
- {
- server.stop();
- server = null;
- }
-
public void testSoakClient() throws Exception
{
ServerLocator locator = createFactory(ClientNonDivertedSoakTest.IS_NETTY);
- final ClientSessionFactory sf = locator.createSessionFactory();
+ final ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, false);
@@ -137,7 +130,7 @@
System.out.println("There are sequence errors in some of the clients,
please look at the logs");
break;
}
-
+
System.out.println("count = " + send.msgs);
Thread.sleep(10000);
}
@@ -150,7 +143,7 @@
assertEquals(0, send.getErrorsCount());
assertEquals(0, rec1.getErrorsCount());
-
+
locator.close();
}