Author: borges
Date: 2011-12-06 10:02:45 -0500 (Tue, 06 Dec 2011)
New Revision: 11861
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/cluster/reattach/MultiThreadRandomReattachTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/PagingTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerCloseTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerFlowControlTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/QueueBrowserTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveImmediateTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/core/deployers/impl/QueueDeployerTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/paging/PagingCounterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/remoting/PingTest.java
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageCursorStressTest.java
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageStressTest.java
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/remote/PingStressTest.java
Log:
Remove unnecessary tearDown code
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/cluster/reattach/MultiThreadRandomReattachTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/cluster/reattach/MultiThreadRandomReattachTestBase.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/cluster/reattach/MultiThreadRandomReattachTestBase.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -44,8 +44,8 @@
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="mailto:clebert.suconic@jboss.org">Clebert
Suconic</a>
- *
*
+ *
*/
public abstract class MultiThreadRandomReattachTestBase extends
MultiThreadReattachSupport
{
@@ -1198,7 +1198,7 @@
{
return 2;
}
-
+
protected int getNumThreads()
{
return 10;
@@ -1212,21 +1212,6 @@
log.info("************ Starting test " + getName());
}
- @Override
- protected void tearDown() throws Exception
- {
- if (liveServer != null && liveServer.isStarted())
- {
- liveServer.stop();
- }
-
- liveServer = null;
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
private void runTestMultipleThreads(final RunnableT runnable,
final int numThreads,
final boolean failOnCreateConnection) throws
Exception
@@ -1252,7 +1237,7 @@
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"));
locator.setReconnectAttempts(-1);
locator.setConfirmationWindowSize(1024 * 1024);
- return locator;
+ return addServerLocator(locator);
}
@Override
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/PagingTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/PagingTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -119,15 +119,6 @@
locator = createInVMNonHALocator();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopComponent(server);
- closeSessionFactory(sf);
- closeServerLocator(locator);
- super.tearDown();
- }
-
public void testPreparePersistent() throws Exception
{
clearData();
@@ -4075,7 +4066,7 @@
PagingStore pgStoreAddress = server.getPagingManager().getPageStore(ADDRESS);
pgStoreAddress.startPaging();
- PagingStore pgStoreDLA = server.getPagingManager().getPageStore(new
SimpleString("DLA"));
+ server.getPagingManager().getPageStore(new SimpleString("DLA"));
ClientProducer producer = session.createProducer(PagingTest.ADDRESS);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerCloseTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerCloseTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerCloseTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -16,39 +16,29 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+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.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.HornetQServers;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.UnitTestCase;
/**
- *
+ *
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class ProducerCloseTest extends ServiceTestBase
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
private HornetQServer server;
-
+ private ClientSessionFactory sf;
private ClientSession session;
private ServerLocator locator;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
public void testCanNotUseAClosedProducer() throws Exception
{
final ClientProducer producer =
session.createProducer(RandomUtil.randomSimpleString());
@@ -79,35 +69,10 @@
Configuration config = createDefaultConfig();
config.getAcceptorConfigurations().add(new
TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()));
config.setSecurityEnabled(false);
- server = HornetQServers.newHornetQServer(config, false);
+ server = createServer(false, config);
server.start();
- locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
- sf = locator.createSessionFactory();
+ locator = createInVMNonHALocator();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true);
}
-
- private ClientSessionFactory sf;
-
- @Override
- protected void tearDown() throws Exception
- {
- session.close();
-
- sf.close();
-
- locator.close();
-
- server.stop();
-
- server = null;
-
- session = null;
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerFlowControlTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerFlowControlTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerFlowControlTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -73,20 +73,6 @@
locator = createFactory(isNetty());
}
- @Override
- protected void tearDown() throws Exception
- {
- if (sf != null)
- {
- sf.close();
- }
- closeServerLocator(locator);
-
- stopComponent(server);
-
- super.tearDown();
- }
-
// TODO need to test crashing a producer with unused credits returns them to the pool
public void testFlowControlSingleConsumer() throws Exception
@@ -240,7 +226,7 @@
locator.setMinLargeMessageSize(minLargeMessageSize);
}
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
session.start();
@@ -377,7 +363,7 @@
locator.setConsumerWindowSize(1024);
locator.setAckBatchSize(1024);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
final SimpleString queueName = new SimpleString("testqueue");
@@ -442,7 +428,7 @@
locator.setConsumerWindowSize(1024);
locator.setAckBatchSize(1024);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -470,7 +456,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -534,7 +520,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -567,7 +553,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -603,7 +589,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -636,7 +622,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -672,7 +658,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -720,7 +706,7 @@
for (int i = 0; i < 10; i++)
{
- ClientProducer prod = session.createProducer("address" + (i +
ClientProducerCreditManagerImpl.MAX_UNREFERENCED_CREDITS_CACHE_SIZE));
+ session.createProducer("address" + (i +
ClientProducerCreditManagerImpl.MAX_UNREFERENCED_CREDITS_CACHE_SIZE));
Assert.assertEquals(ClientProducerCreditManagerImpl.MAX_UNREFERENCED_CREDITS_CACHE_SIZE +
i + 1,
((ClientSessionInternal)session).getProducerCreditManager().creditsMapSize());
@@ -735,7 +721,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -760,7 +746,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
@@ -809,7 +795,7 @@
server.start();
waitForServer(server);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
session = sf.createSession(false, true, true, true);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ProducerTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -20,8 +20,11 @@
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.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.protocol.core.Packet;
import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
@@ -33,8 +36,6 @@
*/
public class ProducerTest extends ServiceTestBase
{
- private static final Logger log = Logger.getLogger(ConsumerTest.class);
-
private HornetQServer server;
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
@@ -49,16 +50,6 @@
server.start();
}
- @Override
- protected void tearDown() throws Exception
- {
- server.stop();
-
- server = null;
-
- super.tearDown();
- }
-
public void testProducerWithSmallWindowSizeAndLargeMessage() throws Exception
{
final CountDownLatch latch = new CountDownLatch(1);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/QueueBrowserTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/QueueBrowserTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/QueueBrowserTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -15,9 +15,12 @@
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.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.ServerLocator;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
import org.hornetq.tests.util.ServiceTestBase;
@@ -28,8 +31,6 @@
*/
public class QueueBrowserTest extends ServiceTestBase
{
- private static final Logger log = Logger.getLogger(QueueBrowserTest.class);
-
private HornetQServer server;
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
@@ -48,25 +49,13 @@
locator = createInVMNonHALocator();
}
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
-
- server.stop();
-
- server = null;
-
- super.tearDown();
- }
-
private ClientSessionFactory sf;
public void testSimpleConsumerBrowser() throws Exception
{
locator.setBlockOnNonDurableSend(true);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
session.createQueue(QUEUE, QUEUE, null, false);
@@ -105,14 +94,13 @@
session.close();
- sf.close();
}
public void testConsumerBrowserWithSelector() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -153,14 +141,13 @@
session.close();
- sf.close();
}
public void testConsumerBrowserWithStringSelector() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -191,14 +178,13 @@
session.close();
- sf.close();
}
public void testConsumerMultipleBrowser() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -229,14 +215,13 @@
}
session.close();
- sf.close();
}
public void testConsumerMultipleBrowserWithSelector() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -275,7 +260,6 @@
session.close();
- sf.close();
}
@@ -291,7 +275,7 @@
private void testConsumerBrowserMessagesArentAcked(final boolean preACK) throws
Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(null, null, false, true, true, preACK,
0);
@@ -321,12 +305,11 @@
session.close();
- sf.close();
}
public void testConsumerBrowserMessageAckDoesNothing() throws Exception
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -358,14 +341,13 @@
session.close();
- sf.close();
}
-
+
public void testBrowseWithZeroConsumerWindowSize() throws Exception
{
locator.setConsumerWindowSize(0);
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -376,23 +358,23 @@
final int numMessages = 100;
byte[] bytes = new byte[240];
-
+
for (int i = 0; i < numMessages; i++)
{
ClientMessage message = session.createMessage(false);
-
+
message.getBodyBuffer().writeBytes(bytes);
-
+
message.putIntProperty("foo", i);
-
+
producer.send(message);
}
//Create a normal non browsing consumer
- ClientConsumer consumer = session.createConsumer(QUEUE);
-
+ session.createConsumer(QUEUE);
+
session.start();
-
+
ClientConsumer browser = session.createConsumer(QUEUE, true);
for (int i = 0; i < numMessages; i++)
@@ -403,8 +385,6 @@
}
session.close();
-
- sf.close();
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveImmediateTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveImmediateTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveImmediateTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -25,9 +25,7 @@
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.server.HornetQServer;
-import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.server.Queue;
import org.hornetq.tests.util.ServiceTestBase;
@@ -37,8 +35,6 @@
*/
public class ReceiveImmediateTest extends ServiceTestBase
{
- private static final Logger log = Logger.getLogger(ReceiveImmediateTest.class);
-
private HornetQServer server;
private final SimpleString QUEUE = new
SimpleString("ReceiveImmediateTest.queue");
@@ -53,32 +49,18 @@
super.setUp();
Configuration config = createDefaultConfig(false);
- server = HornetQServers.newHornetQServer(config, false);
-
+ server = createServer(false, config);
server.start();
-
locator = createInVMNonHALocator();
}
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
-
- server.stop();
-
- server = null;
-
- super.tearDown();
- }
-
private ClientSessionFactory sf;
public void testConsumerReceiveImmediateWithNoMessages() throws Exception
{
doConsumerReceiveImmediateWithNoMessages(false);
}
-
+
public void testConsumerReceiveImmediate() throws Exception
{
doConsumerReceiveImmediate(false);
@@ -96,11 +78,10 @@
public void testConsumerReceiveImmediateWithSessionStop() throws Exception
{
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnAcknowledge(true);
locator.setAckBatchSize(0);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ADDRESS, QUEUE, null, false);
@@ -122,75 +103,70 @@
consumer.close();
session.close();
-
- sf.close();
-
}
-
+
//
https://jira.jboss.org/browse/HORNETQ-450
public void testReceivedImmediateFollowedByReceive() throws Exception
{
locator.setBlockOnNonDurableSend(true);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ADDRESS, QUEUE, null, false);
-
+
ClientProducer producer = session.createProducer(ADDRESS);
ClientMessage message = session.createMessage(false);
-
+
producer.send(message);
ClientConsumer consumer = session.createConsumer(QUEUE, null, false);
-
+
session.start();
-
+
ClientMessage received = consumer.receiveImmediate();
assertNotNull(received);
-
+
received.acknowledge();
-
+
received = consumer.receive(1);
-
- assertNull(received);
- session.close();
+ assertNull(received);
- sf.close();
+ session.close();
}
-
+
//
https://jira.jboss.org/browse/HORNETQ-450
public void testReceivedImmediateFollowedByAsyncConsume() throws Exception
{
-
+
locator.setBlockOnNonDurableSend(true);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ADDRESS, QUEUE, null, false);
-
+
ClientProducer producer = session.createProducer(ADDRESS);
ClientMessage message = session.createMessage(false);
-
+
producer.send(message);
ClientConsumer consumer = session.createConsumer(QUEUE, null, false);
-
+
session.start();
-
+
ClientMessage received = consumer.receiveImmediate();
assertNotNull(received);
-
+
received.acknowledge();
-
+
final AtomicBoolean receivedAsync = new AtomicBoolean(false);
-
+
consumer.setMessageHandler(new MessageHandler()
{
public void onMessage(ClientMessage message)
@@ -198,14 +174,12 @@
receivedAsync.set(true);
}
});
-
+
Thread.sleep(1000);
-
- assertFalse(receivedAsync.get());
- session.close();
+ assertFalse(receivedAsync.get());
- sf.close();
+ session.close();
}
private void doConsumerReceiveImmediateWithNoMessages(final boolean browser) throws
Exception
@@ -213,7 +187,7 @@
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnAcknowledge(true);
locator.setAckBatchSize(0);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, false);
@@ -226,8 +200,6 @@
Assert.assertNull(message);
session.close();
-
- sf.close();
}
private void doConsumerReceiveImmediate(final boolean browser) throws Exception
@@ -236,7 +208,7 @@
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnAcknowledge(true);
locator.setAckBatchSize(0);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ADDRESS, QUEUE, null, false);
@@ -277,9 +249,6 @@
consumer.close();
session.close();
-
- sf.close();
-
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/ReceiveTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -16,7 +16,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;
@@ -31,28 +37,20 @@
private ServerLocator locator;
+ private HornetQServer server;
+
@Override
protected void setUp() throws Exception
{
super.setUp();
locator = createInVMNonHALocator();
+ server = createServer(false);
+ server.start();
}
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
-
- super.tearDown();
- }
-
public void testBasicReceive() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientProducer cp = sendSession.createProducer(addressA);
@@ -64,22 +62,11 @@
Assert.assertNotNull(cc.receive());
session.close();
sendSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
}
public void testReceiveTimesoutCorrectly() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
+
ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
session.createQueue(addressA, queueA, false);
@@ -89,23 +76,11 @@
cc.receive(1000);
Assert.assertTrue(System.currentTimeMillis() - time >= 1000);
session.close();
-
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
}
public void testReceiveOnClosedException() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
+
ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
session.createQueue(addressA, queueA, false);
@@ -121,24 +96,12 @@
{
Assert.assertEquals(HornetQException.OBJECT_CLOSED, e.getCode());
}
- session.close();
-
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
+ session.close();
}
public void testReceiveThrowsExceptionWhenHandlerSet() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
+
ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
session.createQueue(addressA, queueA, false);
@@ -160,23 +123,11 @@
Assert.assertEquals(HornetQException.ILLEGAL_STATE, e.getCode());
}
session.close();
-
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
}
public void testReceiveImmediate() throws Exception
{
- HornetQServer server = createServer(false);
- try
- {
- server.start();
+
// forces perfect round robin
locator.setConsumerWindowSize(1);
ClientSessionFactory cf = locator.createSessionFactory();
@@ -199,13 +150,5 @@
}
session.close();
sendSession.close();
- }
- finally
- {
- if (server.isStarted())
- {
- server.stop();
- }
- }
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -41,7 +41,7 @@
* A RedeliveryConsumerTest
*
* @author <a href="mailto:clebert.suconic@jboss.org">Clebert
Suconic</a>
- *
+ *
* Created Feb 17, 2009 6:06:11 PM
*
*
@@ -150,7 +150,7 @@
session.close();
server.stop();
server.start();
- factory = locator.createSessionFactory();
+ factory = createSessionFactory(locator);
session = factory.createSession(false, false, false);
session.start();
consumer = session.createConsumer(ADDRESS);
@@ -173,7 +173,7 @@
session.close();
server.stop();
server.start();
- factory = locator.createSessionFactory();
+ factory = createSessionFactory(locator);
session = factory.createSession(false, false, false);
session.start();
consumer = session.createConsumer(ADDRESS);
@@ -226,7 +226,7 @@
server.start();
- factory = locator.createSessionFactory();
+ factory = createSessionFactory(locator);
session = factory.createSession(false, true, false);
session.start();
@@ -242,7 +242,7 @@
{
internaltestInfiniteDedeliveryMessageOnPersistent(false);
}
-
+
private void internaltestInfiniteDedeliveryMessageOnPersistent(final boolean strict)
throws Exception
{
setUp(strict);
@@ -255,7 +255,7 @@
session.commit();
session.close();
-
+
int expectedCount = 1;
for (int i = 0 ; i < 700; i++)
{
@@ -277,9 +277,9 @@
factory.close();
server.stop();
-
+
setUp(false);
-
+
for (int i = 0 ; i < 700; i++)
{
session = factory.createSession(false, false, false);
@@ -293,27 +293,27 @@
server.stop();
-
- JournalImpl journal = new
JournalImpl(server.getConfiguration().getJournalFileSize(),
- 2,
+
+ JournalImpl journal = new
JournalImpl(server.getConfiguration().getJournalFileSize(),
+ 2,
0,
- 0,
+ 0,
new
NIOSequentialFileFactory(server.getConfiguration().getJournalDirectory()),
"hornetq-data",
"hq",
1);
-
-
+
+
final AtomicInteger updates = new AtomicInteger();
-
+
journal.start();
journal.load(new LoaderCallback()
{
-
+
public void failedTransaction(long transactionID, List<RecordInfo>
records, List<RecordInfo> recordsToDelete)
{
}
-
+
public void updateRecord(RecordInfo info)
{
if (info.userRecordType == JournalStorageManager.UPDATE_DELIVERY_COUNT)
@@ -321,23 +321,23 @@
updates.incrementAndGet();
}
}
-
+
public void deleteRecord(long id)
{
}
-
+
public void addRecord(RecordInfo info)
{
}
-
+
public void addPreparedTransaction(PreparedTransactionInfo preparedTransaction)
{
}
});
-
+
journal.stop();
-
-
+
+
assertEquals(7, updates.get());
}
@@ -360,7 +360,7 @@
server.start();
locator = createInVMNonHALocator();
- factory = locator.createSessionFactory();
+ factory = createSessionFactory(locator);
ClientSession session = factory.createSession(false, false, false);
try
@@ -374,30 +374,4 @@
session.close();
}
-
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
- if (factory != null)
- {
- factory.close();
- }
-
- if (server != null && server.isStarted())
- {
- server.stop();
- }
-
- factory = null;
-
- server = null;
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -20,11 +20,16 @@
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
-import junit.framework.TestSuite;
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.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
@@ -71,7 +76,7 @@
locator.setConfirmationWindowSize(1024 * 1024);
locator.setBlockOnNonDurableSend(false);
locator.setBlockOnAcknowledge(false);
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
final ClientSession session = sf.createSession(false, true, true);
@@ -79,7 +84,7 @@
final CountDownLatch ready = new CountDownLatch(1);
-
+
// this test will use a queue. Whenever the test wants a failure.. it can just send
TRUE to failureQueue
// This Thread will be reading the queue
Thread failer = new Thread()
@@ -171,8 +176,6 @@
public void doSend2(final int order, final ClientSessionFactory sf, final
LinkedBlockingDeque<Boolean> failureQueue) throws Exception
{
- long start = System.currentTimeMillis();
-
ClientSession s = sf.createSession(false, false, false);
final int numMessages = 500;
@@ -229,7 +232,7 @@
final CountDownLatch latch = new CountDownLatch(1);
volatile int count;
-
+
Exception failure;
public void onMessage(final ClientMessage message)
@@ -239,7 +242,7 @@
failure = new Exception("too many messages");
latch.countDown();
}
-
+
if (message.getIntProperty("count") != count)
{
failure = new Exception("counter " + count + " was not as
expected (" + message.getIntProperty("count") + ")");
@@ -278,7 +281,7 @@
boolean ok = handler.latch.await(60000, TimeUnit.MILLISECONDS);
Assert.assertTrue(ok);
-
+
if (handler.failure != null)
{
throw handler.failure;
@@ -306,34 +309,5 @@
}
s.close();
-
- long end = System.currentTimeMillis();
-
}
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- if (server != null && server.isStarted())
- {
- server.stop();
- }
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
\ No newline at end of file
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -23,13 +23,17 @@
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.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.ServerLocator;
+import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
import org.hornetq.core.protocol.core.impl.wireformat.SessionProducerCreditsMessage;
-import org.hornetq.core.protocol.core.impl.wireformat.SessionSendMessage;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.server.HornetQServer;
@@ -38,11 +42,11 @@
import org.hornetq.tests.util.ServiceTestBase;
/**
- *
+ *
* A ReattachTest
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
+ *
* Created 4 Nov 2008 16:54:50
*
*
@@ -51,22 +55,10 @@
{
private static final Logger log = Logger.getLogger(ReattachTest.class);
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
private static final SimpleString ADDRESS = new
SimpleString("FailoverTestAddress");
-
private HornetQServer service;
-
private ServerLocator locator;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
/*
* Test failure on connection, but server is still up so should immediately reconnect
*/
@@ -82,7 +74,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -168,11 +160,11 @@
public boolean intercept(Packet packet, RemotingConnection connection) throws
HornetQException
{
System.out.println("Intercept..." + packet.getClass().getName());
-
+
if (packet instanceof SessionProducerCreditsMessage )
{
SessionProducerCreditsMessage credit =
(SessionProducerCreditsMessage)packet;
-
+
System.out.println("Credits: " + credit.getCredits());
if (count.incrementAndGet() == 2)
{
@@ -187,7 +179,7 @@
locator.addInterceptor(intercept);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -215,7 +207,7 @@
}
/*
- * Test failure on connection, simulate failure to create connection for a while, then
+ * Test failure on connection, simulate failure to create connection for a while,
then
* allow connection to be recreated
*/
public void testDelayedReattach() throws Exception
@@ -230,7 +222,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -320,7 +312,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -434,7 +426,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -524,7 +516,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- final ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ final ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
session = sf.createSession();
@@ -634,7 +626,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- final ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ final ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
InVMConnector.failOnCreateConnection = true;
@@ -732,7 +724,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -804,7 +796,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -871,7 +863,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -963,7 +955,7 @@
locator.setRetryIntervalMultiplier(retryMultiplier);
locator.setReconnectAttempts(reconnectAttempts);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -1041,7 +1033,7 @@
locator.setReconnectAttempts(reconnectAttempts);
locator.setMaxRetryInterval(maxRetryInterval);
locator.setConfirmationWindowSize(1024 * 1024);
- ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)locator.createSessionFactory();
+ ClientSessionFactoryInternal sf =
(ClientSessionFactoryInternal)createSessionFactory(locator);
ClientSession session = sf.createSession(false, true, true);
@@ -1127,14 +1119,8 @@
{
InVMConnector.resetFailures();
- locator.close();
-
- service.stop();
-
Assert.assertEquals(0, InVMRegistry.instance.size());
- service = null;
-
super.tearDown();
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/core/deployers/impl/QueueDeployerTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/core/deployers/impl/QueueDeployerTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/core/deployers/impl/QueueDeployerTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -14,7 +14,6 @@
package org.hornetq.tests.integration.core.deployers.impl;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.FileDeploymentManager;
import org.hornetq.core.deployers.impl.QueueDeployer;
@@ -22,9 +21,7 @@
import org.hornetq.core.postoffice.Bindings;
import org.hornetq.core.postoffice.impl.LocalQueueBinding;
import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.impl.HornetQServerImpl;
import org.hornetq.tests.util.ServiceTestBase;
-import org.hornetq.tests.util.UnitTestCase;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
@@ -32,7 +29,7 @@
* A QueueDeployerTest
*
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
- *
+ *
*/
public class QueueDeployerTest extends ServiceTestBase
{
@@ -45,15 +42,9 @@
private HornetQServer server;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
public void testParseQueueConfiguration() throws Exception
{
- String xml = "<configuration xmlns='urn:hornetq'>"
+ String xml = "<configuration xmlns='urn:hornetq'>"
+ " <queues>"
+ " <queue name='foo'>"
+ " <address>bar</address>"
@@ -88,24 +79,10 @@
protected void setUp() throws Exception
{
super.setUp();
-
+
server = createServer(true);
DeploymentManager deploymentManager = new FileDeploymentManager(500);
deployer = new QueueDeployer(deploymentManager, server);
server.start();
}
-
- @Override
- protected void tearDown() throws Exception
- {
- deployer = null;
- server.stop();
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/paging/PagingCounterTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/paging/PagingCounterTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/paging/PagingCounterTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -57,7 +57,7 @@
public void testCounter() throws Exception
{
- ClientSessionFactory sf = sl.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(sl);
ClientSession session = sf.createSession();
try
@@ -89,7 +89,7 @@
public void testCleanupCounter() throws Exception
{
- ClientSessionFactory sf = sl.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(sl);
ClientSession session = sf.createSession();
try
@@ -106,25 +106,25 @@
{
counter.increment(tx, 1);
-
+
if (i % 200 == 0)
{
tx.commit();
-
+
storage.waitOnOperations();
assertEquals(i + 1, counter.getValue());
-
+
tx = new TransactionImpl(server.getStorageManager());
}
}
tx.commit();
-
+
storage.waitOnOperations();
-
+
assertEquals(2100, counter.getValue());
-
+
server.stop();
server = newHornetQServer();
@@ -150,7 +150,7 @@
public void testCleanupCounterNonPersistent() throws Exception
{
- ClientSessionFactory sf = sl.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(sl);
ClientSession session = sf.createSession();
try
@@ -158,7 +158,7 @@
Queue queue = server.createQueue(new SimpleString("A1"), new
SimpleString("A1"), null, true, false);
PageSubscriptionCounter counter = locateCounter(queue);
-
+
((PageSubscriptionCounterImpl)counter).setPersistent(false);
StorageManager storage = server.getStorageManager();
@@ -169,25 +169,25 @@
{
counter.increment(tx, 1);
-
+
if (i % 200 == 0)
{
tx.commit();
-
+
storage.waitOnOperations();
assertEquals(i + 1, counter.getValue());
-
+
tx = new TransactionImpl(server.getStorageManager());
}
}
tx.commit();
-
+
storage.waitOnOperations();
-
+
assertEquals(2100, counter.getValue());
-
+
server.stop();
server = newHornetQServer();
@@ -288,65 +288,50 @@
storage.waitOnOperations();
assertEquals(0, counter.getValue());
-
+
server.stop();
-
+
server = newHornetQServer();
-
+
server.start();
-
+
storage = server.getStorageManager();
-
+
queue = server.locateQueue(new SimpleString("A1"));
-
+
assertNotNull(queue);
-
+
counter = locateCounter(queue);
-
+
tx = server.getResourceManager().removeTransaction(xid);
-
+
assertNotNull(tx);
-
+
assertEquals(0, counter.getValue());
-
+
tx.commit(false);
-
+
storage.waitOnOperations();
-
+
assertEquals(2000, counter.getValue());
-
-
- }
- // Package protected ---------------------------------------------
- // Protected -----------------------------------------------------
+ }
+
+ @Override
protected void setUp() throws Exception
{
super.setUp();
server = newHornetQServer();
-
server.start();
-
sl = createInVMNonHALocator();
}
- protected void tearDown() throws Exception
- {
- sl.close();
-
- server.stop();
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
private HornetQServer newHornetQServer()
{
-
+
OperationContextImpl.clearContext();
HornetQServer server = super.createServer(true, false);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/remoting/PingTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/remoting/PingTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/remoting/PingTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -22,7 +22,11 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+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.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.config.Configuration;
@@ -38,10 +42,7 @@
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * @version <tt>$Revision$</tt>
*/
public class PingTest extends ServiceTestBase
{
@@ -70,14 +71,6 @@
server.start();
}
- @Override
- protected void tearDown() throws Exception
- {
- server.stop();
- server = null;
- super.tearDown();
- }
-
class Listener implements SessionFailureListener
{
volatile HornetQException me;
@@ -103,7 +96,7 @@
public void testNoFailureWithPinging() throws Exception
{
TransportConfiguration transportConfig = new
TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory");
- ServerLocator locator =
HornetQClient.createServerLocatorWithoutHA(transportConfig);
+ ServerLocator locator =
addServerLocator(HornetQClient.createServerLocatorWithoutHA(transportConfig));
locator.setClientFailureCheckPeriod(PingTest.CLIENT_FAILURE_CHECK_PERIOD);
locator.setConnectionTTL(PingTest.CLIENT_FAILURE_CHECK_PERIOD * 2);
@@ -165,7 +158,7 @@
public void testNoFailureNoPinging() throws Exception
{
TransportConfiguration transportConfig = new
TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory");
- ServerLocator locator =
HornetQClient.createServerLocatorWithoutHA(transportConfig);
+ ServerLocator locator =
addServerLocator(HornetQClient.createServerLocatorWithoutHA(transportConfig));
locator.setClientFailureCheckPeriod(-1);
locator.setConnectionTTL(-1);
ClientSessionFactory csf = locator.createSessionFactory();
@@ -223,7 +216,7 @@
public void testServerFailureNoPing() throws Exception
{
TransportConfiguration transportConfig = new
TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory");
- ServerLocator locator =
HornetQClient.createServerLocatorWithoutHA(transportConfig);
+ ServerLocator locator =
addServerLocator(HornetQClient.createServerLocatorWithoutHA(transportConfig));
locator.setClientFailureCheckPeriod(PingTest.CLIENT_FAILURE_CHECK_PERIOD);
locator.setConnectionTTL(PingTest.CLIENT_FAILURE_CHECK_PERIOD * 2);
ClientSessionFactoryImpl csf = (ClientSessionFactoryImpl)
locator.createSessionFactory();
@@ -318,7 +311,7 @@
});
TransportConfiguration transportConfig = new
TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory");
- ServerLocator locator =
HornetQClient.createServerLocatorWithoutHA(transportConfig);
+ ServerLocator locator =
addServerLocator(HornetQClient.createServerLocatorWithoutHA(transportConfig));
locator.setClientFailureCheckPeriod(PingTest.CLIENT_FAILURE_CHECK_PERIOD);
locator.setConnectionTTL(PingTest.CLIENT_FAILURE_CHECK_PERIOD * 2);
ClientSessionFactory csf = locator.createSessionFactory();
@@ -402,13 +395,4 @@
locator.close();
}
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
\ No newline at end of file
Modified:
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
===================================================================
---
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -20,7 +20,12 @@
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.ServerLocator;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.server.HornetQServer;
@@ -29,7 +34,7 @@
/**
* A MultiThreadConsumerStressTest
- *
+ *
* This test validates consuming / sending messages while compacting is working
*
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
@@ -146,25 +151,6 @@
}
- @Override
- protected void tearDown() throws Exception
- {
- try
- {
- if (server != null && server.isStarted())
- {
- server.stop();
- }
- }
- catch (Throwable e)
- {
- e.printStackTrace(System.out); // System.out => junit reports
- }
-
- server = null;
- sf = null;
- }
-
private void setupServer(final JournalType journalType) throws Exception,
HornetQException
{
Configuration config = createDefaultConfig(true);
@@ -190,7 +176,7 @@
locator.setBlockOnAcknowledge(false);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession sess = sf.createSession();
@@ -205,7 +191,7 @@
sess.close();
locator.close();
locator = createInVMNonHALocator();
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
}
// Static --------------------------------------------------------
Modified:
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java
===================================================================
---
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -25,7 +25,12 @@
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.ServerLocator;
import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -77,14 +82,6 @@
}
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
- stopServer();
- super.tearDown();
- }
-
public void testMultiThreadCompact() throws Throwable
{
setupServer(getJournalType());
@@ -120,11 +117,11 @@
if (i % 2 == 0 && i > 0)
{
System.out.println("DataFiles = " + journal.getDataFilesCount());
-
+
journal.forceMoveNextFile();
journal.debugWait();
journal.checkReclaimStatus();
-
+
if (journal.getDataFilesCount() != 0)
{
System.out.println("DebugJournal:" + journal.debug());
@@ -155,7 +152,7 @@
*/
private void addEmptyTransaction(final Xid xid) throws Exception, XAException
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(true, false, false);
session.start(xid, XAResource.TMNOFLAGS);
session.end(xid, XAResource.TMSUCCESS);
@@ -166,7 +163,7 @@
private void checkEmptyXID(final Xid xid) throws Exception, XAException
{
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = createSessionFactory(locator);
ClientSession session = sf.createSession(true, false, false);
Xid[] xids = session.recover(XAResource.TMSTARTRSCAN);
@@ -379,7 +376,7 @@
locator.setBlockOnDurableSend(false);
locator.setBlockOnAcknowledge(false);
- sf = locator.createSessionFactory();
+ sf = createSessionFactory(locator);
ClientSession sess = sf.createSession();
Modified:
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageCursorStressTest.java
===================================================================
---
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageCursorStressTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -1121,8 +1121,6 @@
@Override
protected void tearDown() throws Exception
{
- server.stop();
- server = null;
queue = null;
queueList = null;
super.tearDown();
@@ -1133,8 +1131,6 @@
{
super.setUp();
OperationContextImpl.clearContext();
- System.out.println("Tmp:" + getTemporaryDir());
-
queueList = new ArrayList<Queue>();
createServer();
Modified:
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageStressTest.java
===================================================================
---
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageStressTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/paging/PageStressTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -47,12 +47,6 @@
private ServerLocator locator;
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
public void testStopDuringDepage() throws Exception
{
Configuration config = createDefaultConfig();
@@ -69,7 +63,7 @@
messagingService = createServer(true, config, 10 * 1024 * 1024, 20 * 1024 * 1024,
settings);
messagingService.start();
- ClientSessionFactory factory = locator.createSessionFactory();
+ ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session = null;
try
@@ -130,7 +124,7 @@
messagingService.start();
- factory = locator.createSessionFactory();
+ factory = createSessionFactory(locator);
session = factory.createSession(false, false, false);
@@ -161,13 +155,6 @@
finally
{
session.close();
- try
- {
- messagingService.stop();
- }
- catch (Throwable ignored)
- {
- }
}
}
@@ -185,7 +172,7 @@
messagingService = createServer(true, config, 10 * 1024 * 1024, 20 * 1024 * 1024,
settings);
messagingService.start();
- ClientSessionFactory factory = locator.createSessionFactory();
+ ClientSessionFactory factory = createSessionFactory(locator);
ClientSession session = null;
try
@@ -296,9 +283,6 @@
protected void setUp() throws Exception
{
super.setUp();
-
- clearData();
-
locator = createInVMNonHALocator();
locator.setBlockOnAcknowledge(true);
@@ -306,17 +290,4 @@
locator.setBlockOnNonDurableSend(false);
}
-
- @Override
- protected void tearDown() throws Exception
- {
- locator.close();
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified:
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/remote/PingStressTest.java
===================================================================
---
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/remote/PingStressTest.java 2011-12-06
14:04:26 UTC (rev 11860)
+++
trunk/tests/stress-tests/src/test/java/org/hornetq/tests/stress/remote/PingStressTest.java 2011-12-06
15:02:45 UTC (rev 11861)
@@ -23,7 +23,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.ClientSessionFactoryImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
@@ -36,7 +35,7 @@
/**
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert
Suconic</a>
- *
+ *
* @version <tt>$Revision$</tt>
*/
public class PingStressTest extends ServiceTestBase
@@ -66,17 +65,6 @@
server.start();
}
- @Override
- protected void tearDown() throws Exception
- {
- if (server != null && server.isStarted())
- {
- server.stop();
- server = null;
- }
- super.tearDown();
- }
-
protected int getNumberOfIterations()
{
return 20;
@@ -91,7 +79,6 @@
tearDown();
setUp();
}
- System.out.println("Run " + i);
internalTest();
}
@@ -122,7 +109,7 @@
};
server.getRemotingService().addInterceptor(noPongInterceptor);
- ServerLocator locator =
HornetQClient.createServerLocatorWithoutHA(transportConfig);
+ ServerLocator locator =
addServerLocator(HornetQClient.createServerLocatorWithoutHA(transportConfig));
locator.setClientFailureCheckPeriod(PingStressTest.PING_INTERVAL);
locator.setConnectionTTL((long)(PingStressTest.PING_INTERVAL * 1.5));
locator.setCallTimeout(PingStressTest.PING_INTERVAL * 10);
@@ -153,12 +140,12 @@
try
{
- ServerLocator locator =
HornetQClient.createServerLocatorWithoutHA(transportConfig);
+ ServerLocator locator =
addServerLocator(HornetQClient.createServerLocatorWithoutHA(transportConfig));
locator.setClientFailureCheckPeriod(PingStressTest.PING_INTERVAL);
locator.setConnectionTTL((long)(PingStressTest.PING_INTERVAL * 1.5));
locator.setCallTimeout(PingStressTest.PING_INTERVAL * 10);
- final ClientSessionFactory csf2 = locator.createSessionFactory();
+ final ClientSessionFactory csf2 = createSessionFactory(locator);
// Start all at once to make concurrency worst
flagAligned.countDown();
@@ -186,9 +173,9 @@
Thread.sleep(PingStressTest.PING_INTERVAL * (threadNumber % 3));
session.close();
-
+
csf2.close();
-
+
locator.close();
}
}
@@ -225,19 +212,10 @@
{
throw new Exception("Test Failed", e);
}
-
+
csf1.close();
-
+
locator.close();
}
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
\ No newline at end of file