Author: igarashitm
Date: 2011-11-24 14:42:20 -0500 (Thu, 24 Nov 2011)
New Revision: 11762
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/AbstractServerLocator.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/StaticServerLocatorImpl.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/BroadcastGroupConfiguration.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/StaticClusterConnectorImpl.java
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/UDPDiscoveryClusterConnectorImpl.java
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/core/config/impl/FileConfigurationTest.java
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/ConnectionFactoryProperties.java
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/HornetQResourceAdapter.java
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/discovery/DiscoveryTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/ra/ResourceAdapterTest.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/JMSClusteredTestBase.java
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java
Log:
https://issues.jboss.org/browse/HORNETQ-316 fix compile errors in existing testcases
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/AbstractServerLocator.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/AbstractServerLocator.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/AbstractServerLocator.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -52,6 +52,10 @@
*/
public abstract class AbstractServerLocator implements ServerLocatorInternal,
DiscoveryListener, Serializable
{
+ // To be called when there are ServerLocator being finalized.
+ // To be used on test assertions
+ public static Runnable finalizeCallback = null;
+
private static final long serialVersionUID = -1615857864410205260L;
protected enum STATE
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/StaticServerLocatorImpl.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/StaticServerLocatorImpl.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/client/impl/StaticServerLocatorImpl.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -40,10 +40,6 @@
private final Exception e = new Exception();
- // To be called when there are ServerLocator being finalized.
- // To be used on test assertions
- public static Runnable finalizeCallback = null;
-
@Override
protected void initialiseInternal()
{
@@ -302,9 +298,9 @@
log.warn("The ServerLocator you didn't close was created
here:", e);
- if (StaticServerLocatorImpl.finalizeCallback != null)
+ if (AbstractServerLocator.finalizeCallback != null)
{
- StaticServerLocatorImpl.finalizeCallback.run();
+ AbstractServerLocator.finalizeCallback.run();
}
close();
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/BroadcastGroupConfiguration.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/BroadcastGroupConfiguration.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/BroadcastGroupConfiguration.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -43,7 +43,8 @@
private final List<TransportConfiguration> connectorList;
public BroadcastGroupConfiguration(final String name,
- final String clazz, final Map<String, Object> params,
+ final String clazz,
+ final Map<String, Object> params,
final List<TransportConfiguration>
connectors)
{
super();
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -17,6 +17,7 @@
import java.util.List;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.core.config.impl.ConfigurationImpl;
@@ -66,7 +67,7 @@
private final boolean allowDirectConnectionsOnly;
- private final List<TransportConfiguration> directConnectors;
+ private final List<TransportConfiguration> staticConnectors;
public ClusterConnectionConfiguration(final String name,
final String address,
@@ -76,7 +77,8 @@
final boolean forwardWhenNoConsumers,
final int maxHops,
final int confirmationWindowSize,
- final DiscoveryGroupConfiguration
discoveryGroupConfig)
+ final DiscoveryGroupConfiguration
discoveryGroupConfig,
+ boolean allowDirectConnectionsOnly)
{
this(name,
address,
@@ -93,7 +95,9 @@
maxHops,
confirmationWindowSize,
discoveryGroupConfig,
- false, null);
+ allowDirectConnectionsOnly,
+ (List<TransportConfiguration>)discoveryGroupConfig.getParams()
+
.get(DiscoveryGroupConstants.STATIC_CONNECTOR_CONFIG_LIST_NAME));
}
@@ -113,7 +117,7 @@
final int confirmationWindowSize,
final DiscoveryGroupConfiguration
discoveryGroupConfig,
boolean allowDirectConnectionsOnly,
- final List<TransportConfiguration>
directConnectors)
+ final List<TransportConfiguration>
staticConnectors)
{
this.name = name;
this.address = address;
@@ -131,7 +135,7 @@
this.maxHops = maxHops;
this.confirmationWindowSize = confirmationWindowSize;
this.allowDirectConnectionsOnly = allowDirectConnectionsOnly;
- this.directConnectors = directConnectors;
+ this.staticConnectors = staticConnectors;
}
public String getName()
@@ -214,9 +218,9 @@
return confirmationWindowSize;
}
- public List<TransportConfiguration> getAllowedConnectors()
+ public List<TransportConfiguration> getStaticConnectors()
{
- return directConnectors;
+ return staticConnectors;
}
public DiscoveryGroupConfiguration getDiscoveryGroupConfiguration()
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/BroadcastGroupControlImpl.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -95,7 +95,7 @@
int i = 0;
for (TransportConfiguration connector : configuration.getConnectorList())
{
- ret[i++] = connector;
+ ret[i++] = connector.getName();
}
return ret;
@@ -115,7 +115,7 @@
for (TransportConfiguration connector : configuration.getConnectorList())
{
- array.put(connector);
+ array.put(connector.getName());
}
return array.toString();
}
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/management/impl/ClusterConnectionControlImpl.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -24,7 +24,6 @@
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.server.cluster.ClusterConnection;
-import org.hornetq.utils.ConfigurationHelper;
import org.hornetq.utils.json.JSONArray;
/**
@@ -155,12 +154,12 @@
{
return null;
}
-
+
String[] array = new String[connectors.size()];
for (int i=0; i>connectors.size(); i++)
{
- array[i] = connectors.get(i).toString();
+ array[i] = connectors.get(i).getName();
}
return array;
}
@@ -179,7 +178,7 @@
(List<TransportConfiguration>)configuration
.getDiscoveryGroupConfiguration()
.getParams()
- .get(DiscoveryGroupConstants.STATIC_CONNECTOR_CONFIG_LIST_NAME);
+ .get(DiscoveryGroupConstants.STATIC_CONNECTOR_CONFIG_LIST_NAME);
if (connectors == null)
{
@@ -187,10 +186,10 @@
}
JSONArray array = new JSONArray();
-
+
for (TransportConfiguration connector : connectors)
- {
- array.put(connector.toString());
+ {
+ array.put(connector.getName());
}
return array.toString();
}
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -630,7 +630,7 @@
server.getConfiguration().getClusterUser(),
server.getConfiguration().getClusterPassword(),
config.isAllowDirectConnectionsOnly(),
- config.getAllowedConnectors());
+ config.getStaticConnectors());
if (defaultClusterConnection == null)
{
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/StaticClusterConnectorImpl.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/StaticClusterConnectorImpl.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/StaticClusterConnectorImpl.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -24,7 +24,7 @@
/**
* A StaticClusterConnectorImpl
*/
-class StaticClusterConnectorImpl implements ClusterConnector
+public class StaticClusterConnectorImpl implements ClusterConnector
{
private final ClusterConnectionImpl clusterConnectionImpl;
private final List<TransportConfiguration> tcConfigs;
Modified:
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/UDPDiscoveryClusterConnectorImpl.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/UDPDiscoveryClusterConnectorImpl.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/UDPDiscoveryClusterConnectorImpl.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -20,7 +20,7 @@
/**
* A UDPDiscoveryClusterConnectorImpl
*/
-class UDPDiscoveryClusterConnectorImpl implements ClusterConnector
+public class UDPDiscoveryClusterConnectorImpl implements ClusterConnector
{
private final ClusterConnectionImpl clusterConnectionImpl;
private final DiscoveryGroupConfiguration dg;
Modified:
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/core/config/impl/FileConfigurationTest.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/core/config/impl/FileConfigurationTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/core/config/impl/FileConfigurationTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -16,16 +16,18 @@
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;
-import org.hornetq.core.config.impl.FileConfiguration;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.JournalType;
+import org.hornetq.utils.ConfigurationHelper;
/**
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
@@ -135,37 +137,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,
ConfigurationHelper.getIntProperty(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME, -1,
bc.getParams()));
+ Assert.assertEquals("192.168.0.120",
ConfigurationHelper.getStringProperty(BroadcastGroupConstants.GROUP_ADDRESS_NAME, null,
bc.getParams()));
+ Assert.assertEquals(11999,
ConfigurationHelper.getIntProperty(BroadcastGroupConstants.GROUP_PORT_NAME, -1,
bc.getParams()));
+ Assert.assertEquals(12345,
ConfigurationHelper.getIntProperty(BroadcastGroupConstants.BROADCAST_PERIOD_NAME, -1,
bc.getParams()));
+ Assert.assertEquals("connector1",
bc.getConnectorList().get(0).getName());
}
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,
ConfigurationHelper.getIntProperty(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME, -1,
bc.getParams()));
+ Assert.assertEquals("192.168.0.121",
ConfigurationHelper.getStringProperty(BroadcastGroupConstants.GROUP_ADDRESS_NAME, null,
bc.getParams()));
+ Assert.assertEquals(13999,
ConfigurationHelper.getIntProperty(BroadcastGroupConstants.GROUP_PORT_NAME, -1,
bc.getParams()));
+ Assert.assertEquals(23456,
ConfigurationHelper.getIntProperty(BroadcastGroupConstants.BROADCAST_PERIOD_NAME, -1,
bc.getParams()));
+ Assert.assertEquals("connector2",
bc.getConnectorList().get(0).getName());
}
}
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",
ConfigurationHelper.getStringProperty(DiscoveryGroupConstants.GROUP_ADDRESS_NAME, null,
dc.getParams()));
+ assertEquals("172.16.8.10",
ConfigurationHelper.getStringProperty(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME,
null, dc.getParams()));
+ Assert.assertEquals(11999,
ConfigurationHelper.getIntProperty(DiscoveryGroupConstants.GROUP_PORT_NAME, -1,
dc.getParams()));
+ Assert.assertEquals(12345,
ConfigurationHelper.getIntProperty(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME, -1,
dc.getParams()));
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",
ConfigurationHelper.getStringProperty(DiscoveryGroupConstants.GROUP_ADDRESS_NAME, null,
dc.getParams()));
+ assertEquals("172.16.8.11",
ConfigurationHelper.getStringProperty(DiscoveryGroupConstants.LOCAL_BIND_ADDRESS_NAME,
null, dc.getParams()));
+ Assert.assertEquals(12999,
ConfigurationHelper.getIntProperty(DiscoveryGroupConstants.GROUP_PORT_NAME, -1,
dc.getParams()));
+ Assert.assertEquals(23456,
ConfigurationHelper.getIntProperty(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME, -1,
dc.getParams()));
Assert.assertEquals(2, conf.getDivertConfigurations().size());
for (DivertConfiguration dic : conf.getDivertConfigurations())
@@ -235,7 +237,7 @@
Assert.assertEquals(123, ccc.getCallTimeout());
Assert.assertEquals("connector1",
ccc.getStaticConnectors().get(0));
Assert.assertEquals("connector2",
ccc.getStaticConnectors().get(1));
- Assert.assertEquals(null, ccc.getDiscoveryGroupName());
+ Assert.assertEquals(null, ccc.getDiscoveryGroupConfiguration().getName());
}
else
{
@@ -247,16 +249,16 @@
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());
}
}
-
-
+
+
assertEquals(2, conf.getAddressesSettings().size());
-
+
assertTrue(conf.getAddressesSettings().get("a1") != null);
assertTrue(conf.getAddressesSettings().get("a2") != null);
-
+
assertEquals("a1.1",
conf.getAddressesSettings().get("a1").getDeadLetterAddress().toString());
assertEquals("a1.2",
conf.getAddressesSettings().get("a1").getExpiryAddress().toString());
assertEquals(1,
conf.getAddressesSettings().get("a1").getRedeliveryDelay());
@@ -272,28 +274,28 @@
assertEquals(7126716262626l,
conf.getAddressesSettings().get("a2").getPageSizeBytes());
assertEquals(20,
conf.getAddressesSettings().get("a2").getPageCacheMaxSize());
assertEquals(8,
conf.getAddressesSettings().get("a2").getMessageCounterHistoryDayLimit());
-
-
+
+
assertEquals(2, conf.getQueueConfigurations().size());
-
+
assertEquals("queue1", conf.getQueueConfigurations().get(0).getName());
assertEquals("address1",
conf.getQueueConfigurations().get(0).getAddress());
assertEquals("color='red'",
conf.getQueueConfigurations().get(0).getFilterString());
assertEquals(false, conf.getQueueConfigurations().get(0).isDurable());
-
+
assertEquals("queue2", conf.getQueueConfigurations().get(1).getName());
assertEquals("address2",
conf.getQueueConfigurations().get(1).getAddress());
assertEquals("color='blue'",
conf.getQueueConfigurations().get(1).getFilterString());
assertEquals(false, conf.getQueueConfigurations().get(1).isDurable());
-
+
assertEquals(2, conf.getSecurityRoles().size());
assertTrue(conf.getSecurityRoles().containsKey("a1"));
-
+
assertTrue(conf.getSecurityRoles().containsKey("a2"));
-
+
Role a1Role = conf.getSecurityRoles().get("a1").toArray(new Role[1])[0];
-
+
assertFalse(a1Role.isSend());
assertFalse(a1Role.isConsume());
assertFalse(a1Role.isCreateDurableQueue());
@@ -301,9 +303,9 @@
assertTrue(a1Role.isCreateNonDurableQueue());
assertFalse(a1Role.isDeleteNonDurableQueue());
assertFalse(a1Role.isManage());
-
+
Role a2Role = conf.getSecurityRoles().get("a2").toArray(new Role[1])[0];
-
+
assertFalse(a2Role.isSend());
assertFalse(a2Role.isConsume());
assertFalse(a2Role.isCreateDurableQueue());
@@ -311,8 +313,8 @@
assertFalse(a2Role.isCreateNonDurableQueue());
assertTrue(a2Role.isDeleteNonDurableQueue());
assertFalse(a2Role.isManage());
-
+
}
public void testSetGetConfigurationURL()
Modified:
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java
===================================================================
---
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-core/src/test/java/org/hornetq/tests/util/UnitTestCase.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -31,6 +31,7 @@
import java.net.ServerSocket;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -49,6 +50,8 @@
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.Message;
@@ -56,9 +59,14 @@
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.AbstractServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
-import org.hornetq.core.client.impl.ServerLocatorImpl;
+import org.hornetq.core.client.impl.StaticServerLocatorImpl;
+import org.hornetq.core.client.impl.UDPServerLocatorImpl;
+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.PreparedTransactionInfo;
@@ -86,6 +94,9 @@
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.cluster.impl.StaticClusterConnectorImpl;
+import org.hornetq.core.server.cluster.impl.UDPDiscoveryClusterConnectorImpl;
import org.hornetq.core.server.impl.ServerMessageImpl;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.utils.UUIDGenerator;
@@ -249,6 +260,62 @@
return value.substring(0, posPoint + 1) + (last + variant);
}
+ protected static DiscoveryGroupConfiguration
createUDPDiscoveryGroupConfiguration(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(UDPServerLocatorImpl.class.getName(),
+
UDPDiscoveryClusterConnectorImpl.class.getName(),
+ params,
+ name);
+ }
+
+ protected static DiscoveryGroupConfiguration
createUDPDiscoveryGroupConfiguration(String groupAddr, int groupPort)
+ {
+ return
createUDPDiscoveryGroupConfiguration(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_CONNECTOR_CONFIG_LIST_NAME, connectors !=
null ? Arrays.asList(connectors) : null);
+ return new DiscoveryGroupConfiguration(StaticServerLocatorImpl.class.getName(),
+ StaticClusterConnectorImpl.class.getName(),
+ params,
+
UUIDGenerator.getInstance().generateStringUUID());
+ }
+
+ protected static BroadcastGroupConfiguration createBroadcastGroupConfiguration(String
name,
+ String
localBindAddress,
+ int
localBindPort,
+ String
groupAddress,
+ int
groupPort,
+ long
broadcastPeriod,
+
List<TransportConfiguration> connectorList)
+ {
+ Map<String,Object> params = new HashMap<String,Object>();
+ params.put(BroadcastGroupConstants.LOCAL_BIND_ADDRESS_NAME, localBindAddress);
+ params.put(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME,
Integer.toString(localBindPort));
+ params.put(BroadcastGroupConstants.GROUP_ADDRESS_NAME, groupAddress);
+ params.put(BroadcastGroupConstants.GROUP_PORT_NAME, Integer.toString(groupPort));
+ params.put(BroadcastGroupConstants.BROADCAST_PERIOD_NAME,
Long.toString(broadcastPeriod));
+ return new BroadcastGroupConfiguration(name, BroadcastGroupImpl.class.getName(),
params, connectorList);
+ }
+
public static int getUDPDiscoveryPort()
{
return Integer.parseInt(System.getProperty("TEST-UDP-PORT",
"6750"));
@@ -1101,7 +1168,7 @@
// We shutdown the global pools to give a better isolation between tests
try
{
- ServerLocatorImpl.clearThreadPools();
+ AbstractServerLocator.clearThreadPools();
}
catch (Throwable e)
{
Modified:
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/ConnectionFactoryProperties.java
===================================================================
---
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/ConnectionFactoryProperties.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/ConnectionFactoryProperties.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -43,7 +43,7 @@
* The transport config, changing the default configured from the RA
*/
private List<Map<String, Object>> connectionParameters;
-
+
private Boolean ha;
private String connectionLoadBalancingPolicyClassName;
@@ -100,6 +100,8 @@
private Integer threadPoolMaxSize;
+ private Map<String, Object> discoveryPluginParameters;
+
/**
* @return the transportType
*/
@@ -125,17 +127,28 @@
hasBeenUpdated = true;
}
+ public Map<String, Object> getParsedDiscoveryPluginParameters()
+ {
+ return discoveryPluginParameters;
+ }
+
+ public void setParsedDiscoveryPluginParameters(final Map<String, Object>
discoveryPluginParameters)
+ {
+ this.discoveryPluginParameters = discoveryPluginParameters;
+ hasBeenUpdated = true;
+ }
+
public Boolean isHA()
{
return ha;
}
-
+
public void setHA(final Boolean ha)
{
hasBeenUpdated = true;
this.ha = ha;
}
-
+
public String getConnectionLoadBalancingPolicyClassName()
{
if (ConnectionFactoryProperties.trace)
Modified:
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
---
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/HornetQResourceAdapter.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/HornetQResourceAdapter.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -32,6 +32,7 @@
import javax.transaction.xa.XAResource;
import org.hornetq.api.core.DiscoveryGroupConfiguration;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSession;
@@ -57,7 +58,7 @@
public class HornetQResourceAdapter implements ResourceAdapter, Serializable
{
/**
- *
+ *
*/
private static final long serialVersionUID = 4756893709825838770L;
@@ -80,7 +81,7 @@
* The resource adapter properties
*/
private final HornetQRAProperties raProperties;
-
+
/**
* The resource adapter properties before parsing
*/
@@ -93,6 +94,11 @@
private String unparsedConnectors;
/**
+ * The discovery plugin properties for resource adapter before parsing
+ */
+ private String unparsedDiscoveryPluginProperties;
+
+ /**
* Have the factory been configured
*/
private final AtomicBoolean configured;
@@ -103,7 +109,7 @@
private final Map<ActivationSpec, HornetQActivation> activations;
private HornetQConnectionFactory defaultHornetQConnectionFactory;
-
+
private TransactionManager tm;
private String unparsedJndiParams;
@@ -211,7 +217,7 @@
{
HornetQResourceAdapter.log.trace("start(" + ctx + ")");
}
-
+
locateTM();
recoveryManager.start();
@@ -287,7 +293,20 @@
}
}
+ public String getDiscoveryPluginParameters()
+ {
+ return unparsedDiscoveryPluginProperties;
+ }
+ public void setDiscoveryPluginProperties(final String config)
+ {
+ if (config != null)
+ {
+ this.unparsedDiscoveryPluginProperties = config;
+
raProperties.setParsedDiscoveryPluginParameters(Util.parseDiscoveryPluginConfig(config));
+ }
+ }
+
public Boolean getHA()
{
return raProperties.isHA();
@@ -1212,6 +1231,7 @@
* @param obj Object with which to compare
* @return True if this object is the same as the obj argument; false otherwise.
*/
+ @Override
public boolean equals(final Object obj)
{
if (HornetQResourceAdapter.trace)
@@ -1239,6 +1259,7 @@
*
* @return The hash code
*/
+ @Override
public int hashCode()
{
if (HornetQResourceAdapter.trace)
@@ -1423,7 +1444,7 @@
String discoveryAddress = overrideProperties.getDiscoveryAddress() != null ?
overrideProperties.getDiscoveryAddress()
:
getDiscoveryAddress();
-
+
Boolean ha = overrideProperties.isHA() != null ? overrideProperties.isHA() :
getHA();
if(ha == null)
@@ -1433,21 +1454,16 @@
if (discoveryAddress != null)
{
+ Map<String, Object> params = new HashMap<String, Object>();
+
Integer discoveryPort = overrideProperties.getDiscoveryPort() != null ?
overrideProperties.getDiscoveryPort()
:
getDiscoveryPort();
-
+
if(discoveryPort == null)
{
discoveryPort = HornetQClient.DEFAULT_DISCOVERY_PORT;
}
- DiscoveryGroupConfiguration groupConfiguration = new
DiscoveryGroupConfiguration(discoveryAddress, discoveryPort);
-
- if (log.isDebugEnabled())
- {
- log.debug("Creating Connection Factory on the resource adapter for
discovery=" + groupConfiguration + " with ha=" + ha);
- }
-
Long refreshTimeout = overrideProperties.getDiscoveryRefreshTimeout() != null ?
overrideProperties.getDiscoveryRefreshTimeout()
:
raProperties.getDiscoveryRefreshTimeout();
if (refreshTimeout == null)
@@ -1463,10 +1479,24 @@
initialTimeout = HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT;
}
- groupConfiguration.setDiscoveryInitialWaitTimeout(initialTimeout);
+ params.put(DiscoveryGroupConstants.GROUP_ADDRESS_NAME, discoveryAddress);
+ params.put(DiscoveryGroupConstants.GROUP_PORT_NAME, discoveryPort);
+ params.put(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME, refreshTimeout);
+ params.put(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME, initialTimeout);
- groupConfiguration.setRefreshTimeout(refreshTimeout);
+ DiscoveryGroupConfiguration groupConfiguration =
+ new DiscoveryGroupConfiguration(
+
"org.hornetq.core.client.impl.UDPServerLocatorImpl",
+
"org.hornetq.core.server.cluster.impl.UDPDiscoveryClusterConnectorImpl",
+ params, null);
+ if (log.isDebugEnabled())
+ {
+ log.debug("Creating Connection Factory on the resource adapter for
discovery=" + groupConfiguration +
+ " with ha=" + ha);
+ }
+
+
if (ha)
{
cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration,
JMSFactoryType.XA_CF);
@@ -1476,6 +1506,32 @@
cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration,
JMSFactoryType.XA_CF);
}
}
+ else if (this.unparsedDiscoveryPluginProperties != null)
+ {
+ // for another discovery strategy like hornetq-jgroups-discovery
+ Map<String, Object> discoveryPluginParams =
+
overrideConnectionParameters(overrideProperties.getParsedDiscoveryPluginParameters(),
+
raProperties.getParsedDiscoveryPluginParameters());
+
+ String serverLocatorClassName =
(String)discoveryPluginParams.get("server-locator-class");
+
+ String clusterConnectorClassName =
(String)discoveryPluginParams.get("cluster-connector-class");
+
+ DiscoveryGroupConfiguration groupConfiguration =
+ new DiscoveryGroupConfiguration(serverLocatorClassName,
+ clusterConnectorClassName,
+ discoveryPluginParams,
+ null);
+
+ if (ha)
+ {
+ cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration,
JMSFactoryType.XA_CF);
+ }
+ else
+ {
+ cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration,
JMSFactoryType.XA_CF);
+ }
+ }
else
if (connectorClassName != null)
{
@@ -1506,13 +1562,13 @@
transportConfigurations[i] = tc;
}
-
+
if (log.isDebugEnabled())
{
log.debug("Creating Connection Factory on the resource adapter for
transport=" + transportConfigurations + " with ha=" + ha);
}
-
+
if (ha)
{
cf = HornetQJMSClient.createConnectionFactoryWithHA(JMSFactoryType.XA_CF,
transportConfigurations);
@@ -1547,12 +1603,12 @@
}
return map;
}
-
+
private void locateTM()
{
String locatorClasses[] =
raProperties.getTransactionManagerLocatorClass().split(";");
String locatorMethods[] =
raProperties.getTransactionManagerLocatorMethod().split(";");
-
+
for (int i = 0 ; i < locatorClasses.length; i++)
{
tm = Util.locateTM(locatorClasses[i], locatorMethods[i]);
@@ -1561,7 +1617,7 @@
break;
}
}
-
+
if (tm == null)
{
log.warn("It wasn't possible to lookup for a Transaction Manager
through the configured properties TransactionManagerLocatorClass and
TransactionManagerLocatorMethod");
Modified:
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java
===================================================================
---
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-ra/hornetq-ra-jar/src/main/java/org/hornetq/ra/Util.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -13,7 +13,11 @@
package org.hornetq.ra;
import java.lang.reflect.Method;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
import javax.naming.Context;
import javax.transaction.TransactionManager;
@@ -30,7 +34,7 @@
*/
public class Util
{
-
+
private static final Logger log = Logger.getLogger(Util.class);
@@ -45,7 +49,7 @@
* Compare two strings.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final String me, final String you)
{
@@ -69,7 +73,7 @@
* Compare two integers.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Integer me, final Integer you)
{
@@ -93,7 +97,7 @@
* Compare two longs.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Long me, final Long you)
{
@@ -117,7 +121,7 @@
* Compare two doubles.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Double me, final Double you)
{
@@ -141,7 +145,7 @@
* Compare two booleans.
* @param me First value
* @param you Second value
- * @return True if object equals else false.
+ * @return True if object equals else false.
*/
public static boolean compare(final Boolean me, final Boolean you)
{
@@ -174,7 +178,7 @@
return context.lookup(name);
}
- /**
+ /**
* Used on parsing JNDI Configuration
* @param config
* @return
@@ -200,6 +204,27 @@
return hashtable;
}
+ public static Map<String, Object> parseDiscoveryPluginConfig(final String
config)
+ {
+ HashMap<String, Object> result = new HashMap<String, Object>();
+
+ String elements[] = config.split(";");
+
+ for (String element : elements)
+ {
+ String expression[] = element.split("=");
+
+ if (expression.length != 2)
+ {
+ throw new IllegalArgumentException("Invalid expression " + element
+ " at " + config);
+ }
+
+ result.put(expression[0].trim(), expression[1].trim());
+ }
+
+ return result;
+ }
+
public static List<Map<String, Object>> parseConfig(final String config)
{
List<Map<String, Object>> result =new ArrayList<Map<String,
Object>>();
@@ -243,13 +268,13 @@
return res;
}
-
+
/** The Resource adapter can't depend on any provider's specific library.
Because of that we use reflection to locate the
- * transaction manager during startup.
- *
- *
- * TODO:
https://jira.jboss.org/browse/HORNETQ-417
+ * transaction manager during startup.
+ *
+ *
+ * TODO:
https://jira.jboss.org/browse/HORNETQ-417
* We should use a proper SPI instead of reflection
* We would need to define a proper SPI package for this.
* */
Modified:
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java
===================================================================
---
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -11,8 +11,8 @@
import org.hornetq.api.core.TransportConfiguration;
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.ServerLocatorImpl;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.rest.queue.DestinationSettings;
@@ -142,9 +142,10 @@
HashMap<String, Object> transportConfig = new HashMap<String,
Object>();
transportConfig.put(TransportConstants.SERVER_ID_PROP_NAME,
configuration.getInVmId());
+ ServerLocator consumerLocator =
+ HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(InVMConnectorFactory.class.getName(),
+
transportConfig));
- ServerLocator consumerLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
-
if (configuration.getConsumerWindowSize() != -1)
{
consumerLocator.setConsumerWindowSize(configuration.getConsumerWindowSize());
@@ -152,7 +153,9 @@
ClientSessionFactory consumerSessionFactory =
consumerLocator.createSessionFactory();
- ServerLocator defaultLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ ServerLocator defaultLocator =
+ HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(InVMConnectorFactory.class.getName(),
+
transportConfig));
ClientSessionFactory sessionFactory = defaultLocator.createSessionFactory();
Modified:
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java
===================================================================
---
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -2,6 +2,7 @@
import java.util.HashMap;
+import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
@@ -9,8 +10,8 @@
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -49,8 +50,10 @@
hornetqServer.start();
HashMap<String, Object> transportConfig = new HashMap<String,
Object>();
-
- serverLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+
+ serverLocator =
+ HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(InVMConnectorFactory.class.getName(),
+
transportConfig));
sessionFactory = serverLocator.createSessionFactory();
consumerSessionFactory = serverLocator.createSessionFactory();
@@ -79,6 +82,7 @@
this.consumer = consumer;
}
+ @Override
public void run()
{
try
@@ -112,7 +116,7 @@
ClientMessage message;
- message = session.createMessage(ClientMessage.OBJECT_TYPE, false);
+ message = session.createMessage(Message.OBJECT_TYPE, false);
message.getBodyBuffer().writeInt("hello".getBytes().length);
message.getBodyBuffer().writeBytes("hello".getBytes());
producer.send(message);
Modified:
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java
===================================================================
---
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -1,5 +1,9 @@
package org.hornetq.rest.test;
+import java.util.HashMap;
+import java.util.UUID;
+
+import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
@@ -7,10 +11,9 @@
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.MessageHandler;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
-import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -22,9 +25,6 @@
import org.junit.BeforeClass;
import org.junit.Test;
-import java.util.HashMap;
-import java.util.UUID;
-
/**
* * Play with HornetQ
*
@@ -57,7 +57,9 @@
private static void createFactories() throws Exception
{
HashMap<String, Object> transportConfig = new HashMap<String,
Object>();
- serverLocator = new ServerLocatorImpl(false, new
TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ serverLocator =
+ HornetQClient.createServerLocatorWithoutHA(new
TransportConfiguration(InVMConnectorFactory.class.getName(),
+
transportConfig));
sessionFactory = serverLocator.createSessionFactory();
consumerSessionFactory = serverLocator.createSessionFactory();
}
@@ -121,7 +123,7 @@
String uuid = UUID.randomUUID().toString();
System.out.println("Sending: " + uuid);
- message = session.createMessage(ClientMessage.OBJECT_TYPE, true);
+ message = session.createMessage(Message.OBJECT_TYPE, true);
message.getBodyBuffer().writeInt(uuid.getBytes().length);
message.getBodyBuffer().writeBytes(uuid.getBytes());
producer.send(message);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/client/SessionFactoryTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -50,7 +50,7 @@
{
private static final Logger log = Logger.getLogger(SessionFactoryTest.class);
- private DiscoveryGroupConfiguration groupConfiguration = new
DiscoveryGroupConfiguration(getUDPDiscoveryAddress(), getUDPDiscoveryPort());
+ private DiscoveryGroupConfiguration groupConfiguration =
createUDPDiscoveryGroupConfiguration(getUDPDiscoveryAddress(), getUDPDiscoveryPort());
private HornetQServer liveService;
@@ -581,13 +581,13 @@
final int localBindPort = 5432;
- BroadcastGroupConfiguration bcConfig1 = new
BroadcastGroupConfiguration(bcGroupName,
- null,
-
localBindPort,
-
getUDPDiscoveryAddress(),
-
getUDPDiscoveryPort(),
-
broadcastPeriod,
-
Arrays.asList(liveTC.getName()));
+ BroadcastGroupConfiguration bcConfig1 =
createBroadcastGroupConfiguration(bcGroupName,
+ null,
+
localBindPort,
+
getUDPDiscoveryAddress(),
+
getUDPDiscoveryPort(),
+
broadcastPeriod,
+
Arrays.asList(liveTC));
List<BroadcastGroupConfiguration> bcConfigs1 = new
ArrayList<BroadcastGroupConfiguration>();
bcConfigs1.add(bcConfig1);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -91,19 +91,19 @@
final int port = getUDPDiscoveryPort();
- ArrayList<String> list = new ArrayList<String>();
- list.add(server1tc.getName());
- BroadcastGroupConfiguration bcConfig = new
BroadcastGroupConfiguration("bg1",
- null,
- -1,
-
groupAddress,
- port,
- 250,
- list);
+ ArrayList<TransportConfiguration> list = new
ArrayList<TransportConfiguration>();
+ list.add(server1tc);
+ BroadcastGroupConfiguration bcConfig =
createBroadcastGroupConfiguration("bg1",
+ null,
+
-1,
+
groupAddress,
+ port,
+
250,
+ list);
server0.getConfiguration().getBroadcastGroupConfigurations().add(bcConfig);
- DiscoveryGroupConfiguration dcConfig = new
DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
+ DiscoveryGroupConfiguration dcConfig =
createUDPDiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000,
5000);
server0.getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(),
dcConfig);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -1619,25 +1619,25 @@
TransportConfiguration connector = createTransportConfiguration(netty, false,
params);
configuration.getConnectorConfigurations().put(connector.getName(), connector);
- List<String> connectorPairs = new ArrayList<String>();
- connectorPairs.add(connector.getName());
+ List<TransportConfiguration> connectorPairs = new
ArrayList<TransportConfiguration>();
+ connectorPairs.add(connector);
- BroadcastGroupConfiguration bcConfig = new
BroadcastGroupConfiguration("bg1",
- null,
- -1,
-
groupAddress,
- port,
- 200,
-
connectorPairs);
+ BroadcastGroupConfiguration bcConfig =
createBroadcastGroupConfiguration("bg1",
+ null,
+ -1,
+
groupAddress,
+ port,
+ 200,
+
connectorPairs);
configuration.getBroadcastGroupConfigurations().add(bcConfig);
- DiscoveryGroupConfiguration dcConfig = new
DiscoveryGroupConfiguration("dg1",
- null,
-
groupAddress,
- port,
- 1000,
- 1000);
+ DiscoveryGroupConfiguration dcConfig =
createUDPDiscoveryGroupConfiguration("dg1",
+ null,
+
groupAddress,
+ port,
+ 1000,
+ 1000);
configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
@@ -1697,25 +1697,25 @@
TransportConfiguration connector = createTransportConfiguration(netty, false,
params);
configuration.getConnectorConfigurations().put(connector.getName(), connector);
- List<String> connectorPairs = new ArrayList<String>();
- connectorPairs.add(connector.getName());
+ List<TransportConfiguration> connectorPairs = new
ArrayList<TransportConfiguration>();
+ connectorPairs.add(connector);
- 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 =
createUDPDiscoveryGroupConfiguration("dg1",
+ null,
+
groupAddress,
+ port,
+ 5000,
+ 5000);
configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
@@ -1772,16 +1772,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 dg =
createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(dg.getName(),
dg);
+
ClusterConnectionConfiguration clusterConf = new
ClusterConnectionConfiguration(name,
address,
name,
@@ -1790,7 +1793,7 @@
forwardWhenNoConsumers,
maxHops,
1024,
-
pairs,
+
dg,
allowDirectConnectionsOnly);
serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
}
@@ -1813,20 +1816,23 @@
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 dg =
createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(dg.getName(),
dg);
+
ClusterConnectionConfiguration clusterConf = createClusterConfig(name,
address,
forwardWhenNoConsumers,
maxHops,
connectorFrom,
- pairs);
+ dg);
serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
}
@@ -1851,13 +1857,16 @@
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 dg =
createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(dg.getName(),
dg);
+
ClusterConnectionConfiguration clusterConf = new
ClusterConnectionConfiguration(name,
address,
connectorFrom.getName(),
@@ -1872,8 +1881,9 @@
forwardWhenNoConsumers,
maxHops,
1024,
-
pairs,
-
false);
+
dg,
+
false,
+
pairs);
serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
}
@@ -1892,7 +1902,7 @@
final boolean
forwardWhenNoConsumers,
final int maxHops,
TransportConfiguration
connectorFrom,
- List<String>
pairs)
+
DiscoveryGroupConfiguration dg)
{
ClusterConnectionConfiguration clusterConf = new
ClusterConnectionConfiguration(name,
address,
@@ -1902,7 +1912,7 @@
forwardWhenNoConsumers,
maxHops,
1024,
-
pairs,
+
dg,
false);
return clusterConf;
}
@@ -1925,14 +1935,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 dg =
createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ serverFrom.getConfiguration().getDiscoveryGroupConfigurations().put(dg.getName(),
dg);
+
ClusterConnectionConfiguration clusterConf = new
ClusterConnectionConfiguration(name,
address,
name,
@@ -1941,7 +1954,7 @@
forwardWhenNoConsumers,
maxHops,
1024,
-
pairs,
+
dg,
false);
serverFrom.getConfiguration().getClusterConfigurations().add(clusterConf);
@@ -1965,6 +1978,8 @@
TransportConfiguration connectorConfig = createTransportConfiguration(netty, false,
generateParams(node, netty));
server.getConfiguration().getConnectorConfigurations().put(name, connectorConfig);
+ DiscoveryGroupConfiguration dg =
server.getConfiguration().getDiscoveryGroupConfigurations().get(discoveryGroupName);
+
ClusterConnectionConfiguration clusterConf = new
ClusterConnectionConfiguration(name,
address,
name,
@@ -1973,7 +1988,8 @@
forwardWhenNoConsumers,
maxHops,
1024,
-
discoveryGroupName);
+
dg,
+
false);
List<ClusterConnectionConfiguration> clusterConfs =
server.getConfiguration().getClusterConfigurations();
clusterConfs.add(clusterConf);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -15,6 +15,7 @@
import java.util.List;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.logging.Logger;
@@ -60,7 +61,7 @@
final boolean
forwardWhenNoConsumers,
final int maxHops,
TransportConfiguration
connectorFrom,
- List<String>
pairs)
+
DiscoveryGroupConfiguration dg)
{
ClusterConnectionConfiguration clusterConf = new
ClusterConnectionConfiguration(name,
address,
@@ -70,7 +71,7 @@
forwardWhenNoConsumers,
maxHops,
1024,
-
pairs,
+
dg,
false);
return clusterConf;
}
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackAutoTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -246,10 +247,12 @@
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());
+ ArrayList<TransportConfiguration> staticConnectors = new
ArrayList<TransportConfiguration>();
+ staticConnectors.add(liveConnector);
+ DiscoveryGroupConfiguration dgb =
createStaticDiscoveryGroupConfiguration(staticConnectors.toArray(new
TransportConfiguration[0]));
+ backupConfig.getDiscoveryGroupConfigurations().put(dgb.getName(), dgb);
ClusterConnectionConfiguration cccLive = new
ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1,
- staticConnectors, false);
+ dgb, false);
backupConfig.getClusterConfigurations().add(cccLive);
backupServer = createBackupServer();
@@ -260,10 +263,12 @@
liveConfig.setSharedStore(true);
liveConfig.setFailbackDelay(1000);
liveConfig.setClustered(true);
- List<String> pairs = new ArrayList<String>();
- pairs.add(backupConnector.getName());
+ List<TransportConfiguration> pairs = new
ArrayList<TransportConfiguration>();
+ pairs.add(backupConnector);
+ DiscoveryGroupConfiguration dgl =
createStaticDiscoveryGroupConfiguration(staticConnectors.toArray(new
TransportConfiguration[0]));
+ liveConfig.getDiscoveryGroupConfigurations().put(dgl.getName(), dgl);
ClusterConnectionConfiguration ccc0 = new
ClusterConnectionConfiguration("cluster1", "jms",
liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ dgl, false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
liveConfig.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailBackManualTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
@@ -156,10 +157,12 @@
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());
+ ArrayList<TransportConfiguration> staticConnectors = new
ArrayList<TransportConfiguration>();
+ staticConnectors.add(liveConnector);
+ DiscoveryGroupConfiguration dgb =
createStaticDiscoveryGroupConfiguration(staticConnectors.toArray(new
TransportConfiguration[0]));
+ backupConfig.getDiscoveryGroupConfigurations().put(dgb.getName(), dgb);
ClusterConnectionConfiguration cccLive = new
ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1,
- staticConnectors, false);
+ dgb, false);
backupConfig.getClusterConfigurations().add(cccLive);
backupConfig.setAllowAutoFailBack(false);
backupServer = createBackupServer();
@@ -170,10 +173,12 @@
liveConfig.setSecurityEnabled(false);
liveConfig.setSharedStore(true);
liveConfig.setClustered(true);
- List<String> pairs = new ArrayList<String>();
- pairs.add(backupConnector.getName());
+ List<TransportConfiguration> pairs = new
ArrayList<TransportConfiguration>();
+ pairs.add(backupConnector);
+ DiscoveryGroupConfiguration dgl =
createStaticDiscoveryGroupConfiguration(staticConnectors.toArray(new
TransportConfiguration[0]));
+ backupConfig.getDiscoveryGroupConfigurations().put(dgl.getName(), dgl);
ClusterConnectionConfiguration ccc0 = new
ClusterConnectionConfiguration("cluster1", "jms",
liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ dgl, false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
liveConfig.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleBackupsFailoverTestBase.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -29,9 +29,9 @@
import org.hornetq.api.core.client.ClientSession;
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.ClientSessionFactoryInternal;
-import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.client.impl.ServerLocatorInternal;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.HornetQServer;
@@ -207,7 +207,7 @@
{
configs[i] = createTransportConfiguration(isNetty(), false,
generateParams(nodes[i], isNetty()));
}
- return new ServerLocatorImpl(true, configs);
+ return HornetQClient.createServerLocatorWithHA(configs);
}
// Private -------------------------------------------------------
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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;
@@ -175,15 +176,17 @@
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);
}
+ DiscoveryGroupConfiguration dg =
createStaticDiscoveryGroupConfiguration(clusterNodes.toArray(new
TransportConfiguration[0]));
+ config1.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
ClusterConnectionConfiguration ccc1 = new
ClusterConnectionConfiguration("cluster1",
"jms",
backupConnector.getName(),
@@ -192,7 +195,7 @@
false,
1,
1,
-
clusterNodes,
+ dg,
false);
config1.getClusterConfigurations().add(ccc1);
@@ -217,16 +220,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 dg =
createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ config0.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
ClusterConnectionConfiguration ccc0 = new
ClusterConnectionConfiguration("cluster1",
"jms",
liveConnector.getName(),
@@ -235,7 +240,7 @@
false,
1,
1,
- pairs,
+ dg,
false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -63,7 +63,8 @@
false,
1,
1,
- new
ArrayList<String>(), false));
+
createStaticDiscoveryGroupConfiguration(new TransportConfiguration[0]),
+
false));
return config;
}
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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;
@@ -169,13 +170,15 @@
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);
}
+ DiscoveryGroupConfiguration dg =
createStaticDiscoveryGroupConfiguration(clusterNodes.toArray(new
TransportConfiguration[0]));
+ config1.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
ClusterConnectionConfiguration ccc1 = new
ClusterConnectionConfiguration("cluster1",
"jms",
backupConnector.getName(),
@@ -184,7 +187,7 @@
false,
1,
1,
-
clusterNodes,
+ dg,
false);
config1.getClusterConfigurations().add(ccc1);
@@ -206,16 +209,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 dg =
createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ config0.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
ClusterConnectionConfiguration ccc0 = new
ClusterConnectionConfiguration("cluster1",
"jms",
liveConnector.getName(),
@@ -224,7 +229,7 @@
false,
1,
1,
- pairs,
+ dg,
false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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 dg =
createStaticDiscoveryGroupConfiguration(pairs.toArray(new TransportConfiguration[0]));
+ config0.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
ClusterConnectionConfiguration ccc0 = new
ClusterConnectionConfiguration("cluster1",
"jms",
liveConnector.getName(),
@@ -195,7 +198,7 @@
false,
1,
1,
- pairs,
+ dg,
false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
@@ -275,16 +278,18 @@
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 dg =
createStaticDiscoveryGroupConfiguration(createClusterConnections ?
staticConnectors.toArray(new TransportConfiguration[0]) : null);
+ config1.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
ClusterConnectionConfiguration ccc1 = new
ClusterConnectionConfiguration("cluster1",
"jms",
backupConnector.getName(),
@@ -293,8 +298,7 @@
false,
1,
1,
-
createClusterConnections ? staticConnectors
-
: pairs,
+ dg,
false);
config1.getClusterConfigurations().add(ccc1);
config1.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SecurityFailoverTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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,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());
+ ArrayList<TransportConfiguration> staticConnectors = new
ArrayList<TransportConfiguration>();
+ staticConnectors.add(liveConnector);
+ DiscoveryGroupConfiguration dgb =
createStaticDiscoveryGroupConfiguration(staticConnectors.toArray(new
TransportConfiguration[0]));
+ backupConfig.getDiscoveryGroupConfigurations().put(dgb.getName(), dgb);
ClusterConnectionConfiguration cccLive = new
ClusterConnectionConfiguration("cluster1",
"jms",
backupConnector.getName(),
@@ -122,7 +125,7 @@
false,
1,
1,
-
staticConnectors,
+ dgb,
false);
backupConfig.getClusterConfigurations().add(cccLive);
backupServer = createBackupServer();
@@ -137,7 +140,8 @@
liveConfig.setSecurityEnabled(true);
liveConfig.setSharedStore(true);
liveConfig.setClustered(true);
- List<String> pairs = null;
+ DiscoveryGroupConfiguration dgl =
createStaticDiscoveryGroupConfiguration((TransportConfiguration[])null);
+ liveConfig.getDiscoveryGroupConfigurations().put(dgl.getName(), dgl);
ClusterConnectionConfiguration ccc0 = new
ClusterConnectionConfiguration("cluster1",
"jms",
liveConnector.getName(),
@@ -146,7 +150,7 @@
false,
1,
1,
- pairs,
+ dgl,
false);
liveConfig.getClusterConfigurations().add(ccc0);
liveConfig.getConnectorConfigurations().put(liveConnector.getName(),
liveConnector);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -19,10 +19,12 @@
import java.util.Map;
import java.util.Map.Entry;
+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;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
-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.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
@@ -71,7 +73,7 @@
servers.get(4).start();
servers.get(5).start();
- ServerLocatorImpl locator = (ServerLocatorImpl)getServerLocator(0);
+ ServerLocatorInternal locator = (ServerLocatorInternal)getServerLocator(0);
Topology topology = locator.getTopology();
@@ -132,20 +134,21 @@
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);
}
TransportConfiguration backupConnector =
createTransportConfiguration(isNetty(), false, generateParams(nodeid,
isNetty()));
+ DiscoveryGroupConfiguration dg =
createStaticDiscoveryGroupConfiguration(staticConnectors.toArray(new
TransportConfiguration[0]));
+ config1.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
ClusterConnectionConfiguration ccc1 =
- new ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1,
- staticConnectors, false);
+ new ClusterConnectionConfiguration("cluster1", "jms",
backupConnector.getName(), -1, false, false, 1, 1, dg, false);
config1.getClusterConfigurations().add(ccc1);
config1.getConnectorConfigurations().put(backupConnector.getName(),
backupConnector);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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 dg = createStaticDiscoveryGroupConfiguration(new
TransportConfiguration[0]);
+ config.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
config.getClusterConfigurations().add(new
ClusterConnectionConfiguration("cluster",
"foo",
"self",
@@ -76,7 +79,7 @@
false,
1,
1,
- new
ArrayList<String>(), false));
+ dg,
false));
return config;
}
@@ -96,12 +99,14 @@
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 livetc = createTransportConfiguration(true, false,
generateParams(0, true));
+ config.getConnectorConfigurations().put("live", livetc);
config.getConnectorConfigurations().put("self",
createTransportConfiguration(true,
false, generateParams(1, true)));
- List<String> connectors = new ArrayList<String>();
- connectors.add("live");
+ List<TransportConfiguration> connectors = new
ArrayList<TransportConfiguration>();
+ connectors.add(livetc);
+ DiscoveryGroupConfiguration dg =
createStaticDiscoveryGroupConfiguration(connectors.toArray(new
TransportConfiguration[0]));
+ config.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
config.getClusterConfigurations().add(new
ClusterConnectionConfiguration("cluster",
"foo",
"self",
@@ -110,7 +115,7 @@
false,
1,
1,
-
connectors, false));
+ dg,
false));
return config;
}
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -60,7 +60,7 @@
@Override
protected ServerLocator createHAServerLocator()
{
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(new
DiscoveryGroupConfiguration(groupAddress, groupPort));
+ ServerLocator locator =
HornetQClient.createServerLocatorWithHA(createUDPDiscoveryGroupConfiguration(groupAddress,
groupPort));
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
return locator;
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -20,6 +20,7 @@
import junit.framework.Assert;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.client.impl.Topology;
import org.hornetq.core.client.impl.TopologyMember;
@@ -160,8 +161,10 @@
config1.getConnectorConfigurations().put("local-cc1",
createInVMTransportConnectorConfig(1, "local-cc1"));
config1.getConnectorConfigurations().put("local-cc2",
createInVMTransportConnectorConfig(2, "local-cc2"));
- config1.getConnectorConfigurations().put("other-cc1",
createInVMTransportConnectorConfig(3, "other-cc1"));
- config1.getConnectorConfigurations().put("other-cc2",
createInVMTransportConnectorConfig(4, "other-cc2"));
+ TransportConfiguration othercc1 = createInVMTransportConnectorConfig(3,
"other-cc1");
+ config1.getConnectorConfigurations().put("other-cc1", othercc1);
+ TransportConfiguration othercc2 = createInVMTransportConnectorConfig(4,
"other-cc2");
+ config1.getConnectorConfigurations().put("other-cc2", othercc2);
params = new HashMap<String, Object>();
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
@@ -172,9 +175,9 @@
"acceptor-cc2");
config1.getAcceptorConfigurations().add(acceptor2VM1);
- List<String> connectTo = new ArrayList<String>();
- connectTo.add("other-cc1");
-
+ DiscoveryGroupConfiguration dg1 =
createStaticDiscoveryGroupConfiguration(othercc1);
+ config1.getDiscoveryGroupConfigurations().put(dg1.getName(), dg1);
+
ClusterConnectionConfiguration server1CC1 = new
ClusterConnectionConfiguration("cc1",
"jms",
"local-cc1",
@@ -183,13 +186,13 @@
false,
1,
1024,
-
connectTo,
+
dg1,
false);
config1.getClusterConfigurations().add(server1CC1);
- connectTo = new ArrayList<String>();
- connectTo.add("other-cc2");
+ DiscoveryGroupConfiguration dg2 =
createStaticDiscoveryGroupConfiguration(othercc2);
+ config1.getDiscoveryGroupConfigurations().put(dg2.getName(), dg2);
ClusterConnectionConfiguration server1CC2 = new
ClusterConnectionConfiguration("cc2",
"jms",
@@ -199,7 +202,7 @@
false,
1,
1024,
-
connectTo,
+
dg2,
false);
config1.getClusterConfigurations().add(server1CC2);
@@ -228,8 +231,10 @@
config1.getConnectorConfigurations().put("local-cc1",
createInVMTransportConnectorConfig(3, "local-cc1"));
config1.getConnectorConfigurations().put("local-cc2",
createInVMTransportConnectorConfig(4, "local-cc2"));
- config1.getConnectorConfigurations().put("other-cc1",
createInVMTransportConnectorConfig(1, "other-cc1"));
- config1.getConnectorConfigurations().put("other-cc2",
createInVMTransportConnectorConfig(2, "other-cc2"));
+ TransportConfiguration othercc1 = createInVMTransportConnectorConfig(1,
"other-cc1");
+ config1.getConnectorConfigurations().put("other-cc1", othercc1);
+ TransportConfiguration othercc2 = createInVMTransportConnectorConfig(2,
"other-cc2");
+ config1.getConnectorConfigurations().put("other-cc2", othercc2);
params = new HashMap<String, Object>();
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
@@ -240,8 +245,8 @@
"acceptor-cc2");
config1.getAcceptorConfigurations().add(acceptor2VM1);
- List<String> connectTo = new ArrayList<String>();
- connectTo.add("other-cc1");
+ DiscoveryGroupConfiguration dg1 =
createStaticDiscoveryGroupConfiguration(othercc1);
+ config1.getDiscoveryGroupConfigurations().put(dg1.getName(), dg1);
ClusterConnectionConfiguration server1CC1 = new
ClusterConnectionConfiguration("cc1",
"jms",
@@ -251,13 +256,13 @@
false,
1,
1024,
-
connectTo,
+
dg1,
false);
config1.getClusterConfigurations().add(server1CC1);
- connectTo = new ArrayList<String>();
- connectTo.add("other-cc2");
+ DiscoveryGroupConfiguration dg2 =
createStaticDiscoveryGroupConfiguration(othercc2);
+ config1.getDiscoveryGroupConfigurations().put(dg2.getName(), dg2);
ClusterConnectionConfiguration server1CC2 = new
ClusterConnectionConfiguration("cc2",
"jms",
@@ -267,7 +272,7 @@
false,
1,
1024,
-
connectTo,
+
dg2,
false);
config1.getClusterConfigurations().add(server1CC2);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -26,7 +26,7 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.ClusterTopologyListener;
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.logging.Logger;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.cluster.ClusterConnection;
@@ -196,7 +196,7 @@
ServerLocator locator = createHAServerLocator();
- ((ServerLocatorImpl)locator).getTopology().setOwner("testReceive");
+ ((ServerLocatorInternal)locator).getTopology().setOwner("testReceive");
final List<String> nodes = new ArrayList<String>();
final CountDownLatch upLatch = new CountDownLatch(5);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -71,13 +71,13 @@
final String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(nodeID,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -158,13 +158,13 @@
log.info("Local address is " + localAddress);
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- localAddress,
- 6552,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(nodeID,
+ RandomUtil.randomString(),
+ localAddress,
+ 6552,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -204,13 +204,13 @@
final String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(nodeID,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -266,13 +266,13 @@
String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(nodeID,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -355,13 +355,13 @@
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(RandomUtil.randomString(),
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -397,13 +397,13 @@
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
- BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(RandomUtil.randomString(),
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -456,29 +456,29 @@
String node3 = "node-3::" + RandomUtil.randomString();
- BroadcastGroup bg1 = new BroadcastGroupImpl(node1,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress1,
- groupPort1,
- true);
+ BroadcastGroup bg1 = createBroadcastGroupImpl(node1,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress1,
+ groupPort1,
+ true);
- BroadcastGroup bg2 = new BroadcastGroupImpl(node2,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress2,
- groupPort2,
- true);
+ BroadcastGroup bg2 = createBroadcastGroupImpl(node2,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress2,
+ groupPort2,
+ true);
- BroadcastGroup bg3 = new BroadcastGroupImpl(node3,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress3,
- groupPort3,
- true);
+ BroadcastGroup bg3 = createBroadcastGroupImpl(node3,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress3,
+ groupPort3,
+ true);
bg2.start();
bg1.start();
bg3.start();
@@ -599,13 +599,13 @@
String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(nodeID,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -666,31 +666,31 @@
String node2 = RandomUtil.randomString();
String node3 = RandomUtil.randomString();
- BroadcastGroup bg1 = new BroadcastGroupImpl(node1,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg1 = createBroadcastGroupImpl(node1,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg1.start();
- BroadcastGroup bg2 = new BroadcastGroupImpl(node2,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg2 = createBroadcastGroupImpl(node2,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg2.start();
- BroadcastGroup bg3 = new BroadcastGroupImpl(node3,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg3 = createBroadcastGroupImpl(node3,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg3.start();
TransportConfiguration live1 = generateTC();
@@ -854,13 +854,13 @@
String nodeID = RandomUtil.randomString();
- BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(nodeID,
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.start();
@@ -965,13 +965,13 @@
final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
- BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
- RandomUtil.randomString(),
- null,
- -1,
- groupAddress,
- groupPort,
- true);
+ BroadcastGroup bg = createBroadcastGroupImpl(RandomUtil.randomString(),
+ RandomUtil.randomString(),
+ null,
+ -1,
+ groupAddress,
+ groupPort,
+ true);
bg.setNotificationService(notifService);
Assert.assertEquals(0, notifListener.getNotifications().size());
@@ -995,6 +995,23 @@
.toString());
}
+ protected static BroadcastGroupImpl createBroadcastGroupImpl(String nodeID,
+ String name,
+ InetAddress
localAddress,
+ int localPort,
+ InetAddress
groupAddress,
+ int groupPort,
+ boolean active) throws
Exception
+ {
+ return new BroadcastGroupImpl(nodeID, name, active,
createBroadcastGroupConfiguration(name,
+
localAddress.getHostAddress(),
+
localPort,
+
groupAddress.getHostAddress(),
+
groupPort,
+
-1,
+
new ArrayList<TransportConfiguration>()));
+ }
+
private TransportConfiguration generateTC(String debug)
{
String className = "org.foo.bar." + debug + "|" +
UUIDGenerator.getInstance().generateStringUUID() + "";
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -156,7 +156,7 @@
public void testDiscoveryConstructor() throws Exception
{
- DiscoveryGroupConfiguration groupConfiguration = new
DiscoveryGroupConfiguration(groupAddress, groupPort);
+ DiscoveryGroupConfiguration groupConfiguration =
createUDPDiscoveryGroupConfiguration(groupAddress, groupPort);
HornetQConnectionFactory cf = (HornetQConnectionFactory)
HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfiguration, JMSFactoryType.CF);
assertFactoryParams(cf,
null,
@@ -715,22 +715,22 @@
liveConf.setSharedStore(true);
liveConf.setClustered(true);
- List<String> connectorNames = new ArrayList<String>();
- connectorNames.add(liveTC.getName());
-
final long broadcastPeriod = 250;
final String bcGroupName = "bc1";
final int localBindPort = 5432;
- BroadcastGroupConfiguration bcConfig1 = new
BroadcastGroupConfiguration(bcGroupName,
+ List<TransportConfiguration> connectorList = new
ArrayList<TransportConfiguration>();
+ connectorList.add(liveTC);
+
+ BroadcastGroupConfiguration bcConfig1 =
createBroadcastGroupConfiguration(bcGroupName,
null,
localBindPort,
groupAddress,
groupPort,
broadcastPeriod,
-
connectorNames);
+
connectorList);
List<BroadcastGroupConfiguration> bcConfigs1 = new
ArrayList<BroadcastGroupConfiguration>();
bcConfigs1.add(bcConfig1);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/cluster/JMSFailoverTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -31,6 +31,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;
@@ -358,8 +359,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 dg1 = createStaticDiscoveryGroupConfiguration(livetc);
+ backupConf.getDiscoveryGroupConfigurations().put(dg1.getName(), dg1);
ClusterConnectionConfiguration cccBackup = new
ClusterConnectionConfiguration("cluster1",
"jms",
backuptc.getName(),
@@ -368,7 +369,7 @@
false,
1,
1,
-
staticConnectors,
+ dg1,
false);
backupConf.getClusterConfigurations().add(cccBackup);
@@ -402,7 +403,8 @@
liveConf.setSecurityEnabled(false);
liveConf.getAcceptorConfigurations().add(liveAcceptortc);
- List<String> pairs = null;
+ DiscoveryGroupConfiguration dg2 =
createStaticDiscoveryGroupConfiguration((TransportConfiguration[])null);
+ liveConf.getDiscoveryGroupConfigurations().put(dg2.getName(), dg2);
ClusterConnectionConfiguration ccc0 = new
ClusterConnectionConfiguration("cluster1",
"jms",
livetc.getName(),
@@ -411,7 +413,7 @@
false,
1,
1,
- pairs,
+ dg2,
false);
liveConf.getClusterConfigurations().add(ccc0);
liveConf.setSharedStore(true);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/connection/CloseConnectionFactoryOnGCest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -12,22 +12,14 @@
*/
package org.hornetq.tests.integration.jms.connection;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintStream;
-import java.io.StringReader;
import java.util.concurrent.atomic.AtomicInteger;
import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.api.jms.JMSFactoryType;
-import org.hornetq.core.client.impl.ServerLocatorImpl;
+import org.hornetq.core.client.impl.AbstractServerLocator;
import org.hornetq.core.logging.Logger;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.tests.util.JMSTestBase;
@@ -61,7 +53,7 @@
final AtomicInteger valueGC = new AtomicInteger(0);
- ServerLocatorImpl.finalizeCallback = new Runnable()
+ AbstractServerLocator.finalizeCallback = new Runnable()
{
public void run()
{
@@ -85,7 +77,7 @@
}
finally
{
- ServerLocatorImpl.finalizeCallback = null;
+ AbstractServerLocator.finalizeCallback = null;
}
assertEquals("The code is throwing exceptions", 0, valueGC.get());
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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 =
createUDPDiscoveryGroupConfiguration("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/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/BroadcastGroupControlTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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;
@@ -52,15 +53,15 @@
// Static --------------------------------------------------------
- public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration(final
List<String> connectorInfos)
+ public static BroadcastGroupConfiguration randomBroadcastGroupConfiguration(final
List<TransportConfiguration> connectors)
{
- return new BroadcastGroupConfiguration(RandomUtil.randomString(),
+ return createBroadcastGroupConfiguration(RandomUtil.randomString(),
null,
1198,
"231.7.7.7",
1199,
RandomUtil.randomPositiveInt(),
- connectorInfos);
+ connectors);
}
public static Pair<String, String> randomPair()
@@ -75,8 +76,8 @@
public void testAttributes() throws Exception
{
TransportConfiguration connectorConfiguration = new
TransportConfiguration(NettyConnectorFactory.class.getName());
- List<String> connectorInfos = new ArrayList<String>();
- connectorInfos.add(connectorConfiguration.getName());
+ List<TransportConfiguration> connectorInfos = new
ArrayList<TransportConfiguration>();
+ connectorInfos.add(connectorConfiguration);
BroadcastGroupConfiguration broadcastGroupConfig =
BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorInfos);
Configuration conf = createBasicConfig();
@@ -92,21 +93,21 @@
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(Integer.parseInt((String)broadcastGroupConfig.getParams().get(BroadcastGroupConstants.GROUP_PORT_NAME)),
broadcastGroupControl.getGroupPort());
+
Assert.assertEquals(Integer.parseInt((String)broadcastGroupConfig.getParams().get(BroadcastGroupConstants.LOCAL_BIND_PORT_NAME)),
broadcastGroupControl.getLocalBindPort());
+
Assert.assertEquals(Long.parseLong((String)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);
+ Assert.assertEquals(broadcastGroupConfig.getConnectorList().get(0),
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(broadcastGroupConfig.getConnectorList().get(0),
array.getString(0));
Assert.assertTrue(broadcastGroupControl.isStarted());
}
@@ -114,9 +115,9 @@
public void testStartStop() throws Exception
{
TransportConfiguration connectorConfiguration = new
TransportConfiguration(NettyConnectorFactory.class.getName());
- List<String> connectorInfos = new ArrayList<String>();
- connectorInfos.add(connectorConfiguration.getName());
- BroadcastGroupConfiguration broadcastGroupConfig =
BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectorInfos);
+ List<TransportConfiguration> connectors = new
ArrayList<TransportConfiguration>();
+ connectors.add(connectorConfiguration);
+ BroadcastGroupConfiguration broadcastGroupConfig =
BroadcastGroupControlTest.randomBroadcastGroupConfiguration(connectors);
Configuration conf = createBasicConfig();
conf.setSecurityEnabled(false);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -129,6 +129,12 @@
null,
false);
+ DiscoveryGroupConfiguration discoveryGroupConfig =
createUDPDiscoveryGroupConfiguration(discoveryName,
+
null,
+
groupAddress,
+
groupPort,
+
0,
+
0);
clusterConnectionConfig_0 = new ClusterConnectionConfiguration(clusterName,
queueConfig.getAddress(),
"netty",
@@ -137,22 +143,17 @@
false,
1,
1024,
- discoveryName);
- List<String> connectorInfos = new ArrayList<String>();
- connectorInfos.add("netty");
- BroadcastGroupConfiguration broadcastGroupConfig = new
BroadcastGroupConfiguration(discoveryName,
+
discoveryGroupConfig,
+ false);
+ List<TransportConfiguration> connectors = new
ArrayList<TransportConfiguration>();
+ connectors.add(connectorConfig_1);
+ BroadcastGroupConfiguration broadcastGroupConfig =
createBroadcastGroupConfiguration(discoveryName,
null,
-1,
groupAddress,
groupPort,
250,
-
connectorInfos);
- DiscoveryGroupConfiguration discoveryGroupConfig = new
DiscoveryGroupConfiguration(discoveryName,
-
null,
-
groupAddress,
-
groupPort,
-
0,
-
0);
+
connectors);
Configuration conf_1 = createBasicConfig();
conf_1.setSecurityEnabled(false);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -81,7 +81,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(),
@@ -114,7 +114,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 +129,7 @@
String jsonPairs = clusterConnectionControl.getStaticConnectorsAsJSON();
Assert.assertNull(jsonPairs);
- Assert.assertEquals(clusterConnectionConfig2.getDiscoveryGroupName(),
+
Assert.assertEquals(clusterConnectionConfig2.getDiscoveryGroupConfiguration().getName(),
clusterConnectionControl.getDiscoveryGroupName());
}
@@ -200,8 +200,8 @@
RandomUtil.randomString(),
null,
false);
- List<String> connectors = new ArrayList<String>();
- connectors.add(connectorConfig.getName());
+
+ DiscoveryGroupConfiguration dg1 =
createStaticDiscoveryGroupConfiguration(connectorConfig);
clusterConnectionConfig1 = new
ClusterConnectionConfiguration(RandomUtil.randomString(),
queueConfig.getAddress(),
@@ -211,10 +211,10 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
RandomUtil.randomPositiveInt(),
- connectors, false);
+ dg1, false);
String discoveryGroupName = RandomUtil.randomString();
- DiscoveryGroupConfiguration discoveryGroupConfig = new
DiscoveryGroupConfiguration(discoveryGroupName, null, "230.1.2.3", 6745, 500,
0);
+ DiscoveryGroupConfiguration discoveryGroupConfig =
createUDPDiscoveryGroupConfiguration(discoveryGroupName, null, "230.1.2.3",
6745, 500, 0);
clusterConnectionConfig2 = new
ClusterConnectionConfiguration(RandomUtil.randomString(),
queueConfig.getAddress(),
@@ -224,7 +224,7 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
RandomUtil.randomPositiveInt(),
- discoveryGroupName);
+ discoveryGroupConfig,
false);
Configuration conf_1 = createBasicConfig();
conf_1.setSecurityEnabled(false);
@@ -239,6 +239,8 @@
conf_0.setClustered(true);
conf_0.getAcceptorConfigurations().add(new
TransportConfiguration(InVMAcceptorFactory.class.getName()));
conf_0.getConnectorConfigurations().put(connectorConfig.getName(),
connectorConfig);
+ conf_0.getDiscoveryGroupConfigurations().put(dg1.getName(), dg1);
+ conf_0.getDiscoveryGroupConfigurations().put(discoveryGroupConfig.getName(),
discoveryGroupConfig);
conf_0.getClusterConfigurations().add(clusterConnectionConfig1);
conf_0.getClusterConfigurations().add(clusterConnectionConfig2);
conf_0.getDiscoveryGroupConfigurations().put(discoveryGroupName,
discoveryGroupConfig);
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/ra/ResourceAdapterTest.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/ra/ResourceAdapterTest.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/integration/ra/ResourceAdapterTest.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -12,6 +12,7 @@
*/
package org.hornetq.tests.integration.ra;
+import org.hornetq.api.core.DiscoveryGroupConstants;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.ra.HornetQResourceAdapter;
import org.hornetq.ra.inflow.HornetQActivation;
@@ -168,9 +169,9 @@
HornetQResourceAdapter adapter = new HornetQResourceAdapter();
adapter.setDiscoveryAddress("231.1.1.1");
HornetQConnectionFactory factory = adapter.getDefaultHornetQConnectionFactory();
- long initWait =
factory.getDiscoveryGroupConfiguration().getDiscoveryInitialWaitTimeout();
- long refresh = factory.getDiscoveryGroupConfiguration().getRefreshTimeout();
- int port = factory.getDiscoveryGroupConfiguration().getGroupPort();
+ long initWait =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME));
+ long refresh =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
+ int port =
Integer.parseInt((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME));
//defaults
assertEquals(10000l, refresh);
@@ -182,8 +183,8 @@
adapter.setDiscoveryPort(9876);
adapter.setDiscoveryRefreshTimeout(1234l);
factory = adapter.getDefaultHornetQConnectionFactory();
- initWait =
factory.getDiscoveryGroupConfiguration().getDiscoveryInitialWaitTimeout();
- refresh = factory.getDiscoveryGroupConfiguration().getRefreshTimeout();
+ initWait =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME));
+ refresh =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
//override refresh timeout
assertEquals(1234l, refresh);
@@ -194,8 +195,8 @@
adapter.setDiscoveryPort(9876);
adapter.setDiscoveryInitialWaitTimeout(9999l);
factory = adapter.getDefaultHornetQConnectionFactory();
- initWait =
factory.getDiscoveryGroupConfiguration().getDiscoveryInitialWaitTimeout();
- refresh = factory.getDiscoveryGroupConfiguration().getRefreshTimeout();
+ initWait =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME));
+ refresh =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
//override initial wait
assertEquals(10000l, refresh);
@@ -206,8 +207,8 @@
adapter.setDiscoveryPort(9876);
adapter.setDiscoveryInitialWaitTimeout(9999l);
factory = adapter.getDefaultHornetQConnectionFactory();
- initWait =
factory.getDiscoveryGroupConfiguration().getDiscoveryInitialWaitTimeout();
- refresh = factory.getDiscoveryGroupConfiguration().getRefreshTimeout();
+ initWait =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME));
+ refresh =
Long.parseLong((String)factory.getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME));
//override initial wait
assertEquals(10000l, refresh);
@@ -282,10 +283,10 @@
spec.setDestinationType("javax.jms.Queue");
spec.setDestination(MDBQUEUE);
HornetQConnectionFactory fac =
qResourceAdapter.createHornetQConnectionFactory(spec);
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getGroupAddress(),
"231.6.6.6");
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getGroupPort(),
1234);
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getRefreshTimeout(),
1l);
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getDiscoveryInitialWaitTimeout(),
1l);
+
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.GROUP_ADDRESS_NAME),
"231.6.6.6");
+
assertEquals(Integer.parseInt((String)fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME)),
1234);
+
assertEquals(Long.parseLong((String)fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME)),
1l);
+
assertEquals(Long.parseLong((String)fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME)),
1l);
qResourceAdapter.stop();
}
@@ -311,10 +312,10 @@
spec.setDiscoveryInitialWaitTimeout(1l);
spec.setDiscoveryRefreshTimeout(1l);
HornetQConnectionFactory fac =
qResourceAdapter.createHornetQConnectionFactory(spec);
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getGroupAddress(),
"231.6.6.6");
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getGroupPort(),
1234);
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getRefreshTimeout(),
1l);
-
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getDiscoveryInitialWaitTimeout(),
1l);
+
assertEquals(fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.GROUP_ADDRESS_NAME),
"231.6.6.6");
+
assertEquals(Integer.parseInt((String)fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.GROUP_PORT_NAME)),
1234);
+
assertEquals(Long.parseLong((String)fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.REFRESH_TIMEOUT_NAME)),
1l);
+
assertEquals(Long.parseLong((String)fac.getServerLocator().getDiscoveryGroupConfiguration().getParams().get(DiscoveryGroupConstants.INITIAL_WAIT_TIMEOUT_NAME)),
1l);
qResourceAdapter.stop();
}
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/JMSClusteredTestBase.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/JMSClusteredTestBase.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/JMSClusteredTestBase.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -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;
@@ -135,23 +136,22 @@
*/
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 server1tc = new
TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(0));
+ conf2.getConnectorConfigurations().put("toServer1", server1tc);
conf2.getConnectorConfigurations().put("server2",
new
TransportConfiguration(InVMConnectorFactory.class.getName(),
generateInVMParams(1)));
conf2.setClustered(true);
+ DiscoveryGroupConfiguration dg =
createStaticDiscoveryGroupConfiguration(server1tc);
+ conf2.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
+
conf2.getClusterConfigurations().add(new
ClusterConnectionConfiguration("to-server1",
"jms",
"server2",
@@ -160,7 +160,7 @@
false,
MAX_HOPS,
1024,
-
toOtherServerPair, false));
+ dg,
false));
JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl();
@@ -179,24 +179,23 @@
*/
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 server2tc = new
TransportConfiguration(InVMConnectorFactory.class.getName(), generateInVMParams(1));
+ conf1.getConnectorConfigurations().put("toServer2", server2tc);
conf1.getConnectorConfigurations().put("server1",
new
TransportConfiguration(InVMConnectorFactory.class.getName(),
generateInVMParams(0)));
conf1.setClustered(true);
+ DiscoveryGroupConfiguration dg =
createStaticDiscoveryGroupConfiguration(server2tc);
+ conf1.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
+
conf1.getClusterConfigurations().add(new
ClusterConnectionConfiguration("to-server2",
"jms",
"server1",
@@ -205,7 +204,7 @@
false,
MAX_HOPS,
1024,
-
toOtherServerPair, false));
+ dg,
false));
JMSConfigurationImpl jmsconfig = new JMSConfigurationImpl();
Modified:
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java
===================================================================
---
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java 2011-11-24
14:48:59 UTC (rev 11761)
+++
branches/HORNETQ-316/tests/integration-tests/src/test/java/org/hornetq/tests/util/ReplicatedBackupUtils.java 2011-11-24
19:42:20 UTC (rev 11762)
@@ -7,6 +7,7 @@
import java.util.List;
import java.util.Set;
+import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
@@ -27,13 +28,16 @@
*/
public static void createClusterConnectionConf(Configuration configuration, String
name, String... connectors)
{
- List<String> conn = new ArrayList<String>(connectors.length);
+ List<TransportConfiguration> conn = new
ArrayList<TransportConfiguration>(connectors.length);
for (String iConn : connectors)
{
- conn.add(iConn);
+ conn.add(configuration.getConnectorConfigurations().get(iConn));
}
+ DiscoveryGroupConfiguration dg =
UnitTestCase.createStaticDiscoveryGroupConfiguration(conn.toArray(new
TransportConfiguration[0]));
+ configuration.getDiscoveryGroupConfigurations().put(dg.getName(), dg);
+
ClusterConnectionConfiguration clusterConfig =
- new ClusterConnectionConfiguration("cluster1", "jms",
name, -1, false, false, 1, 1, conn, false);
+ new ClusterConnectionConfiguration("cluster1", "jms",
name, -1, false, false, 1, 1, dg, false);
configuration.getClusterConfigurations().add(clusterConfig);
}