Author: timfox
Date: 2010-01-07 17:43:11 -0500 (Thu, 07 Jan 2010)
New Revision: 8775
Modified:
trunk/docs/user-manual/en/core-bridges.xml
trunk/src/config/common/schema/hornetq-configuration.xsd
trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
trunk/src/main/org/hornetq/core/server/cluster/BridgeConfiguration.java
trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
Log:
add username/password to bridge
Modified: trunk/docs/user-manual/en/core-bridges.xml
===================================================================
--- trunk/docs/user-manual/en/core-bridges.xml 2010-01-07 20:57:02 UTC (rev 8774)
+++ trunk/docs/user-manual/en/core-bridges.xml 2010-01-07 22:43:11 UTC (rev 8775)
@@ -61,7 +61,9 @@
<use-duplicate-detection>true</use-duplicate-detection>
<confirmation-window-size>10000000</confirmation-window-size>
<connector-ref connector-name="remote-connector"
- backup-connector-name="backup-remote-connector"/>
+ backup-connector-name="backup-remote-connector"/>
+ <user>foouser</user>
+ <password>foopassword</password>
</bridge>
</programlisting>
<para>In the above example we have shown all the parameters its possible to
configure for a
@@ -168,15 +170,16 @@
<para>The default value for this parameter is
<literal>true</literal>.</para>
</listitem>
<listitem>
- <para><literal>confirmation-window-size</literal>. This
optional parameter determines
- the <literal>confirmation-window-size</literal> to use for
the connection used to forward messages to the target node.
- This attribute is described in section <xref
linkend="client-reconnection"/></para>
+ <para><literal>confirmation-window-size</literal>. This
optional parameter
+ determines the
<literal>confirmation-window-size</literal> to use for the
+ connection used to forward messages to the target node. This
attribute is
+ described in section <xref
linkend="client-reconnection"/></para>
<para>
- <warning>When using the bridge to forward messages from a queue
which has a max-size-bytes set it's important
- that confirmation-window-size is less than or equal to
<literal>max-size-bytes</literal> to prevent the flow of messages from
ceasing.
- </warning>
+ <warning>When using the bridge to forward messages from a queue
which has a
+ max-size-bytes set it's important that
confirmation-window-size is less than
+ or equal to <literal>max-size-bytes</literal> to
prevent the flow of
+ messages from ceasing. </warning>
</para>
-
</listitem>
<listitem>
<para><literal>connector-ref</literal>. This mandatory
parameter determines which
@@ -208,6 +211,17 @@
</listitem>
</itemizedlist>
</listitem>
+ <listitem>
+ <para><literal>user</literal>. This optional parameter
determines the user name to
+ use when creating the bridge connection to the remote server. If it
is not
+ specified the default cluster user specified by
<literal>cluster-user</literal>
+ in <literal>hornetq-configuration.xml</literal> will be
used. </para>
+ <para><literal>password</literal>. This optional
parameter determines the password
+ to use when creating the bridge connection to the remote server. If
it is not
+ specified the default cluster password specified by <literal
+ >cluster-password</literal> in
<literal>hornetq-configuration.xml</literal>
+ will be used. </para>
+ </listitem>
</itemizedlist>
</section>
</chapter>
Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd 2010-01-07 20:57:02 UTC (rev
8774)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd 2010-01-07 22:43:11 UTC (rev
8775)
@@ -312,6 +312,10 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
name="confirmation-window-size" type="xsd:int">
</xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0" name="user"
type="xsd:string">
+ </xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0"
name="password" type="xsd:string">
+ </xsd:element>
<xsd:choice>
<xsd:element maxOccurs="1" minOccurs="1"
name="connector-ref" type="connector-refType">
</xsd:element>
Modified: trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2010-01-07 20:57:02
UTC (rev 8774)
+++ trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2010-01-07 22:43:11
UTC (rev 8775)
@@ -173,12 +173,12 @@
clusterPassword = XMLConfigurationUtil.getString(e,
"cluster-password",
clusterPassword,
- Validators.NOT_NULL_OR_EMPTY);
+ Validators.NO_CHECK);
clusterUser = XMLConfigurationUtil.getString(e,
"cluster-user",
clusterUser,
- Validators.NOT_NULL_OR_EMPTY);
+ Validators.NO_CHECK);
logDelegateFactoryClassName = XMLConfigurationUtil.getString(e,
"log-delegate-factory-class-name",
@@ -684,7 +684,7 @@
{
String name = brNode.getAttribute("name");
- String queueName = XMLConfigurationUtil.getString(brNode, "queue-name",
null, Validators.NOT_NULL_OR_EMPTY);
+ String queueName = XMLConfigurationUtil.getString(brNode, "queue-name",
null, Validators.NOT_NULL_OR_EMPTY);
String forwardingAddress = XMLConfigurationUtil.getString(brNode,
"forwarding-address",
@@ -725,6 +725,10 @@
"use-duplicate-detection",
ConfigurationImpl.DEFAULT_BRIDGE_DUPLICATE_DETECTION);
+ String user = XMLConfigurationUtil.getString(brNode, "user",
ConfigurationImpl.DEFAULT_CLUSTER_USER, Validators.NO_CHECK);
+
+ String password = XMLConfigurationUtil.getString(brNode, "password",
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD, Validators.NO_CHECK);
+
String filterString = null;
Pair<String, String> connectorPair = null;
@@ -778,7 +782,9 @@
useDuplicateDetection,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+ user,
+ password);
}
else
{
@@ -794,7 +800,9 @@
useDuplicateDetection,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- discoveryGroupName);
+ discoveryGroupName,
+ user,
+ password);
}
bridgeConfigurations.add(config);
Modified: trunk/src/main/org/hornetq/core/server/cluster/BridgeConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/BridgeConfiguration.java 2010-01-07
20:57:02 UTC (rev 8774)
+++ trunk/src/main/org/hornetq/core/server/cluster/BridgeConfiguration.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -57,6 +57,10 @@
private int confirmationWindowSize;
private final long clientFailureCheckPeriod;
+
+ private String user;
+
+ private String password;
public BridgeConfiguration(final String name,
final String queueName,
@@ -70,7 +74,9 @@
final boolean useDuplicateDetection,
final int confirmationWindowSize,
final long clientFailureCheckPeriod,
- final Pair<String, String> connectorPair)
+ final Pair<String, String> connectorPair,
+ final String user,
+ final String password)
{
this.name = name;
this.queueName = queueName;
@@ -85,6 +91,8 @@
this.confirmationWindowSize = confirmationWindowSize;
this.clientFailureCheckPeriod = clientFailureCheckPeriod;
this.connectorPair = connectorPair;
+ this.user = user;
+ this.password = password;
discoveryGroupName = null;
}
@@ -100,7 +108,9 @@
final boolean useDuplicateDetection,
final int confirmationWindowSize,
final long clientFailureCheckPeriod,
- final String discoveryGroupName)
+ final String discoveryGroupName,
+ final String user,
+ final String password)
{
this.name = name;
this.queueName = queueName;
@@ -116,6 +126,8 @@
this.clientFailureCheckPeriod = clientFailureCheckPeriod;
connectorPair = null;
this.discoveryGroupName = discoveryGroupName;
+ this.user = user;
+ this.password = password;
}
public String getName()
@@ -291,4 +303,24 @@
{
this.confirmationWindowSize = confirmationWindowSize;
}
+
+ public String getUser()
+ {
+ return user;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setUser(String user)
+ {
+ this.user = user;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
}
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-01-07
20:57:02 UTC (rev 8774)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -121,9 +121,9 @@
private final SimpleString managementNotificationAddress;
- private final String clusterUser;
+ private final String user;
- private final String clusterPassword;
+ private final String password;
private boolean activated;
@@ -161,8 +161,8 @@
final int confirmationWindowSize,
final SimpleString managementAddress,
final SimpleString managementNotificationAddress,
- final String clusterUser,
- final String clusterPassword,
+ final String user,
+ final String password,
final MessageFlowRecord flowRecord,
final boolean activated,
final StorageManager storageManager) throws Exception
@@ -210,9 +210,9 @@
this.managementNotificationAddress = managementNotificationAddress;
- this.clusterUser = clusterUser;
+ this.user = user;
- this.clusterPassword = clusterPassword;
+ this.password = password;
this.flowRecord = flowRecord;
@@ -663,7 +663,7 @@
csf.setConfirmationWindowSize(confirmationWindowSize);
// Session is pre-acknowledge
- session = (ClientSessionInternal)csf.createSession(clusterUser,
clusterPassword, false, true, true, true, 1);
+ session = (ClientSessionInternal)csf.createSession(user, password, false,
true, true, true, 1);
if (session == null)
{
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-01-07
20:57:02 UTC (rev 8774)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -425,8 +425,8 @@
config.getConfirmationWindowSize(),
managementService.getManagementAddress(),
managementService.getManagementNotificationAddress(),
- server.getConfiguration().getClusterUser(),
- server.getConfiguration().getClusterPassword(),
+ config.getUser(),
+ config.getPassword(),
null,
!backup,
server.getStorageManager());
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-01-07
20:57:02 UTC (rev 8774)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -25,6 +25,7 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.*;
+import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.RemotingConnection;
import org.hornetq.core.remoting.impl.invm.InVMConnector;
@@ -122,7 +123,9 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -245,7 +248,9 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -363,7 +368,9 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -489,7 +496,9 @@
false,
confirmationWindowSize,
clientFailureCheckPeriod,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -608,7 +617,9 @@
false,
confirmationWindowSize,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-01-07
20:57:02 UTC (rev 8774)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -24,6 +24,7 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.*;
+import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.server.HornetQServer;
@@ -107,7 +108,9 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -257,7 +260,9 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -454,7 +459,9 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -589,7 +596,9 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-01-07
20:57:02 UTC (rev 8774)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -24,6 +24,7 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.*;
+import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.server.HornetQServer;
@@ -130,7 +131,9 @@
// are sent
numMessages *
messageSize / 2,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-
connectorPair);
+
connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -322,7 +325,9 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-
connectorPair);
+
connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -489,7 +494,9 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
@@ -616,7 +623,9 @@
false,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-
connectorPair);
+
connectorPair,
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-01-07
20:57:02 UTC (rev 8774)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -24,6 +24,7 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.*;
+import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.cluster.Bridge;
@@ -113,7 +114,9 @@
true,
1024,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
-
"dg1");
+ "dg1",
+
ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
List<BridgeConfiguration> bridgeConfigs = new
ArrayList<BridgeConfiguration>();
bridgeConfigs.add(bridgeConfiguration);
Modified: trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2010-01-07
20:57:02 UTC (rev 8774)
+++
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -172,7 +172,9 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+ ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
Configuration conf_1 = new ConfigurationImpl();
conf_1.setSecurityEnabled(false);
Modified:
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2010-01-07
20:57:02 UTC (rev 8774)
+++
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2010-01-07
22:43:11 UTC (rev 8775)
@@ -150,7 +150,9 @@
RandomUtil.randomBoolean(),
RandomUtil.randomPositiveInt(),
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- connectorPair);
+ connectorPair,
+ ConfigurationImpl.DEFAULT_CLUSTER_USER,
+
ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
Configuration conf_1 = new ConfigurationImpl();
conf_1.setSecurityEnabled(false);