Author: ataylor
Date: 2010-07-20 09:55:42 -0400 (Tue, 20 Jul 2010)
New Revision: 9427
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/InterceptorTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AckBatchSizeTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AcknowledgeTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AddressSettingsTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AutogroupIdTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/CommitRollbackTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DeliveryOrderTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DurableQueueTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HeuristicXATest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageConcurrencyTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageCounterTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageHandlerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageRateTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/OrderTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/PagingTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerFlowControlTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveImmediateTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RoutingTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SelfExpandingBufferTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateAndDeleteQueueTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateConsumerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateProducerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionSendAcknowledgementHandlerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionStopStartTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SimpleSendMultipleQueues.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TransactionalSendTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/persistence/DeleteQueueRestartTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/ra/HornetQMessageHandlerTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/remoting/ReconnectTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/ScheduledMessageTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/security/SecurityTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/performance/paging/MeasurePagingMultiThreadTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/client/SendStressTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/CompactingStressTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java
Log:
integration test fixes
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/InterceptorTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,11 +18,7 @@
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -49,6 +45,8 @@
private final SimpleString QUEUE = new
SimpleString("InterceptorTestQueue");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -57,11 +55,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -247,7 +249,7 @@
server.getRemotingService().addInterceptor(interceptor);
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true, true);
@@ -304,10 +306,11 @@
server.getRemotingService().addInterceptor(interceptor);
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(false);
+ locator.setBlockOnNonDurableSend(false);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(false, true, true, true);
session.createQueue(QUEUE, QUEUE, null, false);
@@ -336,7 +339,7 @@
public void testClientInterceptorChangeProperty() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
MyInterceptor3 interceptor = new MyInterceptor3();
@@ -393,7 +396,7 @@
public void testClientInterceptorRejectPacket() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
MyInterceptor4 interceptor = new MyInterceptor4();
@@ -437,7 +440,7 @@
server.getRemotingService().addInterceptor(interceptor3);
server.getRemotingService().addInterceptor(interceptor4);
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true, true);
@@ -521,7 +524,7 @@
MyInterceptor6 interceptor3 = new MyInterceptor6("c", 3);
MyInterceptor6 interceptor4 = new MyInterceptor6("d", 4);
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
sf.getServerLocator().addInterceptor(interceptor1);
sf.getServerLocator().addInterceptor(interceptor2);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AckBatchSizeTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AckBatchSizeTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AckBatchSizeTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
@@ -48,7 +44,8 @@
private int getMessageEncodeSize(final SimpleString address) throws Exception
{
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
ClientMessage message = session.createMessage(false);
// we need to set the destination so we can calculate the encodesize correctly
@@ -66,10 +63,11 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
int numMessages = 100;
- cf.getServerLocator().setAckBatchSize(numMessages *
getMessageEncodeSize(addressA));
- cf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(numMessages * getMessageEncodeSize(addressA));
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, true, true);
@@ -116,9 +114,10 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setAckBatchSize(0);
- cf.getServerLocator().setBlockOnAcknowledge(true);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setAckBatchSize(0);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
int numMessages = 100;
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AcknowledgeTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AcknowledgeTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AcknowledgeTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -19,12 +19,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
import org.hornetq.tests.util.ServiceTestBase;
@@ -48,9 +43,10 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setAckBatchSize(0);
- cf.getServerLocator().setBlockOnAcknowledge(true);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setAckBatchSize(0);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -90,7 +86,8 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();;
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -131,9 +128,10 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setBlockOnAcknowledge(true);
- cf.getServerLocator().setAckBatchSize(0);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(0);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -189,9 +187,10 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setBlockOnAcknowledge(true);
- cf.getServerLocator().setAckBatchSize(0);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(0);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AddressSettingsTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AddressSettingsTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AddressSettingsTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.settings.HierarchicalRepository;
import org.hornetq.core.settings.impl.AddressSettings;
@@ -73,7 +69,8 @@
HierarchicalRepository<AddressSettings> repos =
server.getAddressSettingsRepository();
repos.addMatch(addressA.toString(), addressSettings);
repos.addMatch(addressB.toString(), addressSettings2);
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false);
session.createQueue(addressA, queueA, false);
session.createQueue(addressB, queueB, false);
@@ -136,7 +133,8 @@
HierarchicalRepository<AddressSettings> repos =
server.getAddressSettingsRepository();
repos.addMatch(addressA.toString(), addressSettings);
repos.addMatch("#", addressSettings2);
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false);
session.createQueue(addressA, queueA, false);
session.createQueue(addressB, queueB, false);
@@ -199,7 +197,8 @@
HierarchicalRepository<AddressSettings> repos =
server.getAddressSettingsRepository();
repos.addMatch(addressA.toString(), addressSettings);
repos.addMatch("*", addressSettings2);
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false);
session.createQueue(addressA, queueA, false);
session.createQueue(addressB, queueB, false);
@@ -266,7 +265,8 @@
repos.addMatch(addressA2.toString(), addressSettings);
repos.addMatch("add.*", addressSettings2);
repos.addMatch("#", addressSettings3);
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false);
session.createQueue(addressA2, queueA, false);
session.createQueue(addressB2, queueB, false);
@@ -346,7 +346,8 @@
repos.addMatch(addressA2.toString(), addressSettings);
repos.addMatch("add.*", addressSettings2);
repos.addMatch("#", addressSettings3);
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false);
session.createQueue(addressA2, queueA, false);
session.createQueue(addressB2, queueB, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AutogroupIdTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AutogroupIdTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/AutogroupIdTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,12 +18,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -58,8 +53,9 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setAutoGroup(true);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setAutoGroup(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
session.createQueue(groupTestQ, groupTestQ, null, false);
@@ -115,8 +111,10 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setAutoGroup(true);
+
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setAutoGroup(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
session.createQueue(groupTestQ, groupTestQ, null, false);
@@ -177,8 +175,10 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(false, true, true);
session.createQueue(groupTestQ, groupTestQ, null, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/BlockingSendTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -49,6 +45,7 @@
ClientSession session = null;
ClientSessionFactory factory = null;
+ ServerLocator locator = null;
try
{
@@ -58,10 +55,10 @@
server.start();
System.out.println("sync = " +
server.getConfiguration().isJournalSyncNonTransactional());
+ locator = createFactory(false);
+ locator.setBlockOnDurableSend(true);
+ factory = locator.createSessionFactory();
- factory = createFactory(false);
- factory.getServerLocator().setBlockOnDurableSend(true);
-
session = factory.createSession();
session.createQueue("address", "queue");
@@ -85,6 +82,10 @@
}
finally
{
+ if (locator != null)
+ {
+ locator.close();
+ }
if (factory != null)
{
factory.close();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/CommitRollbackTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/CommitRollbackTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/CommitRollbackTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -19,12 +19,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
import org.hornetq.tests.util.ServiceTestBase;
@@ -50,7 +45,9 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, false, false);
sendSession.createQueue(addressA, queueA, false);
@@ -90,7 +87,8 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, false, false);
sendSession.createQueue(addressA, queueA, false);
@@ -137,7 +135,8 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession(false, false, false);
sendSession.createQueue(addressA, queueA, false);
@@ -190,9 +189,10 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setBlockOnAcknowledge(true);
- cf.getServerLocator().setAckBatchSize(0);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(0);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, false);
sendSession.createQueue(addressA, queueA, false);
@@ -253,9 +253,10 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setBlockOnAcknowledge(true);
- cf.getServerLocator().setAckBatchSize(0);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(0);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
final ClientSession session = cf.createSession(false, true, false);
sendSession.createQueue(addressA, queueA, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerRoundRobinTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -41,7 +37,8 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
session.createQueue(addressA, queueA, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,12 +20,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -46,6 +41,8 @@
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -54,11 +51,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -103,7 +104,7 @@
public void testConsumerAckImmediateAutoCommitTrue() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true, true);
@@ -137,7 +138,7 @@
public void testConsumerAckImmediateAutoCommitFalse() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false, true);
@@ -171,7 +172,7 @@
public void testConsumerAckImmediateAckIgnored() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true, true);
@@ -209,7 +210,7 @@
public void testConsumerAckImmediateCloseSession() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true, true);
@@ -249,7 +250,7 @@
public void testAcksWithSmallSendWindow() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -278,9 +279,10 @@
return true;
}
});
- ClientSessionFactory sfReceive = createInVMFactory();
- sfReceive.getServerLocator().setConfirmationWindowSize(100);
- sfReceive.getServerLocator().setAckBatchSize(-1);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setConfirmationWindowSize(100);
+ locator.setAckBatchSize(-1);
+ ClientSessionFactory sfReceive = locator.createSessionFactory();
ClientSession sessionRec = sfReceive.createSession(false, true, true);
ClientConsumer consumer = sessionRec.createConsumer(QUEUE);
consumer.setMessageHandler(new MessageHandler()
@@ -300,11 +302,12 @@
sessionRec.start();
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
sessionRec.close();
+ locator.close();
}
public void testClearListener() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -327,7 +330,7 @@
public void testNoReceiveWithListener() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -366,9 +369,9 @@
// Test that, on rollback credits are released for messages cleared in the buffer
public void testConsumerCreditsOnRollback() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ locator.setConsumerWindowSize(10000);
- sf.getServerLocator().setConsumerWindowSize(10000);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createTransactedSession();
@@ -425,11 +428,12 @@
// Test that, on rollback credits are released for messages cleared in the buffer
public void testConsumerCreditsOnRollbackLargeMessages() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setConsumerWindowSize(10000);
- sf.getServerLocator().setMinLargeMessageSize(1000);
+ locator.setConsumerWindowSize(10000);
+ locator.setMinLargeMessageSize(1000);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createTransactedSession();
session.createQueue(QUEUE, QUEUE, null, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ConsumerWindowSizeTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -21,12 +21,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.client.impl.ClientConsumerInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.postoffice.Binding;
@@ -53,14 +48,34 @@
private static final boolean isTrace = ConsumerWindowSizeTest.log.isTraceEnabled();
+ private ServerLocator locator;
+
protected boolean isNetty()
{
return false;
}
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ locator = createFactory(isNetty());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+
+ super.tearDown();
+ }
+
private int getMessageEncodeSize(final SimpleString address) throws Exception
{
- ClientSessionFactory cf = createFactory(isNetty());
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
ClientMessage message = session.createMessage(false);
// we need to set the destination so we can calculate the encodesize correctly
@@ -80,10 +95,11 @@
{
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ locator.setConsumerWindowSize(0);
- sf.getServerLocator().setConsumerWindowSize(0);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(false, false, false);
session.createQueue("testWindow", "testWindow", true);
session.close();
@@ -140,14 +156,14 @@
public void testReceiveImmediateWithZeroWindow2() throws Exception
{
HornetQServer server = createServer(true);
-
+ ServerLocator locator = createInVMNonHALocator();
try
{
server.start();
-
- ClientSessionFactory sf = createFactory(false);
- sf.getServerLocator().setConsumerWindowSize(0);
+ locator.setConsumerWindowSize(0);
+
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, false, false);
session.createQueue("testReceive", "testReceive", true);
session.close();
@@ -186,6 +202,7 @@
}
finally
{
+ locator.close();
server.stop();
}
}
@@ -198,10 +215,11 @@
{
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ locator.setConsumerWindowSize(0);
- sf.getServerLocator().setConsumerWindowSize(0);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(false, false, false);
session.createQueue("testWindow", "testWindow", true);
session.close();
@@ -261,9 +279,9 @@
{
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ locator.setConsumerWindowSize(0);
- sf.getServerLocator().setConsumerWindowSize(0);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, false, false);
session.createQueue("testWindow", "testWindow", true);
@@ -326,13 +344,13 @@
public void testSendWindowSize() throws Exception
{
HornetQServer messagingService = createServer(false, isNetty());
- ClientSessionFactory cf = createFactory(isNetty());
+ locator.setBlockOnNonDurableSend(false);
try
{
messagingService.start();
- cf.getServerLocator().setBlockOnNonDurableSend(false);
int numMessage = 100;
- cf.getServerLocator().setConsumerWindowSize(numMessage *
getMessageEncodeSize(addressA));
+ locator.setConsumerWindowSize(numMessage * getMessageEncodeSize(addressA));
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession receiveSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
@@ -391,9 +409,10 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setConsumerWindowSize(1);
+ locator.setConsumerWindowSize(1);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
session = sf.createSession(false, true, true);
SimpleString ADDRESS = addressA;
@@ -484,9 +503,10 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setConsumerWindowSize(0);
+ locator.setConsumerWindowSize(0);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
if (largeMessages)
{
sf.getServerLocator().setMinLargeMessageSize(100);
@@ -614,15 +634,17 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setConsumerWindowSize(0);
+ locator.setConsumerWindowSize(0);
+
if (largeMessages)
{
- sf.getServerLocator().setMinLargeMessageSize(100);
+ locator.setMinLargeMessageSize(100);
}
+ ClientSessionFactory sf = locator.createSessionFactory();
+
session1 = sf.createSession(false, true, true);
session2 = sf.createSession(false, true, true);
@@ -805,14 +827,15 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setConsumerWindowSize(0);
+ locator.setConsumerWindowSize(0);
if (largeMessages)
{
- sf.getServerLocator().setMinLargeMessageSize(100);
+ locator.setMinLargeMessageSize(100);
}
+ ClientSessionFactory sf = locator.createSessionFactory();
+
session = sf.createSession(false, true, true);
SimpleString ADDRESS = new SimpleString("some-queue");
@@ -970,14 +993,15 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setConsumerWindowSize(1);
+ locator.setConsumerWindowSize(1);
if (largeMessage)
{
- sf.getServerLocator().setMinLargeMessageSize(100);
+ locator.setMinLargeMessageSize(100);
}
+ ClientSessionFactory sf = locator.createSessionFactory();
+
session = sf.createSession(false, true, true);
SimpleString ADDRESS = new SimpleString("some-queue");
@@ -1136,13 +1160,14 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setConsumerWindowSize(-1);
+ locator.setConsumerWindowSize(-1);
if (largeMessages)
{
- sf.getServerLocator().setMinLargeMessageSize(100);
+ locator.setMinLargeMessageSize(100);
}
+ ClientSessionFactory sf = locator.createSessionFactory();
+
sessionA = sf.createSession(false, true, true);
SimpleString ADDRESS = new SimpleString("some-queue");
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DeliveryOrderTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DeliveryOrderTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DeliveryOrderTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,12 +20,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -42,13 +37,30 @@
public final SimpleString queueC = new SimpleString("queueC");
+ private ServerLocator locator;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ locator = createInVMNonHALocator();
+ }
+
+ @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 = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, false, true);
ClientProducer cp = sendSession.createProducer(addressA);
int numMessages = 1000;
@@ -89,7 +101,8 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, false);
ClientProducer cp = sendSession.createProducer(addressA);
int numMessages = 1000;
@@ -121,6 +134,7 @@
}
finally
{
+ locator.close();
if (server.isStarted())
{
server.stop();
@@ -134,7 +148,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientSession recSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DurableQueueTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DurableQueueTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/DurableQueueTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,7 +18,6 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.*;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
@@ -41,6 +40,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -147,8 +148,10 @@
server.start();
- sf = createInVMFactory();
+ locator = createInVMNonHALocator();
+ sf = locator.createSessionFactory();
+
session = sf.createSession(false, true, true);
}
@@ -157,6 +160,8 @@
{
session.close();
+ locator.close();
+
server.stop();
sf.close();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -312,9 +312,9 @@
// then we create a client as normal
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ locator.setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = locator.createSessionFactory();
-
- sessionFactory.getServerLocator().setBlockOnAcknowledge(true); // There are
assertions over sizes that needs to be done after the ACK
+// There are assertions over sizes that needs to be done after the ACK
// was received on server
clientSession = sessionFactory.createSession(null, null, false, true, true, false,
0);
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HeuristicXATest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HeuristicXATest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HeuristicXATest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -23,11 +23,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.api.core.management.HornetQServerControl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
@@ -59,6 +55,8 @@
private MBeanServer mbeanServer;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -111,7 +109,7 @@
server.start();
Xid xid = newXID();
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(true, false, false);
@@ -216,7 +214,7 @@
server.start();
Xid xid = newXID();
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(true, false, false);
@@ -324,7 +322,7 @@
server.start();
Xid xid = newXID();
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(true, false, false);
@@ -440,7 +438,7 @@
server.start();
Xid xid = newXID();
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(true, false, false);
@@ -527,6 +525,7 @@
@Override
protected void tearDown() throws Exception
{
+ locator.close();
MBeanServerFactory.releaseMBeanServer(mbeanServer);
super.tearDown();
}
@@ -536,6 +535,7 @@
{
super.setUp();
mbeanServer = MBeanServerFactory.createMBeanServer();
+ locator = createInVMNonHALocator();
}
// Private -------------------------------------------------------
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -48,12 +48,13 @@
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
- ClientSessionFactory clientSessionFactory = locator.createSessionFactory();
// Force an ack at once - this means the send call will block
- clientSessionFactory.getServerLocator().setConfirmationWindowSize(1);
+ locator.setConfirmationWindowSize(1);
+ ClientSessionFactory clientSessionFactory = locator.createSessionFactory();
+
ClientSession session = clientSessionFactory.createSession();
session.setSendAcknowledgementHandler(new SendAcknowledgementHandler()
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/InVMNonPersistentMessageBufferTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -14,11 +14,7 @@
import junit.framework.Assert;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.impl.PacketImpl;
import org.hornetq.core.server.HornetQServer;
@@ -203,15 +199,15 @@
}
- protected ClientSessionFactory createFactory() throws Exception
+ protected ServerLocator createFactory() throws Exception
{
if (isNetty())
{
- return createNettyFactory();
+ return createNettyNonHALocator();
}
else
{
- return createInVMFactory();
+ return createInVMNonHALocator();
}
}
@@ -234,8 +230,10 @@
server.start();
- ClientSessionFactory cf = createFactory();
+ ServerLocator locator = createFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
+
session = cf.createSession();
session.createQueue(InVMNonPersistentMessageBufferTest.address,
InVMNonPersistentMessageBufferTest.queueName);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,11 +18,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.journal.PreparedTransactionInfo;
@@ -61,6 +57,8 @@
private final SimpleString QUEUE = new SimpleString("queue");
+ private ServerLocator locator;
+
@Override
protected void tearDown() throws Exception
{
@@ -88,13 +86,13 @@
server = super.createServer(true, config);
server.start();
-
- factory = createInVMFactory();
+ locator = createInVMNonHALocator();
+ factory = locator.createSessionFactory();
}
protected void stopServer() throws Exception
{
-
+ locator.close();
try
{
factory.close();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -59,6 +59,8 @@
// Static --------------------------------------------------------
private final Logger log = Logger.getLogger(LargeMessageTest.class);
+ private ServerLocator locator;
+
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@@ -80,7 +82,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -168,7 +170,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(!transacted, !transacted, 0);
@@ -252,7 +254,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -305,7 +307,7 @@
server.start();
- sf = createFactory(isNetty());
+ sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -379,7 +381,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -462,7 +464,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
SimpleString ADDRESS_DLA = LargeMessageTest.ADDRESS.concat("-dla");
SimpleString ADDRESS_EXPIRY =
LargeMessageTest.ADDRESS.concat("-expiry");
@@ -597,7 +599,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
SimpleString ADDRESS_DLA = LargeMessageTest.ADDRESS.concat("-dla");
SimpleString ADDRESS_EXPIRY =
LargeMessageTest.ADDRESS.concat("-expiry");
@@ -673,7 +675,7 @@
server.start();
- sf = createFactory(isNetty());
+ sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -740,7 +742,7 @@
server.getAddressSettingsRepository().addMatch("*", addressSettings);
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -782,7 +784,7 @@
server.start();
- sf = createFactory(isNetty());
+ sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -847,7 +849,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(false, false, false);
@@ -948,12 +950,13 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setMinLargeMessageSize(111);
+ locator.setMinLargeMessageSize(111);
- sf.getServerLocator().setCacheLargeMessagesClient(true);
+ locator.setCacheLargeMessagesClient(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
session = sf.createSession(false, false, false);
session.createQueue(LargeMessageTest.ADDRESS, LargeMessageTest.ADDRESS, true);
@@ -1884,7 +1887,7 @@
SimpleString queue[] = new SimpleString[] { new
SimpleString("queue1"), new SimpleString("queue2") };
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
@@ -1967,7 +1970,7 @@
SimpleString queue[] = new SimpleString[] { new
SimpleString("queue1"), new SimpleString("queue2") };
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
@@ -1995,7 +1998,7 @@
server.start();
- sf = createFactory(isNetty());
+ sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, true, true, false, 0);
}
@@ -2049,7 +2052,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(isXA, false, false);
@@ -2136,7 +2139,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(isXA, false, false);
@@ -2270,10 +2273,10 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ locator.setMinLargeMessageSize(1024);
+ locator.setConsumerWindowSize(1024 * 1024);
- sf.getServerLocator().setMinLargeMessageSize(1024);
- sf.getServerLocator().setConsumerWindowSize(1024 * 1024);
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, false, false, false, 0);
@@ -2373,11 +2376,12 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setMinLargeMessageSize(1024);
- sf.getServerLocator().setConsumerWindowSize(1024 * 1024);
+ locator.setMinLargeMessageSize(1024);
+ locator.setConsumerWindowSize(1024 * 1024);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
session = sf.createSession(null, null, false, false, false, false, 0);
session.createQueue(LargeMessageTest.ADDRESS, LargeMessageTest.ADDRESS, null,
true);
@@ -2476,10 +2480,11 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setMinLargeMessageSize(100 * 1024);
+ locator.setMinLargeMessageSize(100 * 1024);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
session = sf.createSession(null, null, false, true, true, false, 0);
session.createQueue(LargeMessageTest.ADDRESS, LargeMessageTest.ADDRESS, null,
true);
@@ -2550,9 +2555,9 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ locator.setMinLargeMessageSize(1024);
- sf.getServerLocator().setMinLargeMessageSize(1024);
+ ClientSessionFactory sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, true, true, false, 0);
@@ -2628,7 +2633,7 @@
server.start();
- ClientSessionFactory sf = createFactory(false);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, false);
@@ -2691,6 +2696,7 @@
{
super.setUp();
clearData();
+ locator = createFactory(isNetty());
log.info("\n*********************************************************************************\n
Starting " + getName() +
"\n*********************************************************************************");
}
@@ -2700,6 +2706,7 @@
{
log.info("\n*********************************************************************************\nDone
with " + getName() +
"\n*********************************************************************************");
+ locator.close();
super.tearDown();
}
@@ -2724,7 +2731,7 @@
try
{
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
if (sendBlocking)
{
@@ -2769,7 +2776,7 @@
server = createServer(true, config, PAGE_SIZE, PAGE_MAX, map);
server.start();
- sf = createFactory(isNetty());
+ sf = locator.createSessionFactory();
}
session = sf.createSession(null, null, false, true, true, false, 0);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageConcurrencyTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageConcurrencyTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageConcurrencyTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,12 +18,7 @@
import java.util.concurrent.LinkedBlockingQueue;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.RandomUtil;
@@ -47,6 +42,8 @@
private final SimpleString QUEUE_NAME = new
SimpleString("MessageConcurrencyTestQueue");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -55,11 +52,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -70,7 +71,7 @@
// Test that a created message can be sent via multiple producers on different
sessions concurrently
public void testMessageConcurrency() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession createSession = sf.createSession();
@@ -131,7 +132,7 @@
// Test that a created message can be sent via multiple producers after being consumed
from a single consumer
public void testMessageConcurrencyAfterConsumption() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession consumeSession = sf.createSession();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageCounterTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageCounterTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageCounterTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -36,6 +32,8 @@
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -44,11 +42,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -58,11 +60,11 @@
public void testMessageCounter() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, false, false, false,
0);
session.createQueue(QUEUE, QUEUE, null, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,10 +17,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-import org.hornetq.api.core.client.ClientConsumer;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
@@ -46,6 +43,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -187,15 +186,15 @@
server = createServer(true);
server.start();
-
- sf = createInVMFactory();
+ locator = createInVMNonHALocator();
+ sf = locator.createSessionFactory();
session = sf.createSession(false, true, true);
}
@Override
protected void tearDown() throws Exception
{
- sf.close();
+ locator.close();
session.close();
@@ -219,7 +218,7 @@
server.stop();
server.start();
- sf = createInVMFactory();
+ sf = locator.createSessionFactory();
session = sf.createSession(false, true, true);
}
// Inner classes -------------------------------------------------
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,11 +17,7 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
import org.hornetq.core.settings.impl.AddressSettings;
@@ -50,6 +46,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -190,15 +188,15 @@
server = createServer(false);
server.start();
-
- sf = createInVMFactory();
+ locator = createInVMNonHALocator();
+ sf = locator.createSessionFactory();
session = sf.createSession(false, true, true);
}
@Override
protected void tearDown() throws Exception
{
- sf.close();
+ locator.close();
session.close();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingConnectionFactoryTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -155,8 +155,8 @@
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ locator.setGroupID("grp1");
ClientSessionFactory sessionFactory = locator.createSessionFactory();
- sessionFactory.getServerLocator().setGroupID("grp1");
clientSession = sessionFactory.createSession(false, true, true);
clientSession.createQueue(qName, qName, null, false);
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageGroupingTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -263,8 +263,8 @@
private void doTestMultipleGroupingTXRollback() throws Exception
{
log.info("*** starting test");ServerLocator locator =
HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator.setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = locator.createSessionFactory();
- sessionFactory.getServerLocator().setBlockOnAcknowledge(true);
ClientSession clientSession = sessionFactory.createSession(false, false, false);
ClientProducer clientProducer = this.clientSession.createProducer(qName);
ClientConsumer consumer = clientSession.createConsumer(qName);
@@ -397,8 +397,8 @@
private void doTestMultipleGroupingXARollback() throws Exception
{
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator.setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = locator.createSessionFactory();
- sessionFactory.getServerLocator().setBlockOnAcknowledge(true);
ClientSession clientSession = sessionFactory.createSession(true, false, false);
ClientProducer clientProducer = this.clientSession.createProducer(qName);
clientSession.start();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageHandlerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageHandlerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageHandlerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,14 +17,8 @@
import junit.framework.Assert;
-import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -40,6 +34,8 @@
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -48,11 +44,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -62,7 +62,7 @@
public void testSetMessageHandlerWithMessagesPending() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -123,7 +123,7 @@
public void testSetResetMessageHandler() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -225,7 +225,7 @@
public void testSetUnsetMessageHandler() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -313,7 +313,7 @@
public void testSetUnsetResetMessageHandler() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -275,9 +275,9 @@
server = HornetQServers.newHornetQServer(config, false);
server.start();
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
sf = locator.createSessionFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
session = sf.createSession(false, true, true);
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageRateTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageRateTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/MessageRateTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,12 +20,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -43,6 +38,8 @@
private final SimpleString ADDRESS = new SimpleString("ADDRESS");
+ private ServerLocator locator;
+
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
@@ -59,8 +56,8 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setProducerMaxRate(10);
+ locator.setProducerMaxRate(10);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ADDRESS, ADDRESS, true);
@@ -95,8 +92,8 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setConsumerMaxRate(10);
+ locator.setConsumerMaxRate(10);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -144,8 +141,8 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setConsumerMaxRate(10);
+ locator.setConsumerMaxRate(10);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -209,6 +206,8 @@
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
super.tearDown();
}
@@ -216,6 +215,8 @@
protected void setUp() throws Exception
{
super.setUp();
+
+ locator = createInVMNonHALocator();
}
// Private -------------------------------------------------------
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/OrderTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/OrderTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/OrderTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -43,15 +39,20 @@
private HornetQServer server;
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
super.setUp();
+
+ locator = createNettyNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
server.stop();
super.tearDown();
}
@@ -77,12 +78,13 @@
server = createServer(persistent, true);
server.start();
- ClientSessionFactory sf = createNettyFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(false);
- sf.getServerLocator().setBlockOnDurableSend(false);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setBlockOnNonDurableSend(false);
+ locator.setBlockOnDurableSend(false);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(true, true, 0);
try
@@ -169,12 +171,12 @@
server = createServer(persistent, true);
server.start();
- ClientSessionFactory sf = createNettyFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(false);
- sf.getServerLocator().setBlockOnDurableSend(false);
- sf.getServerLocator().setBlockOnAcknowledge(false);
+ locator.setBlockOnNonDurableSend(false);
+ locator.setBlockOnDurableSend(false);
+ locator.setBlockOnAcknowledge(false);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(true, true, 0);
int numberOfMessages = 500;
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -23,12 +23,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.paging.impl.TestSupportPageStore;
@@ -51,6 +46,7 @@
*/
public class PagingTest extends ServiceTestBase
{
+ private ServerLocator locator;
public PagingTest(final String name)
{
@@ -81,6 +77,21 @@
// Public --------------------------------------------------------
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ locator = createInVMNonHALocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testSendReceivePagingPersistent() throws Exception
{
internaltestSendReceivePaging(true);
@@ -112,12 +123,12 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
@@ -163,7 +174,7 @@
server.start();
}
- sf = createInVMFactory();
+ sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, true, true, false, 0);
@@ -251,12 +262,11 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
-
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
@@ -391,12 +401,12 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
@@ -447,7 +457,7 @@
new HashMap<String, AddressSettings>());
server.start();
- sf = createInVMFactory();
+ sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, true, true, false, 0);
}
@@ -524,12 +534,12 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, false, true, false,
0);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
@@ -597,12 +607,12 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, false, false, false,
0);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
@@ -687,12 +697,12 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
@@ -829,10 +839,10 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setAckBatchSize(0);
+ locator.setAckBatchSize(0);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession();
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
@@ -925,12 +935,12 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, !transacted, true,
false, 0);
for (int i = 0; i < NUMBER_OF_BINDINGS; i++)
@@ -968,7 +978,7 @@
new HashMap<String, AddressSettings>());
server.start();
- sf = createInVMFactory();
+ sf = locator.createSessionFactory();
session = sf.createSession(null, null, false, true, true, false, 0);
@@ -1041,7 +1051,7 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false);
@@ -1150,7 +1160,7 @@
{
server.start();
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerFlowControlTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerFlowControlTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerFlowControlTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -21,12 +21,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.client.impl.ClientProducerCreditManagerImpl;
import org.hornetq.core.client.impl.ClientProducerCredits;
import org.hornetq.core.client.impl.ClientProducerInternal;
@@ -51,13 +46,29 @@
{
private static final Logger log = Logger.getLogger(ProducerFlowControlTest.class);
+ private ServerLocator locator;
+
protected boolean isNetty()
{
return false;
}
- // TODO need to test crashing a producer with unused credits returns them to the pool
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ locator = createFactory(isNetty());
+ }
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+// TODO need to test crashing a producer with unused credits returns them to the pool
+
public void testFlowControlSingleConsumer() throws Exception
{
testFlowControl(1000, 500, 10 * 1024, 1024, 1024, 1024, 1, 1, 0, false);
@@ -199,17 +210,17 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setProducerWindowSize(producerWindowSize);
- sf.getServerLocator().setConsumerWindowSize(consumerWindowSize);
- sf.getServerLocator().setAckBatchSize(ackBatchSize);
+ locator.setProducerWindowSize(producerWindowSize);
+ locator.setConsumerWindowSize(consumerWindowSize);
+ locator.setAckBatchSize(ackBatchSize);
if (minLargeMessageSize != -1)
{
- sf.getServerLocator().setMinLargeMessageSize(minLargeMessageSize);
+ locator.setMinLargeMessageSize(minLargeMessageSize);
}
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true, true);
session.start();
@@ -347,12 +358,12 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
- sf.getServerLocator().setProducerWindowSize(1024);
- sf.getServerLocator().setConsumerWindowSize(1024);
- sf.getServerLocator().setAckBatchSize(1024);
+ locator.setProducerWindowSize(1024);
+ locator.setConsumerWindowSize(1024);
+ locator.setAckBatchSize(1024);
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
final SimpleString queueName = new SimpleString("testqueue");
@@ -414,11 +425,11 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ locator.setProducerWindowSize(1024);
+ locator.setConsumerWindowSize(1024);
+ locator.setAckBatchSize(1024);
- sf.getServerLocator().setProducerWindowSize(1024);
- sf.getServerLocator().setConsumerWindowSize(1024);
- sf.getServerLocator().setAckBatchSize(1024);
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -449,7 +460,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -516,7 +527,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -552,7 +563,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -590,7 +601,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -626,7 +637,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -664,7 +675,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -728,7 +739,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -755,7 +766,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
@@ -806,7 +817,7 @@
server.start();
- ClientSessionFactory sf = createFactory(isNetty());
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true, true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ProducerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,10 +20,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.Packet;
import org.hornetq.core.protocol.core.impl.PacketImpl;
@@ -76,8 +73,9 @@
return true;
}
});
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setConfirmationWindowSize(100);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setConfirmationWindowSize(100);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
ClientProducer producer = session.createProducer(QUEUE);
ClientMessage message = session.createMessage(true);
@@ -86,6 +84,7 @@
producer.send(message);
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
session.close();
+ locator.close();
}
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -34,6 +34,8 @@
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -42,11 +44,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -60,11 +66,11 @@
{
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
- sf = locator.createSessionFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
session.createQueue(QUEUE, QUEUE, null, false);
@@ -110,7 +116,7 @@
public void testConsumerBrowserWithSelector() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -158,7 +164,7 @@
public void testConsumerBrowserWithStringSelector() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -196,7 +202,7 @@
public void testConsumerMultipleBrowser() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -234,7 +240,7 @@
public void testConsumerMultipleBrowserWithSelector() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -289,7 +295,7 @@
private void testConsumerBrowserMessagesArentAcked(final boolean preACK) throws
Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, true, true, preACK,
0);
@@ -324,7 +330,7 @@
public void testConsumerBrowserMessageAckDoesNothing() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -361,10 +367,10 @@
public void testBrowseWithZeroConsumerWindowSize() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
-
- sf.getServerLocator().setConsumerWindowSize(0);
+ locator.setConsumerWindowSize(0);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(false, true, true);
session.createQueue(QUEUE, QUEUE, null, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveImmediateTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveImmediateTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveImmediateTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -39,6 +39,8 @@
private final SimpleString ADDRESS = new
SimpleString("ReceiveImmediateTest.address");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -48,11 +50,15 @@
server = HornetQServers.newHornetQServer(config, false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -84,12 +90,11 @@
public void testConsumerReceiveImmediateWithSessionStop() throws Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(0);
sf = locator.createSessionFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
- sf.getServerLocator().setAckBatchSize(0);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ADDRESS, QUEUE, null, false);
@@ -118,11 +123,10 @@
private void doConsumerReceiveImmediateWithNoMessages(final boolean browser) throws
Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(0);
sf = locator.createSessionFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
- sf.getServerLocator().setAckBatchSize(0);
ClientSession session = sf.createSession(false, true, false);
@@ -141,12 +145,11 @@
private void doConsumerReceiveImmediate(final boolean browser) throws Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
+ locator.setAckBatchSize(0);
sf = locator.createSessionFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
- sf.getServerLocator().setAckBatchSize(0);
-
ClientSession session = sf.createSession(false, true, true);
session.createQueue(ADDRESS, QUEUE, null, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/ReceiveTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -16,12 +16,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -34,13 +29,31 @@
SimpleString queueA = new SimpleString("queueA");
+ private ServerLocator locator;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ locator = createInVMNonHALocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testBasicReceive() throws Exception
{
HornetQServer server = createServer(false);
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientProducer cp = sendSession.createProducer(addressA);
ClientSession session = cf.createSession(false, true, true);
@@ -67,7 +80,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
session.createQueue(addressA, queueA, false);
ClientConsumer cc = session.createConsumer(queueA);
@@ -93,7 +106,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
session.createQueue(addressA, queueA, false);
ClientConsumer cc = session.createConsumer(queueA);
@@ -126,7 +139,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
session.createQueue(addressA, queueA, false);
ClientConsumer cc = session.createConsumer(queueA);
@@ -164,9 +177,9 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
// forces perfect round robin
- cf.getServerLocator().setConsumerWindowSize(1);
+ locator.setConsumerWindowSize(1);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientProducer cp = sendSession.createProducer(addressA);
ClientSession session = cf.createSession(false, true, true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RedeliveryConsumerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,11 +17,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -51,6 +47,8 @@
ClientSessionFactory factory;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -212,7 +210,7 @@
server.start();
- factory = createInVMFactory();
+ factory = locator.createSessionFactory();
session = factory.createSession(false, true, false);
session.start();
@@ -240,9 +238,9 @@
server = createServer(true, config);
server.start();
+ locator = createInVMNonHALocator();
+ factory = locator.createSessionFactory();
- factory = createInVMFactory();
-
ClientSession session = factory.createSession(false, false, false);
session.createQueue(ADDRESS, ADDRESS, true);
@@ -252,7 +250,7 @@
@Override
protected void tearDown() throws Exception
{
-
+ locator.close();
if (factory != null)
{
factory.close();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RoutingTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RoutingTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/RoutingTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -36,6 +32,24 @@
public final SimpleString queueC = new SimpleString("queueC");
+ private ServerLocator locator;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ locator = createInVMNonHALocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testRouteToMultipleQueues() throws Exception
{
HornetQServer server = createServer(false);
@@ -43,7 +57,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
sendSession.createQueue(addressA, queueB, false);
@@ -93,7 +107,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, false);
int numMessages = 300;
@@ -131,7 +145,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, true);
int numMessages = 300;
@@ -169,7 +183,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, new SimpleString("foo =
'bar'"), false);
int numMessages = 300;
@@ -209,7 +223,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
sendSession.createQueue(addressA, queueA, new SimpleString("foo =
'bar'"), false);
sendSession.createQueue(addressA, queueB, new SimpleString("x = 1"),
false);
@@ -272,7 +286,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
sendSession.createTemporaryQueue(addressA, queueA);
int numMessages = 300;
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SelfExpandingBufferTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SelfExpandingBufferTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SelfExpandingBufferTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,11 +17,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.RandomUtil;
@@ -82,15 +78,10 @@
ClientSessionFactory factory;
- if (netty)
- {
- factory = createNettyFactory();
- }
- else
- {
- factory = createInVMFactory();
- }
+ ServerLocator locator = createFactory(netty);
+ factory = locator.createSessionFactory();
+
ClientSession session = factory.createSession(false, true, true);
try
@@ -147,6 +138,7 @@
finally
{
session.close();
+ locator.close();
}
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCloseOnGCTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,6 +18,7 @@
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.client.impl.ClientSessionFactoryImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -39,6 +40,8 @@
private HornetQServer server;
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -46,11 +49,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ //locator.close();
+
server.stop();
server = null;
@@ -64,7 +71,7 @@
{
try
{
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
ClientSession s1 = factory.createSession();
ClientSession s2 = factory.createSession();
@@ -78,6 +85,9 @@
s1 = null;
s2 = null;
+ locator.close();
+
+ locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new
WeakReference<ClientSessionFactory>(factory);
@@ -105,10 +115,11 @@
{
try
{
- ClientSessionFactory factory = createInVMFactory();
- factory.getServerLocator().setUseGlobalPools(false);
+ locator.setUseGlobalPools(false);
+ ClientSessionFactory factory = locator.createSessionFactory();
+
ClientSession s1 = factory.createSession();
ClientSession s2 = factory.createSession();
@@ -121,6 +132,9 @@
s1 = null;
s2 = null;
+ locator.close();
+
+ locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new
WeakReference<ClientSessionFactory>(factory);
@@ -148,7 +162,7 @@
{
try
{
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
ClientSession s1 = factory.createSession();
ClientSession s2 = factory.createSession();
@@ -162,6 +176,9 @@
s1 = null;
s2 = null;
+ locator.close();
+
+ locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new
WeakReference<ClientSessionFactory>(factory);
@@ -187,7 +204,7 @@
{
try
{
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
ClientSession s1 = factory.createSession();
ClientSession s2 = factory.createSession();
@@ -198,6 +215,9 @@
s1 = null;
s2 = null;
+ locator.close();
+
+ locator = null;
UnitTestCase.checkWeakReferences(wrs1, wrs2);
WeakReference<ClientSessionFactory> fref = new
WeakReference<ClientSessionFactory>(factory);
@@ -223,12 +243,15 @@
{
try
{
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
WeakReference<ClientSessionFactory> fref = new
WeakReference<ClientSessionFactory>(factory);
factory = null;
+ locator.close();
+
+ locator = null;
UnitTestCase.checkWeakReferences(fref);
}
finally
@@ -246,7 +269,7 @@
public void testCloseOneSessionOnGC() throws Exception
{
- ClientSessionFactoryImpl sf = createInVMFactory();
+ ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl)
locator.createSessionFactory();
ClientSession session = sf.createSession(false, true, true);
@@ -265,7 +288,7 @@
public void testCloseSeveralSessionOnGC() throws Exception
{
- ClientSessionFactoryImpl sf = createInVMFactory();
+ ClientSessionFactoryImpl sf = (ClientSessionFactoryImpl)
locator.createSessionFactory();
ClientSession session1 = sf.createSession(false, true, true);
ClientSession session2 = sf.createSession(false, true, true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateAndDeleteQueueTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateAndDeleteQueueTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateAndDeleteQueueTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,6 +17,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
@@ -35,9 +36,12 @@
private final SimpleString queueName = new SimpleString("queue");
+ private ServerLocator locator;
+
+
public void testDurableFalse() throws Exception
{
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
session.createQueue(address, queueName, false);
Binding binding = server.getPostOffice().getBinding(queueName);
Queue q = (Queue)binding.getBindable();
@@ -48,7 +52,7 @@
public void testDurableTrue() throws Exception
{
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
session.createQueue(address, queueName, true);
Binding binding = server.getPostOffice().getBinding(queueName);
Queue q = (Queue)binding.getBindable();
@@ -59,7 +63,7 @@
public void testTemporaryFalse() throws Exception
{
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
session.createQueue(address, queueName, false);
Binding binding = server.getPostOffice().getBinding(queueName);
Queue q = (Queue)binding.getBindable();
@@ -70,7 +74,7 @@
public void testTemporaryTrue() throws Exception
{
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
session.createTemporaryQueue(address, queueName);
Binding binding = server.getPostOffice().getBinding(queueName);
Queue q = (Queue)binding.getBindable();
@@ -81,7 +85,7 @@
public void testcreateWithFilter() throws Exception
{
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
SimpleString filterString = new SimpleString("x=y");
session.createQueue(address, queueName, filterString, false);
Binding binding = server.getPostOffice().getBinding(queueName);
@@ -96,7 +100,7 @@
AddressSettings addressSettings = new AddressSettings();
addressSettings.setLastValueQueue(true);
server.getAddressSettingsRepository().addMatch(address.toString(),
addressSettings);
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
SimpleString filterString = new SimpleString("x=y");
session.createQueue(address, queueName, filterString, false);
Binding binding = server.getPostOffice().getBinding(queueName);
@@ -107,7 +111,7 @@
public void testDeleteQueue() throws Exception
{
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
session.createQueue(address, queueName, false);
Binding binding = server.getPostOffice().getBinding(queueName);
Assert.assertNotNull(binding);
@@ -119,7 +123,7 @@
public void testDeleteQueueNotExist() throws Exception
{
- ClientSession session = createInVMFactory().createSession(false, true, true);
+ ClientSession session = locator.createSessionFactory().createSession(false, true,
true);
try
{
session.deleteQueue(queueName);
@@ -138,11 +142,14 @@
super.setUp();
server = createServer(false);
server.start();
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
if (server != null && server.isStarted())
{
server.stop();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateConsumerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateConsumerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateConsumerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,6 +17,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -28,16 +29,34 @@
{
private final String queueName = "ClientSessionCreateConsumerTestQ";
+ private ServerLocator locator;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ locator = createInVMNonHALocator();
+
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testCreateConsumer() throws Exception
{
HornetQServer service = createServer(false);
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName);
@@ -56,10 +75,10 @@
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
try
{
@@ -84,10 +103,10 @@
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName,
"foo=bar");
@@ -106,10 +125,10 @@
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
try
@@ -135,10 +154,10 @@
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName, null, true);
@@ -157,10 +176,10 @@
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientConsumer consumer = clientSession.createConsumer(queueName, null, 100,
100, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateProducerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateProducerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionCreateProducerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -17,6 +17,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -26,16 +27,34 @@
*/
public class SessionCreateProducerTest extends ServiceTestBase
{
+ private ServerLocator locator;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ locator = createInVMNonHALocator();
+
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testCreateAnonProducer() throws Exception
{
HornetQServer service = createServer(false);
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
ClientProducer producer = clientSession.createProducer();
Assert.assertNull(producer.getAddress());
@@ -57,10 +76,10 @@
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
ClientProducer producer =
clientSession.createProducer("testAddress");
Assert.assertNotNull(producer.getAddress());
@@ -82,10 +101,10 @@
try
{
service.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setProducerMaxRate(99);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnNonDurableSend(true);
+ locator.setProducerMaxRate(99);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
clientSession.close();
try
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionSendAcknowledgementHandlerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionSendAcknowledgementHandlerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionSendAcknowledgementHandlerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,11 +20,7 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
-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.SendAcknowledgementHandler;
+import org.hornetq.api.core.client.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -72,10 +68,12 @@
public void testSendAcknowledgements() throws Exception
{
- ClientSessionFactory csf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
- csf.getServerLocator().setConfirmationWindowSize(1024);
+ locator.setConfirmationWindowSize(1024);
+
+ ClientSessionFactory csf = locator.createSessionFactory();
ClientSession session = csf.createSession(null, null, false, true, true, false,
1);
session.createQueue(address, queueName, false);
@@ -103,6 +101,7 @@
session.close();
+ locator.close();
boolean ok = latch.await(5000, TimeUnit.MILLISECONDS);
Assert.assertTrue(ok);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionStopStartTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionStopStartTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionStopStartTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,12 +18,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -39,6 +34,8 @@
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -47,11 +44,15 @@
server = createServer(false);
server.start();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
server.stop();
server = null;
@@ -61,7 +62,7 @@
public void testStopStartConsumerSyncReceiveImmediate() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -105,7 +106,7 @@
public void testStopStartConsumerSyncReceive() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -152,7 +153,7 @@
public void testStopStartConsumerAsyncSyncStoppedByHandler() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -242,7 +243,7 @@
public void testStopStartConsumerAsyncSync() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -340,7 +341,7 @@
public void testStopStartConsumerAsyncASyncStoppeeByHandler() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -442,7 +443,7 @@
public void testStopStartConsumerAsyncASync() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -544,7 +545,8 @@
private int getMessageEncodeSize(final SimpleString address) throws Exception
{
- ClientSessionFactory cf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, true, true);
ClientMessage message = session.createMessage(false);
// we need to set the destination so we can calculate the encodesize correctly
@@ -557,8 +559,8 @@
public void testStopStartMultipleConsumers() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
- sf.getServerLocator().setConsumerWindowSize(getMessageEncodeSize(QUEUE) * 33);
+ locator.setConsumerWindowSize(getMessageEncodeSize(QUEUE) * 33);
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -611,7 +613,7 @@
public void testStopStartAlreadyStartedSession() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -652,7 +654,7 @@
public void testStopAlreadyStoppedSession() throws Exception
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,12 +20,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.SessionFailureListener;
+import org.hornetq.api.core.client.*;
import org.hornetq.api.core.client.ClientSession.BindingQuery;
import org.hornetq.api.core.client.ClientSession.QueueQuery;
import org.hornetq.core.client.impl.ClientSessionInternal;
@@ -43,13 +38,31 @@
{
private final String queueName = "ClientSessionTestQ";
+ private ServerLocator locator;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ locator = createInVMNonHALocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testFailureListener() throws Exception
{
HornetQServer server = createServer(false);
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
final CountDownLatch latch = new CountDownLatch(1);
clientSession.addFailureListener(new SessionFailureListener()
@@ -87,7 +100,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
class MyFailureListener implements SessionFailureListener
{
@@ -131,7 +144,7 @@
long ttl = 500;
server.getConfiguration().setConnectionTTLOverride(ttl);
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSessionInternal clientSession =
(ClientSessionInternal)cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientProducer producer = clientSession.createProducer();
@@ -181,7 +194,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
clientSession.createQueue("a1", "q1", false);
clientSession.createQueue("a1", "q2", false);
@@ -219,7 +232,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
clientSession.createQueue("a1", queueName, false);
clientSession.createConsumer(queueName);
@@ -249,7 +262,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
clientSession.createQueue("a1", queueName, "foo=bar",
false);
clientSession.createConsumer(queueName);
@@ -276,7 +289,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
QueueQuery resp = clientSession.queueQuery(new SimpleString(queueName));
Assert.assertFalse(resp.isExists());
@@ -298,7 +311,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
ClientProducer p = clientSession.createProducer();
@@ -327,7 +340,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
ClientMessage clientMessage = clientSession.createMessage(false);
Assert.assertFalse(clientMessage.isDurable());
@@ -348,7 +361,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
ClientMessage clientMessage = clientSession.createMessage(true);
Assert.assertTrue(clientMessage.isDurable());
@@ -369,7 +382,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
ClientMessage clientMessage = clientSession.createMessage((byte)99, false);
Assert.assertEquals((byte)99, clientMessage.getType());
@@ -390,7 +403,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
ClientMessage clientMessage = clientSession.createMessage((byte)88, false, 100l,
300l, (byte)33);
Assert.assertEquals((byte)88, clientMessage.getType());
@@ -414,7 +427,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
Assert.assertEquals(server.getVersion().getIncrementingVersion(),
clientSession.getVersion());
clientSession.close();
@@ -434,7 +447,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
clientSession.start();
@@ -455,7 +468,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, true, true);
clientSession.createQueue(queueName, queueName, false);
clientSession.start();
@@ -477,7 +490,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, false, true);
clientSession.createQueue(queueName, queueName, false);
ClientProducer cp = clientSession.createProducer(queueName);
@@ -512,7 +525,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession clientSession = cf.createSession(false, false, true);
clientSession.createQueue(queueName, queueName, false);
ClientProducer cp = clientSession.createProducer(queueName);
@@ -550,9 +563,9 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientProducer cp = sendSession.createProducer(queueName);
ClientSession clientSession = cf.createSession(false, true, false);
@@ -621,9 +634,9 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
- cf.getServerLocator().setBlockOnNonDurableSend(true);
- cf.getServerLocator().setBlockOnDurableSend(true);
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession sendSession = cf.createSession(false, true, true);
ClientProducer cp = sendSession.createProducer(queueName);
ClientSession clientSession = cf.createSession(false, true, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SimpleSendMultipleQueues.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SimpleSendMultipleQueues.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SimpleSendMultipleQueues.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -14,11 +14,7 @@
import junit.framework.Assert;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.RandomUtil;
@@ -52,6 +48,8 @@
private ClientConsumer consumer3;
+ private ServerLocator locator;
+
public void test() throws Exception
{
for (int i = 0; i < 1000; i++)
@@ -89,8 +87,10 @@
server.start();
- ClientSessionFactory cf = createFactory();
+ locator = createNettyNonHALocator();
+ ClientSessionFactory cf = locator.createSessionFactory();
+
session = cf.createSession();
session.createQueue(SimpleSendMultipleQueues.address, "queue1");
@@ -108,11 +108,6 @@
session.start();
}
- protected ClientSessionFactory createFactory() throws Exception
- {
- return createNettyFactory();
- }
-
@Override
protected void tearDown() throws Exception
{
@@ -129,6 +124,8 @@
session.deleteQueue("queue3");
session.close();
+
+ locator.close();
}
if (server.isStarted())
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -231,8 +231,8 @@
});
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator.setConnectionTTL(TemporaryQueueTest.CONNECTION_TTL);
sf = locator.createSessionFactory();
- sf.getServerLocator().setConnectionTTL(TemporaryQueueTest.CONNECTION_TTL);
session = sf.createSession(false, true, true);
session.createTemporaryQueue(address, queue);
@@ -297,8 +297,8 @@
server.start();
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator.setConnectionTTL(TemporaryQueueTest.CONNECTION_TTL);
sf = locator.createSessionFactory();
- sf.getServerLocator().setConnectionTTL(TemporaryQueueTest.CONNECTION_TTL);
session = sf.createSession(false, true, true);
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TransactionalSendTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TransactionalSendTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/TransactionalSendTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,6 +18,7 @@
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;
@@ -35,13 +36,31 @@
public final SimpleString queueC = new SimpleString("queueC");
+ private ServerLocator locator;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ locator = createInVMNonHALocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testSendWithCommit() throws Exception
{
HornetQServer server = createServer(false);
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, false, false);
session.createQueue(addressA, queueA, false);
ClientProducer cp = session.createProducer(addressA);
@@ -79,7 +98,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession(false, false, false);
session.createQueue(addressA, queueA, false);
ClientProducer cp = session.createProducer(addressA);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/ClientCrashTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -55,6 +55,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@@ -154,11 +156,11 @@
{
super.setUp();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(NettyConnectorFactory.class.getName()));
- ClientSessionFactory sf = locator.createSessionFactory();
+ locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(NettyConnectorFactory.class.getName()));
- sf.getServerLocator().setClientFailureCheckPeriod(ClientCrashTest.PING_PERIOD);
- sf.getServerLocator().setConnectionTTL(ClientCrashTest.CONNECTION_TTL);
+ locator.setClientFailureCheckPeriod(ClientCrashTest.PING_PERIOD);
+ locator.setConnectionTTL(ClientCrashTest.CONNECTION_TTL);
+ sf = locator.createSessionFactory();
}
@Override
@@ -167,7 +169,7 @@
// sf.close();
sf = null;
-
+ locator.close();
super.tearDown();
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/clientcrash/CrashClient.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -45,7 +45,7 @@
CrashClient.log.debug("args = " + Arrays.asList(args));
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(NettyConnectorFactory.class.getName()));
- ClientSessionFactory sf = locator.createSessionFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
sf.getServerLocator().setClientFailureCheckPeriod(ClientCrashTest.PING_PERIOD);
sf.getServerLocator().setConnectionTTL(ClientCrashTest.CONNECTION_TTL);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -107,9 +107,10 @@
TransportConfiguration server0tc = new TransportConfiguration(getConnector(),
server0Params);
TransportConfiguration server1tc = new TransportConfiguration(getConnector(),
server1Params);
- //connectors.put(server1tc.getName(), server1tc);
- // server0.getConfiguration().setConnectorConfigurations(connectors);
+ HashMap<String, TransportConfiguration> connectors = new
HashMap<String, TransportConfiguration>();
+ connectors.put(server1tc.getName(), server1tc);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
final int messageSize = 1024;
@@ -117,7 +118,7 @@
final int numMessages = 10;
ArrayList<String> connectorConfig = new ArrayList<String>();
- connectorConfig.add(getConnector());
+ connectorConfig.add(server1tc.getName());
BridgeConfiguration bridgeConfiguration = new
BridgeConfiguration("bridge1",
queueName0,
forwardAddress,
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -103,7 +103,7 @@
final String bridgeName = "bridge1";
ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add("dg1");
+ staticConnectors.add(server1tc.getName());
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
forwardAddress,
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -1103,12 +1103,12 @@
serverTotc = new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY,
params);
}
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(InVMConnectorFactory.class.getName()));
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(serverTotc);
+
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
ClientSessionFactory sf = locator.createSessionFactory();
- sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
-
sfs[node] = sf;
}
@@ -1467,13 +1467,15 @@
Map<String, TransportConfiguration> connectors =
serverFrom.getConfiguration().getConnectorConfigurations();
List<String> pairs = new ArrayList<String>();
+ TransportConfiguration configuration =
serverFrom.getConfiguration().getAcceptorConfigurations().iterator().next();
+ String connectorName = configuration.getName();
+ connectors.put(connectorName, configuration);
for (int element : nodesTo)
{
Map<String, Object> params = generateParams(element, netty);
TransportConfiguration serverTotc;
-
if (netty)
{
serverTotc = new
TransportConfiguration(ServiceTestBase.NETTY_CONNECTOR_FACTORY, params);
@@ -1482,7 +1484,7 @@
{
serverTotc = new
TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY, params);
}
-
+
connectors.put(serverTotc.getName(), serverTotc);
pairs.add(serverTotc.getName());
@@ -1490,7 +1492,7 @@
ClusterConnectionConfiguration clusterConf = new
ClusterConnectionConfiguration(name,
address,
-
name,
+
connectorName,
250,
true,
forwardWhenNoConsumers,
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/OrderReattachTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -23,12 +23,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.protocol.core.impl.RemotingConnectionImpl;
@@ -86,8 +81,8 @@
server = createServer(false, isNetty);
server.start();
-
- ClientSessionFactory sf = createFactory(isNetty);
+ ServerLocator locator = createFactory(isNetty);
+ ClientSessionFactory sf = locator.createSessionFactory();
sf.getServerLocator().setReconnectAttempts(-1);
sf.getServerLocator().setConfirmationWindowSize(100 * 1024 * 1024);
sf.getServerLocator().setBlockOnNonDurableSend(false);
@@ -167,6 +162,14 @@
try
{
+ locator.close();
+ }
+ catch (Exception e)
+ {
+ //
+ }
+ try
+ {
sf.close();
}
catch (Exception e)
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -21,11 +21,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.SessionFailureListener;
+import org.hornetq.api.core.client.*;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
@@ -58,6 +54,8 @@
private HornetQServer service;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -75,7 +73,7 @@
final int reconnectAttempts = 1;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -153,7 +151,7 @@
final int reconnectAttempts = -1;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -244,7 +242,7 @@
final long asyncFailDelay = 2000;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -359,7 +357,7 @@
final int reconnectAttempts = 3;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -450,7 +448,7 @@
final int reconnectAttempts = -1;
- final ClientSessionFactoryInternal sf = createFactory(false);
+ final ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -561,7 +559,7 @@
final int reconnectAttempts = -1;
- final ClientSessionFactoryInternal sf = createFactory(false);
+ final ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -660,7 +658,7 @@
final int reconnectAttempts = -1;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -733,7 +731,7 @@
final int reconnectAttempts = 10;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -801,7 +799,7 @@
final int reconnectAttempts = -1;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -894,7 +892,7 @@
final int reconnectAttempts = -1;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -972,7 +970,7 @@
final long maxRetryInterval = 1000;
- ClientSessionFactoryInternal sf = createFactory(false);
+ ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal)
locator.createSessionFactory();
sf.getServerLocator().setRetryInterval(retryInterval);
sf.getServerLocator().setRetryIntervalMultiplier(retryMultiplier);
@@ -1055,6 +1053,8 @@
service = createServer(false, false);
service.start();
+
+ locator = createFactory(false);
}
@Override
@@ -1062,6 +1062,8 @@
{
InVMConnector.resetFailures();
+ locator.close();
+
service.stop();
Assert.assertEquals(0, InVMRegistry.instance.size());
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -31,12 +31,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
@@ -147,22 +142,25 @@
server = createServer(realFiles);
server.start();
+ ServerLocator locator = createInVMNonHALocator();
try
{
- ClientSessionFactory sf = createInVMFactory();
if (sendingBlocking)
- { sf.getServerLocator().setBlockOnNonDurableSend(true);
- sf.getServerLocator().setBlockOnDurableSend(true);
- sf.getServerLocator().setBlockOnAcknowledge(true);
+ {
+ locator.setBlockOnNonDurableSend(true);
+ locator.setBlockOnDurableSend(true);
+ locator.setBlockOnAcknowledge(true);
}
if (producerWindow > 0)
{
- sf.getServerLocator().setConfirmationWindowSize(producerWindow);
+ locator.setConfirmationWindowSize(producerWindow);
}
- sf.getServerLocator().setMinLargeMessageSize(minSize);
+ locator.setMinLargeMessageSize(minSize);
+
+ ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session;
@@ -256,7 +254,7 @@
server = createServer(realFiles);
server.start();
- sf = createInVMFactory();
+ sf = locator.createSessionFactory();
}
session = sf.createSession(null, null, isXA, false, false, preAck, 0);
@@ -531,6 +529,7 @@
}
finally
{
+ locator.close();
try
{
server.stop();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -49,8 +49,10 @@
server.start();
- ClientSessionFactory sf = createFactory(false);
+ ServerLocator locator = createFactory(false);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(false, false);
try
@@ -99,6 +101,7 @@
finally
{
sf.close();
+ locator.close();
server.stop();
}
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -24,11 +24,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.paging.Page;
import org.hornetq.core.paging.PagedMessage;
@@ -109,8 +105,10 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
+
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
session.start();
@@ -119,7 +117,7 @@
Assert.assertNull(consumer.receiveImmediate());
- session.close();
+ locator.close();
}
finally
{
@@ -148,7 +146,8 @@
try
{
- ClientSessionFactory sf = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
// Making it synchronous, just because we want to stop sending messages as soon
as the page-store becomes in
// page mode
@@ -207,6 +206,8 @@
consumer.close();
session.close();
+
+ locator.close();
}
finally
{
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/paging/PagingSendTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -16,11 +16,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.ServiceTestBase;
@@ -83,24 +79,18 @@
try
{
+ ServerLocator locator = createFactory(isNetty());
ClientSessionFactory sf;
- if (isNetty())
- {
- sf = createNettyFactory();
- }
- else
- {
- sf = createInVMFactory();
- }
+
// Making it synchronous, just because we want to stop sending messages as soon
as the page-store becomes in
// page mode
// and we could only guarantee that by setting it to synchronous
- sf.getServerLocator().setBlockOnNonDurableSend(blocking);
- sf.getServerLocator().setBlockOnDurableSend(blocking);
- sf.getServerLocator().setBlockOnAcknowledge(blocking);
-
+ locator.setBlockOnNonDurableSend(blocking);
+ locator.setBlockOnDurableSend(blocking);
+ locator.setBlockOnAcknowledge(blocking);
+ sf = locator.createSessionFactory() ;
ClientSession session = sf.createSession(null, null, false, true, true, false,
0);
session.createQueue(PagingSendTest.ADDRESS, PagingSendTest.ADDRESS, null,
true);
@@ -142,6 +132,8 @@
consumer.close();
session.close();
+
+ locator.close();
}
finally
{
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/persistence/DeleteQueueRestartTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/persistence/DeleteQueueRestartTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/persistence/DeleteQueueRestartTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -19,10 +19,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.HornetQException;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -68,7 +65,8 @@
server.start();
- ClientSessionFactory factory = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory factory = locator.createSessionFactory();
factory.getServerLocator().setBlockOnDurableSend(true);
factory.getServerLocator().setBlockOnNonDurableSend(true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/ra/HornetQMessageHandlerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/ra/HornetQMessageHandlerTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/ra/HornetQMessageHandlerTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,6 +15,7 @@
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.core.config.Configuration;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.jms.client.HornetQMessage;
@@ -47,6 +48,8 @@
private HornetQServer server;
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -56,11 +59,14 @@
configuration.setSecurityEnabled(false);
server = createServer(true, configuration);
server.start();
+
+ locator = createFactory(false);
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
if (server != null)
{
try
@@ -95,7 +101,7 @@
DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new
DummyMessageEndpointFactory(endpoint);
qResourceAdapter.endpointActivation(endpointFactory, spec);
- ClientSession session = createFactory(false).createSession();
+ ClientSession session = locator.createSessionFactory().createSession();
ClientProducer clientProducer =
session.createProducer("jms.topic.mdbTopic");
ClientMessage message = session.createMessage(true);
message.getBodyBuffer().writeString("1");
@@ -150,7 +156,7 @@
DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new
DummyMessageEndpointFactory(endpoint);
qResourceAdapter.endpointActivation(endpointFactory, spec);
- ClientSession session = createFactory(false).createSession();
+ ClientSession session = locator.createSessionFactory().createSession();
ClientProducer clientProducer =
session.createProducer("jms.topic.mdbTopic");
ClientMessage message = session.createMessage(true);
message.getBodyBuffer().writeString("1");
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/remoting/ReconnectTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/remoting/ReconnectTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/remoting/ReconnectTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -21,6 +21,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.logging.Logger;
@@ -71,9 +72,9 @@
try
{
+ ServerLocator locator = createFactory(isNetty);
+ ClientSessionFactory factory = locator.createSessionFactory();
- ClientSessionFactory factory = createFactory(isNetty);
-
factory.getServerLocator().setClientFailureCheckPeriod(pingPeriod); // Using a
smaller timeout
factory.getServerLocator().setRetryInterval(500);
factory.getServerLocator().setRetryIntervalMultiplier(1d);
@@ -101,6 +102,7 @@
});
+ locator.close();
server.stop();
Thread.sleep((pingPeriod * 2));
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/DelayedMessageTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -14,11 +14,7 @@
import junit.framework.Assert;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -42,6 +38,8 @@
private final String qName = "DelayedMessageTestQueue";
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -58,7 +56,7 @@
newSets.setRedeliveryDelay(DelayedMessageTest.DELAY);
newSets.merge(qs);
server.getAddressSettingsRepository().addMatch(qName, newSets);
-
+ locator = createInVMNonHALocator();
}
@Override
@@ -83,7 +81,7 @@
public void testDelayedRedeliveryDefaultOnClose() throws Exception
{
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, false, false);
session.createQueue(qName, qName, null, true);
@@ -152,7 +150,7 @@
public void testDelayedRedeliveryDefaultOnRollback() throws Exception
{
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, false, false);
session.createQueue(qName, qName, null, true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/ScheduledMessageTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/ScheduledMessageTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/scheduling/ScheduledMessageTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -19,11 +19,7 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -49,6 +45,8 @@
private HornetQServer server;
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -59,11 +57,14 @@
configuration.setJournalMinFiles(2);
server = createServer(true, configuration);
server.start();
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
if (server != null)
{
try
@@ -132,7 +133,7 @@
public void testPagedMessageDeliveredCorrectly() throws Exception
{
// then we create a client as normal
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, true, false);
session.createQueue(atestq, atestq, null, true);
ClientProducer producer = session.createProducer(atestq);
@@ -168,7 +169,7 @@
qs.setRedeliveryDelay(5000l);
server.getAddressSettingsRepository().addMatch(atestq.toString(), qs);
// then we create a client as normal
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, true, false);
session.createQueue(atestq, atestq, null, true);
session.createQueue(atestq, atestq2, null, true);
@@ -217,7 +218,7 @@
qs.setRedeliveryDelay(5000l);
server.getAddressSettingsRepository().addMatch(atestq.toString(), qs);
// then we create a client as normal
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, true, false);
session.createQueue(atestq, atestq, null, true);
session.createQueue(atestq, atestq2, null, true);
@@ -247,7 +248,7 @@
server = null;
server = createServer(true, configuration);
server.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession(false, true, true);
consumer = session.createConsumer(atestq);
consumer2 = session.createConsumer(atestq2);
@@ -276,7 +277,7 @@
{
// then we create a client as normal
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, true, false);
session.createQueue(atestq, atestq, null, true);
ClientProducer producer = session.createProducer(atestq);
@@ -301,7 +302,7 @@
server = null;
server = createServer(true, configuration);
server.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession(false, true, true);
}
ClientConsumer consumer = session.createConsumer(atestq);
@@ -325,7 +326,7 @@
public void testScheduledMessagesDeliveredCorrectly(final boolean recover) throws
Exception
{
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, true, false);
session.createQueue(atestq, atestq, null, true);
ClientProducer producer = session.createProducer(atestq);
@@ -360,7 +361,7 @@
server = createServer(true, configuration);
server.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession(false, true, true);
}
@@ -405,7 +406,7 @@
public void testScheduledMessagesDeliveredCorrectlyDifferentOrder(final boolean
recover) throws Exception
{
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, true, false);
session.createQueue(atestq, atestq, null, true);
ClientProducer producer = session.createProducer(atestq);
@@ -441,7 +442,7 @@
server = createServer(true, configuration);
server.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession(false, true, true);
@@ -486,7 +487,7 @@
public void testScheduledAndNormalMessagesDeliveredCorrectly(final boolean recover)
throws Exception
{
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(false, true, false);
session.createQueue(atestq, atestq, null, true);
ClientProducer producer = session.createProducer(atestq);
@@ -518,7 +519,7 @@
server = createServer(true, configuration);
server.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession(false, true, true);
}
@@ -560,7 +561,7 @@
Xid xid = new XidImpl("xa1".getBytes(), 1,
UUIDGenerator.getInstance().generateStringUUID().getBytes());
Xid xid2 = new XidImpl("xa2".getBytes(), 1,
UUIDGenerator.getInstance().generateStringUUID().getBytes());
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(true, false, false);
session.createQueue(atestq, atestq, null, true);
session.start(xid, XAResource.TMNOFLAGS);
@@ -580,7 +581,7 @@
server = createServer(true, configuration);
server.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession(true, false, false);
}
@@ -625,7 +626,7 @@
Xid xid = new XidImpl("xa1".getBytes(), 1,
UUIDGenerator.getInstance().generateStringUUID().getBytes());
- ClientSessionFactory sessionFactory = createInVMFactory();
+ ClientSessionFactory sessionFactory = locator.createSessionFactory();
ClientSession session = sessionFactory.createSession(tx, false, false);
session.createQueue(atestq, atestq, null, true);
ClientProducer producer = session.createProducer(atestq);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/security/SecurityTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/security/SecurityTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/security/SecurityTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -33,11 +33,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.HornetQServer;
@@ -61,6 +57,25 @@
private static final String queueA = "queueA";
+ private ServerLocator locator;
+
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ locator = createInVMNonHALocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+
+ super.tearDown();
+ }
+
public void testCreateSessionWithNullUserPass() throws Exception
{
Configuration configuration = createDefaultConfig(false);
@@ -72,7 +87,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
try
{
@@ -102,7 +117,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
try
{
ClientSession session = cf.createSession(false, true, true);
@@ -132,7 +147,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
try
{
@@ -163,7 +178,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
try
{
@@ -202,7 +217,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
session.close();
@@ -233,7 +248,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
try
{
@@ -272,7 +287,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
session.deleteQueue(SecurityTest.queueA);
@@ -304,7 +319,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
try
@@ -344,7 +359,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false);
session.close();
@@ -375,7 +390,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
try
{
@@ -414,7 +429,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false);
session.deleteQueue(SecurityTest.queueA);
@@ -446,7 +461,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, false);
try
@@ -486,7 +501,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
cf.getServerLocator().setBlockOnNonDurableSend(true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
@@ -520,7 +535,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
cf.getServerLocator().setBlockOnNonDurableSend(true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
@@ -561,7 +576,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
ClientProducer cp = session.createProducer(SecurityTest.addressA);
@@ -602,7 +617,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession senSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
@@ -643,7 +658,7 @@
roles.add(role);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession senSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
@@ -694,7 +709,7 @@
roles.add(receiveRole);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession senSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
@@ -756,7 +771,7 @@
roles.add(receiveRole);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession senSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
senSession.createQueue(SecurityTest.addressA, SecurityTest.queueA, true);
@@ -829,7 +844,7 @@
roles.add(receiveRole);
securityRepository.addMatch(SecurityTest.addressA, roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession senSession = cf.createSession(false, true, true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
@@ -925,7 +940,7 @@
roles.add(role);
securityRepository.addMatch(configuration.getManagementAddress().toString(),
roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
cf.getServerLocator().setBlockOnNonDurableSend(true);
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
ClientProducer cp =
session.createProducer(configuration.getManagementAddress());
@@ -958,7 +973,7 @@
roles.add(role);
securityRepository.addMatch(configuration.getManagementAddress().toString(),
roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(configuration.getManagementAddress().toString(),
SecurityTest.queueA, true);
ClientProducer cp =
session.createProducer(configuration.getManagementAddress());
@@ -999,7 +1014,7 @@
roles.add(role);
securityRepository.addMatch(configuration.getManagementAddress().toString(),
roles);
securityManager.addRole("auser", "arole");
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
ClientSession session = cf.createSession("auser", "pass",
false, true, true, false, -1);
session.createQueue(configuration.getManagementAddress().toString(),
SecurityTest.queueA, true);
ClientProducer cp =
session.createProducer(configuration.getManagementAddress());
@@ -1044,7 +1059,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
try
{
@@ -1088,7 +1103,7 @@
try
{
server.start();
- ClientSessionFactory cf = createInVMFactory();
+ ClientSessionFactory cf = locator.createSessionFactory();
try
{
@@ -1154,7 +1169,7 @@
ClientSession andrewConnection = null;
ClientSession frankConnection = null;
ClientSession samConnection = null;
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
factory.getServerLocator().setBlockOnNonDurableSend(true);
factory.getServerLocator().setBlockOnDurableSend(true);
@@ -1292,7 +1307,7 @@
ClientSession andrewConnection = null;
ClientSession frankConnection = null;
ClientSession samConnection = null;
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
factory.getServerLocator().setBlockOnNonDurableSend(true);
factory.getServerLocator().setBlockOnDurableSend(true);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaRecoveryTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -23,11 +23,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -1265,8 +1261,8 @@
private void createClients(final boolean createQueue, final boolean commitACKs) throws
Exception
{
-
- sessionFactory = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory sf = locator.createSessionFactory();
clientSession = sessionFactory.createSession(true, false, commitACKs);
if (createQueue)
{
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -25,12 +25,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -59,6 +54,8 @@
private final SimpleString atestq = new SimpleString("BasicXaTestq");
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -76,7 +73,9 @@
// start the server
messagingService.start();
- sessionFactory = createInVMFactory();
+ locator = createInVMNonHALocator();
+ sessionFactory = locator.createSessionFactory();
+
clientSession = sessionFactory.createSession(true, false, false);
clientSession.createQueue(atestq, atestq, null, true);
@@ -118,8 +117,8 @@
{
// Since both resources have same RM, TM will probably use 1PC optimization
-
- ClientSessionFactory factory = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = null;
@@ -154,7 +153,7 @@
// Since both resources have same RM, TM will probably use 1PC optimization
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = null;
@@ -213,10 +212,12 @@
public void testIsSameRM() throws Exception
{
- ClientSessionFactory nettyFactory = createNettyFactory();
+ ServerLocator locator = createNettyNonHALocator();
+ ClientSessionFactory nettyFactory = locator.createSessionFactory();
validateRM(nettyFactory, nettyFactory);
validateRM(sessionFactory, sessionFactory);
validateRM(nettyFactory, sessionFactory);
+ locator.close();
}
private void validateRM(final ClientSessionFactory factory1, final
ClientSessionFactory factory2) throws Exception
@@ -503,7 +504,7 @@
messagingService.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
xid = newXID();
session = sessionFactory.createSession(true, false, false);
@@ -530,7 +531,7 @@
messagingService.start();
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
xid = newXID();
session = sessionFactory.createSession(true, false, false);
@@ -544,7 +545,7 @@
messagingService.start();
// This is not really necessary... But since the server has stopped, I would prefer
to keep recreating the factory
- sessionFactory = createInVMFactory();
+ sessionFactory = locator.createSessionFactory();
session = sessionFactory.createSession(true, false, false);
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/performance/paging/MeasurePagingMultiThreadTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/performance/paging/MeasurePagingMultiThreadTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/performance/paging/MeasurePagingMultiThreadTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -18,10 +18,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.settings.impl.AddressSettings;
@@ -69,10 +66,11 @@
HornetQServer messagingService = createServer(true, config, 10 * 1024, 20 * 1024,
settings);
messagingService.start();
+ ServerLocator locator = createInVMNonHALocator();
try
{
- final ClientSessionFactory factory = createInVMFactory();
+ final ClientSessionFactory factory = locator.createSessionFactory();
final SimpleString adr = new SimpleString("test-adr");
createDestination(factory, adr);
@@ -177,6 +175,7 @@
}
finally
{
+ locator.close();
messagingService.stop();
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/client/SendStressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/client/SendStressTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/client/SendStressTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -15,11 +15,7 @@
import junit.framework.Assert;
-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.*;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -57,9 +53,9 @@
public void doTestStressSend(final boolean netty) throws Exception
{
HornetQServer server = createServer(false, netty);
+ ServerLocator locator = createFactory(netty);
+ ClientSessionFactory sf = locator.createSessionFactory();
- ClientSessionFactory sf = createFactory(netty);
-
ClientSession session = null;
final int batchSize = 2000;
@@ -129,6 +125,7 @@
e.printStackTrace();
}
}
+ locator.close();
server.stop();
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/CompactingStressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/CompactingStressTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/CompactingStressTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,11 +20,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Message;
-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.*;
import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -433,10 +429,12 @@
server.start();
- sf = createInVMFactory();
- sf.getServerLocator().setBlockOnDurableSend(false);
- sf.getServerLocator().setBlockOnAcknowledge(false);
+ ServerLocator locator = createInVMNonHALocator();
+ locator.setBlockOnDurableSend(false);
+ locator.setBlockOnAcknowledge(false);
+
+ sf = locator.createSessionFactory();
ClientSession sess = sf.createSession();
try
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/LargeJournalStressTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -19,11 +19,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.HornetQException;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.server.HornetQServer;
@@ -56,6 +52,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -257,6 +255,8 @@
super.setUp();
clearData();
+
+ locator = createInVMNonHALocator();
}
/**
@@ -278,7 +278,7 @@
server.start();
- sf = createInVMFactory();
+ sf = locator.createSessionFactory();
sf.getServerLocator().setBlockOnAcknowledge(false);
sf.getServerLocator().setBlockOnNonDurableSend(false);
sf.getServerLocator().setBlockOnDurableSend(false);
@@ -303,12 +303,14 @@
sess.close();
- sf = createInVMFactory();
+ sf = locator.createSessionFactory();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
if (sf != null)
{
sf.close();
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/MultiThreadConsumerStressTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -20,11 +20,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.server.HornetQServer;
@@ -55,6 +51,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
@Override
protected void setUp() throws Exception
{
@@ -153,6 +151,8 @@
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
try
{
if (server != null && server.isStarted())
@@ -186,8 +186,10 @@
server.start();
- sf = createNettyFactory();
+ ServerLocator locator = createNettyNonHALocator();
+ sf = locator.createSessionFactory();
+
sf.getServerLocator().setBlockOnDurableSend(false);
sf.getServerLocator().setBlockOnNonDurableSend(false);
@@ -205,8 +207,9 @@
}
sess.close();
-
- sf = createInVMFactory();
+ locator.close();
+ locator = createInVMNonHALocator();
+ sf = locator.createSessionFactory();
}
// Static --------------------------------------------------------
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/journal/NIOMultiThreadCompactorStressTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -25,11 +25,7 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -63,6 +59,8 @@
private ClientSessionFactory sf;
+ private ServerLocator locator;
+
protected int getNumberOfIterations()
{
return 3;
@@ -72,11 +70,14 @@
protected void setUp() throws Exception
{
super.setUp();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
stopServer();
super.tearDown();
}
@@ -143,7 +144,7 @@
*/
private void addEmptyTransaction(final Xid xid) throws Exception, XAException
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
sf.getServerLocator().setBlockOnNonDurableSend(false);
sf.getServerLocator().setBlockOnAcknowledge(false);
ClientSession session = sf.createSession(true, false, false);
@@ -156,7 +157,7 @@
private void checkEmptyXID(final Xid xid) throws Exception, XAException
{
- ClientSessionFactory sf = createInVMFactory();
+ ClientSessionFactory sf = locator.createSessionFactory();
sf.getServerLocator().setBlockOnNonDurableSend(false);
sf.getServerLocator().setBlockOnAcknowledge(false);
ClientSession session = sf.createSession(true, false, false);
@@ -367,7 +368,9 @@
server.start();
- sf = createNettyFactory();
+ ServerLocator locator = createNettyNonHALocator();
+
+ sf = locator.createSessionFactory();
sf.getServerLocator().setBlockOnDurableSend(false);
sf.getServerLocator().setBlockOnAcknowledge(false);
@@ -383,7 +386,9 @@
sess.close();
- sf = createInVMFactory();
+ locator.close();
+
+ sf = locator.createSessionFactory();
}
// Static --------------------------------------------------------
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/stress/paging/PageStressTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -19,14 +19,9 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
-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.*;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.JournalType;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.ServiceTestBase;
@@ -44,6 +39,8 @@
private HornetQServer messagingService;
+ private ServerLocator locator;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -66,7 +63,7 @@
messagingService = createServer(true, config, 10 * 1024 * 1024, 20 * 1024 * 1024,
settings);
messagingService.start();
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
factory.getServerLocator().setBlockOnAcknowledge(true);
factory.getServerLocator().setBlockOnDurableSend(false);
factory.getServerLocator().setBlockOnNonDurableSend(false);
@@ -130,7 +127,7 @@
messagingService.start();
- factory = createInVMFactory();
+ factory = locator.createSessionFactory();
session = factory.createSession(false, false, false);
@@ -185,7 +182,7 @@
messagingService = createServer(true, config, 10 * 1024 * 1024, 20 * 1024 * 1024,
settings);
messagingService.start();
- ClientSessionFactory factory = createInVMFactory();
+ ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = null;
try
@@ -304,11 +301,15 @@
super.setUp();
clearData();
+
+ locator = createInVMNonHALocator();
}
@Override
protected void tearDown() throws Exception
{
+ locator.close();
+
super.tearDown();
}
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -34,6 +34,7 @@
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.jms.HornetQJMSClient;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
import org.hornetq.core.remoting.impl.netty.NettyConnector;
@@ -384,8 +385,8 @@
{
server.start();
-
- ClientSessionFactory factory = createInVMFactory();
+ ServerLocator locator = createInVMNonHALocator();
+ ClientSessionFactory factory = locator.createSessionFactory();
ClientSession session = factory.createSession(false, false, false);
HornetQDestination queue = (HornetQDestination)
HornetQJMSClient.createQueue("test");
session.createQueue(queue.getSimpleAddress(), queue.getSimpleAddress(), true);
@@ -422,6 +423,8 @@
activation.start();
activation.stop();
+ locator.close();
+
}
finally
{
Modified:
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-07-19
19:11:34 UTC (rev 9426)
+++
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-07-20
13:55:42 UTC (rev 9427)
@@ -327,26 +327,26 @@
return configuration;
}
- protected ClientSessionFactoryImpl createFactory(final boolean isNetty) throws
Exception
+ protected ServerLocator createFactory(final boolean isNetty) throws Exception
{
if (isNetty)
{
- return createNettyFactory();
+ return createNettyNonHALocator();
}
else
{
- return createInVMFactory();
+ return createInVMNonHALocator();
}
}
- protected ClientSessionFactoryImpl createInVMFactory() throws Exception
+ protected ServerLocator createInVMNonHALocator()
{
- return createFactory(INVM_CONNECTOR_FACTORY);
+ return HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
}
- protected ClientSessionFactoryImpl createNettyFactory() throws Exception
+ protected ServerLocator createNettyNonHALocator()
{
- return createFactory(NETTY_CONNECTOR_FACTORY);
+ return HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(NETTY_CONNECTOR_FACTORY));
}
protected ClientSessionFactoryImpl createFactory(final String connectorClass) throws
Exception