JBoss hornetq SVN: r10219 - in branches/Branch_2_2_EAP/src/main/org/hornetq/core: server/cluster/impl and 1 other directory.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-02-16 12:56:44 -0500 (Wed, 16 Feb 2011)
New Revision: 10219
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
Log:
relaxed synching to avoid contention
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java 2011-02-16 13:41:38 UTC (rev 10218)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/client/impl/Topology.java 2011-02-16 17:56:44 UTC (rev 10219)
@@ -88,12 +88,13 @@
return (member != null);
}
- public synchronized void fireListeners(ClusterTopologyListener listener)
+ public void sendTopology(ClusterTopologyListener listener)
{
int count = 0;
- for (Map.Entry<String, TopologyMember> entry : topology.entrySet())
+ Map<String, TopologyMember> copy = new HashMap<String, TopologyMember>(topology);
+ for (Map.Entry<String, TopologyMember> entry : copy.entrySet())
{
- listener.nodeUP(entry.getKey(), entry.getValue().getConnector(), ++count == topology.size());
+ listener.nodeUP(entry.getKey(), entry.getValue().getConnector(), ++count == copy.size());
}
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-02-16 13:41:38 UTC (rev 10218)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-02-16 17:56:44 UTC (rev 10219)
@@ -29,8 +29,6 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.ClusterTopologyListener;
import org.hornetq.api.core.client.HornetQClient;
-import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.client.impl.ServerLocatorInternal;
import org.hornetq.core.client.impl.Topology;
import org.hornetq.core.client.impl.TopologyMember;
@@ -300,20 +298,23 @@
return clusterConnections.get(name.toString());
}
- public synchronized void addClusterTopologyListener(final ClusterTopologyListener listener,
+ public void addClusterTopologyListener(final ClusterTopologyListener listener,
final boolean clusterConnection)
{
- if (clusterConnection)
+ synchronized (this)
{
- this.clusterConnectionListeners.add(listener);
+ if (clusterConnection)
+ {
+ this.clusterConnectionListeners.add(listener);
+ }
+ else
+ {
+ this.clientListeners.add(listener);
+ }
}
- else
- {
- this.clientListeners.add(listener);
- }
// We now need to send the current topology to the client
- topology.fireListeners(listener);
+ topology.sendTopology(listener);
}
public synchronized void removeClusterTopologyListener(final ClusterTopologyListener listener,
13 years, 10 months
JBoss hornetq SVN: r10218 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-16 08:41:38 -0500 (Wed, 16 Feb 2011)
New Revision: 10218
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java
Log:
changing a comment
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java 2011-02-16 13:15:24 UTC (rev 10217)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java 2011-02-16 13:41:38 UTC (rev 10218)
@@ -184,7 +184,7 @@
tx.setContainsPersistent();
}
- // For a tx, it's important that the entry is not added to the cache until commit (or prepare)
+ // For a tx, it's important that the entry is not added to the cache until commit
// since if the client fails then resends them tx we don't want it to get rejected
tx.addOperation(new AddDuplicateIDOperation(duplID, recordID));
}
13 years, 10 months
JBoss hornetq SVN: r10217 - in branches/Branch_2_2_EAP: src/main/org/hornetq/core/postoffice and 2 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-02-16 08:15:24 -0500 (Wed, 16 Feb 2011)
New Revision: 10217
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/DuplicateIDCache.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java
Log:
https://issues.jboss.org/browse/JBPAPP-5888 - now add a tx operation for the dup id instead of adding straight to cache
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-02-16 10:29:21 UTC (rev 10216)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-02-16 13:15:24 UTC (rev 10217)
@@ -66,6 +66,7 @@
import org.hornetq.core.persistence.config.PersistedAddressSetting;
import org.hornetq.core.persistence.config.PersistedRoles;
import org.hornetq.core.postoffice.Binding;
+import org.hornetq.core.postoffice.DuplicateIDCache;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.replication.ReplicationManager;
import org.hornetq.core.replication.impl.ReplicatedJournal;
@@ -1702,17 +1703,10 @@
encoding.decode(buff);
- List<Pair<byte[], Long>> ids = duplicateIDMap.get(encoding.address);
+ DuplicateIDCache cache = postOffice.getDuplicateIDCache(encoding.address);
- if (ids == null)
- {
- ids = new ArrayList<Pair<byte[], Long>>();
+ cache.load(tx, encoding.duplID);
- duplicateIDMap.put(encoding.address, ids);
- }
-
- ids.add(new Pair<byte[], Long>(encoding.duplID, record.id));
-
break;
}
case ACKNOWLEDGE_CURSOR:
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/DuplicateIDCache.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/DuplicateIDCache.java 2011-02-16 10:29:21 UTC (rev 10216)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/DuplicateIDCache.java 2011-02-16 13:15:24 UTC (rev 10217)
@@ -36,4 +36,6 @@
void deleteFromCache(byte [] duplicateID) throws Exception;
void load(List<Pair<byte[], Long>> theIds) throws Exception;
+
+ void load(final Transaction tx, final byte[] duplID);
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java 2011-02-16 10:29:21 UTC (rev 10216)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/DuplicateIDCacheImpl.java 2011-02-16 13:15:24 UTC (rev 10217)
@@ -190,6 +190,11 @@
}
}
+ public void load(final Transaction tx, final byte[] duplID)
+ {
+ tx.addOperation(new AddDuplicateIDOperation(duplID, tx.getID()));
+ }
+
private synchronized void addToCacheInMemory(final byte[] duplID, final long recordID)
{
ByteArrayHolder holder = new ByteArrayHolder(duplID);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java 2011-02-16 10:29:21 UTC (rev 10216)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java 2011-02-16 13:15:24 UTC (rev 10217)
@@ -881,6 +881,92 @@
locator.close();
}
+ public void testXADuplicateDetectionPrepareAndRollbackStopServer() throws Exception
+ {
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+
+ ClientSessionFactory sf = locator.createSessionFactory();
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientMessage message = createMessage(session, 0);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+
+ session.prepare(xid);
+
+ session.close();
+
+ messagingService.stop();
+
+ messagingService.start();
+
+ sf = locator.createSessionFactory();
+
+ session = sf.createSession(true, false, false);
+
+ session.start(xid, XAResource.TMJOIN);
+
+ session.end(xid, XAResource.TMSUCCESS);
+
+ session.rollback(xid);
+
+ session.close();
+
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session = sf.createSession(true, false, false);
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ producer = session.createProducer(queueName);
+
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+
+ session.prepare(xid2);
+
+ session.commit(xid2, false);
+
+ session.close();
+
+ session = sf.createSession(false, false, false);
+
+ session.start();
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ ClientMessage msgRec = consumer.receive(5000);
+ assertNotNull(msgRec);
+ msgRec.acknowledge();
+
+ session.commit();
+
+ session.close();
+
+ sf.close();
+
+ locator.close();
+ }
+
public void testXADuplicateDetection4() throws Exception
{
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
@@ -1914,108 +2000,6 @@
messagingService2.stop();
}
- public void testPersistXA2() throws Exception
- {
- messagingService.stop();
-
- Configuration conf = createDefaultConfig();
-
- conf.setIDCacheSize(cacheSize);
-
- HornetQServer messagingService2 = HornetQServers.newHornetQServer(conf);
-
- messagingService2.start();
-
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
-
- ClientSessionFactory sf = locator.createSessionFactory();
-
- ClientSession session = sf.createSession(true, false, false);
-
- Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
-
- session.start(xid, XAResource.TMNOFLAGS);
-
- session.start();
-
- final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
-
- session.createQueue(queueName, queueName, null, false);
-
- ClientProducer producer = session.createProducer(queueName);
-
- ClientConsumer consumer = session.createConsumer(queueName);
-
- ClientMessage message = createMessage(session, 1);
- SimpleString dupID = new SimpleString("abcdefg");
- message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
- producer.send(message);
-
- message = createMessage(session, 2);
- SimpleString dupID2 = new SimpleString("hijklmnopqr");
- message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
- producer.send(message);
-
- session.end(xid, XAResource.TMSUCCESS);
- session.prepare(xid);
-
- session.close();
-
- sf.close();
-
- messagingService2.stop();
-
- messagingService2 = HornetQServers.newHornetQServer(conf);
-
- messagingService2.start();
-
- sf = locator.createSessionFactory();
-
- session = sf.createSession(true, false, false);
-
- Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
-
- session.start(xid2, XAResource.TMNOFLAGS);
-
- session.start();
-
- session.createQueue(queueName, queueName, null, false);
-
- producer = session.createProducer(queueName);
-
- consumer = session.createConsumer(queueName);
-
- message = createMessage(session, 1);
- message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
- producer.send(message);
-
- message = createMessage(session, 2);
- message.putBytesProperty(Message.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
- producer.send(message);
-
- session.end(xid2, XAResource.TMSUCCESS);
- session.prepare(xid2);
- session.commit(xid2, false);
-
- Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
-
- session.start(xid3, XAResource.TMNOFLAGS);
-
- ClientMessage message2 = consumer.receiveImmediate();
- Assert.assertNull(message2);
-
- message2 = consumer.receiveImmediate();
- Assert.assertNull(message2);
-
- session.close();
-
- sf.close();
-
- locator.close();
-
- messagingService2.stop();
- }
-
@Override
protected void setUp() throws Exception
{
@@ -2027,7 +2011,7 @@
conf.setIDCacheSize(cacheSize);
- messagingService = HornetQServers.newHornetQServer(conf, false);
+ messagingService = HornetQServers.newHornetQServer(conf, true);
messagingService.start();
}
13 years, 10 months
JBoss hornetq SVN: r10216 - in branches/HORNETQ-316: examples/jms/symmetric-cluster/src/org/hornetq/jms/example and 16 other directories.
by do-not-reply@jboss.org
Author: igarashitm
Date: 2011-02-16 05:29:21 -0500 (Wed, 16 Feb 2011)
New Revision: 10216
Modified:
branches/HORNETQ-316/.classpath
branches/HORNETQ-316/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java
branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java
branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
- removed compile errors from existing testcases & examples
- added createStaticDiscoveryGroup() & createSimpleUDPDiscoveryGroup() on HornetQServerControl
Modified: branches/HORNETQ-316/.classpath
===================================================================
--- branches/HORNETQ-316/.classpath 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/.classpath 2011-02-16 10:29:21 UTC (rev 10216)
@@ -133,5 +133,6 @@
<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-expression.jar"/>
<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-jms.jar"/>
<classpathentry kind="lib" path="thirdparty/org/springframework/lib/spring-tx.jar"/>
+ <classpathentry kind="lib" path="thirdparty/jgroups/lib/jgroups.jar"/>
<classpathentry kind="output" path="eclipse-output"/>
</classpath>
Modified: branches/HORNETQ-316/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java
===================================================================
--- branches/HORNETQ-316/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/examples/jms/symmetric-cluster/src/org/hornetq/jms/example/SymmetricClusterExample.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -12,6 +12,9 @@
*/
package org.hornetq.jms.example;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
@@ -22,9 +25,12 @@
import javax.jms.Topic;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.common.example.HornetQExample;
+import org.hornetq.core.client.impl.SimpleUDPServerLocatorImpl;
+import org.hornetq.utils.UUIDGenerator;
/**
* This example demonstrates a cluster of three nodes set up in a symmetric topology - i.e. each node
@@ -81,8 +87,12 @@
// connection factory directly we avoid having to worry about a JNDI look-up.
// In an app server environment you could use HA-JNDI to lookup from the clustered JNDI servers without
// having to know about a specific one.
- DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration("231.7.7.7", 9876);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(DiscoveryGroupConstants.GROUP_ADDRESS_NAME, "231.7.7.7");
+ params.put(DiscoveryGroupConstants.GROUP_PORT_NAME, 9876);
+ DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(SimpleUDPServerLocatorImpl.class.getName(), params, UUIDGenerator.getInstance().generateStringUUID());
+
ConnectionFactory cf = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.CF);
// We give a little while for each server to broadcast its whereabouts to the client
Modified: branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -576,4 +576,16 @@
@Operation(desc = "force the server to stop and notify clients to failover", impact = MBeanOperationInfo.UNKNOWN)
void forceFailover() throws Exception;
+
+ @Operation(desc = "create static discovery group", impact = MBeanOperationInfo.UNKNOWN)
+ void createStaticDiscoveryGroup(@Parameter(name="name", desc="Name of the discovery group") String name,
+ @Parameter(name="connectors", desc="List of the connector name with comma separated") String connectors) throws Exception;
+
+ @Operation(desc = "create simple UDP discovery group", impact = MBeanOperationInfo.UNKNOWN)
+ void createSimpleUDPDiscoveryGroup(@Parameter(name="name", desc="Name of the discovery group") String name,
+ @Parameter(name="localBindAddress", desc="Local bind address") String localBindAddress,
+ @Parameter(name="groupAddress", desc="Discovery group address") String groupAddress,
+ @Parameter(name="groupPort", desc="Discovery group port") int groupPort,
+ @Parameter(name="refreshTimeout", desc="Refresh timeout") long refreshTimeout,
+ @Parameter(name="initialWaitTimeout", desc="initial wait timeout to discover") long initialWaitTimeout) throws Exception;
}
Modified: branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -35,6 +35,8 @@
import javax.management.NotificationListener;
import javax.transaction.xa.Xid;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -44,6 +46,8 @@
import org.hornetq.api.core.management.HornetQServerControl;
import org.hornetq.api.core.management.NotificationType;
import org.hornetq.api.core.management.QueueControl;
+import org.hornetq.core.client.impl.SimpleUDPServerLocatorImpl;
+import org.hornetq.core.client.impl.StaticServerLocatorImpl;
import org.hornetq.core.config.BridgeConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.DivertConfiguration;
@@ -69,6 +73,7 @@
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.SecurityFormatter;
+import org.hornetq.utils.UUIDGenerator;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
@@ -1902,4 +1907,36 @@
return list;
}
+ public void createStaticDiscoveryGroup(String name, String connectors) throws Exception
+ {
+ List<TransportConfiguration> connectorConfigs = new ArrayList<TransportConfiguration>();
+ for(String connector : toList(connectors))
+ {
+ connectorConfigs.add(configuration.getConnectorConfigurations().get(connector));
+ }
+
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_CONNECTOR_REF_LIST_NAME, connectors);
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectorConfigs.toArray(new TransportConfiguration[0]));
+ DiscoveryGroupConfiguration groupConf = new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(), params, name);
+ configuration.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+ }
+
+ public void createSimpleUDPDiscoveryGroup(String name,
+ String localBindAddress,
+ String groupAddress,
+ int groupPort,
+ long refreshTimeout,
+ long initialWaitTimeout) throws Exception
+ {
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME, localBindAddress);
+ params.put(DiscoveryGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(DiscoveryGroupConstants.GROUP_PORT_NAME, groupPort);
+ params.put(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME, refreshTimeout);
+ params.put(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME, initialWaitTimeout);
+ DiscoveryGroupConfiguration groupConf = new DiscoveryGroupConfiguration(SimpleUDPServerLocatorImpl.class.getName(), params, name);
+ configuration.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+ }
+
}
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -18,16 +18,20 @@
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import junit.framework.Assert;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
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.SimpleUDPServerLocatorImpl;
import org.hornetq.core.config.BroadcastGroupConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.logging.Logger;
@@ -50,7 +54,7 @@
{
private static final Logger log = Logger.getLogger(SessionFactoryTest.class);
- private DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(getUDPDiscoveryAddress(), getUDPDiscoveryPort());
+ private DiscoveryGroupConfiguration groupConfiguration = createSimpleUDPDiscoveryGroupConfiguration(getUDPDiscoveryAddress(), getUDPDiscoveryPort());
private HornetQServer liveService;
@@ -60,7 +64,7 @@
protected void setUp() throws Exception
{
super.setUp();
-
+
startServer();
}
@@ -577,7 +581,7 @@
final int localBindPort = 5432;
- BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration(bcGroupName,
+ BroadcastGroupConfiguration bcConfig1 = createBroadcastGroupConfiguration(bcGroupName,
null,
localBindPort,
getUDPDiscoveryAddress(),
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -20,6 +20,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
@@ -110,8 +111,8 @@
final int reconnectAttempts = 1;
final int confirmationWindowSize = 1024;
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
@@ -124,7 +125,7 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -256,9 +257,10 @@
final int reconnectAttempts = 3;
final int confirmationWindowSize = 1024;
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
forwardAddress,
@@ -270,7 +272,7 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -385,9 +387,9 @@
final int reconnectAttempts = 3;
final int confirmationWindowSize = 1024;
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
-
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
forwardAddress,
@@ -399,7 +401,7 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -527,9 +529,9 @@
final int confirmationWindowSize = 1024;
final long clientFailureCheckPeriod = 1000;
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
-
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
forwardAddress,
@@ -541,7 +543,7 @@
false,
confirmationWindowSize,
clientFailureCheckPeriod,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -662,8 +664,8 @@
final int reconnectAttempts = 3;
final int confirmationWindowSize = 1024;
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
@@ -676,7 +678,7 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -20,6 +20,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -94,8 +95,8 @@
server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
final String bridgeName = "bridge1";
@@ -110,7 +111,7 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -257,8 +258,8 @@
server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
final String bridgeName = "bridge1";
@@ -273,7 +274,7 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -468,8 +469,8 @@
server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
final String bridgeName = "bridge1";
@@ -484,7 +485,7 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -619,8 +620,8 @@
server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
final String bridgeName = "bridge1";
@@ -635,7 +636,7 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -20,6 +20,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -117,8 +118,9 @@
final int numMessages = 10;
- ArrayList<String> connectorConfig = new ArrayList<String>();
- connectorConfig.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration("bridge1",
queueName0,
forwardAddress,
@@ -132,7 +134,7 @@
// are sent
numMessages * messageSize / 2,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorConfig,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -317,8 +319,9 @@
final String filterString = "animal='goat'";
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration("bridge1",
queueName0,
forwardAddress,
@@ -330,7 +333,7 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -491,8 +494,8 @@
server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration("bridge1",
queueName0,
@@ -505,8 +508,8 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
- false,
+ groupConf,
+ false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -634,8 +637,8 @@
server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration("bridge1",
queueName0,
@@ -648,7 +651,7 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -776,8 +779,9 @@
final int numMessages = 10;
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration("bridge1",
queueName0,
null, // pass a null forwarding address to use messages' original address
@@ -791,7 +795,7 @@
// are sent
numMessages * messageSize / 2,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -93,24 +93,26 @@
ArrayList<String> list = new ArrayList<String>();
list.add(server1tc.getName());
- BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
+ BroadcastGroupConfiguration bcConfig = createBroadcastGroupConfiguration("bg1",
null,
-1,
groupAddress,
port,
250,
- list);
+ list);
server0.getConfiguration().getBroadcastGroupConfigurations().add(bcConfig);
- DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
+ DiscoveryGroupConfiguration dcConfig = createSimpleUDPDiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
server0.getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
final String bridgeName = "bridge1";
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
forwardAddress,
@@ -122,7 +124,7 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -20,6 +20,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
@@ -105,9 +106,9 @@
final int reconnectAttempts = -1;
final int confirmationWindowSize = 1024; // 1 kiB
-
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[]{server1tc});
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put("server1tc-static", groupConf);
+
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
queueName0,
forwardAddress,
@@ -119,7 +120,7 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -14,6 +14,7 @@
package org.hornetq.tests.integration.cluster.distribution;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -1464,17 +1465,17 @@
List<String> connectorPairs = new ArrayList<String>();
connectorPairs.add(connector.getName());
- BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
- null,
- -1,
- groupAddress,
- port,
- 1000,
- connectorPairs);
+ BroadcastGroupConfiguration bcConfig = createBroadcastGroupConfiguration("bg1",
+ null,
+ -1,
+ groupAddress,
+ port,
+ 1000,
+ connectorPairs);
configuration.getBroadcastGroupConfigurations().add(bcConfig);
- DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
+ DiscoveryGroupConfiguration dcConfig = createSimpleUDPDiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
@@ -1551,17 +1552,17 @@
List<String> connectorPairs = new ArrayList<String>();
connectorPairs.add(connector.getName());
- BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
- null,
- -1,
- groupAddress,
- port,
- 1000,
- connectorPairs);
+ BroadcastGroupConfiguration bcConfig = createBroadcastGroupConfiguration("bg1",
+ null,
+ -1,
+ groupAddress,
+ port,
+ 1000,
+ connectorPairs);
configuration.getBroadcastGroupConfigurations().add(bcConfig);
- DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
+ DiscoveryGroupConfiguration dcConfig = createSimpleUDPDiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
@@ -1632,16 +1633,19 @@
TransportConfiguration connectorFrom = createTransportConfiguration(netty, false, generateParams(nodeFrom, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(name, connectorFrom);
- List<String> pairs = null;
+ List<TransportConfiguration> pairs = null;
if (nodeTo != -1)
{
TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(nodeTo, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc);
- pairs = new ArrayList<String>();
- pairs.add(serverTotc.getName());
+ pairs = new ArrayList<TransportConfiguration>();
+ pairs.add(serverTotc);
}
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
address,
name,
@@ -1650,7 +1654,7 @@
forwardWhenNoConsumers,
maxHops,
1024,
- pairs, allowDirectConnectionsOnly);
+ groupConf, allowDirectConnectionsOnly);
serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
}
@@ -1673,14 +1677,17 @@
TransportConfiguration connectorFrom = createTransportConfiguration(netty, false, generateParams(nodeFrom, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(connectorFrom.getName(), connectorFrom);
- List<String> pairs = new ArrayList<String>();
+ List<TransportConfiguration> pairs = new ArrayList<TransportConfiguration>();
for (int element : nodesTo)
{
TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(element, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc);
- pairs.add(serverTotc.getName());
+ pairs.add(serverTotc);
}
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
address,
connectorFrom.getName(),
@@ -1689,7 +1696,7 @@
forwardWhenNoConsumers,
maxHops,
1024,
- pairs, false);
+ groupConf, false);
serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
}
@@ -1712,14 +1719,17 @@
TransportConfiguration connectorFrom = createTransportConfiguration(netty, false, generateParams(nodeFrom, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(name, connectorFrom);
- List<String> pairs = new ArrayList<String>();
+ List<TransportConfiguration> pairs = new ArrayList<TransportConfiguration>();
for (int element : nodesTo)
{
TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(element, netty));
serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc);
- pairs.add(serverTotc.getName());
+ pairs.add(serverTotc);
}
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
+
ClusterConnectionConfiguration clusterConf = new ClusterConnectionConfiguration(name,
address,
name,
@@ -1728,7 +1738,7 @@
forwardWhenNoConsumers,
maxHops,
1024,
- pairs, false);
+ groupConf, false);
serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
}
@@ -1759,7 +1769,9 @@
forwardWhenNoConsumers,
maxHops,
1024,
- discoveryGroupName);
+ server.getConfiguration().getDiscoveryGroupConfigurations().get(discoveryGroupName),
+ false);
+
List<ClusterConnectionConfiguration> clusterConfs = server.getConfiguration().getClusterConfigurations();
clusterConfs.add(clusterConf);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -14,6 +14,8 @@
package org.hornetq.tests.integration.cluster.failover;
import junit.framework.Assert;
+
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -208,10 +210,10 @@
TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
backupConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
backupConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(liveConnector.getName());
+ DiscoveryGroupConfiguration liveGroup = createStaticDiscoveryGroupConfiguration(liveConnector);
+ backupConfig.getDiscoveryGroupConfigurations().put(liveGroup.getName(), liveGroup);
ClusterConnectionConfiguration cccLive = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1,
- staticConnectors, false);
+ liveGroup, false);
backupConfig.getClusterConfigurations().add(cccLive);
backupServer = createBackupServer();
@@ -221,10 +223,10 @@
liveConfig.setSecurityEnabled(false);
liveConfig.setSharedStore(true);
liveConfig.setClustered(true);
- List<String> pairs = new ArrayList<String>();
- pairs.add(backupConnector.getName());
+ DiscoveryGroupConfiguration buGroup = createStaticDiscoveryGroupConfiguration(backupConnector);
+ liveConfig.getDiscoveryGroupConfigurations().put(buGroup.getName(), buGroup);
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ buGroup, false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
liveConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -14,6 +14,8 @@
package org.hornetq.tests.integration.cluster.failover;
import junit.framework.Assert;
+
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -148,10 +150,10 @@
TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
backupConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
backupConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(liveConnector.getName());
+ DiscoveryGroupConfiguration liveGroup = createStaticDiscoveryGroupConfiguration(liveConnector);
+ backupConfig.getDiscoveryGroupConfigurations().put(liveGroup.getName(), liveGroup);
ClusterConnectionConfiguration cccLive = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1,
- staticConnectors, false);
+ liveGroup, false);
backupConfig.getClusterConfigurations().add(cccLive);
backupConfig.setAllowAutoFailBack(false);
backupServer = createBackupServer();
@@ -162,10 +164,10 @@
liveConfig.setSecurityEnabled(false);
liveConfig.setSharedStore(true);
liveConfig.setClustered(true);
- List<String> pairs = new ArrayList<String>();
- pairs.add(backupConnector.getName());
+ DiscoveryGroupConfiguration buGroup = createStaticDiscoveryGroupConfiguration(backupConnector);
+ liveConfig.getDiscoveryGroupConfigurations().put(buGroup.getName(), buGroup);
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ buGroup, false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
liveConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -24,6 +24,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
@@ -134,10 +135,10 @@
TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
backupConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
backupConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(liveConnector.getName());
+ DiscoveryGroupConfiguration liveGroup = createStaticDiscoveryGroupConfiguration(liveConnector);
+ backupConfig.getDiscoveryGroupConfigurations().put(liveGroup.getName(), liveGroup);
ClusterConnectionConfiguration cccLive = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1,
- staticConnectors, false);
+ liveGroup, false);
backupConfig.getClusterConfigurations().add(cccLive);
backupServer = createBackupServer();
@@ -147,9 +148,8 @@
liveConfig.setSecurityEnabled(false);
liveConfig.setSharedStore(true);
liveConfig.setClustered(true);
- List<String> pairs = null;
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ null, false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
liveServer = createLiveServer();
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -34,6 +34,7 @@
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.AbstractServerLocator;
import org.hornetq.core.client.impl.ServerLocatorInternal;
+import org.hornetq.core.client.impl.StaticServerLocatorImpl;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.integration.cluster.util.TestableServer;
import org.hornetq.tests.util.ServiceTestBase;
@@ -189,7 +190,7 @@
{
configs[i] = createTransportConfiguration(isNetty(), false, generateParams(nodes[i], isNetty()));
}
- return new AbstractServerLocator(true, configs);
+ return new StaticServerLocatorImpl(true, createStaticDiscoveryGroupConfiguration(configs));
}
// Private -------------------------------------------------------
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Map;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ServerLocator;
@@ -142,14 +143,16 @@
TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty()));
config1.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
- List<String> clusterNodes = new ArrayList<String>();
+ List<TransportConfiguration> clusterNodes = new ArrayList<TransportConfiguration>();
for (int node : otherClusterNodes)
{
TransportConfiguration connector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
config1.getConnectorConfigurations().put(connector.getName(), connector);
- clusterNodes.add(connector.getName());
+ clusterNodes.add(connector);
}
- ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1, clusterNodes, false);
+ DiscoveryGroupConfiguration nodeConf = createStaticDiscoveryGroupConfiguration(clusterNodes.toArray(new TransportConfiguration[0]));
+ config1.getDiscoveryGroupConfigurations().put(nodeConf.getName(), nodeConf);
+ ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1, nodeConf, false);
config1.getClusterConfigurations().add(ccc1);
config1.setBindingsDirectory(config1.getBindingsDirectory() + "_" + liveNode);
@@ -169,16 +172,18 @@
config0.setSecurityEnabled(false);
config0.setSharedStore(true);
config0.setClustered(true);
- List<String> pairs = new ArrayList<String>();
+ List<TransportConfiguration> pairs = new ArrayList<TransportConfiguration>();
for (int node : otherLiveNodes)
{
TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
config0.getConnectorConfigurations().put(otherLiveConnector.getName(), otherLiveConnector);
- pairs.add(otherLiveConnector.getName());
+ pairs.add(otherLiveConnector);
}
+ DiscoveryGroupConfiguration nodeConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ config0.getDiscoveryGroupConfigurations().put(nodeConf.getName(), nodeConf);
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ nodeConf, false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -16,6 +16,7 @@
import java.util.ArrayList;
import java.util.Map;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
@@ -55,6 +56,8 @@
config.setClustered(true);
config.getConnectorConfigurations().put("self",
createTransportConfiguration(true, false, generateParams(0, true)));
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[0]);
+ config.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
config.getClusterConfigurations().add(new ClusterConnectionConfiguration("cluster",
"foo",
"self",
@@ -63,7 +66,8 @@
false,
1,
1,
- new ArrayList<String>(), false));
+ groupConf,
+ false));
return config;
}
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Map;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
@@ -167,14 +168,16 @@
TransportConfiguration backupConnector = createTransportConfiguration(true, false, generateParams(nodeid, true));
config1.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
- List<String> clusterNodes = new ArrayList<String>();
+ List<TransportConfiguration> clusterNodes = new ArrayList<TransportConfiguration>();
for (int node : otherClusterNodes)
{
TransportConfiguration connector = createTransportConfiguration(true, false, generateParams(node, true));
config1.getConnectorConfigurations().put(connector.getName(), connector);
- clusterNodes.add(connector.getName());
+ clusterNodes.add(connector);
}
- ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1, clusterNodes, false);
+ DiscoveryGroupConfiguration nodeConf = createStaticDiscoveryGroupConfiguration(clusterNodes.toArray(new TransportConfiguration[0]));
+ config1.getDiscoveryGroupConfigurations().put(nodeConf.getName(), nodeConf);
+ ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1, nodeConf, false);
config1.getClusterConfigurations().add(ccc1);
@@ -197,16 +200,18 @@
config0.setSharedStore(true);
config0.setJournalType(JournalType.NIO);
config0.setClustered(true);
- List<String> pairs = new ArrayList<String>();
+ List<TransportConfiguration> pairs = new ArrayList<TransportConfiguration>();
for (int node : otherLiveNodes)
{
TransportConfiguration otherLiveConnector = createTransportConfiguration(true, false, generateParams(node, true));
config0.getConnectorConfigurations().put(otherLiveConnector.getName(), otherLiveConnector);
- pairs.add(otherLiveConnector.getName());
+ pairs.add(otherLiveConnector);
}
+ DiscoveryGroupConfiguration nodeConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ config0.getDiscoveryGroupConfigurations().put(nodeConf.getName(), nodeConf);
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ nodeConf, false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Map;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ServerLocator;
@@ -177,16 +178,18 @@
config0.setSharedStore(true);
config0.setJournalType(JournalType.NIO);
config0.setClustered(true);
- List<String> pairs = new ArrayList<String>();
+ List<TransportConfiguration> pairs = new ArrayList<TransportConfiguration>();
for (int node : otherLiveNodes)
{
TransportConfiguration otherLiveConnector = createTransportConfiguration(true,
false,
generateParams(node, true));
config0.getConnectorConfigurations().put(otherLiveConnector.getName(), otherLiveConnector);
- pairs.add(otherLiveConnector.getName());
+ pairs.add(otherLiveConnector);
}
+ DiscoveryGroupConfiguration nodeConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ config0.getDiscoveryGroupConfigurations().put(nodeConf.getName(), nodeConf);
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1",
"jms",
liveConnector.getName(),
@@ -195,7 +198,7 @@
false,
1,
1,
- pairs,
+ nodeConf,
false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
@@ -275,16 +278,17 @@
config1.setBackup(true);
config1.setJournalType(JournalType.NIO);
config1.setClustered(true);
- List<String> staticConnectors = new ArrayList<String>();
+ List<TransportConfiguration> staticConnectors = new ArrayList<TransportConfiguration>();
for (int node : nodes)
{
TransportConfiguration liveConnector = createTransportConfiguration(true, false, generateParams(node, true));
config1.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
- staticConnectors.add(liveConnector.getName());
+ staticConnectors.add(liveConnector);
}
TransportConfiguration backupConnector = createTransportConfiguration(true, false, generateParams(nodeid, true));
- List<String> pairs = null;
+ DiscoveryGroupConfiguration nodeConf = createStaticDiscoveryGroupConfiguration(createClusterConnections ? staticConnectors.toArray(new TransportConfiguration[0]) : null);
+ config1.getDiscoveryGroupConfigurations().put(nodeConf.getName(), nodeConf);
ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1",
"jms",
backupConnector.getName(),
@@ -293,8 +297,7 @@
false,
1,
1,
- createClusterConnections ? staticConnectors
- : pairs,
+ nodeConf,
false);
config1.getClusterConfigurations().add(ccc1);
config1.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Set;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
@@ -112,8 +113,8 @@
TransportConfiguration backupConnector = getConnectorTransportConfiguration(false);
backupConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
backupConfig.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(liveConnector.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(liveConnector);
+ backupConfig.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
ClusterConnectionConfiguration cccLive = new ClusterConnectionConfiguration("cluster1",
"jms",
backupConnector.getName(),
@@ -122,7 +123,7 @@
false,
1,
1,
- staticConnectors,
+ groupConf,
false);
backupConfig.getClusterConfigurations().add(cccLive);
backupServer = createBackupServer();
@@ -137,7 +138,6 @@
liveConfig.setSecurityEnabled(true);
liveConfig.setSharedStore(true);
liveConfig.setClustered(true);
- List<String> pairs = null;
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1",
"jms",
liveConnector.getName(),
@@ -146,7 +146,7 @@
false,
1,
1,
- pairs,
+ null,
false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Map;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ServerLocator;
@@ -107,16 +108,18 @@
config1.setSharedStore(true);
config1.setBackup(true);
config1.setClustered(true);
- List<String> staticConnectors = new ArrayList<String>();
+ List<TransportConfiguration> staticConnectors = new ArrayList<TransportConfiguration>();
for (int node : nodes)
{
TransportConfiguration liveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
config1.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
- staticConnectors.add(liveConnector.getName());
+ staticConnectors.add(liveConnector);
}
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(staticConnectors.toArray(new TransportConfiguration[0]));
+ config1.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
TransportConfiguration backupConnector = createTransportConfiguration(isNetty(), false, generateParams(nodeid, isNetty()));
- ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1, staticConnectors, false);
+ ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1, groupConf, false);
config1.getClusterConfigurations().add(ccc1);
config1.getConnectorConfigurations().put(backupConnector.getName(), backupConnector);
@@ -137,16 +140,18 @@
config0.setSecurityEnabled(false);
config0.setSharedStore(true);
config0.setClustered(true);
- List<String> pairs = null;
+ List<TransportConfiguration> pairs = new ArrayList<TransportConfiguration>();
for (int node : otherLiveNodes)
{
TransportConfiguration otherLiveConnector = createTransportConfiguration(isNetty(), false, generateParams(node, isNetty()));
config0.getConnectorConfigurations().put(otherLiveConnector.getName(), otherLiveConnector);
- pairs.add(otherLiveConnector.getName());
+ pairs.add(otherLiveConnector);
}
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ config0.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ groupConf, false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -16,6 +16,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
@@ -68,6 +69,8 @@
config.getAcceptorConfigurations().add(createTransportConfiguration(true, true, generateParams(0, true)));
config.getConnectorConfigurations().put("self",
createTransportConfiguration(true, false, generateParams(0, true)));
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(new TransportConfiguration[0]);
+ config.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
config.getClusterConfigurations().add(new ClusterConnectionConfiguration("cluster",
"foo",
"self",
@@ -76,7 +79,7 @@
false,
1,
1,
- new ArrayList<String>(), false));
+ groupConf, false));
return config;
}
@@ -96,12 +99,11 @@
config.setClustered(true);
config.getAcceptorConfigurations().add(createTransportConfiguration(true, true, generateParams(1, true)));
config.setLiveConnectorName("live");
- config.getConnectorConfigurations().put("live",
- createTransportConfiguration(true, false, generateParams(0, true)));
+ TransportConfiguration liveConnector = createTransportConfiguration(true, false, generateParams(0, true));
+ config.getConnectorConfigurations().put("live", liveConnector);
config.getConnectorConfigurations().put("self",
createTransportConfiguration(true, false, generateParams(1, true)));
- List<String> connectors = new ArrayList<String>();
- connectors.add("live");
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(liveConnector);
config.getClusterConfigurations().add(new ClusterConnectionConfiguration("cluster",
"foo",
"self",
@@ -110,7 +112,7 @@
false,
1,
1,
- connectors, false));
+ groupConf, false));
return config;
}
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -60,7 +60,7 @@
@Override
protected ServerLocator createHAServerLocator()
{
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(new DiscoveryGroupConfiguration(groupAddress, groupPort));
+ ServerLocator locator = HornetQClient.createServerLocatorWithHA(createSimpleUDPDiscoveryGroupConfiguration(groupAddress, groupPort));
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
return locator;
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -26,6 +26,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.NotificationType;
@@ -33,6 +34,8 @@
import org.hornetq.core.cluster.DiscoveryGroup;
import org.hornetq.core.cluster.DiscoveryListener;
import org.hornetq.core.cluster.impl.DiscoveryGroupImpl;
+import org.hornetq.core.config.BroadcastGroupConfiguration;
+import org.hornetq.core.config.BroadcastGroupConstants;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.cluster.BroadcastGroup;
import org.hornetq.core.server.cluster.impl.BroadcastGroupImpl;
@@ -71,13 +74,11 @@
final String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
@@ -157,13 +158,13 @@
log.info("Local address is " + localAddress);
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- localAddress,
- 6552,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.LOCAL_BIND_ADDRESS_NAME, localAddress);
+ params.put(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME, 6552);
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
@@ -203,13 +204,11 @@
final String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
@@ -262,13 +261,11 @@
String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
@@ -347,13 +344,11 @@
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(), broadcastConf.getName(), true, broadcastConf);
bg.start();
@@ -389,13 +384,11 @@
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(), broadcastConf.getName(), true, broadcastConf);
bg.start();
@@ -445,31 +438,25 @@
String node3 = RandomUtil.randomString();
- BroadcastGroup bg1 = new BroadcastGroupImpl(node1,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress1,
- groupPort1,
- true);
+ Map<String,Object> params1 = new HashMap<String,Object>();
+ params1.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress1);
+ params1.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort1);
+ BroadcastGroupConfiguration broadcastConf1 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params1, RandomUtil.randomString());
+ BroadcastGroup bg1 = new BroadcastGroupImpl(node1, broadcastConf1.getName(), true, broadcastConf1);
bg1.start();
- BroadcastGroup bg2 = new BroadcastGroupImpl(node2,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress2,
- groupPort2,
- true);
+ Map<String,Object> params2 = new HashMap<String,Object>();
+ params2.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress2);
+ params2.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort2);
+ BroadcastGroupConfiguration broadcastConf2 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params2, RandomUtil.randomString());
+ BroadcastGroup bg2 = new BroadcastGroupImpl(node2, broadcastConf2.getName(), true, broadcastConf2);
bg2.start();
- BroadcastGroup bg3 = new BroadcastGroupImpl(node3,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress3,
- groupPort3,
- true);
+ Map<String,Object> params3 = new HashMap<String,Object>();
+ params3.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress3);
+ params3.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort3);
+ BroadcastGroupConfiguration broadcastConf3 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params3, RandomUtil.randomString());
+ BroadcastGroup bg3 = new BroadcastGroupImpl(node3, broadcastConf3.getName(), true, broadcastConf3);
bg3.start();
TransportConfiguration live1 = generateTC();
@@ -587,13 +574,11 @@
String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
@@ -654,31 +639,19 @@
String node2 = RandomUtil.randomString();
String node3 = RandomUtil.randomString();
- BroadcastGroup bg1 = new BroadcastGroupImpl(node1,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf1 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg1 = new BroadcastGroupImpl(node1, broadcastConf1.getName(), true, broadcastConf1);
bg1.start();
- BroadcastGroup bg2 = new BroadcastGroupImpl(node2,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroupConfiguration broadcastConf2 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg2 = new BroadcastGroupImpl(node2, broadcastConf2.getName(), true, broadcastConf2);
bg2.start();
- BroadcastGroup bg3 = new BroadcastGroupImpl(node3,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroupConfiguration broadcastConf3 = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg3 = new BroadcastGroupImpl(node3, broadcastConf3.getName(), true, broadcastConf3);
bg3.start();
TransportConfiguration live1 = generateTC();
@@ -842,14 +815,11 @@
String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
-
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(nodeID, broadcastConf.getName(), true, broadcastConf);
bg.start();
TransportConfiguration live1 = generateTC();
@@ -953,13 +923,11 @@
final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
final int groupPort = getUDPDiscoveryPort();
- BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ BroadcastGroupConfiguration broadcastConf = new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, RandomUtil.randomString());
+ BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(), broadcastConf.getName(), true, broadcastConf);
bg.setNotificationService(notifService);
Assert.assertEquals(0, notifListener.getNotifications().size());
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -156,7 +156,7 @@
public void testDiscoveryConstructor() throws Exception
{
- DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(groupAddress, groupPort);
+ DiscoveryGroupConfiguration groupConfiguration = createSimpleUDPDiscoveryGroupConfiguration(groupAddress, groupPort);
HornetQConnectionFactory cf = (HornetQConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.CF);
assertFactoryParams(cf,
null,
@@ -724,13 +724,13 @@
final int localBindPort = 5432;
- BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration(bcGroupName,
- null,
- localBindPort,
- groupAddress,
- groupPort,
- broadcastPeriod,
- connectorNames);
+ BroadcastGroupConfiguration bcConfig1 = createBroadcastGroupConfiguration(bcGroupName,
+ null,
+ localBindPort,
+ groupAddress,
+ groupPort,
+ broadcastPeriod,
+ connectorNames);
List<BroadcastGroupConfiguration> bcConfigs1 = new ArrayList<BroadcastGroupConfiguration>();
bcConfigs1.add(bcConfig1);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -32,6 +32,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
@@ -361,8 +362,8 @@
backupConf.getAcceptorConfigurations().add(backupAcceptortc);
backupConf.getConnectorConfigurations().put(livetc.getName(), livetc);
backupConf.getConnectorConfigurations().put(backuptc.getName(), backuptc);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(livetc.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(livetc);
+ backupConf.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
ClusterConnectionConfiguration cccBackup = new ClusterConnectionConfiguration("cluster1",
"jms",
backuptc.getName(),
@@ -371,7 +372,7 @@
false,
1,
1,
- staticConnectors,
+ groupConf,
false);
backupConf.getClusterConfigurations().add(cccBackup);
@@ -404,7 +405,7 @@
liveConf.setSecurityEnabled(false);
liveConf.getAcceptorConfigurations().add(liveAcceptortc);
- List<String> pairs = null;
+ DiscoveryGroupConfiguration pairs = null;
ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1",
"jms",
livetc.getName(),
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -339,9 +339,9 @@
config.getConnectorConfigurations().put("netty",
new TransportConfiguration(NettyConnectorFactory.class.getName()));
- DiscoveryGroupConfiguration dcg = new DiscoveryGroupConfiguration("mygroup", "172.16.8.10",
- "243.7.7.7", 12345,
- 5432, 5432);
+ DiscoveryGroupConfiguration dcg = createSimpleUDPDiscoveryGroupConfiguration("mygroup", "172.16.8.10",
+ "243.7.7.7", 12345,
+ 5432, 5432);
config.getDiscoveryGroupConfigurations().put("mygroup", dcg);
HornetQServer server = createServer(false, config);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -657,12 +657,12 @@
conf.setJMXManagementEnabled(true);
conf.getDiscoveryGroupConfigurations()
.put("discovery",
- new DiscoveryGroupConfiguration("discovery",
- null,
- "231.7.7.7",
- discoveryPort,
- ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT,
- ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT));
+ createSimpleUDPDiscoveryGroupConfiguration("discovery",
+ null,
+ "231.7.7.7",
+ discoveryPort,
+ ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT,
+ ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT));
HornetQServer server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
context = new InVMContext();
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -23,6 +23,8 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -74,7 +76,7 @@
BridgeControl bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
Assert.assertEquals(bridgeConfig.getName(), bridgeControl.getName());
- Assert.assertEquals(bridgeConfig.getDiscoveryGroupName(), bridgeControl.getDiscoveryGroupName());
+ Assert.assertEquals(bridgeConfig.getDiscoveryGroupConfiguration().getName(), bridgeControl.getDiscoveryGroupName());
Assert.assertEquals(bridgeConfig.getQueueName(), bridgeControl.getQueueName());
Assert.assertEquals(bridgeConfig.getForwardingAddress(), bridgeControl.getForwardingAddress());
Assert.assertEquals(bridgeConfig.getFilterString(), bridgeControl.getFilterString());
@@ -84,7 +86,8 @@
Assert.assertEquals(bridgeConfig.isUseDuplicateDetection(), bridgeControl.isUseDuplicateDetection());
String[] connectorPairData = bridgeControl.getStaticConnectors();
- Assert.assertEquals(bridgeConfig.getStaticConnectors().get(0), connectorPairData[0]);
+ TransportConfiguration[] connectors = (TransportConfiguration[])bridgeConfig.getDiscoveryGroupConfiguration().getParams().get((DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME));
+ Assert.assertEquals(connectors[0].getName(), connectorPairData[0]);
Assert.assertTrue(bridgeControl.isStarted());
}
@@ -159,8 +162,7 @@
RandomUtil.randomString(),
null,
false);
- List<String> connectors = new ArrayList<String>();
- connectors.add(connectorConfig.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(connectorConfig);
bridgeConfig = new BridgeConfiguration(RandomUtil.randomString(),
sourceQueueConfig.getName(),
targetQueueConfig.getAddress(),
@@ -172,7 +174,7 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -191,6 +193,7 @@
conf_0.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
conf_0.getQueueConfigurations().add(sourceQueueConfig);
+ conf_0.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
conf_0.getBridgeConfigurations().add(bridgeConfig);
server_1 = HornetQServers.newHornetQServer(conf_1, MBeanServerFactory.createMBeanServer(), false);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -22,6 +22,8 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
@@ -74,7 +76,7 @@
CoreMessagingProxy proxy = createProxy(bridgeConfig.getName());
Assert.assertEquals(bridgeConfig.getName(), (String)proxy.retrieveAttributeValue("name"));
- Assert.assertEquals(bridgeConfig.getDiscoveryGroupName(),
+ Assert.assertEquals(bridgeConfig.getDiscoveryGroupConfiguration().getName(),
(String)proxy.retrieveAttributeValue("discoveryGroupName"));
Assert.assertEquals(bridgeConfig.getQueueName(), (String)proxy.retrieveAttributeValue("queueName"));
Assert.assertEquals(bridgeConfig.getForwardingAddress(),
@@ -90,7 +92,8 @@
((Boolean)proxy.retrieveAttributeValue("useDuplicateDetection")).booleanValue());
Object[] data = (Object[])proxy.retrieveAttributeValue("staticConnectors");
- Assert.assertEquals(bridgeConfig.getStaticConnectors().get(0), data[0]);
+ TransportConfiguration[] connectors = (TransportConfiguration[])bridgeConfig.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ Assert.assertEquals(connectors[0].getName(), data[0]);
Assert.assertTrue((Boolean)proxy.retrieveAttributeValue("started"));
}
@@ -137,8 +140,7 @@
RandomUtil.randomString(),
null,
false);
- List<String> connectors = new ArrayList<String>();
- connectors.add(connectorConfig.getName());
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(connectorConfig);
bridgeConfig = new BridgeConfiguration(RandomUtil.randomString(),
sourceQueueConfig.getName(),
targetQueueConfig.getAddress(),
@@ -150,7 +152,7 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectors,
+ groupConf,
false,
ConfigurationImpl.DEFAULT_CLUSTER_USER,
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
@@ -169,6 +171,7 @@
conf_0.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
conf_0.getQueueConfigurations().add(sourceQueueConfig);
+ conf_0.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
conf_0.getBridgeConfigurations().add(bridgeConfig);
server_1 = HornetQServers.newHornetQServer(conf_1, MBeanServerFactory.createMBeanServer(), false);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -22,6 +22,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.BroadcastGroupControl;
import org.hornetq.core.config.BroadcastGroupConfiguration;
+import org.hornetq.core.config.BroadcastGroupConstants;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -54,13 +55,13 @@
public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration(final List<String> connectorInfos)
{
- return new BroadcastGroupConfiguration(RandomUtil.randomString(),
- null,
- 1198,
- "231.7.7.7",
- 1199,
- RandomUtil.randomPositiveInt(),
- connectorInfos);
+ return createBroadcastGroupConfiguration(RandomUtil.randomString(),
+ null,
+ 1198,
+ "231.7.7.7",
+ 1199,
+ RandomUtil.randomPositiveInt(),
+ connectorInfos);
}
public static Pair<String, String> randomPair()
@@ -92,21 +93,22 @@
BroadcastGroupControl broadcastGroupControl = createManagementControl(broadcastGroupConfig.getName());
Assert.assertEquals(broadcastGroupConfig.getName(), broadcastGroupControl.getName());
- Assert.assertEquals(broadcastGroupConfig.getGroupAddress(), broadcastGroupControl.getGroupAddress());
- Assert.assertEquals(broadcastGroupConfig.getGroupPort(), broadcastGroupControl.getGroupPort());
- Assert.assertEquals(broadcastGroupConfig.getLocalBindPort(), broadcastGroupControl.getLocalBindPort());
- Assert.assertEquals(broadcastGroupConfig.getBroadcastPeriod(), broadcastGroupControl.getBroadcastPeriod());
+ Assert.assertEquals(broadcastGroupConfig.getParams().get(BroadcastGroupConstants.GROUP_ADDRESS_NAME), broadcastGroupControl.getGroupAddress());
+ Assert.assertEquals(broadcastGroupConfig.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME), broadcastGroupControl.getGroupPort());
+ Assert.assertEquals(broadcastGroupConfig.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME), broadcastGroupControl.getLocalBindPort());
+ Assert.assertEquals(broadcastGroupConfig.getParams().get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME), broadcastGroupControl.getBroadcastPeriod());
Object[] connectorPairs = broadcastGroupControl.getConnectorPairs();
Assert.assertEquals(1, connectorPairs.length);
System.out.println(connectorPairs);
String connectorPairData = (String)connectorPairs[0];
- Assert.assertEquals(broadcastGroupConfig.getConnectorInfos().get(0), connectorPairData);
+ TransportConfiguration[] connectors = (TransportConfiguration[])broadcastGroupConfig.getParams().get(BroadcastGroupConstants.CONNECTOR_LIST_NAME);
+ Assert.assertEquals(connectors[0].getName(), connectorPairData);
String jsonString = broadcastGroupControl.getConnectorPairsAsJSON();
Assert.assertNotNull(jsonString);
JSONArray array = new JSONArray(jsonString);
Assert.assertEquals(1, array.length());
- Assert.assertEquals(broadcastGroupConfig.getConnectorInfos().get(0), array.getString(0));
+ Assert.assertEquals(connectors[0].getName(), array.getString(0));
Assert.assertTrue(broadcastGroupControl.isStarted());
}
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -130,6 +130,13 @@
null,
false);
+ DiscoveryGroupConfiguration discoveryGroupConfig = createSimpleUDPDiscoveryGroupConfiguration(discoveryName,
+ null,
+ groupAddress,
+ groupPort,
+ 0,
+ 0);
+
clusterConnectionConfig_0 = new ClusterConnectionConfiguration(clusterName,
queueConfig.getAddress(),
clusterName,
@@ -138,22 +145,17 @@
false,
1,
1024,
- discoveryName);
+ discoveryGroupConfig,
+ false);
List<String> connectorInfos = new ArrayList<String>();
connectorInfos.add("netty");
- BroadcastGroupConfiguration broadcastGroupConfig = new BroadcastGroupConfiguration(discoveryName,
- null,
- -1,
- groupAddress,
- groupPort,
- 250,
- connectorInfos);
- DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(discoveryName,
- null,
- groupAddress,
- groupPort,
- 0,
- 0);
+ BroadcastGroupConfiguration broadcastGroupConfig = createBroadcastGroupConfiguration(discoveryName,
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ 250,
+ connectorInfos);
Configuration conf_1 = createBasicConfig();
conf_1.setSecurityEnabled(false);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -24,6 +24,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -81,7 +82,7 @@
Assert.assertEquals(clusterConnectionConfig1.getName(), clusterConnectionControl.getName());
Assert.assertEquals(clusterConnectionConfig1.getAddress(), clusterConnectionControl.getAddress());
- Assert.assertEquals(clusterConnectionConfig1.getDiscoveryGroupName(),
+ Assert.assertEquals(clusterConnectionConfig1.getDiscoveryGroupConfiguration().getName(),
clusterConnectionControl.getDiscoveryGroupName());
Assert.assertEquals(clusterConnectionConfig1.getRetryInterval(), clusterConnectionControl.getRetryInterval());
Assert.assertEquals(clusterConnectionConfig1.isDuplicateDetection(),
@@ -93,13 +94,14 @@
Object[] connectors = clusterConnectionControl.getStaticConnectors();
Assert.assertEquals(1, connectors.length);
String connector = (String)connectors[0];
- Assert.assertEquals(clusterConnectionConfig1.getStaticConnectors().get(0), connector);
+ TransportConfiguration[] clusterConnectors = (TransportConfiguration[])clusterConnectionConfig1.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME);
+ Assert.assertEquals(clusterConnectors[0].getName(), connector);
String jsonString = clusterConnectionControl.getStaticConnectorsAsJSON();
Assert.assertNotNull(jsonString);
JSONArray array = new JSONArray(jsonString);
Assert.assertEquals(1, array.length());
- Assert.assertEquals(clusterConnectionConfig1.getStaticConnectors().get(0), array.getString(0));
+ Assert.assertEquals(clusterConnectors[0].getName(), array.getString(0));
Assert.assertNull(clusterConnectionControl.getDiscoveryGroupName());
@@ -114,7 +116,7 @@
Assert.assertEquals(clusterConnectionConfig2.getName(), clusterConnectionControl.getName());
Assert.assertEquals(clusterConnectionConfig2.getAddress(), clusterConnectionControl.getAddress());
- Assert.assertEquals(clusterConnectionConfig2.getDiscoveryGroupName(),
+ Assert.assertEquals(clusterConnectionConfig2.getDiscoveryGroupConfiguration().getName(),
clusterConnectionControl.getDiscoveryGroupName());
Assert.assertEquals(clusterConnectionConfig2.getRetryInterval(), clusterConnectionControl.getRetryInterval());
Assert.assertEquals(clusterConnectionConfig2.isDuplicateDetection(),
@@ -129,7 +131,7 @@
String jsonPairs = clusterConnectionControl.getStaticConnectorsAsJSON();
Assert.assertNull(jsonPairs);
- Assert.assertEquals(clusterConnectionConfig2.getDiscoveryGroupName(),
+ Assert.assertEquals(clusterConnectionConfig2.getDiscoveryGroupConfiguration().getName(),
clusterConnectionControl.getDiscoveryGroupName());
}
@@ -200,8 +202,7 @@
RandomUtil.randomString(),
null,
false);
- List<String> connectors = new ArrayList<String>();
- connectors.add(connectorConfig.getName());
+ DiscoveryGroupConfiguration staticGroupConfig = createStaticDiscoveryGroupConfiguration(connectorConfig);
clusterConnectionConfig1 = new ClusterConnectionConfiguration(RandomUtil.randomString(),
queueConfig.getAddress(),
@@ -211,10 +212,10 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
RandomUtil.randomPositiveInt(),
- connectors, false);
+ staticGroupConfig, false);
String discoveryGroupName = RandomUtil.randomString();
- DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration(discoveryGroupName, null, "230.1.2.3", 6745, 500, 0);
+ DiscoveryGroupConfiguration discoveryGroupConfig = createSimpleUDPDiscoveryGroupConfiguration(discoveryGroupName, null, "230.1.2.3", 6745, 500, 0);
clusterConnectionConfig2 = new ClusterConnectionConfiguration(RandomUtil.randomString(),
queueConfig.getAddress(),
@@ -224,7 +225,7 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
RandomUtil.randomPositiveInt(),
- discoveryGroupName);
+ discoveryGroupConfig, false);
Configuration conf_1 = createBasicConfig();
conf_1.setSecurityEnabled(false);
@@ -241,6 +242,7 @@
conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
conf_0.getClusterConfigurations().add(clusterConnectionConfig1);
conf_0.getClusterConfigurations().add(clusterConnectionConfig2);
+ conf_0.getDiscoveryGroupConfigurations().put(staticGroupConfig.getName(), staticGroupConfig);
conf_0.getDiscoveryGroupConfigurations().put(discoveryGroupName, discoveryGroupConfig);
mbeanServer_1 = MBeanServerFactory.createMBeanServer();
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -612,6 +612,8 @@
session.createQueue(sourceAddress, sourceQueue);
session.createQueue(targetAddress, targetQueue);
+ serverControl.createStaticDiscoveryGroup("static0", connectorConfig.getName());
+
serverControl.createBridge(name,
sourceQueue,
targetAddress,
@@ -623,9 +625,8 @@
false, // duplicateDetection
1, // confirmationWindowSize
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorConfig.getName(), // liveConnector
+ "static0", // liveConnector
false,
- false,
null,
null);
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -592,7 +592,6 @@
int confirmationWindowSize,
long clientFailureCheckPeriod,
String connectorNames,
- boolean useDiscovery,
boolean ha,
String user,
String password) throws Exception
@@ -610,7 +609,6 @@
confirmationWindowSize,
clientFailureCheckPeriod,
connectorNames,
- useDiscovery,
ha,
user,
password);
@@ -621,6 +619,27 @@
{
return (String)proxy.invokeOperation("listProducersInfoAsJSON");
}
+
+ public void createStaticDiscoveryGroup(String name, String connectors) throws Exception
+ {
+ proxy.invokeOperation("createStaticDiscoveryGroup", name, connectors);
+ }
+
+ public void createSimpleUDPDiscoveryGroup(String name,
+ String localBindAddress,
+ String groupAddress,
+ int groupPort,
+ long refreshTimeout,
+ long initialWaitTimeout) throws Exception
+ {
+ proxy.invokeOperation("createSimpleUDPDiscoveryGroup",
+ name,
+ localBindAddress,
+ groupAddress,
+ groupPort,
+ refreshTimeout,
+ initialWaitTimeout);
+ }
};
}
// Package protected ---------------------------------------------
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -13,13 +13,17 @@
package org.hornetq.tests.unit.core.config.impl;
+import java.util.List;
+
import junit.framework.Assert;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.BridgeConfiguration;
import org.hornetq.core.config.BroadcastGroupConfiguration;
+import org.hornetq.core.config.BroadcastGroupConstants;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.DivertConfiguration;
@@ -135,37 +139,37 @@
if (bc.getName().equals("bg1"))
{
Assert.assertEquals("bg1", bc.getName());
- Assert.assertEquals(10999, bc.getLocalBindPort());
- Assert.assertEquals("192.168.0.120", bc.getGroupAddress());
- Assert.assertEquals(11999, bc.getGroupPort());
- Assert.assertEquals(12345, bc.getBroadcastPeriod());
- Assert.assertEquals("connector1", bc.getConnectorInfos().get(0));
+ Assert.assertEquals(10999, bc.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME));
+ Assert.assertEquals("192.168.0.120", bc.getParams().get(BroadcastGroupConstants.GROUP_ADDRESS_NAME));
+ Assert.assertEquals(11999, bc.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME));
+ Assert.assertEquals(12345, bc.getParams().get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME));
+ Assert.assertEquals("connector1", ((List<String>)bc.getParams().get(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME)).get(0));
}
else
{
Assert.assertEquals("bg2", bc.getName());
- Assert.assertEquals(12999, bc.getLocalBindPort());
- Assert.assertEquals("192.168.0.121", bc.getGroupAddress());
- Assert.assertEquals(13999, bc.getGroupPort());
- Assert.assertEquals(23456, bc.getBroadcastPeriod());
- Assert.assertEquals("connector2", bc.getConnectorInfos().get(0));
+ Assert.assertEquals(12999, bc.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME));
+ Assert.assertEquals("192.168.0.121", bc.getParams().get(BroadcastGroupConstants.GROUP_ADDRESS_NAME));
+ Assert.assertEquals(13999, bc.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME));
+ Assert.assertEquals(23456, bc.getParams().get(BroadcastGroupConstants.BROADCAST_PERIOD_NAME));
+ Assert.assertEquals("connector2", ((List<String>)bc.getParams().get(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME)).get(0));
}
}
Assert.assertEquals(2, conf.getDiscoveryGroupConfigurations().size());
DiscoveryGroupConfiguration dc = conf.getDiscoveryGroupConfigurations().get("dg1");
Assert.assertEquals("dg1", dc.getName());
- Assert.assertEquals("192.168.0.120", dc.getGroupAddress());
- assertEquals("172.16.8.10", dc.getLocalBindAddress());
- Assert.assertEquals(11999, dc.getGroupPort());
- Assert.assertEquals(12345, dc.getRefreshTimeout());
+ Assert.assertEquals("192.168.0.120", dc.getParams().get(DiscoveryGroupConstants.GROUP_ADDRESS_NAME));
+ assertEquals("172.16.8.10", dc.getParams().get(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME));
+ Assert.assertEquals(11999, dc.getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME));
+ Assert.assertEquals(12345, dc.getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
dc = conf.getDiscoveryGroupConfigurations().get("dg2");
Assert.assertEquals("dg2", dc.getName());
- Assert.assertEquals("192.168.0.121", dc.getGroupAddress());
- assertEquals("172.16.8.11", dc.getLocalBindAddress());
- Assert.assertEquals(12999, dc.getGroupPort());
- Assert.assertEquals(23456, dc.getRefreshTimeout());
+ Assert.assertEquals("192.168.0.121", dc.getParams().get(DiscoveryGroupConstants.GROUP_ADDRESS_NAME));
+ assertEquals("172.16.8.11", dc.getParams().get(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME));
+ Assert.assertEquals(12999, dc.getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME));
+ Assert.assertEquals(23456, dc.getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
Assert.assertEquals(2, conf.getDivertConfigurations().size());
for (DivertConfiguration dic : conf.getDivertConfigurations())
@@ -206,8 +210,7 @@
Assert.assertEquals(0.2, bc.getRetryIntervalMultiplier());
Assert.assertEquals(2, bc.getReconnectAttempts());
Assert.assertEquals(true, bc.isUseDuplicateDetection());
- Assert.assertEquals("connector1", bc.getStaticConnectors().get(0));
- Assert.assertEquals(null, bc.getDiscoveryGroupName());
+ Assert.assertEquals("connector1", ((TransportConfiguration[])bc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME))[0].getName());
}
else
{
@@ -216,8 +219,7 @@
Assert.assertEquals("bridge-forwarding-address2", bc.getForwardingAddress());
Assert.assertEquals(null, bc.getFilterString());
Assert.assertEquals(null, bc.getTransformerClassName());
- Assert.assertEquals(null, bc.getStaticConnectors());
- Assert.assertEquals("dg1", bc.getDiscoveryGroupName());
+ Assert.assertEquals("dg1", bc.getDiscoveryGroupConfiguration().getName());
}
}
@@ -232,9 +234,8 @@
Assert.assertEquals(true, ccc.isDuplicateDetection());
Assert.assertEquals(false, ccc.isForwardWhenNoConsumers());
Assert.assertEquals(1, ccc.getMaxHops());
- Assert.assertEquals("connector1", ccc.getStaticConnectors().get(0));
- Assert.assertEquals("connector2", ccc.getStaticConnectors().get(1));
- Assert.assertEquals(null, ccc.getDiscoveryGroupName());
+ Assert.assertEquals("connector1", ((TransportConfiguration[])ccc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME))[0].getName());
+ Assert.assertEquals("connector2", ((TransportConfiguration[])ccc.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME))[1].getName());
}
else
{
@@ -244,8 +245,7 @@
Assert.assertEquals(false, ccc.isDuplicateDetection());
Assert.assertEquals(true, ccc.isForwardWhenNoConsumers());
Assert.assertEquals(2, ccc.getMaxHops());
- Assert.assertEquals(null, ccc.getStaticConnectors());
- Assert.assertEquals("dg1", ccc.getDiscoveryGroupName());
+ Assert.assertEquals("dg1", ccc.getDiscoveryGroupConfiguration().getName());
}
}
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/util/JMSClusteredTestBase.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -23,6 +23,7 @@
import javax.jms.Topic;
import javax.naming.NamingException;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.api.jms.JMSFactoryType;
@@ -129,23 +130,21 @@
*/
private void setupServer2() throws Exception
{
- List<String> toOtherServerPair = new ArrayList<String>();
- toOtherServerPair.add("toServer1");
-
Configuration conf2 = createDefaultConfig(1, generateInVMParams(1), InVMAcceptorFactory.class.getCanonicalName());
conf2.setSecurityEnabled(false);
conf2.setJMXManagementEnabled(true);
conf2.setPersistenceEnabled(false);
- conf2.getConnectorConfigurations().put("toServer1",
- new TransportConfiguration(InVMConnectorFactory.class.getName(),
- generateInVMParams(0)));
+ TransportConfiguration toServer1 = new TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(0));
+ conf2.getConnectorConfigurations().put("toServer1", toServer1);
conf2.getConnectorConfigurations().put("server2",
new TransportConfiguration(InVMConnectorFactory.class.getName(),
generateInVMParams(1)));
conf2.setClustered(true);
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(toServer1);
+ conf2.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
conf2.getClusterConfigurations().add(new ClusterConnectionConfiguration("to-server1",
"jms",
"server2",
@@ -154,7 +153,7 @@
true,
MAX_HOPS,
1024,
- toOtherServerPair, false));
+ groupConf, false));
JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl();
@@ -173,24 +172,22 @@
*/
private void setupServer1() throws Exception
{
- List<String> toOtherServerPair = new ArrayList<String>();
- toOtherServerPair.add("toServer2");
-
Configuration conf1 = createDefaultConfig(0, generateInVMParams(0), InVMAcceptorFactory.class.getCanonicalName());
conf1.setSecurityEnabled(false);
conf1.setJMXManagementEnabled(true);
conf1.setPersistenceEnabled(false);
- conf1.getConnectorConfigurations().put("toServer2",
- new TransportConfiguration(InVMConnectorFactory.class.getName(),
- generateInVMParams(1)));
+ TransportConfiguration toServer2 = new TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(1));
+ conf1.getConnectorConfigurations().put("toServer2", toServer2);
conf1.getConnectorConfigurations().put("server1",
new TransportConfiguration(InVMConnectorFactory.class.getName(),
generateInVMParams(0)));
conf1.setClustered(true);
+ DiscoveryGroupConfiguration groupConf = createStaticDiscoveryGroupConfiguration(toServer2);
+ conf1.getDiscoveryGroupConfigurations().put(groupConf.getName(), groupConf);
conf1.getClusterConfigurations().add(new ClusterConnectionConfiguration("to-server2",
"jms",
"server1",
@@ -199,7 +196,7 @@
true,
MAX_HOPS,
1024,
- toOtherServerPair, false));
+ groupConf, false));
JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl();
Modified: branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-02-16 04:47:04 UTC (rev 10215)
+++ branches/HORNETQ-316/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-02-16 10:29:21 UTC (rev 10216)
@@ -47,13 +47,21 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
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.api.core.client.HornetQClient;
import org.hornetq.core.asyncio.impl.AsynchronousFileImpl;
+import org.hornetq.core.client.impl.SimpleUDPServerLocatorImpl;
+import org.hornetq.core.client.impl.StaticServerLocatorImpl;
+import org.hornetq.core.config.BridgeConfiguration;
+import org.hornetq.core.config.BroadcastGroupConfiguration;
+import org.hornetq.core.config.BroadcastGroupConstants;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.journal.impl.AIOSequentialFileFactory;
@@ -70,6 +78,7 @@
import org.hornetq.core.server.MessageReference;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
+import org.hornetq.core.server.cluster.impl.BroadcastGroupImpl;
import org.hornetq.core.server.impl.ServerMessageImpl;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
@@ -226,6 +235,59 @@
return value.substring(0, posPoint + 1) + (last + variant);
}
+ protected static DiscoveryGroupConfiguration createSimpleUDPDiscoveryGroupConfiguration(String name,
+ String localBindAddr,
+ String groupAddr,
+ int groupPort,
+ long refreshTimeout,
+ long discoveryInitialTimeout)
+ {
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME, localBindAddr);
+ params.put(DiscoveryGroupConstants.GROUP_ADDRESS_NAME, groupAddr);
+ params.put(DiscoveryGroupConstants.GROUP_PORT_NAME, groupPort);
+ params.put(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME, refreshTimeout);
+ params.put(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME, discoveryInitialTimeout);
+ return new DiscoveryGroupConfiguration(SimpleUDPServerLocatorImpl.class.getName(), params, name);
+ }
+
+ protected static DiscoveryGroupConfiguration createSimpleUDPDiscoveryGroupConfiguration(String groupAddr, int groupPort)
+ {
+ return createSimpleUDPDiscoveryGroupConfiguration(UUIDGenerator.getInstance().generateStringUUID(),
+ null,
+ groupAddr,
+ groupPort,
+ HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
+ HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT);
+ }
+
+ protected static DiscoveryGroupConfiguration createStaticDiscoveryGroupConfiguration(TransportConfiguration... connectors)
+ {
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(DiscoveryGroupConstants.STATIC_CONNECTORS_LIST_NAME, connectors);
+ return new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(),
+ params,
+ UUIDGenerator.getInstance().generateStringUUID());
+ }
+
+ protected static BroadcastGroupConfiguration createBroadcastGroupConfiguration(String name,
+ String localBindAddress,
+ int localBindPort,
+ String groupAddress,
+ int groupPort,
+ long broadcastPeriod,
+ List<String> connectorInfos)
+ {
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.LOCAL_BIND_ADDRESS_NAME, localBindAddress);
+ params.put(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME, localBindPort);
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, groupPort);
+ params.put(BroadcastGroupConstants.BROADCAST_PERIOD_NAME, broadcastPeriod);
+ params.put(BroadcastGroupConstants.CONNECTOR_REF_LIST_NAME, connectorInfos);
+ return new BroadcastGroupConfiguration(BroadcastGroupImpl.class.getName(), params, name);
+ }
+
public static int getUDPDiscoveryPort()
{
return Integer.parseInt(System.getProperty("TEST-UDP-PORT", "6750"));
13 years, 10 months
JBoss hornetq SVN: r10215 - branches/Branch_2_2_EAP.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-15 23:47:04 -0500 (Tue, 15 Feb 2011)
New Revision: 10215
Modified:
branches/Branch_2_2_EAP/.classpath
Log:
oops
Modified: branches/Branch_2_2_EAP/.classpath
===================================================================
--- branches/Branch_2_2_EAP/.classpath 2011-02-16 04:43:31 UTC (rev 10214)
+++ branches/Branch_2_2_EAP/.classpath 2011-02-16 04:47:04 UTC (rev 10215)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/.svn/**/*" kind="src" path="src/main"/>
- <classpathentry kind="src" path="order-test-putnam"/>
<classpathentry kind="src" path="src/config/common"/>
<classpathentry kind="src" path="build/src"/>
<classpathentry kind="src" path="tests/jms-tests/config"/>
13 years, 10 months
JBoss hornetq SVN: r10214 - in branches/Branch_2_2_EAP/src/main/org/hornetq/core: server/impl and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-15 23:43:31 -0500 (Tue, 15 Feb 2011)
New Revision: 10214
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
Log:
Fixing test on AddressSettings
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2011-02-16 04:28:00 UTC (rev 10213)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2011-02-16 04:43:31 UTC (rev 10214)
@@ -467,7 +467,7 @@
public synchronized Binding removeBinding(final SimpleString uniqueName) throws Exception
{
- addressSettingsRepository.clear();
+ addressSettingsRepository.clearCache();
Binding binding = addressManager.removeBinding(uniqueName);
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-02-16 04:28:00 UTC (rev 10213)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-02-16 04:43:31 UTC (rev 10214)
@@ -1011,7 +1011,7 @@
public void destroyQueue(final SimpleString queueName, final ServerSession session) throws Exception
{
- addressSettingsRepository.clear();
+ addressSettingsRepository.clearCache();
Binding binding = postOffice.getBinding(queueName);
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java 2011-02-16 04:28:00 UTC (rev 10213)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/HierarchicalRepository.java 2011-02-16 04:43:31 UTC (rev 10214)
@@ -63,5 +63,7 @@
*/
void clear();
+ void clearCache();
+
int getCacheSize();
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-02-16 04:28:00 UTC (rev 10213)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/settings/impl/HierarchicalObjectRepository.java 2011-02-16 04:43:31 UTC (rev 10214)
@@ -69,7 +69,7 @@
*/
public void addMatch(final String match, final T value)
{
- cache.clear();
+ clearCache();
Match.verify(match);
Match<T> match1 = new Match<T>(match);
match1.setValue(value);
@@ -159,7 +159,7 @@
{
matches.remove(match);
new Exception("Clearing cache").printStackTrace();
- cache.clear();
+ clearCache();
onChange();
}
@@ -180,16 +180,21 @@
*/
public void setDefault(final T defaultValue)
{
- cache.clear();
+ clearCache();
defaultmatch = defaultValue;
}
public void clear()
{
- cache.clear();
+ clearCache();
listeners.clear();
matches.clear();
}
+
+ public void clearCache()
+ {
+ cache.clear();
+ }
private void onChange()
{
13 years, 10 months
JBoss hornetq SVN: r10213 - in branches/Branch_2_2_EAP: src/main/org/hornetq/utils and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-15 23:28:00 -0500 (Tue, 15 Feb 2011)
New Revision: 10213
Modified:
branches/Branch_2_2_EAP/.classpath
branches/Branch_2_2_EAP/src/main/org/hornetq/utils/LinkedListImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java
Log:
fixing tests / tweaks
Modified: branches/Branch_2_2_EAP/.classpath
===================================================================
--- branches/Branch_2_2_EAP/.classpath 2011-02-16 00:15:54 UTC (rev 10212)
+++ branches/Branch_2_2_EAP/.classpath 2011-02-16 04:28:00 UTC (rev 10213)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/.svn/**/*" kind="src" path="src/main"/>
+ <classpathentry kind="src" path="order-test-putnam"/>
<classpathentry kind="src" path="src/config/common"/>
<classpathentry kind="src" path="build/src"/>
<classpathentry kind="src" path="tests/jms-tests/config"/>
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/utils/LinkedListImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/utils/LinkedListImpl.java 2011-02-16 00:15:54 UTC (rev 10212)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/utils/LinkedListImpl.java 2011-02-16 04:28:00 UTC (rev 10213)
@@ -182,7 +182,7 @@
toRemove.next = toRemove.prev = null;
}
- private void nudgeIterators(Node<E> node)
+ private synchronized void nudgeIterators(Node<E> node)
{
for (int i = 0; i < numIters; i++)
{
@@ -194,7 +194,7 @@
}
}
- private void addIter(Iterator iter)
+ private synchronized void addIter(Iterator iter)
{
if (numIters == iters.length)
{
@@ -206,7 +206,7 @@
numIters++;
}
- private void resize(int newSize)
+ private synchronized void resize(int newSize)
{
Iterator[] newIters = createIteratorArray(newSize);
@@ -215,7 +215,7 @@
iters = newIters;
}
- private void removeIter(Iterator iter)
+ private synchronized void removeIter(Iterator iter)
{
for (int i = 0; i < numIters; i++)
{
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java 2011-02-16 00:15:54 UTC (rev 10212)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/xa/BasicXaTest.java 2011-02-16 04:28:00 UTC (rev 10213)
@@ -406,7 +406,7 @@
clientSession2.close();
}
-
+
public void testReceiveRollback() throws Exception
{
int numSessions = 100;
@@ -1020,7 +1020,6 @@
try
{
message.acknowledge();
- BasicXaTest.log.info("processed message " + (received++));
}
catch (HornetQException e)
{
13 years, 10 months
JBoss hornetq SVN: r10212 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-15 19:15:54 -0500 (Tue, 15 Feb 2011)
New Revision: 10212
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java
Log:
fixing tests / accidental commit
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java 2011-02-16 00:07:02 UTC (rev 10211)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/persistence/impl/journal/LargeServerMessageImpl.java 2011-02-16 00:15:54 UTC (rev 10212)
@@ -173,7 +173,7 @@
// This file is linked to another message, deleting the reference where it belongs on this case
linkMessage.decrementDelayDeletionCount();
}
- else if (delayDeletionCount.get() <= 0)
+ else
{
if (LargeServerMessageImpl.isTrace)
{
@@ -192,27 +192,18 @@
}
}
- public int incrementRefCount() throws Exception
- {
- int value = super.incrementRefCount();
-
-// new Exception("increment, value=" + value +
-// " on msgCount = " +
-// this.getIntProperty("counter-message") +
-// " messageID=" +
-// this.getMessageID()).printStackTrace();
-
- return value;
- }
-
- static int deleted = 0;
-
@Override
public synchronized int decrementRefCount() throws Exception
{
int currentRefCount = super.decrementRefCount();
- checkDelete();
+ // We use <= as this could be used by load.
+ // because of a failure, no references were loaded, so we have 0... and we still need to delete the associated
+ // files
+ if (delayDeletionCount.get() <= 0)
+ {
+ checkDelete();
+ }
return currentRefCount;
}
@@ -324,7 +315,7 @@
file = storageManager.createFileForLargeMessage(getMessageID(), durable);
file.open();
-
+
bodySize = file.size();
}
}
13 years, 10 months
JBoss hornetq SVN: r10211 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-15 19:07:02 -0500 (Tue, 15 Feb 2011)
New Revision: 10211
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ScheduledDeliveryHandlerImpl.java
Log:
tweak
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ScheduledDeliveryHandlerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ScheduledDeliveryHandlerImpl.java 2011-02-15 22:33:01 UTC (rev 10210)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/ScheduledDeliveryHandlerImpl.java 2011-02-16 00:07:02 UTC (rev 10211)
@@ -195,7 +195,11 @@
for (MessageReference reference : references)
{
- reference.getQueue().addTail(reference);
+ Queue queue = reference.getQueue();
+ synchronized (queue)
+ {
+ queue.addTail(reference);
+ }
}
// Just to speed up GC
13 years, 10 months
JBoss hornetq SVN: r10210 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-02-15 17:33:01 -0500 (Tue, 15 Feb 2011)
New Revision: 10210
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java
Log:
adding comment
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-02-15 22:30:27 UTC (rev 10209)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-02-15 22:33:01 UTC (rev 10210)
@@ -1275,6 +1275,8 @@
{
for (ConsumerHolder holder : this.consumerList)
{
+ // GC finalize will take care of closing it
+ // We can't close it now as the iterator could be already being used
holder.iter = null;
}
}
13 years, 10 months