Author: clebert.suconic(a)jboss.com
Date: 2010-11-20 13:29:51 -0500 (Sat, 20 Nov 2010)
New Revision: 9917
Modified:
branches/2_2_0_HA_Improvements_preMerge/examples/jms/embedded/src/org/hornetq/jms/example/EmbeddedExample.java
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-configuration.xsd
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-jms.xsd
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/core/client/HornetQClient.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/jms/management/JMSServerControl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/JMSServerManager.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/ReSendMessageTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSConfigurationTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/JMSTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
Removing dependency to Configuration and a few tweaks
Modified:
branches/2_2_0_HA_Improvements_preMerge/examples/jms/embedded/src/org/hornetq/jms/example/EmbeddedExample.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/examples/jms/embedded/src/org/hornetq/jms/example/EmbeddedExample.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/examples/jms/embedded/src/org/hornetq/jms/example/EmbeddedExample.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -59,14 +59,18 @@
configuration.getAcceptorConfigurations()
.add(new
TransportConfiguration(NettyAcceptorFactory.class.getName()));
+ TransportConfiguration connectorConfig = new
TransportConfiguration(NettyConnectorFactory.class.getName());
+
+ configuration.getConnectorConfigurations().put("connector",
connectorConfig);
+
+
// Step 2. Create the JMS configuration
JMSConfiguration jmsConfig = new JMSConfigurationImpl();
// Step 3. Configure the JMS ConnectionFactory
- TransportConfiguration connectorConfig = new
TransportConfiguration(NettyConnectorFactory.class.getName());
- List<TransportConfiguration> configurations = new
ArrayList<TransportConfiguration>();
- configurations.add(connectorConfig);
- ConnectionFactoryConfiguration cfConfig = new
ConnectionFactoryConfigurationImpl("cf", false, configurations,
"/cf");
+ ArrayList<String> connectorNames = new ArrayList<String>();
+ connectorNames.add("connector");
+ ConnectionFactoryConfiguration cfConfig = new
ConnectionFactoryConfigurationImpl("cf", false, connectorNames,
"/cf");
jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
// Step 4. Configure the JMS Queue
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-configuration.xsd
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-configuration.xsd 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-configuration.xsd 2010-11-20
18:29:51 UTC (rev 9917)
@@ -231,6 +231,8 @@
<xsd:element name="refresh-timeout" type="xsd:int"/>
+ <xsd:element name="initial-wait-timeout" type="xsd:int"/>
+
<xsd:element name="discovery-group">
<xsd:complexType>
<xsd:sequence>
@@ -242,6 +244,8 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0"
ref="refresh-timeout">
</xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0"
ref="initial-wait-timeout">
+ </xsd:element>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:ID"
use="required"/>
</xsd:complexType>
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-jms.xsd
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-jms.xsd 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/config/common/schema/hornetq-jms.xsd 2010-11-20
18:29:51 UTC (rev 9917)
@@ -28,7 +28,6 @@
<xsd:all>
<xsd:element name="xa" type="xsd:boolean"
maxOccurs="1" minOccurs="0"></xsd:element>
<xsd:element name="discovery-group-ref"
type="discovery-group-refType" maxOccurs="1"
minOccurs="0"></xsd:element>
- <xsd:element name="discovery-initial-wait-timeout"
type="xsd:long" maxOccurs="1"
minOccurs="0"></xsd:element>
<xsd:element name="connectors" maxOccurs="1"
minOccurs="0">
<xsd:complexType>
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/core/client/HornetQClient.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/core/client/HornetQClient.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/core/client/HornetQClient.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -69,8 +69,6 @@
public static final long DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT = 10000;
- public static final long DEFAULT_DISCOVERY_REFRESH_TIMEOUT = 10000;
-
public static final long DEFAULT_RETRY_INTERVAL = 2000;
public static final double DEFAULT_RETRY_INTERVAL_MULTIPLIER = 1d;
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/jms/management/JMSServerControl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/api/jms/management/JMSServerControl.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -131,18 +131,6 @@
boolean destroyTopic(@Parameter(name = "name", desc = "Name of the
topic to destroy") String name) throws Exception;
/**
- * Create a JMS ConnectionFactory with the specified name connected to a single
HornetQ server.
- * <br>
- * The ConnectionFactory is bound to JNDI for all the specified bindings.
- */
- void createConnectionFactory(String name,
- boolean ha,
- @Parameter(name = "cfType", desc =
"RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int
cfType,
- String liveTransportClassName,
- Map<String, Object> liveTransportParams,
- Object[] jndiBindings) throws Exception;
-
- /**
* Create a JMS ConnectionFactory with the specified name connected to a static list
of live-backup servers.
* <br>
* The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
@@ -156,8 +144,7 @@
void createConnectionFactory(String name,
boolean ha,
@Parameter(name = "cfType", desc =
"RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int
cfType,
- Object[] liveConnectorsTransportClassNames,
- Object[] liveConnectorTransportParams,
+ String[] connectorNames,
Object[] bindings) throws Exception;
/**
@@ -170,8 +157,7 @@
void createConnectionFactory(@Parameter(name = "name") String name,
@Parameter(name = "ha") boolean ha,
@Parameter(name = "cfType", desc =
"RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int
cfType,
- @Parameter(name = "liveTransportClassNames",
desc = "comma-separated list of class names for transport to live servers")
String liveTransportClassNames,
- @Parameter(name = "liveTransportParams", desc =
"comma-separated list of key=value parameters for the live transports (enclosed
between { } for each transport)") String liveTransportParams,
+ @Parameter(name = "connectorNames", desc =
"comma-separated list of connectorNames") String connectors,
@Parameter(name = "jndiBindings", desc =
"comma-separated list of JNDI bindings (use ',' if u need to use
commas in your jndi name)") String jndiBindings) throws Exception;
/**
@@ -183,29 +169,26 @@
*
* @see #createConnectionFactory(String, Object[], Object[], Object[], Object[])
*/
- void createConnectionFactory(String name,
+ void createConnectionFactoryDiscovery(String name,
boolean ha,
@Parameter(name = "cfType", desc =
"RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int
cfType,
- String discoveryAddress,
- int discoveryPort,
- Object[] bindings) throws Exception;
+ @Parameter(name = "discoveryGroupName",
desc="Refereced at the main configuration, it's the name of the config with
automatic discovery") String discoveryGroupName,
+ @Parameter(name = "jndiBindings",
desc="Comma separated JNDI Bindings") String bindings) throws Exception;
/**
* Create a JMS ConnectionFactory with the specified name using a discovery group to
discover HornetQ servers.
* <br>
- * The ConnectionFactory is bound to JNDI for the specified bindings Strings
+ * The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
* <br>
* This factory listens to the specified {@code discoveryAddress} and {@code
discoveryPort} to discover which servers it can connect to.
*
* @see #createConnectionFactory(String, Object[], Object[], Object[], Object[])
*/
- @Operation(desc = "Create a JMS ConnectionFactory", impact =
MBeanOperationInfo.ACTION)
- void createConnectionFactory(@Parameter(name = "name") String name,
- @Parameter(name = "ha") boolean ha,
+ void createConnectionFactoryDiscovery(String name,
+ boolean ha,
@Parameter(name = "cfType", desc =
"RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int
cfType,
- @Parameter(name = "discoveryAddress") String
discoveryAddress,
- @Parameter(name = "discoveryPort") int
discoveryPort,
- @Parameter(name = "jndiBindings") String
jndiBindings) throws Exception;
+ @Parameter(name = "discoveryGroupName",
desc="Refereced at the main configuration, it's the name of the config with
automatic discovery") String discoveryGroupName,
+ Object[] bindings) throws Exception;
/**
* Destroy the ConnectionFactory corresponding to the specified name.
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -316,8 +316,6 @@
this.nodeID = UUIDGenerator.getInstance().generateStringUUID();
- discoveryRefreshTimeout = HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT;
-
clientFailureCheckPeriod = HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD;
connectionTTL = HornetQClient.DEFAULT_CONNECTION_TTL;
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/config/DiscoveryGroupConfiguration.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -42,18 +42,22 @@
private int groupPort;
private long refreshTimeout;
+
+ private long discoveryInitialWaitTimeout;
public DiscoveryGroupConfiguration(final String name,
final String localBindAddress,
final String groupAddress,
final int groupPort,
- final long refreshTimeout)
+ final long refreshTimeout,
+ final long discoveryInitialWaitTimeout)
{
this.name = name;
this.groupAddress = groupAddress;
this.localBindAddress = localBindAddress;
this.groupPort = groupPort;
this.refreshTimeout = refreshTimeout;
+ this.discoveryInitialWaitTimeout = discoveryInitialWaitTimeout;
}
public String getName()
@@ -120,4 +124,22 @@
{
this.refreshTimeout = refreshTimeout;
}
+
+ /**
+ * @return the discoveryInitialWaitTimeout
+ */
+ public long getDiscoveryInitialWaitTimeout()
+ {
+ return discoveryInitialWaitTimeout;
+ }
+
+ /**
+ * @param discoveryInitialWaitTimeout the discoveryInitialWaitTimeout to set
+ */
+ public void setDiscoveryInitialWaitTimeout(long discoveryInitialWaitTimeout)
+ {
+ this.discoveryInitialWaitTimeout = discoveryInitialWaitTimeout;
+ }
+
+
}
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/deployers/impl/FileConfigurationParser.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -935,6 +935,11 @@
String groupAddress = XMLConfigurationUtil.getString(e, "group-address",
null, Validators.NOT_NULL_OR_EMPTY);
int groupPort = XMLConfigurationUtil.getInteger(e, "group-port", -1,
Validators.MINUS_ONE_OR_GT_ZERO);
+
+ long discoveryInitialWaitTimeout = XMLConfigurationUtil.getLong(e,
+
"initial-wait-timeout",
+
HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
+
Validators.GT_ZERO);
long refreshTimeout = XMLConfigurationUtil.getLong(e,
"refresh-timeout",
@@ -945,7 +950,8 @@
localBindAddress,
groupAddress,
groupPort,
-
refreshTimeout);
+
refreshTimeout,
+
discoveryInitialWaitTimeout);
if (mainConfig.getDiscoveryGroupConfigurations().containsKey(name))
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -69,6 +69,11 @@
{
serverLocator = null;
}
+
+ public HornetQConnectionFactory(final ServerLocator serverLocator)
+ {
+ this.serverLocator = serverLocator;
+ }
public HornetQConnectionFactory(final boolean ha, final String discoveryAddress, final
int discoveryPort)
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQJMSConnectionFactory.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -16,6 +16,7 @@
import javax.jms.ConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ServerLocator;
/**
@@ -37,6 +38,14 @@
}
/**
+ * @param serverLocator
+ */
+ public HornetQJMSConnectionFactory(ServerLocator serverLocator)
+ {
+ super(serverLocator);
+ }
+
+ /**
* @param ha
* @param discoveryAddress
* @param discoveryPort
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQQueueConnectionFactory.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -16,6 +16,7 @@
import javax.jms.QueueConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ServerLocator;
/**
* A class that represents a QueueConnectionFactory.
@@ -36,6 +37,14 @@
}
/**
+ * @param serverLocator
+ */
+ public HornetQQueueConnectionFactory(ServerLocator serverLocator)
+ {
+ super(serverLocator);
+ }
+
+ /**
* @param ha
* @param discoveryAddress
* @param discoveryPort
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQTopicConnectionFactory.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -16,6 +16,7 @@
import javax.jms.TopicConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ServerLocator;
/**
* A class that represents a TopicConnectionFactory.
@@ -36,6 +37,15 @@
}
/**
+ * @param serverLocator
+ */
+ public HornetQTopicConnectionFactory(ServerLocator serverLocator)
+ {
+ super(serverLocator);
+ }
+
+
+ /**
* @param ha
* @param discoveryAddress
* @param discoveryPort
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAConnectionFactory.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -16,6 +16,7 @@
import javax.jms.XAConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ServerLocator;
/**
* A class that represents a XAConnectionFactory.
@@ -35,6 +36,14 @@
}
/**
+ * @param serverLocator
+ */
+ public HornetQXAConnectionFactory(ServerLocator serverLocator)
+ {
+ super(serverLocator);
+ }
+
+ /**
* @param ha
* @param discoveryAddress
* @param discoveryPort
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXAQueueConnectionFactory.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -16,6 +16,7 @@
import javax.jms.XAQueueConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ServerLocator;
/**
* A class that represents a XAQueueConnectionFactory.
@@ -36,6 +37,14 @@
}
/**
+ * @param serverLocator
+ */
+ public HornetQXAQueueConnectionFactory(ServerLocator serverLocator)
+ {
+ super(serverLocator);
+ }
+
+ /**
* @param ha
* @param discoveryAddress
* @param discoveryPort
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/client/HornetQXATopicConnectionFactory.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -16,6 +16,7 @@
import javax.jms.XATopicConnectionFactory;
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ServerLocator;
/**
* A class that represents a XATopicConnectionFactory.
@@ -36,6 +37,14 @@
}
/**
+ * @param serverLocator
+ */
+ public HornetQXATopicConnectionFactory(final ServerLocator serverLocator)
+ {
+ super(serverLocator);
+ }
+
+ /**
* @param ha
* @param discoveryAddress
* @param discoveryPort
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -30,8 +30,6 @@
import javax.management.NotificationListener;
import javax.management.StandardMBean;
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.management.ManagementHelper;
import org.hornetq.api.core.management.Parameter;
import org.hornetq.api.jms.management.ConnectionFactoryControl;
import org.hornetq.api.jms.management.DestinationControl;
@@ -45,10 +43,10 @@
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.jms.client.HornetQQueue;
import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.impl.JMSFactoryType;
import org.hornetq.spi.core.protocol.RemotingConnection;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
-import org.hornetq.jms.server.impl.JMSFactoryType;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -130,28 +128,6 @@
return result;
}
- private static List<TransportConfiguration>
convertToTransportConfigurationArray(final Object[] liveConnectorsTransportClassNames,
- final
Object[] liveConnectorTransportParams)
- {
- List<TransportConfiguration> tcs = new
ArrayList<TransportConfiguration>();
-
- for (int i = 0; i < liveConnectorsTransportClassNames.length; i++)
- {
- Map<String, Object> liveParams = null;
- if (liveConnectorTransportParams.length > i)
- {
- liveParams = (Map<String, Object>)liveConnectorTransportParams[i];
- }
-
- TransportConfiguration tcLive = new
TransportConfiguration(liveConnectorsTransportClassNames[i].toString(),
- liveParams);
-
- tcs.add(tcLive);
- }
-
- return tcs;
- }
-
public static MBeanNotificationInfo[] getNotificationInfos()
{
NotificationType[] values = NotificationType.values();
@@ -177,12 +153,15 @@
// Public --------------------------------------------------------
// JMSServerControlMBean implementation --------------------------
- public void createConnectionFactory(final String name,
- final boolean ha,
- final int cfType,
- final String liveTransportClassName,
- final Map<String, Object>
liveTransportParams,
- final Object[] jndiBindings) throws Exception
+
+ /**
+ * See the interface definition for the javadoc.
+ */
+ public void createConnectionFactory(String name,
+ boolean ha,
+ int cfType,
+ String[] connectorNames,
+ Object[] jndiBindings) throws Exception
{
checkStarted();
@@ -190,16 +169,17 @@
try
{
- TransportConfiguration liveTC = new
TransportConfiguration(liveTransportClassName, liveTransportParams);
+ List<String> connectorList = new
ArrayList<String>(connectorNames.length);
- List<TransportConfiguration> list = new
ArrayList<TransportConfiguration>(1);
+ for (String str : connectorNames)
+ {
+ connectorList.add(str);
+ }
- list.add(liveTC);
-
server.createConnectionFactory(name,
ha,
JMSFactoryType.valueOf(cfType),
- list,
+ connectorList,
JMSServerControlImpl.convert(jndiBindings));
sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
@@ -210,41 +190,27 @@
}
}
- public void createConnectionFactory(final String name,
- final boolean ha,
- int cfType,
- final Object[] liveConnectorsTransportClassNames,
- final Object[] liveConnectorTransportParams,
- final Object[] jndiBindings) throws Exception
+ /**
+ * Create a JMS ConnectionFactory with the specified name connected to a single
live-backup pair of servers.
+ * <br>
+ * The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
+ *
+ */
+ public void createConnectionFactory(String name, boolean ha, int cfType, String
connectors, String jndiBindings) throws Exception
{
- checkStarted();
- clearIO();
+ createConnectionFactory(name, ha, cfType, toArray(connectors),
toArray(jndiBindings));
- try
- {
- List<TransportConfiguration> pairs =
JMSServerControlImpl.convertToTransportConfigurationArray(liveConnectorsTransportClassNames,
-
liveConnectorTransportParams);
- server.createConnectionFactory(name,
- ha,
- JMSFactoryType.valueOf(cfType),
- pairs,
- JMSServerControlImpl.convert(jndiBindings));
-
- sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
- }
- finally
- {
- blockOnIO();
- }
}
- public void createConnectionFactory(final String name,
- final boolean ha,
- final int cfType,
- final String liveTransportClassNames,
- final String liveTransportParams,
- final String jndiBindings) throws Exception
+ /**
+ * Look at the iterface for the javadoc
+ */
+ public void createConnectionFactoryDiscovery(String name,
+ boolean ha,
+ int cfType,
+ String discoveryGroupName,
+ Object[] bindings) throws Exception
{
checkStarted();
@@ -252,36 +218,11 @@
try
{
- Object[] liveClassNames =
JMSServerControlImpl.toArray(liveTransportClassNames);
- Object[] liveParams =
ManagementHelper.fromCommaSeparatedArrayOfCommaSeparatedKeyValues(liveTransportParams);
- Object[] bindings = JMSServerControlImpl.toArray(jndiBindings);
- createConnectionFactory(name, ha, cfType, liveClassNames, liveParams,
bindings);
- }
- finally
- {
- blockOnIO();
- }
- }
-
- public void createConnectionFactory(final String name,
- final boolean ha,
- final int cfType,
- final String discoveryAddress,
- final int discoveryPort,
- final Object[] jndiBindings) throws Exception
- {
- checkStarted();
-
- clearIO();
-
- try
- {
server.createConnectionFactory(name,
ha,
JMSFactoryType.valueOf(cfType),
- discoveryAddress,
- discoveryPort,
- JMSServerControlImpl.convert(jndiBindings));
+ discoveryGroupName,
+ JMSServerControlImpl.convert(bindings));
sendNotification(NotificationType.CONNECTION_FACTORY_CREATED, name);
}
@@ -289,30 +230,19 @@
{
blockOnIO();
}
+
}
- public void createConnectionFactory(final String name,
- final boolean ha,
- final int cfType,
- final String discoveryAddress,
- final int discoveryPort,
- final String jndiBindings) throws Exception
+ /**
+ * Look at the iterface for the javadoc
+ */
+ public void createConnectionFactoryDiscovery(String name,
+ boolean ha,
+ int cfType,
+ String discoveryGroupName,
+ String jndiBindings) throws Exception
{
- checkStarted();
-
- clearIO();
-
- try
- {
- Object[] bindings = JMSServerControlImpl.toArray(jndiBindings);
-
- createConnectionFactory(name, ha, cfType, discoveryAddress, discoveryPort,
bindings);
-
- }
- finally
- {
- blockOnIO();
- }
+ createConnectionFactoryDiscovery(name, ha, cfType, discoveryGroupName,
toArray(jndiBindings));
}
public boolean createQueue(final String name) throws Exception
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/JMSServerManager.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -159,18 +159,18 @@
*/
boolean destroyTopic(String name) throws Exception;
- void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, String
discoveryAddress, int discoveryPort, String ... jndiBindings) throws Exception;
+ void createConnectionFactory(String name, boolean ha, JMSFactoryType cfType, String
discoveryGroupName, String ... jndiBindings) throws Exception;
void createConnectionFactory(String name,
boolean ha,
JMSFactoryType cfType,
- List<TransportConfiguration> connectorConfigs,
+ List<String> connectorNames,
String ... bindings) throws Exception;
void createConnectionFactory(String name,
boolean ha,
JMSFactoryType cfType,
- List<TransportConfiguration> connectorConfigs,
+ List<String> connectorNames,
String clientID,
long clientFailureCheckPeriod,
long connectionTTL,
@@ -204,12 +204,8 @@
void createConnectionFactory(String name,
boolean ha,
JMSFactoryType cfType,
- String localBindAdress,
- String discoveryAddress,
- int discoveryPort,
+ String discoveryGroupName,
String clientID,
- long discoveryRefreshTimeout,
- long discoveryInitialWaitTimeout,
long clientFailureCheckPeriod,
long connectionTTL,
long callTimeout,
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/ConnectionFactoryConfiguration.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -34,21 +34,13 @@
void setBindings(String[] bindings);
- String getLocalBindAddress();
+ String getDiscoveryGroupName();
- void setLocalBindAddress(String localBindAddress);
+ void setDiscoveryGroupName(String discoveryGroupName);
+
+ List<String> getConnectorNames();
- String getDiscoveryAddress();
-
- void setDiscoveryAddress(String discoveryAddress);
-
- int getDiscoveryPort();
-
- void setDiscoveryPort(int discoveryPort);
-
- List<TransportConfiguration> getConnectorConfigs();
-
- void setConnectorConfigs(List<TransportConfiguration> connectorConfigs);
+ void setConnectorNames(List<String> connectorNames);
boolean isHA();
@@ -58,10 +50,6 @@
void setClientID(String clientID);
- long getDiscoveryRefreshTimeout();
-
- void setDiscoveryRefreshTimeout(long discoveryRefreshTimeout);
-
long getClientFailureCheckPeriod();
void setClientFailureCheckPeriod(long clientFailureCheckPeriod);
@@ -134,10 +122,6 @@
void setDupsOKBatchSize(int dupsOKBatchSize);
- long getInitialWaitTimeout();
-
- void setInitialWaitTimeout(long initialWaitTimeout);
-
boolean isUseGlobalPools();
void setUseGlobalPools(boolean useGlobalPools);
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -24,6 +24,8 @@
import org.hornetq.utils.BufferHelper;
import org.hornetq.utils.DataConstants;
+import org.hornetq.api.core.SimpleString;;
+
/**
* A ConnectionFactoryConfigurationImpl
*
@@ -41,20 +43,14 @@
private String[] bindings;
- private String localBindAddress;
+ private List<String> connectorNames;
+
+ private String discoveryGroupName;
- private String discoveryAddress;
-
- private int discoveryPort;
-
- private List<TransportConfiguration> connectorConfigs;
-
private String clientID = null;
private boolean ha = HornetQClient.DEFAULT_HA;
- private long discoveryRefreshTimeout =
HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT;
-
private long clientFailureCheckPeriod =
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD;
private long connectionTTL = HornetQClient.DEFAULT_CONNECTION_TTL;
@@ -124,26 +120,15 @@
public ConnectionFactoryConfigurationImpl(final String name,
final boolean ha,
- final String discoveryAddress,
- final int discoveryPort,
+ final List<String> connectorNames,
final String... bindings)
{
this(name, ha, bindings);
- this.discoveryAddress = discoveryAddress;
- this.discoveryPort = discoveryPort;
+ this.connectorNames = connectorNames;
}
- public ConnectionFactoryConfigurationImpl(final String name,
- final boolean ha,
- final List<TransportConfiguration>
transportConfigs,
- final String... bindings)
+ public ConnectionFactoryConfigurationImpl(final String name, final boolean ha, final
String... bindings)
{
- this(name, ha, bindings);
- connectorConfigs = transportConfigs;
- }
-
- private ConnectionFactoryConfigurationImpl(final String name, final boolean ha, final
String... bindings)
- {
this.name = name;
this.ha = ha;
this.bindings = new String[bindings.length];
@@ -167,46 +152,32 @@
return name;
}
- public String getLocalBindAddress()
+ /**
+ * @return the discoveryGroupName
+ */
+ public String getDiscoveryGroupName()
{
- return localBindAddress;
+ return discoveryGroupName;
}
- public void setLocalBindAddress(final String localBindAddress)
+ /**
+ * @param discoveryGroupName the discoveryGroupName to set
+ */
+ public void setDiscoveryGroupName(String discoveryGroupName)
{
- this.localBindAddress = localBindAddress;
+ this.discoveryGroupName = discoveryGroupName;
}
- public String getDiscoveryAddress()
+ public List<String> getConnectorNames()
{
- return discoveryAddress;
+ return connectorNames;
}
- public void setDiscoveryAddress(final String discoveryAddress)
+ public void setConnectorNames(final List<String> connectorNames)
{
- this.discoveryAddress = discoveryAddress;
+ this.connectorNames = connectorNames;
}
- public int getDiscoveryPort()
- {
- return discoveryPort;
- }
-
- public void setDiscoveryPort(final int discoveryPort)
- {
- this.discoveryPort = discoveryPort;
- }
-
- public List<TransportConfiguration> getConnectorConfigs()
- {
- return connectorConfigs;
- }
-
- public void setConnectorConfigs(final List<TransportConfiguration>
connectorConfigs)
- {
- this.connectorConfigs = connectorConfigs;
- }
-
public boolean isHA()
{
return ha;
@@ -227,16 +198,6 @@
this.clientID = clientID;
}
- public long getDiscoveryRefreshTimeout()
- {
- return discoveryRefreshTimeout;
- }
-
- public void setDiscoveryRefreshTimeout(final long discoveryRefreshTimeout)
- {
- this.discoveryRefreshTimeout = discoveryRefreshTimeout;
- }
-
public long getClientFailureCheckPeriod()
{
return clientFailureCheckPeriod;
@@ -526,32 +487,24 @@
{
name = buffer.readSimpleString().toString();
- localBindAddress = BufferHelper.readNullableSimpleStringAsString(buffer);
-
- discoveryAddress = BufferHelper.readNullableSimpleStringAsString(buffer);
-
- discoveryPort = buffer.readInt();
-
+ discoveryGroupName = BufferHelper.readNullableSimpleStringAsString(buffer);
+
int nConnectors = buffer.readInt();
if (nConnectors > 0)
{
- connectorConfigs = new ArrayList<TransportConfiguration>(nConnectors);
+ connectorNames = new ArrayList<String>(nConnectors);
for (int i = 0; i < nConnectors; i++)
{
- TransportConfiguration tc = new TransportConfiguration();
-
- tc.decode(buffer);
-
- connectorConfigs.add(tc);
+ SimpleString str = buffer.readSimpleString();
+
+ connectorNames.add(str.toString());
}
}
clientID = BufferHelper.readNullableSimpleStringAsString(buffer);
- discoveryRefreshTimeout = buffer.readLong();
-
clientFailureCheckPeriod = buffer.readLong();
connectionTTL = buffer.readLong();
@@ -618,30 +571,24 @@
{
BufferHelper.writeAsSimpleString(buffer, name);
- BufferHelper.writeAsNullableSimpleString(buffer, localBindAddress);
-
- BufferHelper.writeAsNullableSimpleString(buffer, discoveryAddress);
-
- buffer.writeInt(discoveryPort);
-
- if (connectorConfigs == null)
+ BufferHelper.writeAsNullableSimpleString(buffer, discoveryGroupName);
+
+ if (this.connectorNames == null)
{
buffer.writeInt(0);
}
else
{
- buffer.writeInt(connectorConfigs.size());
+ buffer.writeInt(connectorNames.size());
- for (TransportConfiguration tc : connectorConfigs)
+ for (String tc : connectorNames)
{
- tc.encode(buffer);
+ BufferHelper.writeAsSimpleString(buffer, tc);
}
}
BufferHelper.writeAsNullableSimpleString(buffer, clientID);
- buffer.writeLong(discoveryRefreshTimeout);
-
buffer.writeLong(clientFailureCheckPeriod);
buffer.writeLong(connectionTTL);
@@ -708,22 +655,19 @@
{
int size = BufferHelper.sizeOfSimpleString(name) +
- BufferHelper.sizeOfNullableSimpleString(localBindAddress) +
+ BufferHelper.sizeOfNullableSimpleString(discoveryGroupName);
+
+ size += DataConstants.SIZE_INT;
- BufferHelper.sizeOfNullableSimpleString(discoveryAddress) +
-
- DataConstants.SIZE_INT; // discoveryPort
-
- if (connectorConfigs != null)
+ if (this.connectorNames != null)
{
- for (TransportConfiguration tc : connectorConfigs)
+ for (String tc : connectorNames)
{
- size += TransportConfigurationEncodingSupport.getEncodeSize(tc);
+ size += BufferHelper.sizeOfSimpleString(tc);
}
}
+
size += BufferHelper.sizeOfNullableSimpleString(clientID) +
- DataConstants.SIZE_LONG +
- // discoveryRefreshTimeout
DataConstants.SIZE_LONG +
// clientFailureCheckPeriod
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerConfigParserImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -59,17 +59,14 @@
// Attributes ----------------------------------------------------
- private final Configuration config;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
- public JMSServerConfigParserImpl(final Configuration config)
+ public JMSServerConfigParserImpl()
{
- this.config = config;
}
/**
@@ -344,11 +341,6 @@
"connection-load-balancing-policy-class-name",
HornetQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
Validators.NOT_NULL_OR_EMPTY);
- long discoveryInitialWaitTimeout = XMLConfigurationUtil.getLong(e,
-
"discovery-initial-wait-timeout",
-
HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
-
Validators.GT_ZERO);
-
boolean ha = XMLConfigurationUtil.getBoolean(e, "ha",
HornetQClient.DEFAULT_HA);
String groupid = XMLConfigurationUtil.getString(e, "group-id", null,
Validators.NO_CHECK);
@@ -403,44 +395,19 @@
if (discoveryGroupName != null)
{
- DiscoveryGroupConfiguration discoveryGroupConfiguration =
config.getDiscoveryGroupConfigurations()
-
.get(discoveryGroupName);
-
- if (discoveryGroupConfiguration == null)
- {
- log.warn("There is no discovery group with name '" +
discoveryGroupName + "' deployed.");
-
- throw new IllegalArgumentException("There is no discovery group with
name '" + discoveryGroupName +
- "' deployed.");
- }
-
cfConfig = new ConnectionFactoryConfigurationImpl(name,
ha,
-
discoveryGroupConfiguration.getGroupAddress(),
-
discoveryGroupConfiguration.getGroupPort(),
strbindings);
-
cfConfig.setLocalBindAddress(discoveryGroupConfiguration.getLocalBindAddress());
- cfConfig.setInitialWaitTimeout(discoveryInitialWaitTimeout);
-
cfConfig.setDiscoveryRefreshTimeout(discoveryGroupConfiguration.getRefreshTimeout());
+ cfConfig.setDiscoveryGroupName(discoveryGroupName);
}
else
{
- List<TransportConfiguration> tcList = new
ArrayList<TransportConfiguration>();
-
+ ArrayList<String> connectors = new
ArrayList<String>(connectorNames.size());
for (String connectorName : connectorNames)
{
- TransportConfiguration tc =
config.getConnectorConfigurations().get(connectorName);
-
- if (tc == null)
- {
- log.warn("There is no connector with name '" + connectorName
+ "' deployed.");
-
- throw new IllegalArgumentException("There is no connector with name
'" + connectorName + "' deployed.");
- }
-
- tcList.add(tc);
+ connectors.add(connectorName);
}
- cfConfig = new ConnectionFactoryConfigurationImpl(name, ha, tcList,
strbindings);
+ cfConfig = new ConnectionFactoryConfigurationImpl(name, ha, connectors,
strbindings);
}
cfConfig.setFactoryType(factType);
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerDeployer.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -63,7 +63,7 @@
this.jmsServerManager = jmsServerManager;
- parser = new
JMSServerConfigParserImpl(jmsServerManager.getHornetQServer().getConfiguration());
+ parser = new JMSServerConfigParserImpl();
}
/**
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -29,6 +29,7 @@
import org.hornetq.api.core.management.ResourceNames;
import org.hornetq.api.jms.HornetQJMSClient;
import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.DiscoveryGroupConfiguration;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.deployers.impl.FileDeploymentManager;
import org.hornetq.core.deployers.impl.XmlDeployer;
@@ -697,7 +698,7 @@
public synchronized void createConnectionFactory(final String name,
final boolean ha,
final JMSFactoryType cfType,
- final
List<TransportConfiguration> connectorConfigs,
+ final List<String>
connectorNames,
String... jndiBindings) throws
Exception
{
checkInitialised();
@@ -706,7 +707,7 @@
{
ConnectionFactoryConfiguration configuration = new
ConnectionFactoryConfigurationImpl(name,
ha,
-
connectorConfigs);
+
connectorNames);
configuration.setFactoryType(cfType);
createConnectionFactory(true, configuration, jndiBindings);
}
@@ -715,7 +716,7 @@
public synchronized void createConnectionFactory(final String name,
final boolean ha,
JMSFactoryType cfType,
- final
List<TransportConfiguration> connectorConfigs,
+ final List<String>
connectorNames,
final String clientID,
final long clientFailureCheckPeriod,
final long connectionTTL,
@@ -752,7 +753,7 @@
{
ConnectionFactoryConfiguration configuration = new
ConnectionFactoryConfigurationImpl(name,
ha,
-
connectorConfigs);
+
connectorNames);
configuration.setClientID(clientID);
configuration.setClientFailureCheckPeriod(clientFailureCheckPeriod);
configuration.setConnectionTTL(connectionTTL);
@@ -787,13 +788,9 @@
public synchronized void createConnectionFactory(final String name,
final boolean ha,
- JMSFactoryType cfType,
- final String localBindAddress,
- final String discoveryAddress,
- final int discoveryPort,
+ final JMSFactoryType cfType,
+ final String discoveryGroupName,
final String clientID,
- final long discoveryRefreshTimeout,
- final long
discoveryInitialWaitTimeout,
final long clientFailureCheckPeriod,
final long connectionTTL,
final long callTimeout,
@@ -829,13 +826,10 @@
{
ConnectionFactoryConfiguration configuration = new
ConnectionFactoryConfigurationImpl(name,
ha,
-
discoveryAddress,
-
discoveryPort);
+
jndiBindings);
+ configuration.setDiscoveryGroupName(discoveryGroupName);
configuration.setFactoryType(cfType);
- configuration.setLocalBindAddress(localBindAddress);
configuration.setClientID(clientID);
- configuration.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
- configuration.setInitialWaitTimeout(discoveryInitialWaitTimeout);
configuration.setClientFailureCheckPeriod(clientFailureCheckPeriod);
configuration.setConnectionTTL(connectionTTL);
configuration.setCallTimeout(callTimeout);
@@ -869,8 +863,7 @@
public synchronized void createConnectionFactory(final String name,
final boolean ha,
final JMSFactoryType cfType,
- final String discoveryAddress,
- final int discoveryPort,
+ final String discoveryGroupName,
final String... jndiBindings) throws
Exception
{
checkInitialised();
@@ -879,8 +872,8 @@
{
ConnectionFactoryConfiguration configuration = new
ConnectionFactoryConfigurationImpl(name,
ha,
-
discoveryAddress,
-
discoveryPort);
+
jndiBindings);
+ configuration.setDiscoveryGroupName(discoveryGroupName);
createConnectionFactory(true, configuration, jndiBindings);
}
}
@@ -1007,36 +1000,58 @@
if (cf == null)
{
- if (cfConfig.getDiscoveryAddress() != null)
+ if (cfConfig.getDiscoveryGroupName() != null)
{
+ DiscoveryGroupConfiguration groupConfig =
server.getConfiguration().getDiscoveryGroupConfigurations().get(cfConfig.getDiscoveryGroupName());
+
+ if (groupConfig == null)
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "Discovery
Group '" + cfConfig.getDiscoveryGroupName() + "' doesn't exist on
maing config");
+ }
if (cfConfig.isHA())
{
- cf =
HornetQJMSClient.createConnectionFactoryWithHA(cfConfig.getDiscoveryAddress(),
-
cfConfig.getDiscoveryPort(),
+ cf =
HornetQJMSClient.createConnectionFactoryWithHA(groupConfig.getGroupAddress(),
+
groupConfig.getGroupPort(),
cfConfig.getFactoryType());
}
else
{
- cf =
HornetQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getDiscoveryAddress(),
-
cfConfig.getDiscoveryPort(),
+ cf =
HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfig.getGroupAddress(),
+
groupConfig.getGroupPort(),
cfConfig.getFactoryType());
}
- cf.setLocalBindAddress(cfConfig.getLocalBindAddress());
- cf.setDiscoveryRefreshTimeout(cfConfig.getDiscoveryRefreshTimeout());
- cf.setDiscoveryInitialWaitTimeout(cfConfig.getInitialWaitTimeout());
+ cf.setLocalBindAddress(groupConfig.getLocalBindAddress());
+ cf.setDiscoveryRefreshTimeout(groupConfig.getRefreshTimeout());
+
cf.setDiscoveryInitialWaitTimeout(groupConfig.getDiscoveryInitialWaitTimeout());
}
else
{
- TransportConfiguration[] connectorConfigs =
(TransportConfiguration[])cfConfig.getConnectorConfigs().toArray(new
TransportConfiguration[cfConfig.getConnectorConfigs().size()]);
+ if (cfConfig.getConnectorNames() == null ||
cfConfig.getConnectorNames().size() == 0)
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE, "Null
Connector name passed to create ConnectionFactory");
+ }
+ TransportConfiguration[] configs = new
TransportConfiguration[cfConfig.getConnectorNames().size()];
+
+ int count = 0;
+ for (String name : cfConfig.getConnectorNames())
+ {
+ TransportConfiguration connector =
server.getConfiguration().getConnectorConfigurations().get(name);
+ if (connector == null)
+ {
+ throw new HornetQException(HornetQException.ILLEGAL_STATE,
"Connector '" + name + "' not found on the main configuration
file");
+ }
+ configs[count++] = connector;
+ }
+
if (cfConfig.isHA())
{
- cf =
HornetQJMSClient.createConnectionFactoryWithHA(cfConfig.getFactoryType(),
connectorConfigs);
+ cf =
HornetQJMSClient.createConnectionFactoryWithHA(cfConfig.getFactoryType(), configs);
}
else
{
- cf =
HornetQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getFactoryType(),
connectorConfigs);
+ cf =
HornetQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getFactoryType(), configs);
}
}
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/CTSMiscellaneousTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -26,6 +26,7 @@
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.server.impl.JMSFactoryType;
+import org.hornetq.tests.util.RandomUtil;
/**
* Safeguards for previously detected TCK failures.
@@ -48,7 +49,6 @@
private static final String ORG_JBOSS_MESSAGING_SERVICE_LBCONNECTION_FACTORY =
"StrictTCKConnectionFactory";
// Constructors --------------------------------------------------
-
@Override
protected void setUp() throws Exception
{
@@ -65,7 +65,7 @@
getJmsServerManager().createConnectionFactory("StrictTCKConnectionFactory",
false,
JMSFactoryType.CF,
- connectorConfigs,
+
registerTransportConfigurations(connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/HornetQServerTestCase.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -35,6 +35,7 @@
import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
+import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.HornetQServer;
@@ -42,6 +43,7 @@
import org.hornetq.jms.tests.tools.ServerManagement;
import org.hornetq.jms.tests.tools.container.Server;
import org.hornetq.jms.tests.util.ProxyAssertSupport;
+import org.hornetq.tests.util.RandomUtil;
/**
* @author <a href="mailto:adrian@jboss.org">Adrian Brock</a>
@@ -61,7 +63,29 @@
protected final Logger log = Logger.getLogger(getClass());
// Static --------------------------------------------------------
+
+ /**
+ * @param connectorConfigs
+ * @return
+ */
+ protected ArrayList<String>
registerTransportConfigurations(List<TransportConfiguration> connectorConfigs)
throws Exception
+ {
+ // The connectors need to be pre-configured at main config object but this method
is taking TransportConfigurations directly
+ // So this will first register them at the config and then generate a list of
objects
+ ArrayList<String> connectors = new ArrayList<String>();
+ for (TransportConfiguration tnsp : connectorConfigs)
+ {
+ String name = RandomUtil.randomString();
+
+ getJmsServer().getConfiguration().getConnectorConfigurations().put(name, tnsp);
+
+ connectors.add(name);
+ }
+ return connectors;
+ }
+
+
/** Some testcases are time sensitive, and we need to make sure a GC would happen
before certain scenarios*/
public static void forceGC()
{
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/JMSTestCase.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -69,7 +69,7 @@
getJmsServerManager().createConnectionFactory("testsuitecf",
false,
JMSFactoryType.CF,
- connectorConfigs,
+
registerTransportConfigurations(connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -103,7 +103,7 @@
getJmsServerManager().createConnectionFactory("testsuitecf_queue",
false,
JMSFactoryType.QUEUE_CF,
- connectorConfigs,
+
registerTransportConfigurations(connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -137,7 +137,7 @@
getJmsServerManager().createConnectionFactory("testsuitecf_topic",
false,
JMSFactoryType.TOPIC_CF,
- connectorConfigs,
+
registerTransportConfigurations(connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -39,6 +39,7 @@
import org.hornetq.integration.bootstrap.HornetQBootstrapServer;
import org.hornetq.jms.server.JMSServerManager;
import org.hornetq.jms.server.impl.JMSFactoryType;
+import org.hornetq.tests.util.RandomUtil;
import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
/**
@@ -288,11 +289,13 @@
{
List<TransportConfiguration> connectorConfigs = new
ArrayList<TransportConfiguration>();
connectorConfigs.add(new
TransportConfiguration(NettyConnectorFactory.class.getName()));
+
+ ArrayList<String> connectors =
registerTransportConfigurations(connectorConfigs);
getJMSServerManager().createConnectionFactory(objectName,
false,
JMSFactoryType.CF,
- connectorConfigs,
+ connectors,
clientId,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -324,6 +327,26 @@
jndiBindings);
}
+ /**
+ * @param connectorConfigs
+ * @return
+ */
+ protected ArrayList<String>
registerTransportConfigurations(List<TransportConfiguration> connectorConfigs)
+ {
+ // The connectors need to be pre-configured at main config object but this method
is taking TransportConfigurations directly
+ // So this will first register them at the config and then generate a list of
objects
+ ArrayList<String> connectors = new ArrayList<String>();
+ for (TransportConfiguration tnsp : connectorConfigs)
+ {
+ String name = RandomUtil.randomString();
+
+ getHornetQServer().getConfiguration().getConnectorConfigurations().put(name,
tnsp);
+
+ connectors.add(name);
+ }
+ return connectors;
+ }
+
public void undeployConnectionFactory(final String objectName) throws Exception
{
getJMSServerManager().destroyConnectionFactory(objectName);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -119,7 +119,7 @@
null,
groupAddress,
groupPort,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ 0,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
HornetQClient.DEFAULT_CALL_TIMEOUT,
@@ -161,7 +161,7 @@
tc,
null,
-1,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ 0,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
HornetQClient.DEFAULT_CALL_TIMEOUT,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -20,14 +20,19 @@
import junit.framework.Assert;
-import org.hornetq.api.core.Pair;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+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.config.BridgeConfiguration;
import org.hornetq.core.config.BroadcastGroupConfiguration;
+import org.hornetq.core.config.CoreQueueConfiguration;
import org.hornetq.core.config.DiscoveryGroupConfiguration;
-import org.hornetq.core.config.CoreQueueConfiguration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
@@ -96,7 +101,7 @@
server0.getConfiguration().getBroadcastGroupConfigurations().add(bcConfig);
- DiscoveryGroupConfiguration dcConfig = new
DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000);
+ DiscoveryGroupConfiguration dcConfig = new
DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
server0.getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(),
dcConfig);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -1525,7 +1525,7 @@
configuration.getBroadcastGroupConfigurations().add(bcConfig);
- DiscoveryGroupConfiguration dcConfig = new
DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000);
+ DiscoveryGroupConfiguration dcConfig = new
DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/FloodServerTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -24,7 +24,6 @@
import javax.jms.MessageProducer;
import javax.jms.Session;
-import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.jms.HornetQJMSClient;
@@ -122,7 +121,6 @@
int retryInterval = 1000;
double retryIntervalMultiplier = 1.0;
int reconnectAttempts = -1;
- boolean failoverOnServerShutdown = true;
long callTimeout = 30000;
List<TransportConfiguration> connectorConfigs = new
ArrayList<TransportConfiguration>();
@@ -131,7 +129,7 @@
serverManager.createConnectionFactory("ManualReconnectionToSingleServerTest",
false,
JMSFactoryType.CF,
- connectorConfigs,
+ registerConnectors(server,
connectorConfigs),
null,
1000,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -64,7 +64,7 @@
null,
null,
-1,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ 0,
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -122,7 +122,7 @@
new TransportConfiguration[]{liveTC},
null,
-1,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ 0,
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -164,7 +164,7 @@
null,
groupAddress,
groupPort,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ 0,
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -205,7 +205,7 @@
new TransportConfiguration[]{liveTC},
null,
-1,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ 0,
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
@@ -247,7 +247,7 @@
new TransportConfiguration[]{liveTC},
null,
-1,
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ 0,
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/ManualReconnectionToSingleServerTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -171,8 +171,7 @@
configs.add(new TransportConfiguration(NettyConnectorFactory.class.getName()));
ConnectionFactoryConfiguration cfConfig = new
ConnectionFactoryConfigurationImpl("cf",
false,
- configs,
-
"/cf");
+ registerConnectors(server, configs), "/cf");
cfConfig.setRetryInterval(1000);
cfConfig.setRetryIntervalMultiplier(1.0);
cfConfig.setReconnectAttempts(-1);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/PreACKJMSTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -13,7 +13,9 @@
package org.hornetq.tests.integration.jms.client;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Random;
import javax.jms.Connection;
import javax.jms.MessageConsumer;
@@ -27,8 +29,10 @@
import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.core.server.HornetQServer;
import org.hornetq.jms.server.impl.JMSFactoryType;
import org.hornetq.tests.util.JMSTestBase;
+import org.hornetq.tests.util.RandomUtil;
/**
* A PreACKJMSTest
@@ -197,11 +201,13 @@
double retryIntervalMultiplier = 1.0;
int reconnectAttempts = -1;
int callTimeout = 30000;
+
+ ArrayList<String> connectors = registerConnectors(server, connectorConfigs);
jmsServer.createConnectionFactory("ManualReconnectionToSingleServerTest",
false,
JMSFactoryType.CF,
- connectorConfigs,
+ connectors,
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/ReSendMessageTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/ReSendMessageTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/ReSendMessageTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -300,7 +300,7 @@
jmsServer.createConnectionFactory("ManualReconnectionToSingleServerTest",
false,
JMSFactoryType.CF,
- connectorConfigs,
+ registerConnectors(server, connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -69,7 +69,7 @@
jmsServer.createConnectionFactory("cffoo",
false,
JMSFactoryType.CF,
- connectorConfigs,
+ registerConnectors(server, connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/StoreConfigTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -25,10 +25,7 @@
import javax.jms.Session;
import javax.naming.NamingException;
-import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
-import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
import org.hornetq.tests.util.JMSTestBase;
@@ -59,11 +56,14 @@
public void testCreateCF() throws Exception
{
- TransportConfiguration transportConfiguration = new
TransportConfiguration(InVMConnectorFactory.class.getName());
- List<TransportConfiguration> transportConfigurations = new
ArrayList<TransportConfiguration>();
- transportConfigurations.add(transportConfiguration);
+ server.getConfiguration().getConnectorConfigurations().put("tst", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+
+ server.getConfiguration().getConnectorConfigurations().put("np", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+
+ List<String> transportConfigurations = new ArrayList<String>();
+ transportConfigurations.add("tst");
ConnectionFactoryConfigurationImpl factCFG = new
ConnectionFactoryConfigurationImpl("tst", false, transportConfigurations);
-
+
jmsServer.createConnectionFactory(true, factCFG, "/someCF",
"/someCF2" );
@@ -108,9 +108,12 @@
public void testCreateTopic() throws Exception
{
- TransportConfiguration transportConfiguration = new
TransportConfiguration(InVMConnectorFactory.class.getName());
- List<TransportConfiguration> transportConfigurations = new
ArrayList<TransportConfiguration>();
- transportConfigurations.add(transportConfiguration);
+ server.getConfiguration().getConnectorConfigurations().put("tst", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+
+ server.getConfiguration().getConnectorConfigurations().put("np", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+
+ List<String> transportConfigurations = new ArrayList<String>();
+ transportConfigurations.add("tst");
ConnectionFactoryConfigurationImpl factCFG = new
ConnectionFactoryConfigurationImpl("tst", false, transportConfigurations);
@@ -217,9 +220,12 @@
public void testCreateQueue() throws Exception
{
- TransportConfiguration transportConfiguration = new
TransportConfiguration(InVMConnectorFactory.class.getName());
- List<TransportConfiguration> transportConfigurations = new
ArrayList<TransportConfiguration>();
- transportConfigurations.add(transportConfiguration);
+ server.getConfiguration().getConnectorConfigurations().put("tst", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+
+// server.getConfiguration().getConnectorConfigurations().put("np", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+
+ List<String> transportConfigurations = new ArrayList<String>();
+ transportConfigurations.add("tst");
ConnectionFactoryConfigurationImpl factCFG = new
ConnectionFactoryConfigurationImpl("tst", false, transportConfigurations);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/client/TextMessageTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -24,7 +24,6 @@
import junit.framework.Assert;
-import org.hornetq.api.core.Pair;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.jms.server.impl.JMSFactoryType;
@@ -236,7 +235,7 @@
jmsServer.createConnectionFactory("ManualReconnectionToSingleServerTest",
false,
JMSFactoryType.CF,
- connectorConfigs,
+ registerConnectors(server, connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/divert/DivertAndACKClientTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -147,7 +147,7 @@
jmsServer.createConnectionFactory("ManualReconnectionToSingleServerTest",
false,
JMSFactoryType.CF,
- connectorConfigs,
+ registerConnectors(server, connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/JMSServerDeployerTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -347,7 +347,7 @@
DiscoveryGroupConfiguration dcg = new
DiscoveryGroupConfiguration("mygroup", "172.16.8.10",
"243.7.7.7", 12345,
- 5432);
+ 5432, 5432);
config.getDiscoveryGroupConfigurations().put("mygroup", dcg);
HornetQServer server = createServer(false, config);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSConfigurationTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSConfigurationTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSConfigurationTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -74,7 +74,7 @@
transportConfigs.add(connectorConfig);
ConnectionFactoryConfiguration cfConfig = new
ConnectionFactoryConfigurationImpl(RandomUtil.randomString(),
false,
-
transportConfigs,
+
registerConnectors(coreServer, transportConfigs),
"/cf/binding1",
"/cf/binding2");
jmsConfiguration.getConnectionFactoryConfigurations().add(cfConfig);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/config/JMSServerConfigParserTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -54,7 +54,7 @@
// anything so the parsing will work
config.getConnectorConfigurations().put("netty", new
TransportConfiguration());
- JMSServerConfigParser parser = new JMSServerConfigParserImpl(config);
+ JMSServerConfigParser parser = new JMSServerConfigParserImpl();
String conf = "hornetq-jms-for-JMSServerDeployerTest.xml";
URL confURL = Thread.currentThread().getContextClassLoader().getResource(conf);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -38,7 +38,6 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.management.AddressControl;
import org.hornetq.api.core.management.ObjectNameBuilder;
-import org.hornetq.api.core.management.Parameter;
import org.hornetq.api.core.management.ResourceNames;
import org.hornetq.api.jms.management.JMSServerControl;
import org.hornetq.core.config.Configuration;
@@ -48,7 +47,6 @@
import org.hornetq.core.postoffice.QueueBinding;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
-import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.replication.ReplicationEndpoint;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
@@ -410,6 +408,8 @@
public void testCreateConnectionFactory_3b() throws Exception
{
+ server.getConfiguration().getConnectorConfigurations().put("tst", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
+
doCreateConnectionFactory(new ConnectionFactoryCreator()
{
public void createConnectionFactory(final JMSServerControl control,
@@ -417,75 +417,27 @@
final Object[] bindings) throws Exception
{
String jndiBindings = JMSServerControlTest.toCSV(bindings);
- String params = "\"" + TransportConstants.SERVER_ID_PROP_NAME
+ "\"=1";
control.createConnectionFactory(cfName,
false,
0,
- InVMConnectorFactory.class.getName(),
- params,
+ "tst",
jndiBindings);
}
});
}
- // with 2 live servers & no backups
- public void testCreateConnectionFactory_3c() throws Exception
- {
- doCreateConnectionFactory(new ConnectionFactoryCreator()
- {
- public void createConnectionFactory(final JMSServerControl control,
- final String cfName,
- final Object[] bindings) throws Exception
- {
- String jndiBindings = JMSServerControlTest.toCSV(bindings);
- String params = String.format("{%s=%s}, {%s=%s}",
- TransportConstants.SERVER_ID_PROP_NAME,
- 0,
- TransportConstants.SERVER_ID_PROP_NAME,
- 1);
-
- control.createConnectionFactory(cfName,
- false,
- 0,
- InVMConnectorFactory.class.getName() +
", " +
-
InVMConnectorFactory.class.getName(),
- params,
- jndiBindings);
- }
- });
- }
-
- public void testCreateConnectionFactory_5() throws Exception
- {
- doCreateConnectionFactory(new ConnectionFactoryCreator()
- {
- public void createConnectionFactory(final JMSServerControl control,
- final String cfName,
- final Object[] bindings) throws Exception
- {
- TransportConfiguration tcLive = new
TransportConfiguration(InVMConnectorFactory.class.getName());
-
- control.createConnectionFactory(cfName,
- false,
- 0,
- new Object[] { tcLive.getFactoryClassName()
},
- new Object[] { tcLive.getParams() },
- bindings);
- }
- });
- }
-
public void testListPreparedTransactionDetails() throws Exception
{
Xid xid = newXID();
JMSServerControl control = createManagementControl();
- TransportConfiguration tc = new
TransportConfiguration(InVMConnectorFactory.class.getName());
String cfJNDIBinding = "/cf";
String cfName = "cf";
+
+ server.getConfiguration().getConnectorConfigurations().put("tst", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
- control.createConnectionFactory(cfName, false, 0, tc.getFactoryClassName(),
"", cfJNDIBinding);
+ control.createConnectionFactory(cfName, false, 0, "tst", cfJNDIBinding);
control.createQueue("q", "/q");
@@ -525,8 +477,10 @@
TransportConfiguration tc = new
TransportConfiguration(InVMConnectorFactory.class.getName());
String cfJNDIBinding = "/cf";
String cfName = "cf";
+
+ server.getConfiguration().getConnectorConfigurations().put("tst", new
TransportConfiguration(INVM_CONNECTOR_FACTORY));
- control.createConnectionFactory(cfName, false, 0, tc.getFactoryClassName(),
"", cfJNDIBinding);
+ control.createConnectionFactory(cfName, false, 0, "tst", cfJNDIBinding);
control.createQueue("q", "/q");
@@ -649,6 +603,7 @@
null,
"231.7.7.7",
discoveryPort,
+
ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT,
ConfigurationImpl.DEFAULT_BROADCAST_REFRESH_TIMEOUT));
HornetQServer server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlUsingJMSTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -13,7 +13,6 @@
package org.hornetq.tests.integration.jms.server.management;
-import java.util.Map;
import java.util.Set;
import javax.jms.QueueConnection;
@@ -249,76 +248,35 @@
public void createConnectionFactory(String name,
boolean ha,
int cfType,
- String liveTransportClassName,
- Map<String, Object>
liveTransportParams,
- Object[] jndiBindings) throws Exception
- {
- proxy.invokeOperation("createConnectionFactory", name,
- ha,
- cfType,
- liveTransportClassName,
- liveTransportParams,
- jndiBindings);
- }
-
- public void createConnectionFactory(String name,
- boolean ha,
- int cfType,
- Object[] liveConnectorsTransportClassNames,
- Object[] liveConnectorTransportParams,
+ String[] connectorNames,
Object[] bindings) throws Exception
{
- proxy.invokeOperation("createConnectionFactory", name,
- ha,
- cfType,
- liveConnectorsTransportClassNames,
- liveConnectorTransportParams,
- bindings);
+ proxy.invokeOperation("createConnectionFactory", name, ha, cfType,
connectorNames, bindings);
+
}
- public void createConnectionFactory(String name,
- boolean ha,
- int cfType,
- String liveTransportClassNames,
- String liveTransportParams,
- String jndiBindings) throws Exception
+ public void createConnectionFactory(String name, boolean ha, int cfType, String
connectors, String jndiBindings) throws Exception
{
- proxy.invokeOperation("createConnectionFactory", name,
- ha,
- cfType,
- liveTransportClassNames,
- liveTransportParams,
- jndiBindings);
+ proxy.invokeOperation("createConnectionFactory", name, ha, cfType,
connectors, jndiBindings);
}
- public void createConnectionFactory(String name,
- boolean ha,
- int cfType,
- String discoveryAddress,
- int discoveryPort,
- Object[] bindings) throws Exception
+ public void createConnectionFactoryDiscovery(String name,
+ boolean ha,
+ int cfType,
+ String discoveryGroupName,
+ String bindings) throws Exception
{
- proxy.invokeOperation("createConnectionFactory", name,
- ha,
- cfType,
- discoveryAddress,
- discoveryPort,
- bindings);
+ proxy.invokeOperation("createConnectionFactory", name, ha, cfType,
discoveryGroupName, bindings);
}
- public void createConnectionFactory(String name,
- boolean ha,
- int cfType,
- String discoveryAddress,
- int discoveryPort,
- String jndiBindings) throws Exception
+ public void createConnectionFactoryDiscovery(String name,
+ boolean ha,
+ int cfType,
+ String discoveryGroupName,
+ Object[] bindings) throws
Exception
{
- proxy.invokeOperation("createConnectionFactory", name,
- ha,
- cfType,
- discoveryAddress,
- discoveryPort,
- jndiBindings);
+ // TODO Auto-generated method stub
+
}
};
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControl2Test.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -152,7 +152,8 @@
null,
groupAddress,
groupPort,
-
HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT);
+
0,
+
0);
Configuration conf_1 = new ConfigurationImpl();
conf_1.setSecurityEnabled(false);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -214,7 +214,7 @@
connectors);
String discoveryGroupName = RandomUtil.randomString();
- DiscoveryGroupConfiguration discoveryGroupConfig = new
DiscoveryGroupConfiguration(discoveryGroupName, null, "230.1.2.3", 6745, 500);
+ DiscoveryGroupConfiguration discoveryGroupConfig = new
DiscoveryGroupConfiguration(discoveryGroupName, null, "230.1.2.3", 6745, 500,
0);
clusterConnectionConfig2 = new
ClusterConnectionConfiguration(RandomUtil.randomString(),
queueConfig.getAddress(),
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -68,14 +68,12 @@
createJMSStorage();
- List<TransportConfiguration> transportConfigs = new
ArrayList<TransportConfiguration>();
+ List<String> transportConfigs = new ArrayList<String>();
for (int i = 0 ; i < 5; i++)
{
- TransportConfiguration config1 = new TransportConfiguration("c1-" +
i);
- TransportConfiguration config2 = new TransportConfiguration("c2-" +
i);
- transportConfigs.add(config1);
- transportConfigs.add(config2);
+ transportConfigs.add("c1-" + i);
+ transportConfigs.add("c2-" + i);
}
@@ -95,12 +93,12 @@
PersistedConnectionFactory cf1 = cfs.get(0);
- assertEquals(5, cf1.getConfig().getConnectorConfigs().size());
+ assertEquals(5, cf1.getConfig().getConnectorNames().size());
int i = 0 ;
- List<TransportConfiguration> configs =
cf1.getConfig().getConnectorConfigs();
- assertEquals(configs.get(0).getName(), "c1-" + i);
- assertEquals(configs.get(1).getName(), "c2-" + i);
+ List<String> configs = cf1.getConfig().getConnectorNames();
+ assertEquals(configs.get(0), "c1-" + i);
+ assertEquals(configs.get(1), "c2-" + i);
}
public void testSizeOfCF() throws Exception
@@ -112,7 +110,7 @@
str[i] = "str" + i;
}
- ConnectionFactoryConfiguration config = new
ConnectionFactoryConfigurationImpl("some-name", false, new
ArrayList<TransportConfiguration>(), str);
+ ConnectionFactoryConfiguration config = new
ConnectionFactoryConfigurationImpl("some-name", false, new
ArrayList<String>(), "");
int size = config.getEncodeSize();
@@ -145,23 +143,16 @@
str[i] = "str" + i;
}
- List<TransportConfiguration> connectorConfigs = new
ArrayList<TransportConfiguration>();
+ List<String> connectorConfigs = new ArrayList<String>();
Map<String, Object> liveParams = new HashMap<String, Object>();
liveParams.put(TransportConstants.PORT_PROP_NAME, 5665);
- TransportConfiguration live1 = new
TransportConfiguration(NettyConnectorFactory.class.getName(), liveParams );
Map<String, Object> backupParams = new HashMap<String, Object>();
backupParams.put(TransportConstants.PORT_PROP_NAME, 5775);
- TransportConfiguration backup1 = new
TransportConfiguration(NettyConnectorFactory.class.getName(), backupParams);
Map<String, Object> liveParams2 = new HashMap<String, Object>();
liveParams2.put(TransportConstants.PORT_PROP_NAME, 6665);
- TransportConfiguration live2 = new
TransportConfiguration(NettyConnectorFactory.class.getName(), liveParams2);
-
- connectorConfigs.add(live1);
- connectorConfigs.add(live2);
- connectorConfigs.add(backup1);
ConnectionFactoryConfiguration config = new
ConnectionFactoryConfigurationImpl("some-name", false, connectorConfigs, str);
- config.setConnectorConfigs(connectorConfigs );
+ config.setConnectorNames(connectorConfigs );
List<Pair<String, String>> connectors = new
ArrayList<Pair<String,String>>();
connectors.add(new Pair<String, String>(RandomUtil.randomString(), null));
//config.setConnectorNames(connectors);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/unit/ra/ResourceAdapterTest.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -86,8 +86,6 @@
Assert.assertEquals(factory.getDiscoveryInitialWaitTimeout(),
HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT);
Assert.assertEquals(factory.getDiscoveryPort(), -1);
- Assert.assertEquals(factory.getDiscoveryRefreshTimeout(),
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT);
Assert.assertEquals(factory.getDupsOKBatchSize(),
HornetQClient.DEFAULT_ACK_BATCH_SIZE);
Assert.assertEquals(factory.getMinLargeMessageSize(),
HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
Assert.assertEquals(factory.getProducerMaxRate(),
HornetQClient.DEFAULT_PRODUCER_MAX_RATE);
@@ -138,8 +136,6 @@
Assert.assertEquals(factory.getDiscoveryInitialWaitTimeout(),
HornetQClient.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT);
Assert.assertEquals(factory.getDiscoveryPort(), -1);
- Assert.assertEquals(factory.getDiscoveryRefreshTimeout(),
- HornetQClient.DEFAULT_DISCOVERY_REFRESH_TIMEOUT);
Assert.assertEquals(factory.getDupsOKBatchSize(),
HornetQClient.DEFAULT_ACK_BATCH_SIZE);
Assert.assertEquals(factory.getMinLargeMessageSize(),
HornetQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
Assert.assertEquals(factory.getProducerMaxRate(),
HornetQClient.DEFAULT_PRODUCER_MAX_RATE);
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/JMSTestBase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/JMSTestBase.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -183,7 +183,7 @@
jmsServer.createConnectionFactory("ManualReconnectionToSingleServerTest",
false,
JMSFactoryType.CF,
- connectorConfigs,
+ registerConnectors(server, connectorConfigs),
null,
HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
HornetQClient.DEFAULT_CONNECTION_TTL,
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
---
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-11-20
18:23:29 UTC (rev 9916)
+++
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-11-20
18:29:51 UTC (rev 9917)
@@ -400,7 +400,29 @@
Assert.assertNotNull(o);
return o;
}
+
+ /**
+ * @param connectorConfigs
+ * @return
+ */
+ protected ArrayList<String> registerConnectors(final HornetQServer server, final
List<TransportConfiguration> connectorConfigs)
+ {
+ // The connectors need to be pre-configured at main config object but this method
is taking TransportConfigurations directly
+ // So this will first register them at the config and then generate a list of
objects
+ ArrayList<String> connectors = new ArrayList<String>();
+ for (TransportConfiguration tnsp : connectorConfigs)
+ {
+ String name = RandomUtil.randomString();
+
+ server.getConfiguration().getConnectorConfigurations().put(name, tnsp);
+
+ connectors.add(name);
+ }
+ return connectors;
+ }
+
+
protected static void checkFreePort(final int... ports)
{
for (int port : ports)