JBoss hornetq SVN: r11763 - in branches/Branch_2_2_EAP/tests/src/org/hornetq/tests: util and 1 other directory.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2011-11-25 03:29:12 -0500 (Fri, 25 Nov 2011)
New Revision: 11763
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
exclude tests from running in Windows as the tests tries to create filenames with tab characters which is not valid for Windows
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java 2011-11-24 19:42:20 UTC (rev 11762)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/deployers/impl/FileDeploymentManagerTest.java 2011-11-25 08:29:12 UTC (rev 11763)
@@ -48,13 +48,19 @@
public void testStartStop1WithWhitespace() throws Exception
{
testStartStop1("fdm test file.xml");
- testStartStop1("fdm\ttest\tfile.xml");
+ if (!isWindows())
+ {
+ testStartStop1("fdm\ttest\tfile.xml");
+ }
}
public void testStartStop2WithWhitespace() throws Exception
{
testStartStop2("fdm test file.xml");
- testStartStop2("fdm\ttest\tfile.xml");
+ if (!isWindows())
+ {
+ testStartStop2("fdm\ttest\tfile.xml");
+ }
}
private void testStartStop1(final String filename) throws Exception
@@ -67,6 +73,8 @@
FileDeploymentManagerTest.log.debug(file.getAbsoluteFile());
+ System.out.println("========file name: " + file.getAbsolutePath());
+
file.createNewFile();
FakeDeployer deployer = new FakeDeployer(filename);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-11-24 19:42:20 UTC (rev 11762)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-11-25 08:29:12 UTC (rev 11763)
@@ -138,6 +138,13 @@
checkThread = false;
}
+ private String osType = System.getProperty("os.name").toLowerCase();
+
+ protected boolean isWindows()
+ {
+ return (osType.indexOf("win") >= 0);
+ }
+
// Static --------------------------------------------------------
protected Configuration createDefaultConfig()
13 years, 1 month
JBoss hornetq SVN: r11762 - in branches/HORNETQ-316: hornetq-core/src/main/java/org/hornetq/core/config and 21 other directories.
by do-not-reply@jboss.org
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);
}
13 years, 1 month
JBoss hornetq SVN: r11761 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 09:48:59 -0500 (Thu, 24 Nov 2011)
New Revision: 11761
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java
Log:
Remove another spurious sys.out
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java 2011-11-24 13:12:30 UTC (rev 11760)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java 2011-11-24 14:48:59 UTC (rev 11761)
@@ -68,7 +68,6 @@
@Override
public boolean intercept(Packet packet, RemotingConnection connection) throws HornetQException
{
- System.out.println("intercept? wtf " + packet);
if (packet.getType() == PacketImpl.BACKUP_REGISTRATION)
{
latch.countDown();
13 years, 1 month
JBoss hornetq SVN: r11760 - trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 08:12:30 -0500 (Thu, 24 Nov 2011)
New Revision: 11760
Modified:
trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java
Log:
HORNETQ-720 Revert svn r11667, as it truly broke replication.
Modified: trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java 2011-11-24 12:34:42 UTC (rev 11759)
+++ trunk/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java 2011-11-24 13:12:30 UTC (rev 11760)
@@ -2008,7 +2008,6 @@
if (replicationSync)
{
assert filesRepository.getDataFiles().isEmpty();
- filesRepository.ensureMinFiles();
setJournalState(JournalState.SYNCING);
return new JournalLoadInformation(0, -1);
}
13 years, 1 month
JBoss hornetq SVN: r11759 - trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 07:34:42 -0500 (Thu, 24 Nov 2011)
New Revision: 11759
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java
Log:
Remove call to sys.out that should not have been committed.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java 2011-11-24 12:26:38 UTC (rev 11758)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java 2011-11-24 12:34:42 UTC (rev 11759)
@@ -32,7 +32,6 @@
@Override
public boolean intercept(Packet packet, RemotingConnection connection) throws HornetQException
{
- System.out.println(packet);
if (packet.getType() != PacketImpl.BACKUP_REGISTRATION_FAILED)
return true;
log.warn("Failed to register as backup. Stopping the server.");
13 years, 1 month
JBoss hornetq SVN: r11758 - in trunk: tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover and 1 other directory.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 07:26:38 -0500 (Thu, 24 Nov 2011)
New Revision: 11758
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
Clean up's: add final to fields, delete trailing whitespace etc.
Modified: trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
--- trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2011-11-24 12:26:17 UTC (rev 11757)
+++ trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2011-11-24 12:26:38 UTC (rev 11758)
@@ -55,27 +55,27 @@
private final byte CF_RECORD = 1;
private final byte DESTINATION_RECORD = 2;
-
+
private final byte JNDI_RECORD = 3;
-
+
// Attributes ----------------------------------------------------
private final IDGenerator idGenerator;
-
+
private final String journalDir;
-
+
private final boolean createDir;
-
+
private final Journal jmsJournal;
private volatile boolean started;
-
- private Map<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<String, PersistedConnectionFactory>();
- private Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedDestination>();
-
- private Map<Pair<PersistedType, String>, PersistedJNDI> mapJNDI = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedJNDI>();
+ private final Map<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<String, PersistedConnectionFactory>();
+ private final Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedDestination>();
+
+ private final Map<Pair<PersistedType, String>, PersistedJNDI> mapJNDI = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedJNDI>();
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -117,7 +117,7 @@
{
jmsJournal = localJMS;
}
-
+
this.idGenerator = idGenerator;
}
@@ -144,7 +144,7 @@
jmsJournal.appendAddRecord(id, CF_RECORD, connectionFactory, true);
mapFactories.put(connectionFactory.getName(), connectionFactory);
}
-
+
public void deleteConnectionFactory(final String cfName) throws Exception
{
PersistedConnectionFactory oldCF = mapFactories.remove(cfName);
@@ -152,7 +152,7 @@
{
jmsJournal.appendDeleteRecord(oldCF.getId(), false);
}
-
+
this.deleteJNDI(PersistedType.ConnectionFactory, cfName);
}
@@ -177,22 +177,22 @@
jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true);
destinations.put(new Pair<PersistedType, String>(destination.getType(), destination.getName()), destination);
}
-
+
public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
{
ArrayList<PersistedJNDI> list = new ArrayList<PersistedJNDI>();
-
+
list.addAll(mapJNDI.values());
-
+
return list;
}
-
+
public void addJNDI(PersistedType type, String name, String ... address) throws Exception
{
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
long tx = idGenerator.generateID();
-
+
PersistedJNDI currentJNDI = mapJNDI.get(key);
if (currentJNDI != null)
{
@@ -202,30 +202,30 @@
{
currentJNDI = new PersistedJNDI(type, name);
}
-
+
mapJNDI.put(key, currentJNDI);
-
+
for (String adItem : address)
{
currentJNDI.addJNDI(adItem);
}
-
+
long newId = idGenerator.generateID();
-
+
currentJNDI.setId(newId);
-
+
jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
-
+
jmsJournal.appendCommitRecord(tx, true);
}
-
+
public void deleteJNDI(PersistedType type, String name, String address) throws Exception
{
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
long tx = idGenerator.generateID();
-
+
PersistedJNDI currentJNDI = mapJNDI.get(key);
if (currentJNDI == null)
{
@@ -235,9 +235,9 @@
{
jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
}
-
+
currentJNDI.deleteJNDI(address);
-
+
if (currentJNDI.getJndi().size() == 0)
{
mapJNDI.remove(key);
@@ -248,15 +248,15 @@
currentJNDI.setId(newId);
jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
}
-
+
jmsJournal.appendCommitRecord(tx, true);
}
-
+
public void deleteJNDI(PersistedType type, String name) throws Exception
{
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name);
-
+
PersistedJNDI currentJNDI = mapJNDI.remove(key);
if (currentJNDI != null)
@@ -293,25 +293,21 @@
checkAndCreateDir(journalDir, createDir);
jmsJournal.start();
-
+
started = true;
}
- /* (non-Javadoc)
- * @see org.hornetq.jms.persistence.JMSStorageManager#installReplication(org.hornetq.core.replication.ReplicationEndpoint)
- */
+ @Override
public void installReplication(ReplicationEndpoint replicationEndpoint) throws Exception
{
jmsJournal.loadInternalOnly();
replicationEndpoint.registerJournal((byte)2, this.jmsJournal);
}
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#stop()
- */
+
+ @Override
public void stop() throws Exception
{
this.started = false;
@@ -321,13 +317,13 @@
public void load() throws Exception
{
mapFactories.clear();
-
+
List<RecordInfo> data = new ArrayList<RecordInfo>();
-
+
ArrayList<PreparedTransactionInfo> list = new ArrayList<PreparedTransactionInfo>();
-
+
jmsJournal.load(data, list, null);
-
+
for (RecordInfo record : data)
{
long id = record.id;
@@ -335,7 +331,7 @@
HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(record.data);
byte rec = record.getUserRecordType();
-
+
if (rec == CF_RECORD)
{
PersistedConnectionFactory cf = new PersistedConnectionFactory();
@@ -362,9 +358,9 @@
{
throw new IllegalStateException("Invalid record type " + rec);
}
-
+
}
-
+
}
// Package protected ---------------------------------------------
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java 2011-11-24 12:26:17 UTC (rev 11757)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java 2011-11-24 12:26:38 UTC (rev 11758)
@@ -43,6 +43,7 @@
syncDelay = new BackupSyncDelay(backupServer, liveServer);
}
+
public void testNodeID() throws Exception
{
startBackupFinishSyncing();
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-11-24 12:26:17 UTC (rev 11757)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-11-24 12:26:38 UTC (rev 11758)
@@ -41,7 +41,6 @@
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.integration.cluster.util.TestableServer;
@@ -58,7 +57,6 @@
*/
public class FailoverTest extends FailoverTestBase
{
- private static final Logger log = Logger.getLogger(FailoverTest.class);
private static final int NUM_MESSAGES = 100;
private ServerLocator locator;
13 years, 1 month
JBoss hornetq SVN: r11757 - trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 07:26:17 -0500 (Thu, 24 Nov 2011)
New Revision: 11757
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
Log:
Every ServerLocator created to be closed at tearDown().
Modified: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-11-24 12:26:05 UTC (rev 11756)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-11-24 12:26:17 UTC (rev 11757)
@@ -16,6 +16,7 @@
import java.io.IOException;
import java.net.ServerSocket;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -81,6 +82,7 @@
protected NodeManager nodeManager;
protected boolean startBackupServer = true;
+ private final Collection<ServerLocator> serverLocators = new ArrayList<ServerLocator>();
// Static --------------------------------------------------------
@@ -234,6 +236,15 @@
stopComponent(backupServer);
stopComponent(liveServer);
+ synchronized (serverLocators)
+ {
+ for (ServerLocator locator : serverLocators)
+ {
+ closeServerLocator(locator);
+ }
+ serverLocators.clear();
+ }
+
Assert.assertEquals(0, InVMRegistry.instance.size());
backupServer = null;
@@ -371,6 +382,10 @@
protected ServerLocatorInternal getServerLocator() throws Exception
{
ServerLocator locator = HornetQClient.createServerLocatorWithHA(getConnectorTransportConfiguration(true), getConnectorTransportConfiguration(false));
+ synchronized (serverLocators)
+ {
+ serverLocators.add(locator);
+ }
return (ServerLocatorInternal) locator;
}
13 years, 1 month
JBoss hornetq SVN: r11756 - trunk/hornetq-core/src/main/java/org/hornetq/core/server.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 07:26:05 -0500 (Thu, 24 Nov 2011)
New Revision: 11756
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java
Log:
Remove method present in super interface.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java 2011-11-24 12:25:37 UTC (rev 11755)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java 2011-11-24 12:26:05 UTC (rev 11756)
@@ -118,8 +118,6 @@
Set<ServerSession> getSessions();
- boolean isStarted();
-
boolean isStopped();
HierarchicalRepository<Set<Role>> getSecurityRepository();
13 years, 1 month
JBoss hornetq SVN: r11755 - in trunk: hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl and 6 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 07:25:37 -0500 (Thu, 24 Nov 2011)
New Revision: 11755
Added:
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationFailedMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterConnection.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
HORNETQ-720 HORNETQ-771 Autheticate Replicated backup request and handle replication-start error msg.
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -1408,7 +1408,7 @@
}
}
- private class Channel0Handler implements ChannelHandler
+ private final class Channel0Handler implements ChannelHandler
{
private final CoreRemotingConnection conn;
@@ -1498,9 +1498,12 @@
serverLocator.notifyNodeUp(topMessage.getUniqueEventID(), topMessage.getNodeID(), topMessage.getPair(), topMessage.isLast());
}
}
+ else if (type == PacketImpl.BACKUP_REGISTRATION_FAILED)
+ {
+ // no-op
+ }
}
-
}
public class CloseRunnable implements Runnable
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/ChannelImpl.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -13,6 +13,7 @@
package org.hornetq.core.protocol.core.impl;
+import java.util.EnumSet;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
@@ -59,10 +60,18 @@
{
this.id = id;
}
+
+ protected static String idToString(long code)
+ {
+ for (CHANNEL_ID channel:EnumSet.allOf(CHANNEL_ID.class)){
+ if (channel.id==code) return channel.toString();
+ }
+ return Long.toString(code);
+ }
}
private static final Logger log = Logger.getLogger(ChannelImpl.class);
-
+
private static final boolean isTrace = log.isTraceEnabled();
private volatile long id;
@@ -118,11 +127,11 @@
resendCache = null;
}
}
-
+
public boolean supports(final byte packetType)
{
int version = connection.getClientVersion();
-
+
switch (packetType)
{
case PacketImpl.CLUSTER_TOPOLOGY_V2:
@@ -198,7 +207,7 @@
synchronized (sendLock)
{
packet.setChannelID(id);
-
+
if (isTrace)
{
log.trace("Sending packet nonblocking " + packet + " on channeID=" + id);
@@ -237,7 +246,7 @@
{
lock.unlock();
}
-
+
if (isTrace)
{
log.trace("Writing buffer for channelID=" + id);
@@ -351,7 +360,10 @@
{
if (confWindowSize < 0)
{
- throw new IllegalStateException("You can't set confirmationHandler on a connection with confirmation-window-size < 0. Look at the documentation for more information.");
+ final String msg =
+ "You can't set confirmationHandler on a connection with confirmation-window-size < 0."
+ + " Look at the documentation for more information.";
+ throw new IllegalStateException(msg);
}
commandConfirmationHandler = handler;
}
@@ -575,4 +587,10 @@
firstStoredCommandID += numberToClear;
}
+
+ @Override
+ public String toString()
+ {
+ return "Channel[id=" + CHANNEL_ID.idToString(id) + ", handler=" + handler + "]";
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/CoreProtocolManager.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -17,7 +17,6 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQException;
@@ -44,6 +43,7 @@
import org.hornetq.core.protocol.core.impl.wireformat.SubscribeClusterTopologyUpdatesMessageV2;
import org.hornetq.core.remoting.CloseListener;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.cluster.ClusterConnection;
import org.hornetq.spi.core.protocol.ConnectionEntry;
import org.hornetq.spi.core.protocol.ProtocolManager;
import org.hornetq.spi.core.protocol.RemotingConnection;
@@ -211,33 +211,23 @@
} else if (packet.getType() == PacketImpl.BACKUP_REGISTRATION)
{
BackupRegistrationMessage msg = (BackupRegistrationMessage)packet;
+ ClusterConnection clusterConnection = acceptorUsed.getClusterConnection();
- try {
- server.startReplication(rc, acceptorUsed.getClusterConnection(), getPair(msg.getConnector(), true));
- } catch (HornetQException e){
- channel0.send(new BackupRegistrationFailedMessage(e));
- }
- }
- else if (packet.getType() == PacketImpl.BACKUP_REGISTRATION_FAILED)
- {
- assert server.getConfiguration().isBackup();
- assert !server.getConfiguration().isSharedStore();
- log.warn("Replication failed to start because of exception with error " +
- ((BackupRegistrationFailedMessage)packet).getCause());
- Executors.newSingleThreadExecutor().execute(new Runnable()
+ if (clusterConnection.verify(msg.getClusterUser(), msg.getClusterPassword()))
{
- public void run()
+ try
{
- try
- {
- server.stop();
- }
- catch (Exception e)
- {
- log.error("Error while stopping server: " + server, e);
- }
+ server.startReplication(rc, clusterConnection, getPair(msg.getConnector(), true));
}
- });
+ catch (HornetQException e)
+ {
+ channel0.send(new BackupRegistrationFailedMessage(e));
+ }
+ }
+ else
+ {
+ channel0.send(new BackupRegistrationFailedMessage(null));
+ }
}
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/PacketDecoder.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -88,6 +88,7 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.wireformat.BackupRegistrationFailedMessage;
import org.hornetq.core.protocol.core.impl.wireformat.BackupRegistrationMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ClusterTopologyChangeMessage;
import org.hornetq.core.protocol.core.impl.wireformat.ClusterTopologyChangeMessage_V2;
@@ -547,6 +548,11 @@
packet = new BackupRegistrationMessage();
break;
}
+ case PacketImpl.BACKUP_REGISTRATION_FAILED:
+ {
+ packet = new BackupRegistrationFailedMessage();
+ break;
+ }
case PacketImpl.REPLICATION_START_FINISH_SYNC:
{
packet = new ReplicationStartSyncMessage();
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationFailedMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationFailedMessage.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationFailedMessage.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -13,28 +13,70 @@
public final class BackupRegistrationFailedMessage extends PacketImpl
{
- int errorCode;
+ enum BackupRegistrationProblem
+ {
+ EXCEPTION(0), AUTHENTICATION(1);
+ final int code;
+ private BackupRegistrationProblem(int code)
+ {
+ this.code = code;
+ }
+ }
+
+ int errorCode = -1;
+ BackupRegistrationProblem problem;
+
public BackupRegistrationFailedMessage(HornetQException e)
{
super(BACKUP_REGISTRATION_FAILED);
- errorCode = e.getCode();
+ if (e != null)
+ {
+ errorCode = e.getCode();
+ problem = BackupRegistrationProblem.EXCEPTION;
+ }
+ else
+ {
+ problem = BackupRegistrationProblem.AUTHENTICATION;
+ }
}
+ public BackupRegistrationFailedMessage()
+ {
+ super(BACKUP_REGISTRATION_FAILED);
+ }
+
public int getCause()
{
return errorCode;
}
+ public BackupRegistrationProblem getRegistrationProblem()
+ {
+ return problem;
+ }
+
@Override
public void encodeRest(final HornetQBuffer buffer)
{
- buffer.writeInt(errorCode);
+ buffer.writeInt(problem.code);
+ if (problem == BackupRegistrationProblem.EXCEPTION)
+ {
+ buffer.writeInt(errorCode);
+ }
}
@Override
public void decodeRest(final HornetQBuffer buffer)
{
- errorCode = buffer.readInt();
+ if (buffer.readInt() == BackupRegistrationProblem.AUTHENTICATION.code)
+ {
+ problem = BackupRegistrationProblem.AUTHENTICATION;
+ }
+ else
+ {
+ problem = BackupRegistrationProblem.EXCEPTION;
+ errorCode = buffer.readInt();
+ }
}
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/impl/wireformat/BackupRegistrationMessage.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -1,6 +1,3 @@
-/**
- *
- */
package org.hornetq.core.protocol.core.impl.wireformat;
import org.hornetq.api.core.HornetQBuffer;
@@ -8,10 +5,13 @@
import org.hornetq.core.protocol.core.impl.PacketImpl;
/**
- * Registers a backup node with its live server.
+ * Registers a given backup-server as the replicating backup of a live server (i.e. a regular
+ * HornetQ).
* <p>
- * After registration the live server will initiate synchronization of its state with the new backup
- * node.
+ * If it succeeds the backup will start synchronization of its state with the new backup node, and
+ * replicating any new data. If it fails the backup server will receive a message indicating
+ * failure, and should shutdown.
+ * @see BackupRegistrationFailedMessage
*/
public final class BackupRegistrationMessage extends PacketImpl
{
@@ -20,11 +20,17 @@
private String nodeID;
- public BackupRegistrationMessage(String nodeId, TransportConfiguration tc)
+ private String clusterUser;
+
+ private String clusterPassword;
+
+ public BackupRegistrationMessage(String nodeId, TransportConfiguration tc, String user, String password)
{
this();
connector = tc;
nodeID = nodeId;
+ clusterUser = user;
+ clusterPassword = password;
}
public BackupRegistrationMessage()
@@ -46,6 +52,8 @@
public void encodeRest(final HornetQBuffer buffer)
{
buffer.writeString(nodeID);
+ buffer.writeString(clusterUser);
+ buffer.writeString(clusterPassword);
connector.encode(buffer);
}
@@ -53,8 +61,26 @@
public void decodeRest(final HornetQBuffer buffer)
{
nodeID = buffer.readString();
+ clusterUser = buffer.readString();
+ clusterPassword = buffer.readString();
connector = new TransportConfiguration();
connector.decode(buffer);
}
+ /**
+ * @return
+ */
+ public String getClusterUser()
+ {
+ return clusterUser;
+ }
+
+ /**
+ * @return
+ */
+ public String getClusterPassword()
+ {
+ return clusterPassword;
+ }
+
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -243,7 +243,8 @@
public synchronized void start() throws Exception
{
Configuration config = server.getConfiguration();
-
+ try
+ {
storage = server.getStorageManager();
storage.start();
@@ -270,7 +271,12 @@
pageManager.start();
started = true;
-
+ }
+ catch (Exception e)
+ {
+ if (!server.isStopped())
+ throw e;
+ }
}
public synchronized void stop() throws Exception
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicationManagerImpl.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -98,7 +98,7 @@
public ReplicationManagerImpl(CoreRemotingConnection remotingConnection, final ExecutorFactory executorFactory)
{
this.executorFactory = executorFactory;
- replicatingChannel = remotingConnection.getChannel(CHANNEL_ID.REPLICATION.id, -1);
+ this.replicatingChannel = remotingConnection.getChannel(CHANNEL_ID.REPLICATION.id, -1);
this.remotingConnection = remotingConnection;
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterConnection.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterConnection.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/ClusterConnection.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -27,7 +27,7 @@
* A ClusterConnection
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
+ *
* Created 23 Jan 2009 14:51:55
*
*
@@ -37,32 +37,40 @@
SimpleString getName();
String getNodeID();
-
+
HornetQServer getServer();
-
+
void nodeAnnounced(long eventUID, String nodeID, Pair<TransportConfiguration, TransportConfiguration> connectorPair, boolean backup);
void addClusterTopologyListener(ClusterTopologyListener listener, boolean clusterConnection);
-
+
void removeClusterTopologyListener(ClusterTopologyListener listener, boolean clusterConnection);
-
+
/**
* @return a Map of node ID and addresses
*/
Map<String, String> getNodes();
void activate() throws Exception;
-
+
TransportConfiguration getConnector();
-
+
Topology getTopology();
-
+
void flushExecutor();
// for debug
String describe();
void informTopology();
-
+
void announceBackup();
+
+ /**
+ * Verifies whether user and password match the ones configured for this ClusterConnection.
+ * @param clusterUser
+ * @param clusterPassword
+ * @return
+ */
+ boolean verify(String clusterUser, String clusterPassword);
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -1502,7 +1502,7 @@
@Override
public String toString()
{
- return "ClusterConnectionImpl@" + System.identityHashCode(this) +
+ return "ClusterConnectionImpl@" + System.identityHashCode(this) +
"[nodeUUID=" + nodeUUID +
", connector=" +
connector +
@@ -1563,9 +1563,6 @@
}
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
@Override
public String toString()
{
@@ -1590,4 +1587,10 @@
}
}
+
+ @Override
+ public boolean verify(String clusterUser0, String clusterPassword0)
+ {
+ return clusterUser.equals(clusterUser0) && clusterPassword.equals(clusterPassword0);
+ }
}
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -381,7 +381,8 @@
log.warn("No connector with name '" + config.getConnectorName() + "'. backup cannot be announced.");
return;
}
- liveChannel.send(new BackupRegistrationMessage(nodeUUID.toString(), connector));
+ liveChannel.send(new BackupRegistrationMessage(nodeUUID.toString(), connector, configuration.getClusterUser(),
+ configuration.getClusterPassword()));
}
else
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-11-24 12:24:54 UTC (rev 11754)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -1287,7 +1287,7 @@
if (ConfigurationImpl.DEFAULT_CLUSTER_USER.equals(configuration.getClusterUser()) && ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD.equals(configuration.getClusterPassword()))
{
- log.warn("Security risk! It has been detected that the cluster admin user and password " + "have not been changed from the installation default. "
+ log.warn("Security risk! HornetQ is running with the default cluster admin user and default password. "
+ "Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.");
}
@@ -2047,7 +2047,7 @@
replicationEndpoint.setQuorumManager(quorumManager);
serverLocator0.setReconnectAttempts(-1);
-
+ serverLocator0.addInterceptor(new ReplicationError(HornetQServerImpl.this));
threadPool.execute(new Runnable()
{
@Override
@@ -2064,7 +2064,6 @@
CoreRemotingConnection liveConnection = liveServerSessionFactory.getConnection();
Channel pingChannel = liveConnection.getChannel(CHANNEL_ID.PING.id, -1);
Channel replicationChannel = liveConnection.getChannel(CHANNEL_ID.REPLICATION.id, -1);
-
connectToReplicationEndpoint(replicationChannel);
replicationEndpoint.start();
clusterManager.announceReplicatingBackup(pingChannel);
Added: trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java (rev 0)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/impl/ReplicationError.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.hornetq.core.server.impl;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+
+/**
+ * Stops the backup in case of an error at the start of Replication.
+ * <p>
+ * Using an interceptor for the task to avoid a server reference inside of the 'basic' channel-0
+ * handler at {@link ClientSessionFactoryImpl#Channel0Handler}. As {@link ClientSessionFactoryImpl}
+ * is also shipped in the HQ-client JAR (which does not include {@link HornetQServer}).
+ */
+final class ReplicationError implements Interceptor
+{
+ private final HornetQServer server;
+ private static final Logger log = Logger.getLogger(ReplicationError.class);
+
+ public ReplicationError(HornetQServer server)
+ {
+ this.server = server;
+ }
+
+ @Override
+ public boolean intercept(Packet packet, RemotingConnection connection) throws HornetQException
+ {
+ System.out.println(packet);
+ if (packet.getType() != PacketImpl.BACKUP_REGISTRATION_FAILED)
+ return true;
+ log.warn("Failed to register as backup. Stopping the server.");
+ try
+ {
+ server.stop();
+ }
+ catch (Exception e)
+ {
+ throw new HornetQException(HornetQException.INTERNAL_ERROR, "error trying to stop " + server, e);
+ }
+
+ return false;
+ }
+
+}
Added: trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java
===================================================================
--- trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java (rev 0)
+++ trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupAuthenticationTest.java 2011-11-24 12:25:37 UTC (rev 11755)
@@ -0,0 +1,79 @@
+/**
+ *
+ */
+package org.hornetq.tests.integration.cluster.failover;
+
+import java.util.Arrays;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.Interceptor;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.protocol.core.Packet;
+import org.hornetq.core.protocol.core.impl.PacketImpl;
+import org.hornetq.spi.core.protocol.RemotingConnection;
+import org.hornetq.tests.util.TransportConfigurationUtils;
+
+public class BackupAuthenticationTest extends FailoverTestBase
+{
+ private static CountDownLatch latch;
+ @Override
+ public void setUp() throws Exception
+ {
+ startBackupServer = false;
+ latch = new CountDownLatch(1);
+ super.setUp();
+ }
+
+ public void testPasswordSetting() throws Exception
+ {
+ waitForServer(liveServer.getServer());
+ backupServer.start();
+ assertTrue(latch.await(5, TimeUnit.SECONDS));
+ /*
+ * can't intercept the message at the backup, so we intercept the registration message at the
+ * live.
+ */
+ Thread.sleep(2000);
+ assertFalse("backup should have stopped", backupServer.isStarted());
+ backupConfig.setClusterPassword(CLUSTER_PASSWORD);
+ backupServer.start();
+ waitForServer(backupServer.getServer());
+ }
+
+ @Override
+ protected void createConfigs() throws Exception
+ {
+ createReplicatedConfigs();
+ backupConfig.setClusterPassword("crocodile");
+ liveConfig.setInterceptorClassNames(Arrays.asList(NotifyingInterceptor.class.getName()));
+ }
+
+ @Override
+ protected TransportConfiguration getAcceptorTransportConfiguration(boolean live)
+ {
+ return TransportConfigurationUtils.getInVMAcceptor(live);
+ }
+
+ @Override
+ protected TransportConfiguration getConnectorTransportConfiguration(boolean live)
+ {
+ return TransportConfigurationUtils.getInVMConnector(live);
+ }
+
+ public static final class NotifyingInterceptor implements Interceptor
+ {
+
+ @Override
+ public boolean intercept(Packet packet, RemotingConnection connection) throws HornetQException
+ {
+ System.out.println("intercept? wtf " + packet);
+ if (packet.getType() == PacketImpl.BACKUP_REGISTRATION)
+ {
+ latch.countDown();
+ }
+ return true;
+ }
+ }
+}
13 years, 1 month
JBoss hornetq SVN: r11754 - in trunk/hornetq-core/src/main/java/org/hornetq: core/config and 2 other directories.
by do-not-reply@jboss.org
Author: borges
Date: 2011-11-24 07:24:54 -0500 (Thu, 24 Nov 2011)
New Revision: 11754
Modified:
trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java
trunk/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java
trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/Channel.java
trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java
Log:
Improve Javadocs
Modified: trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java 2011-11-24 12:24:34 UTC (rev 11753)
+++ trunk/hornetq-core/src/main/java/org/hornetq/api/core/TransportConfiguration.java 2011-11-24 12:24:54 UTC (rev 11754)
@@ -19,19 +19,21 @@
import org.hornetq.utils.UUIDGenerator;
/**
- * A TransportConfiguration is used by a client to specify a connections to a server and its backup if one exists.<br><br>
+ * A TransportConfiguration is used by a client to specify connections to a server and its backup if
+ * one exists.
+ * <p>
+ * Typically the constructors take the class name and parameters for needed to create the
+ * connection. These will be different dependent on which connector is being used, i.e. Netty or
+ * InVM etc. For example:
* <p/>
- * Typically the constructors take the class name and parameters for needed to create the connection. These will be
- * different dependent on which connector is being used, i.e. Netty or InVM etc. For example:<br><br>
- * <p/>
- * <code>
- * HashMap<String, Object> map = new HashMap<String, Object>();<br>
- * map.put("host", "localhost");<br>
- * map.put("port", 5445);<br>
- * TransportConfiguration config = new TransportConfiguration(InVMConnectorFactory.class.getName(), map); <br>
- * ClientSessionFactory sf = new ClientSessionFactoryImpl(config); <br>
- * </code><br><br>
- *
+ *
+ * <pre>
+ * HashMap<String, Object> map = new HashMap<String, Object>();
+ * map.put("host", "localhost");
+ * map.put("port", 5445);
+ * TransportConfiguration config = new TransportConfiguration(InVMConnectorFactory.class.getName(), map);
+ * ClientSessionFactory sf = new ClientSessionFactoryImpl(config);
+ * </pre>
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*/
public class TransportConfiguration implements Serializable
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java 2011-11-24 12:24:34 UTC (rev 11753)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/config/ClusterConnectionConfiguration.java 2011-11-24 12:24:54 UTC (rev 11754)
@@ -23,10 +23,6 @@
* A ClusterConnectionConfiguration
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- *
- * Created 13 Jan 2009 09:42:17
- *
- *
*/
public class ClusterConnectionConfiguration implements Serializable
{
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/Channel.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/Channel.java 2011-11-24 12:24:34 UTC (rev 11753)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/protocol/core/Channel.java 2011-11-24 12:24:54 UTC (rev 11754)
@@ -36,7 +36,7 @@
* @return the id
*/
long getID();
-
+
/** For protocol check */
boolean supports(byte packetID);
@@ -46,7 +46,7 @@
* @param packet the packet to send
*/
void send(Packet packet);
-
+
/**
* sends a packet on this channel using batching algorithm if appropriate
*
@@ -71,8 +71,8 @@
Packet sendBlocking(Packet packet) throws HornetQException;
/**
- * sets the {@link org.hornetq.core.protocol.core.ChannelHandler} that this channel should forward received packets to.
- *
+ * Sets the {@link org.hornetq.core.protocol.core.ChannelHandler} that this channel should
+ * forward received packets to.
* @param handler the handler
*/
void setHandler(ChannelHandler handler);
@@ -134,7 +134,7 @@
Lock getLock();
/**
- * returns the Remoting Connection being used by the channel
+ * returns the {@link CoreRemotingConnection} being used by the channel
*/
CoreRemotingConnection getConnection();
Modified: trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java
===================================================================
--- trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java 2011-11-24 12:24:34 UTC (rev 11753)
+++ trunk/hornetq-core/src/main/java/org/hornetq/core/server/HornetQServer.java 2011-11-24 12:24:54 UTC (rev 11754)
@@ -48,19 +48,28 @@
import org.hornetq.utils.ExecutorFactory;
/**
- * This interface defines the internal interface of the HornetQ Server exposed to other components of the server. The
- * external management interface of the HornetQ Server is defined by the HornetQServerManagement interface This
- * interface is never exposed outside the HornetQ server, e.g. by JMX or other means
- *
+ * This interface defines the internal interface of the HornetQ Server exposed to other components
+ * of the server.
+ * <p>
+ * The external management interface of the HornetQ Server is defined by the HornetQServerManagement
+ * interface.
+ * <p>
+ * This interface is never exposed outside the HornetQ server, e.g. by JMX or other means
* @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
*/
public interface HornetQServer extends HornetQComponent
{
- /** This method was created mainly for testing but it may be used in scenarios where
- * you need to have more than one Server inside the same VM.
- * This identity will be exposed on logs what may help you to debug issues on the log traces and debugs.*/
+ /**
+ * Sets the server identity.
+ * <p>
+ * The identity will be exposed on logs. It may help to debug issues on the log traces and
+ * debugs.
+ * <p>
+ * This method was created mainly for testing but it may be used in scenarios where you need to
+ * have more than one Server inside the same VM.
+ */
void setIdentity(String identity);
String getIdentity();
@@ -85,9 +94,7 @@
/**
* Returns the resource to manage this HornetQ server.
- *
- * Using this control will throw IllegalStateException if the
- * server is not properly started.
+ * @throws IllegalStateException if the server is not properly started.
*/
HornetQServerControlImpl getHornetQServerControl();
13 years, 1 month