[hornetq-commits] JBoss hornetq SVN: r9579 - in branches/2_2_0_HA_Improvements: tests/src/org/hornetq/tests/integration/client and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Aug 23 08:47:19 EDT 2010
Author: jmesnil
Date: 2010-08-23 08:47:18 -0400 (Mon, 23 Aug 2010)
New Revision: 9579
Modified:
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java
branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/TopologyMember.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
uncommented and fixed SessionFactoryTest
* flag Topology and TopologyMember as serializable since they're members of ServerLocator
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java 2010-08-23 12:46:05 UTC (rev 9578)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/Topology.java 2010-08-23 12:47:18 UTC (rev 9579)
@@ -12,6 +12,7 @@
*/
package org.hornetq.core.client.impl;
+import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -23,8 +24,12 @@
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
* Created Aug 16, 2010
*/
-public class Topology
+public class Topology implements Serializable
{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -9037171688692471371L;
/*
* topology describes the other cluster nodes that this server knows about:
*
Modified: branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/TopologyMember.java
===================================================================
--- branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/TopologyMember.java 2010-08-23 12:46:05 UTC (rev 9578)
+++ branches/2_2_0_HA_Improvements/src/main/org/hornetq/core/client/impl/TopologyMember.java 2010-08-23 12:47:18 UTC (rev 9579)
@@ -12,6 +12,8 @@
*/
package org.hornetq.core.client.impl;
+import java.io.Serializable;
+
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
@@ -19,8 +21,10 @@
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
* Created Aug 16, 2010
*/
-public class TopologyMember
+public class TopologyMember implements Serializable
{
+ private static final long serialVersionUID = 1123652191795626133L;
+
private final Pair<TransportConfiguration, TransportConfiguration> connector;
private final int distance;
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2010-08-23 12:46:05 UTC (rev 9578)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2010-08-23 12:47:18 UTC (rev 9579)
@@ -17,27 +17,23 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Arrays;
import java.util.List;
-import java.util.Map;
import junit.framework.Assert;
-import org.hornetq.api.core.HornetQException;
-import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
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.core.client.impl.ClientSessionFactoryImpl;
import org.hornetq.core.config.BroadcastGroupConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.impl.invm.TransportConstants;
+import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
-import org.hornetq.core.server.HornetQServers;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.ServiceTestBase;
@@ -60,42 +56,39 @@
private HornetQServer liveService;
- private HornetQServer backupService;
-
private TransportConfiguration liveTC;
- private TransportConfiguration backupTC;
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ startServer();
+ }
+
@Override
protected void tearDown() throws Exception
{
- if (liveService != null && liveService.isStarted())
+ if (liveService != null)
{
liveService.stop();
}
- if (backupService != null && backupService.isStarted())
- {
- backupService.stop();
- }
+
liveService = null;
- backupService = null;
liveTC = null;
- backupTC = null;
super.tearDown();
}
- /* public void testSerializable() throws Exception
+ public void testSerializable() throws Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(InVMConnectorFactory.class.getName()));
- ClientSessionFactory cf = locator.createSessionFactory();
-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(cf);
+ oos.writeObject(locator);
oos.close();
@@ -105,289 +98,110 @@
ObjectInputStream ois = new ObjectInputStream(bais);
- ClientSessionFactoryImpl csi = (ClientSessionFactoryImpl)ois.readObject();
+ ServerLocator csi = (ServerLocator)ois.readObject();
Assert.assertNotNull(csi);
}
public void testCloseUnusedClientSessionFactoryWithoutGlobalPools() throws Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(liveTC);
ClientSessionFactory csf = locator.createSessionFactory();
- csf.getServerLocator().setUseGlobalPools(false);
csf.close();
}
- public void testDefaultConstructor() throws Exception
+ public void testDiscoveryConstructor() throws Exception
{
- try
- {
- startLiveAndBackup();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(groupAddress, groupPort);
- ClientSessionFactory cf = locator.createSessionFactory();
-
- assertFactoryParams(cf,
- null,
- null,
- 0,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- HornetQClient.DEFAULT_CONNECTION_TTL,
- HornetQClient.DEFAULT_CALL_TIMEOUT,
- HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
- HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
- HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
- HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
- HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
- HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
- HornetQClient.DEFAULT_AUTO_GROUP,
- HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
- HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- HornetQClient.DEFAULT_ACK_BATCH_SIZE,
- HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
- HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
- HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_RETRY_INTERVAL,
- HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
- HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
- HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
- try
- {
- ClientSession session = cf.createSession(false, true, true);
- Assert.fail("Should throw exception");
- }
- catch (HornetQException e)
- {
- e.printStackTrace();
- // Ok
- }
- final List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(liveTC,
- backupTC);
- staticConnectors.add(pair0);
- cf.getServerLocator().setStaticConnectors(staticConnectors);
- ClientSession session = cf.createSession(false, true, true);
- Assert.assertNotNull(session);
- session.close();
- testSettersThrowException(cf);
- }
- finally
- {
- stopLiveAndBackup();
- }
+ assertFactoryParams(locator,
+ null,
+ groupAddress,
+ groupPort,
+ HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ HornetQClient.DEFAULT_CONNECTION_TTL,
+ HornetQClient.DEFAULT_CALL_TIMEOUT,
+ HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
+ HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
+ HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
+ HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
+ HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
+ HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
+ HornetQClient.DEFAULT_AUTO_GROUP,
+ HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
+ HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ HornetQClient.DEFAULT_ACK_BATCH_SIZE,
+ HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
+ HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
+ HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
+ HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
+ HornetQClient.DEFAULT_RETRY_INTERVAL,
+ HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
+ HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
+
+ ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSession session = cf.createSession(false, true, true);
+ Assert.assertNotNull(session);
+ session.close();
+ testSettersThrowException(cf);
+
+ cf.close();
}
- public void testDiscoveryConstructor() throws Exception
- {
- try
- {
- startLiveAndBackup();
- ClientSessionFactory cf = HornetQClient.createClientSessionFactory(groupAddress, groupPort);
- assertFactoryParams(cf,
- null,
- groupAddress,
- groupPort,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- HornetQClient.DEFAULT_CONNECTION_TTL,
- HornetQClient.DEFAULT_CALL_TIMEOUT,
- HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
- HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
- HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
- HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
- HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
- HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
- HornetQClient.DEFAULT_AUTO_GROUP,
- HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
- HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- HornetQClient.DEFAULT_ACK_BATCH_SIZE,
- HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
- HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
- HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_RETRY_INTERVAL,
- HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
- HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
- HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
- ClientSession session = cf.createSession(false, true, true);
- Assert.assertNotNull(session);
- session.close();
- testSettersThrowException(cf);
- }
- finally
- {
- stopLiveAndBackup();
- }
- }
-
public void testStaticConnectorListConstructor() throws Exception
{
- try
- {
- startLiveAndBackup();
- final List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(liveTC,
- backupTC);
- staticConnectors.add(pair0);
+ TransportConfiguration[] tc = new TransportConfiguration[] { liveTC };
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(tc);
- ClientSessionFactory cf = HornetQClient.createClientSessionFactory(staticConnectors);
- assertFactoryParams(cf,
- staticConnectors,
- null,
- 0,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- HornetQClient.DEFAULT_CONNECTION_TTL,
- HornetQClient.DEFAULT_CALL_TIMEOUT,
- HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
- HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
- HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
- HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
- HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
- HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
- HornetQClient.DEFAULT_AUTO_GROUP,
- HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
- HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- HornetQClient.DEFAULT_ACK_BATCH_SIZE,
- HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
- HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
- HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_RETRY_INTERVAL,
- HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
- HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
- HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
- ClientSession session = cf.createSession(false, true, true);
- Assert.assertNotNull(session);
- session.close();
- testSettersThrowException(cf);
- }
- finally
- {
- stopLiveAndBackup();
- }
+ assertFactoryParams(locator,
+ tc,
+ null,
+ -1,
+ HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ HornetQClient.DEFAULT_CONNECTION_TTL,
+ HornetQClient.DEFAULT_CALL_TIMEOUT,
+ HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
+ HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
+ HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
+ HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
+ HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
+ HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
+ HornetQClient.DEFAULT_AUTO_GROUP,
+ HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
+ HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ HornetQClient.DEFAULT_ACK_BATCH_SIZE,
+ HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
+ HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
+ HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
+ HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
+ HornetQClient.DEFAULT_RETRY_INTERVAL,
+ HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
+ HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
+
+ ClientSessionFactory cf = locator.createSessionFactory();
+ ClientSession session = cf.createSession(false, true, true);
+ Assert.assertNotNull(session);
+ session.close();
+ testSettersThrowException(cf);
+
+ cf.close();
}
- public void testStaticConnectorLiveAndBackupConstructor() throws Exception
+ public void testGettersAndSetters() throws Exception
{
- try
- {
- startLiveAndBackup();
- final List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(liveTC,
- backupTC);
- staticConnectors.add(pair0);
- ClientSessionFactory cf = HornetQClient.createClientSessionFactory(liveTC, backupTC);
- assertFactoryParams(cf,
- staticConnectors,
- null,
- 0,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- HornetQClient.DEFAULT_CONNECTION_TTL,
- HornetQClient.DEFAULT_CALL_TIMEOUT,
- HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
- HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
- HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
- HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
- HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
- HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
- HornetQClient.DEFAULT_AUTO_GROUP,
- HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
- HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- HornetQClient.DEFAULT_ACK_BATCH_SIZE,
- HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
- HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
- HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_RETRY_INTERVAL,
- HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
- HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
- HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
- ClientSession session = cf.createSession(false, true, true);
- Assert.assertNotNull(session);
- session.close();
- testSettersThrowException(cf);
- }
- finally
- {
- stopLiveAndBackup();
- }
- }
+ TransportConfiguration[] tc = new TransportConfiguration[] { liveTC };
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(tc);
- public void testStaticConnectorLiveConstructor() throws Exception
- {
- try
- {
- startLiveAndBackup();
- final List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(liveTC,
- null);
- staticConnectors.add(pair0);
-
- ClientSessionFactory cf = HornetQClient.createClientSessionFactory(liveTC);
- assertFactoryParams(cf,
- staticConnectors,
- null,
- 0,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- HornetQClient.DEFAULT_CONNECTION_TTL,
- HornetQClient.DEFAULT_CALL_TIMEOUT,
- HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
- HornetQClient.DEFAULT_CONSUMER_WINDOW_SIZE,
- HornetQClient.DEFAULT_CONSUMER_MAX_RATE,
- HornetQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE,
- HornetQClient.DEFAULT_PRODUCER_MAX_RATE,
- HornetQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
- HornetQClient.DEFAULT_BLOCK_ON_DURABLE_SEND,
- HornetQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND,
- HornetQClient.DEFAULT_AUTO_GROUP,
- HornetQClient.DEFAULT_PRE_ACKNOWLEDGE,
- HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
- HornetQClient.DEFAULT_ACK_BATCH_SIZE,
- HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
- HornetQClient.DEFAULT_USE_GLOBAL_POOLS,
- HornetQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_THREAD_POOL_MAX_SIZE,
- HornetQClient.DEFAULT_RETRY_INTERVAL,
- HornetQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
- HornetQClient.DEFAULT_RECONNECT_ATTEMPTS,
- HornetQClient.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
- ClientSession session = cf.createSession(false, true, true);
- Assert.assertNotNull(session);
- session.close();
- testSettersThrowException(cf);
- }
- finally
- {
- stopLiveAndBackup();
- }
- }
-
- public void testGettersAndSetters()
- {
- ClientSessionFactory cf = HornetQClient.createClientSessionFactory();
-
- List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(liveTC,
- backupTC);
- staticConnectors.add(pair0);
-
- String discoveryAddress = RandomUtil.randomString();
- int discoveryPort = RandomUtil.randomPositiveInt();
long discoveryRefreshTimeout = RandomUtil.randomPositiveLong();
long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
long connectionTTL = RandomUtil.randomPositiveLong();
@@ -413,73 +227,64 @@
int reconnectAttempts = RandomUtil.randomPositiveInt();
boolean failoverOnServerShutdown = RandomUtil.randomBoolean();
- cf.setStaticConnectors(staticConnectors);
- cf.setDiscoveryAddress(discoveryAddress);
- cf.setDiscoveryPort(discoveryPort);
- cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
- cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
- cf.setConnectionTTL(connectionTTL);
- cf.setCallTimeout(callTimeout);
- cf.setMinLargeMessageSize(minLargeMessageSize);
- cf.setConsumerWindowSize(consumerWindowSize);
- cf.setConsumerMaxRate(consumerMaxRate);
- cf.setConfirmationWindowSize(confirmationWindowSize);
- cf.setProducerMaxRate(producerMaxRate);
- cf.setBlockOnAcknowledge(blockOnAcknowledge);
- cf.setBlockOnDurableSend(blockOnDurableSend);
- cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
- cf.setAutoGroup(autoGroup);
- cf.setPreAcknowledge(preAcknowledge);
- cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
- cf.setAckBatchSize(ackBatchSize);
- cf.setDiscoveryInitialWaitTimeout(initialWaitTimeout);
- cf.setUseGlobalPools(useGlobalPools);
- cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
- cf.setThreadPoolMaxSize(threadPoolMaxSize);
- cf.setRetryInterval(retryInterval);
- cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
- cf.setReconnectAttempts(reconnectAttempts);
- cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
+ locator.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
+ locator.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ locator.setConnectionTTL(connectionTTL);
+ locator.setCallTimeout(callTimeout);
+ locator.setMinLargeMessageSize(minLargeMessageSize);
+ locator.setConsumerWindowSize(consumerWindowSize);
+ locator.setConsumerMaxRate(consumerMaxRate);
+ locator.setConfirmationWindowSize(confirmationWindowSize);
+ locator.setProducerMaxRate(producerMaxRate);
+ locator.setBlockOnAcknowledge(blockOnAcknowledge);
+ locator.setBlockOnDurableSend(blockOnDurableSend);
+ locator.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ locator.setAutoGroup(autoGroup);
+ locator.setPreAcknowledge(preAcknowledge);
+ locator.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
+ locator.setAckBatchSize(ackBatchSize);
+ locator.setDiscoveryInitialWaitTimeout(initialWaitTimeout);
+ locator.setUseGlobalPools(useGlobalPools);
+ locator.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ locator.setThreadPoolMaxSize(threadPoolMaxSize);
+ locator.setRetryInterval(retryInterval);
+ locator.setRetryIntervalMultiplier(retryIntervalMultiplier);
+ locator.setReconnectAttempts(reconnectAttempts);
+ locator.setFailoverOnServerShutdown(failoverOnServerShutdown);
- Assert.assertEquals(staticConnectors, cf.getStaticConnectors());
- Assert.assertEquals(discoveryAddress, cf.getDiscoveryAddress());
- Assert.assertEquals(discoveryPort, cf.getDiscoveryPort());
- Assert.assertEquals(discoveryRefreshTimeout, cf.getDiscoveryRefreshTimeout());
- Assert.assertEquals(clientFailureCheckPeriod, cf.getClientFailureCheckPeriod());
- Assert.assertEquals(connectionTTL, cf.getConnectionTTL());
- Assert.assertEquals(callTimeout, cf.getCallTimeout());
- Assert.assertEquals(minLargeMessageSize, cf.getMinLargeMessageSize());
- Assert.assertEquals(consumerWindowSize, cf.getConsumerWindowSize());
- Assert.assertEquals(consumerMaxRate, cf.getConsumerMaxRate());
- Assert.assertEquals(confirmationWindowSize, cf.getConfirmationWindowSize());
- Assert.assertEquals(producerMaxRate, cf.getProducerMaxRate());
- Assert.assertEquals(blockOnAcknowledge, cf.isBlockOnAcknowledge());
- Assert.assertEquals(blockOnDurableSend, cf.isBlockOnDurableSend());
- Assert.assertEquals(blockOnNonDurableSend, cf.isBlockOnNonDurableSend());
- Assert.assertEquals(autoGroup, cf.isAutoGroup());
- Assert.assertEquals(preAcknowledge, cf.isPreAcknowledge());
- Assert.assertEquals(loadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName());
- Assert.assertEquals(ackBatchSize, cf.getAckBatchSize());
- Assert.assertEquals(initialWaitTimeout, cf.getDiscoveryInitialWaitTimeout());
- Assert.assertEquals(useGlobalPools, cf.isUseGlobalPools());
- Assert.assertEquals(scheduledThreadPoolMaxSize, cf.getScheduledThreadPoolMaxSize());
- Assert.assertEquals(threadPoolMaxSize, cf.getThreadPoolMaxSize());
- Assert.assertEquals(retryInterval, cf.getRetryInterval());
- Assert.assertEquals(retryIntervalMultiplier, cf.getRetryIntervalMultiplier());
- Assert.assertEquals(reconnectAttempts, cf.getReconnectAttempts());
- Assert.assertEquals(failoverOnServerShutdown, cf.isFailoverOnServerShutdown());
+ assertEqualsTransportConfigurations(tc, locator.getStaticTransportConfigurations());
+ Assert.assertEquals(null, locator.getDiscoveryAddress());
+ Assert.assertEquals(-1, locator.getDiscoveryPort());
+ Assert.assertEquals(discoveryRefreshTimeout, locator.getDiscoveryRefreshTimeout());
+ Assert.assertEquals(clientFailureCheckPeriod, locator.getClientFailureCheckPeriod());
+ Assert.assertEquals(connectionTTL, locator.getConnectionTTL());
+ Assert.assertEquals(callTimeout, locator.getCallTimeout());
+ Assert.assertEquals(minLargeMessageSize, locator.getMinLargeMessageSize());
+ Assert.assertEquals(consumerWindowSize, locator.getConsumerWindowSize());
+ Assert.assertEquals(consumerMaxRate, locator.getConsumerMaxRate());
+ Assert.assertEquals(confirmationWindowSize, locator.getConfirmationWindowSize());
+ Assert.assertEquals(producerMaxRate, locator.getProducerMaxRate());
+ Assert.assertEquals(blockOnAcknowledge, locator.isBlockOnAcknowledge());
+ Assert.assertEquals(blockOnDurableSend, locator.isBlockOnDurableSend());
+ Assert.assertEquals(blockOnNonDurableSend, locator.isBlockOnNonDurableSend());
+ Assert.assertEquals(autoGroup, locator.isAutoGroup());
+ Assert.assertEquals(preAcknowledge, locator.isPreAcknowledge());
+ Assert.assertEquals(loadBalancingPolicyClassName, locator
+ .getConnectionLoadBalancingPolicyClassName());
+ Assert.assertEquals(ackBatchSize, locator.getAckBatchSize());
+ Assert.assertEquals(initialWaitTimeout, locator.getDiscoveryInitialWaitTimeout());
+ Assert.assertEquals(useGlobalPools, locator.isUseGlobalPools());
+ Assert.assertEquals(scheduledThreadPoolMaxSize, locator.getScheduledThreadPoolMaxSize());
+ Assert.assertEquals(threadPoolMaxSize, locator.getThreadPoolMaxSize());
+ Assert.assertEquals(retryInterval, locator.getRetryInterval());
+ Assert.assertEquals(retryIntervalMultiplier, locator.getRetryIntervalMultiplier());
+ Assert.assertEquals(reconnectAttempts, locator.getReconnectAttempts());
+ Assert.assertEquals(failoverOnServerShutdown, locator.isFailoverOnServerShutdown());
}
private void testSettersThrowException(final ClientSessionFactory cf)
{
- List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
- Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(liveTC,
- backupTC);
- staticConnectors.add(pair0);
-
- String discoveryAddress = RandomUtil.randomString();
- int discoveryPort = RandomUtil.randomPositiveInt();
long discoveryRefreshTimeout = RandomUtil.randomPositiveLong();
long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
long connectionTTL = RandomUtil.randomPositiveLong();
@@ -507,7 +312,7 @@
try
{
- cf.setStaticConnectors(staticConnectors);
+ cf.getServerLocator().setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -516,7 +321,7 @@
}
try
{
- cf.setDiscoveryAddress(discoveryAddress);
+ cf.getServerLocator().setClientFailureCheckPeriod(clientFailureCheckPeriod);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -525,7 +330,7 @@
}
try
{
- cf.setDiscoveryPort(discoveryPort);
+ cf.getServerLocator().setConnectionTTL(connectionTTL);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -534,7 +339,7 @@
}
try
{
- cf.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
+ cf.getServerLocator().setCallTimeout(callTimeout);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -543,7 +348,7 @@
}
try
{
- cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
+ cf.getServerLocator().setMinLargeMessageSize(minLargeMessageSize);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -552,7 +357,7 @@
}
try
{
- cf.setConnectionTTL(connectionTTL);
+ cf.getServerLocator().setConsumerWindowSize(consumerWindowSize);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -561,7 +366,7 @@
}
try
{
- cf.setCallTimeout(callTimeout);
+ cf.getServerLocator().setConsumerMaxRate(consumerMaxRate);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -570,7 +375,7 @@
}
try
{
- cf.setMinLargeMessageSize(minLargeMessageSize);
+ cf.getServerLocator().setConfirmationWindowSize(confirmationWindowSize);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -579,7 +384,7 @@
}
try
{
- cf.setConsumerWindowSize(consumerWindowSize);
+ cf.getServerLocator().setProducerMaxRate(producerMaxRate);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -588,7 +393,7 @@
}
try
{
- cf.setConsumerMaxRate(consumerMaxRate);
+ cf.getServerLocator().setBlockOnAcknowledge(blockOnAcknowledge);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -597,7 +402,7 @@
}
try
{
- cf.setConfirmationWindowSize(confirmationWindowSize);
+ cf.getServerLocator().setBlockOnDurableSend(blockOnDurableSend);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -606,7 +411,7 @@
}
try
{
- cf.setProducerMaxRate(producerMaxRate);
+ cf.getServerLocator().setBlockOnNonDurableSend(blockOnNonDurableSend);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -615,7 +420,7 @@
}
try
{
- cf.setBlockOnAcknowledge(blockOnAcknowledge);
+ cf.getServerLocator().setAutoGroup(autoGroup);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -624,7 +429,7 @@
}
try
{
- cf.setBlockOnDurableSend(blockOnDurableSend);
+ cf.getServerLocator().setPreAcknowledge(preAcknowledge);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -633,7 +438,7 @@
}
try
{
- cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
+ cf.getServerLocator().setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -642,7 +447,7 @@
}
try
{
- cf.setAutoGroup(autoGroup);
+ cf.getServerLocator().setAckBatchSize(ackBatchSize);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -651,7 +456,7 @@
}
try
{
- cf.setPreAcknowledge(preAcknowledge);
+ cf.getServerLocator().setDiscoveryInitialWaitTimeout(initialWaitTimeout);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -660,7 +465,7 @@
}
try
{
- cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
+ cf.getServerLocator().setUseGlobalPools(useGlobalPools);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -669,7 +474,7 @@
}
try
{
- cf.setAckBatchSize(ackBatchSize);
+ cf.getServerLocator().setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -678,7 +483,7 @@
}
try
{
- cf.setDiscoveryInitialWaitTimeout(initialWaitTimeout);
+ cf.getServerLocator().setThreadPoolMaxSize(threadPoolMaxSize);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -687,7 +492,7 @@
}
try
{
- cf.setUseGlobalPools(useGlobalPools);
+ cf.getServerLocator().setRetryInterval(retryInterval);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -696,7 +501,7 @@
}
try
{
- cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
+ cf.getServerLocator().setRetryIntervalMultiplier(retryIntervalMultiplier);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -705,7 +510,7 @@
}
try
{
- cf.setThreadPoolMaxSize(threadPoolMaxSize);
+ cf.getServerLocator().setReconnectAttempts(reconnectAttempts);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
@@ -714,73 +519,46 @@
}
try
{
- cf.setRetryInterval(retryInterval);
+ cf.getServerLocator().setFailoverOnServerShutdown(failoverOnServerShutdown);
Assert.fail("Should throw exception");
}
catch (IllegalStateException e)
{
// OK
}
- try
- {
- cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
- Assert.fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- // OK
- }
- try
- {
- cf.setReconnectAttempts(reconnectAttempts);
- Assert.fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- // OK
- }
- try
- {
- cf.setFailoverOnServerShutdown(failoverOnServerShutdown);
- Assert.fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- // OK
- }
- cf.getStaticConnectors();
- cf.getDiscoveryAddress();
- cf.getDiscoveryPort();
- cf.getDiscoveryRefreshTimeout();
- cf.getClientFailureCheckPeriod();
- cf.getConnectionTTL();
- cf.getCallTimeout();
- cf.getMinLargeMessageSize();
- cf.getConsumerWindowSize();
- cf.getConsumerMaxRate();
- cf.getConfirmationWindowSize();
- cf.getProducerMaxRate();
- cf.isBlockOnAcknowledge();
- cf.isBlockOnDurableSend();
- cf.isBlockOnNonDurableSend();
- cf.isAutoGroup();
- cf.isPreAcknowledge();
- cf.getConnectionLoadBalancingPolicyClassName();
- cf.getAckBatchSize();
- cf.getDiscoveryInitialWaitTimeout();
- cf.isUseGlobalPools();
- cf.getScheduledThreadPoolMaxSize();
- cf.getThreadPoolMaxSize();
- cf.getRetryInterval();
- cf.getRetryIntervalMultiplier();
- cf.getReconnectAttempts();
- cf.isFailoverOnServerShutdown();
+ cf.getServerLocator().getStaticTransportConfigurations();
+ cf.getServerLocator().getDiscoveryAddress();
+ cf.getServerLocator().getDiscoveryPort();
+ cf.getServerLocator().getDiscoveryRefreshTimeout();
+ cf.getServerLocator().getClientFailureCheckPeriod();
+ cf.getServerLocator().getConnectionTTL();
+ cf.getServerLocator().getCallTimeout();
+ cf.getServerLocator().getMinLargeMessageSize();
+ cf.getServerLocator().getConsumerWindowSize();
+ cf.getServerLocator().getConsumerMaxRate();
+ cf.getServerLocator().getConfirmationWindowSize();
+ cf.getServerLocator().getProducerMaxRate();
+ cf.getServerLocator().isBlockOnAcknowledge();
+ cf.getServerLocator().isBlockOnDurableSend();
+ cf.getServerLocator().isBlockOnNonDurableSend();
+ cf.getServerLocator().isAutoGroup();
+ cf.getServerLocator().isPreAcknowledge();
+ cf.getServerLocator().getConnectionLoadBalancingPolicyClassName();
+ cf.getServerLocator().getAckBatchSize();
+ cf.getServerLocator().getDiscoveryInitialWaitTimeout();
+ cf.getServerLocator().isUseGlobalPools();
+ cf.getServerLocator().getScheduledThreadPoolMaxSize();
+ cf.getServerLocator().getThreadPoolMaxSize();
+ cf.getServerLocator().getRetryInterval();
+ cf.getServerLocator().getRetryIntervalMultiplier();
+ cf.getServerLocator().getReconnectAttempts();
+ cf.getServerLocator().isFailoverOnServerShutdown();
}
- private void assertFactoryParams(final ClientSessionFactory cf,
- final List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors,
+ private void assertFactoryParams(final ServerLocator locator,
+ final TransportConfiguration[] staticConnectors,
final String discoveryAddress,
final int discoveryPort,
final long discoveryRefreshTimeout,
@@ -808,93 +586,53 @@
final int reconnectAttempts,
final boolean failoverOnServerShutdown)
{
- List<Pair<TransportConfiguration, TransportConfiguration>> cfStaticConnectors = cf.getStaticConnectors();
if (staticConnectors == null)
{
- Assert.assertNull(cfStaticConnectors);
+ Assert.assertNull(locator.getStaticTransportConfigurations());
}
else
{
- Assert.assertEquals(staticConnectors.size(), cfStaticConnectors.size());
-
- for (int i = 0; i < staticConnectors.size(); i++)
- {
- Assert.assertEquals(staticConnectors.get(i), cfStaticConnectors.get(i));
- }
+ assertEqualsTransportConfigurations(staticConnectors, locator.getStaticTransportConfigurations());
}
- Assert.assertEquals(cf.getDiscoveryAddress(), discoveryAddress);
- Assert.assertEquals(cf.getDiscoveryPort(), discoveryPort);
- Assert.assertEquals(cf.getDiscoveryRefreshTimeout(), discoveryRefreshTimeout);
- Assert.assertEquals(cf.getClientFailureCheckPeriod(), clientFailureCheckPeriod);
- Assert.assertEquals(cf.getConnectionTTL(), connectionTTL);
- Assert.assertEquals(cf.getCallTimeout(), callTimeout);
- Assert.assertEquals(cf.getMinLargeMessageSize(), minLargeMessageSize);
- Assert.assertEquals(cf.getConsumerWindowSize(), consumerWindowSize);
- Assert.assertEquals(cf.getConsumerMaxRate(), consumerMaxRate);
- Assert.assertEquals(cf.getConfirmationWindowSize(), confirmationWindowSize);
- Assert.assertEquals(cf.getProducerMaxRate(), producerMaxRate);
- Assert.assertEquals(cf.isBlockOnAcknowledge(), blockOnAcknowledge);
- Assert.assertEquals(cf.isBlockOnDurableSend(), blockOnDurableSend);
- Assert.assertEquals(cf.isBlockOnNonDurableSend(), blockOnNonDurableSend);
- Assert.assertEquals(cf.isAutoGroup(), autoGroup);
- Assert.assertEquals(cf.isPreAcknowledge(), preAcknowledge);
- Assert.assertEquals(cf.getConnectionLoadBalancingPolicyClassName(), loadBalancingPolicyClassName);
- Assert.assertEquals(cf.getAckBatchSize(), ackBatchSize);
- Assert.assertEquals(cf.getDiscoveryInitialWaitTimeout(), initialWaitTimeout);
- Assert.assertEquals(cf.isUseGlobalPools(), useGlobalPools);
- Assert.assertEquals(cf.getScheduledThreadPoolMaxSize(), scheduledThreadPoolMaxSize);
- Assert.assertEquals(cf.getThreadPoolMaxSize(), threadPoolMaxSize);
- Assert.assertEquals(cf.getRetryInterval(), retryInterval);
- Assert.assertEquals(cf.getRetryIntervalMultiplier(), retryIntervalMultiplier);
- Assert.assertEquals(cf.getReconnectAttempts(), reconnectAttempts);
- Assert.assertEquals(cf.isFailoverOnServerShutdown(), failoverOnServerShutdown);
+ Assert.assertEquals(locator.getDiscoveryAddress(), discoveryAddress);
+ Assert.assertEquals(locator.getDiscoveryPort(), discoveryPort);
+ Assert.assertEquals(locator.getDiscoveryRefreshTimeout(), discoveryRefreshTimeout);
+ Assert.assertEquals(locator.getClientFailureCheckPeriod(), clientFailureCheckPeriod);
+ Assert.assertEquals(locator.getConnectionTTL(), connectionTTL);
+ Assert.assertEquals(locator.getCallTimeout(), callTimeout);
+ Assert.assertEquals(locator.getMinLargeMessageSize(), minLargeMessageSize);
+ Assert.assertEquals(locator.getConsumerWindowSize(), consumerWindowSize);
+ Assert.assertEquals(locator.getConsumerMaxRate(), consumerMaxRate);
+ Assert.assertEquals(locator.getConfirmationWindowSize(), confirmationWindowSize);
+ Assert.assertEquals(locator.getProducerMaxRate(), producerMaxRate);
+ Assert.assertEquals(locator.isBlockOnAcknowledge(), blockOnAcknowledge);
+ Assert.assertEquals(locator.isBlockOnDurableSend(), blockOnDurableSend);
+ Assert.assertEquals(locator.isBlockOnNonDurableSend(), blockOnNonDurableSend);
+ Assert.assertEquals(locator.isAutoGroup(), autoGroup);
+ Assert.assertEquals(locator.isPreAcknowledge(), preAcknowledge);
+ Assert.assertEquals(locator.getConnectionLoadBalancingPolicyClassName(),
+ loadBalancingPolicyClassName);
+ Assert.assertEquals(locator.getAckBatchSize(), ackBatchSize);
+ Assert.assertEquals(locator.getDiscoveryInitialWaitTimeout(), initialWaitTimeout);
+ Assert.assertEquals(locator.isUseGlobalPools(), useGlobalPools);
+ Assert.assertEquals(locator.getScheduledThreadPoolMaxSize(), scheduledThreadPoolMaxSize);
+ Assert.assertEquals(locator.getThreadPoolMaxSize(), threadPoolMaxSize);
+ Assert.assertEquals(locator.getRetryInterval(), retryInterval);
+ Assert.assertEquals(locator.getRetryIntervalMultiplier(), retryIntervalMultiplier);
+ Assert.assertEquals(locator.getReconnectAttempts(), reconnectAttempts);
+ Assert.assertEquals(locator.isFailoverOnServerShutdown(), failoverOnServerShutdown);
}
- private void stopLiveAndBackup() throws Exception
+ private void startServer() throws Exception
{
- if (liveService.isStarted())
- {
- SessionFactoryTest.log.info("stopping live");
- liveService.stop();
- }
- if (backupService.isStarted())
- {
- SessionFactoryTest.log.info("stopping backup");
- backupService.stop();
- }
- }
-
- private void startLiveAndBackup() throws Exception
- {
- Map<String, Object> backupParams = new HashMap<String, Object>();
- Configuration backupConf = new ConfigurationImpl();
- backupConf.setSecurityEnabled(false);
- backupConf.setClustered(true);
- backupConf.setSharedStore(true);
- backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
- backupConf.getAcceptorConfigurations()
- .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory", backupParams));
- backupConf.setBackup(true);
- backupService = HornetQServers.newHornetQServer(backupConf, false);
- backupService.start();
-
Configuration liveConf = new ConfigurationImpl();
liveConf.setSecurityEnabled(false);
- liveTC = new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory");
- liveConf.getAcceptorConfigurations()
- .add(new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory"));
- Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
- backupTC = new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory", backupParams);
- connectors.put(backupTC.getName(), backupTC);
- connectors.put(liveTC.getName(), liveTC);
- liveConf.setConnectorConfigurations(connectors);
- liveConf.setBackupConnectorName(backupTC.getName());
+ liveTC = new TransportConfiguration(InVMConnectorFactory.class.getName());
+ liveConf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ liveConf.getConnectorConfigurations().put(liveTC.getName(), liveTC);
liveConf.setSharedStore(true);
liveConf.setClustered(true);
- List<Pair<String, String>> connectorNames = new ArrayList<Pair<String, String>>();
- connectorNames.add(new Pair<String, String>(liveTC.getName(), backupTC.getName()));
-
final long broadcastPeriod = 250;
final String bcGroupName = "bc1";
@@ -907,13 +645,13 @@
groupAddress,
groupPort,
broadcastPeriod,
- connectorNames);
+ Arrays.asList(liveTC.getName()));
List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<BroadcastGroupConfiguration>();
bcConfigs1.add(bcConfig1);
liveConf.setBroadcastGroupConfigurations(bcConfigs1);
- liveService = HornetQServers.newHornetQServer(liveConf, false);
+ liveService = createFakeLockServer(false, liveConf);
liveService.start();
- }*/
+ }
}
Modified: branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-08-23 12:46:05 UTC (rev 9578)
+++ branches/2_2_0_HA_Improvements/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-08-23 12:47:18 UTC (rev 9579)
@@ -47,6 +47,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
@@ -298,6 +299,15 @@
Assert.assertEquals("byte at index " + i, expected[i], actual[i]);
}
}
+
+ public static void assertEqualsTransportConfigurations(final TransportConfiguration[] expected, final TransportConfiguration[] actual)
+ {
+ assertEquals(expected.length, actual.length);
+ for (int i = 0; i < expected.length; i++)
+ {
+ Assert.assertEquals("TransportConfiguration at index " + i, expected[i], actual[i]);
+ }
+ }
public static void assertEqualsBuffers(final int size, final HornetQBuffer expected, final HornetQBuffer actual)
{
More information about the hornetq-commits
mailing list