JBoss hornetq SVN: r9924 - in branches/2_2_0_HA_Improvements_preMerge: tests/src/org/hornetq/tests/integration/client and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-11-23 22:36:30 -0500 (Tue, 23 Nov 2010)
New Revision: 9924
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/…
[View More]src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
Log:
test fixes
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-11-23 20:12:05 UTC (rev 9923)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-11-24 03:36:30 UTC (rev 9924)
@@ -361,7 +361,7 @@
started = true;
- log.info("HornetQ Backup Server version " + getVersion().getFullVersion() + " [" + nodeManager.getNodeId() + "] started");
+ log.info("HornetQ Backup Server version " + getVersion().getFullVersion() + " [" + nodeManager.getNodeId() + "] started, waiting live to fail before it gets active");
nodeManager.awaitLiveNode();
@@ -1373,12 +1373,12 @@
{
// Load the journal and populate queues, transactions and caches in memory
+ pagingManager.reloadStores();
+
JournalLoadInformation[] journalInfo = loadJournals();
compareJournals(journalInfo);
- pagingManager.resumeDepages();
-
final ServerInfo dumper = new ServerInfo(this, pagingManager);
long dumpInfoInterval = configuration.getServerDumpInterval();
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-11-23 20:12:05 UTC (rev 9923)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-11-24 03:36:30 UTC (rev 9924)
@@ -1651,7 +1651,28 @@
}
session.commit();
+
+ session.close();
+
+ locator.close();
+
+ locator = createInVMNonHALocator();
+
+ server.stop();
+
+
+ server = createServer(true,
+ config,
+ PagingTest.PAGE_SIZE,
+ PagingTest.PAGE_MAX,
+ new HashMap<String, AddressSettings>());
+
+ server.start();
+ sf = locator.createSessionFactory();
+
+ session = sf.createSession(null, null, false, false, false, false, 0);
+
ClientConsumer consumer = session.createConsumer(PagingTest.ADDRESS);
session.start();
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-11-23 20:12:05 UTC (rev 9923)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-11-24 03:36:30 UTC (rev 9924)
@@ -68,7 +68,8 @@
protected Configuration backupConfig;
protected Configuration liveConfig;
- private NodeManager nodeManager;
+
+ protected NodeManager nodeManager;
// Static --------------------------------------------------------
@@ -287,6 +288,8 @@
}
System.out.println("FailoverTestBase.waitForNewLive");
}
+
+
protected TransportConfiguration getInVMConnectorTransportConfiguration(final boolean live)
{
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2010-11-23 20:12:05 UTC (rev 9923)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2010-11-24 03:36:30 UTC (rev 9924)
@@ -22,11 +22,14 @@
import org.hornetq.api.core.HornetQException;
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.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.client.impl.ClientSessionInternal;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.replication.impl.ReplicationEndpointImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.spi.core.protocol.RemotingConnection;
@@ -35,6 +38,8 @@
/**
* A PagingFailoverTest
+ *
+ * TODO: validate replication failover also
*
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*
@@ -52,6 +57,7 @@
static final SimpleString ADDRESS = new SimpleString("SimpleAddress");
// Attributes ----------------------------------------------------
+ private ServerLocator locator;
// Static --------------------------------------------------------
@@ -59,6 +65,26 @@
// Public --------------------------------------------------------
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ locator = getServerLocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+ super.tearDown();
+ }
+
+ public void testPageFailBeforeConsume() throws Exception
+ {
+ internalTestPage(false, true);
+ }
+
+
public void testPage() throws Exception
{
internalTestPage(false, false);
@@ -76,17 +102,11 @@
public void internalTestPage(final boolean transacted, final boolean failBeforeConsume) throws Exception
{
- throw new Exception("must change the test to reflect the new replication code");
-
- /*
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
+ locator.setReconnectAttempts(-1);
- //waitForTopology(locator, 1, 1);
-
- ClientSessionFactoryInternal sf = (ClientSessionFactoryInternal) locator.createSessionFactory();
+ ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
ClientSession session = sf.createSession(!transacted, !transacted, 0);
try
@@ -94,23 +114,6 @@
session.createQueue(PagingFailoverTest.ADDRESS, PagingFailoverTest.ADDRESS, true);
- final CountDownLatch latch = new CountDownLatch(1);
-
- class MyListener implements SessionFailureListener
- {
- public void connectionFailed(final HornetQException me)
- {
- latch.countDown();
- }
-
- public void beforeReconnect(final HornetQException exception)
- {
- }
-
- }
-
- session.addFailureListener(new MyListener());
-
ClientProducer prod = session.createProducer(PagingFailoverTest.ADDRESS);
final int TOTAL_MESSAGES = 2000;
@@ -128,12 +131,15 @@
session.commit();
- ReplicationEndpointImpl endpoint = null;
-
if (failBeforeConsume)
{
- failSession(session, latch);
+ crash(session);
}
+
+
+ session.close();
+
+ session = sf.createSession(!transacted, !transacted, 0);
session.start();
@@ -143,6 +149,7 @@
for (int i = 0; i < MIDDLE; i++)
{
+ System.out.println("msg " + i);
ClientMessage msg = cons.receive(20000);
Assert.assertNotNull(msg);
msg.acknowledge();
@@ -154,19 +161,19 @@
}
session.commit();
+
+ cons.close();
+
+ Thread.sleep(1000);
- if (endpoint != null)
- {
- endpoint.setDeletePages(true);
- }
-
if (!failBeforeConsume)
{
- failSession(session, latch);
+ crash(session);
+ // failSession(session, latch);
}
session.close();
-
+
session = sf.createSession(true, true, 0);
cons = session.createConsumer(PagingFailoverTest.ADDRESS);
@@ -193,7 +200,6 @@
{
}
}
- */
}
/**
@@ -217,18 +223,12 @@
// Protected -----------------------------------------------------
- /* (non-Javadoc)
- * @see org.hornetq.tests.integration.cluster.failover.FailoverTestBase#getAcceptorTransportConfiguration(boolean)
- */
@Override
protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live)
{
return getInVMTransportAcceptorConfiguration(live);
}
- /* (non-Javadoc)
- * @see org.hornetq.tests.integration.cluster.failover.FailoverTestBase#getConnectorTransportConfiguration(boolean)
- */
@Override
protected TransportConfiguration getConnectorTransportConfiguration(final boolean live)
{
@@ -238,11 +238,12 @@
@Override
protected HornetQServer createServer(final boolean realFiles, final Configuration configuration)
{
- return createServer(realFiles,
- configuration,
- PagingFailoverTest.PAGE_SIZE,
- PagingFailoverTest.PAGE_MAX,
- new HashMap<String, AddressSettings>());
+ return createInVMFailoverServer(true,
+ configuration,
+ PagingFailoverTest.PAGE_SIZE,
+ PagingFailoverTest.PAGE_MAX,
+ new HashMap<String, AddressSettings>(),
+ nodeManager);
}
@Override
@@ -250,36 +251,13 @@
{
return new SameProcessHornetQServer(createServer(true, backupConfig));
}
-
+
@Override
protected TestableServer createLiveServer()
{
return new SameProcessHornetQServer(createServer(true, liveConfig));
}
-
- /**
- * @throws Exception
- */
- @Override
- protected void createConfigs() throws Exception
- {
- Configuration config1 = super.createDefaultConfig();
- config1.getAcceptorConfigurations().clear();
- config1.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(false));
- config1.setSecurityEnabled(false);
- config1.setSharedStore(true);
- config1.setBackup(true);
- backupServer = createBackupServer();
-
- Configuration config0 = super.createDefaultConfig();
- config0.getAcceptorConfigurations().clear();
- config0.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
- config0.setSecurityEnabled(false);
- config0.setSharedStore(true);
- liveServer = createLiveServer();
- }
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2010-11-23 20:12:05 UTC (rev 9923)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/util/SameProcessHornetQServer.java 2010-11-24 03:36:30 UTC (rev 9924)
@@ -13,7 +13,6 @@
package org.hornetq.tests.integration.cluster.util;
-import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -24,7 +23,6 @@
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.cluster.impl.ClusterManagerImpl;
-import org.hornetq.spi.core.protocol.RemotingConnection;
/**
* A SameProcessHornetQServer
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9923 - branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-11-23 15:12:05 -0500 (Tue, 23 Nov 2010)
New Revision: 9923
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
tweak
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/…
[View More]hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-11-23 16:01:59 UTC (rev 9922)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-11-23 20:12:05 UTC (rev 9923)
@@ -13,7 +13,11 @@
package org.hornetq.tests.integration.cluster.failover;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.CountDownLatch;
import javax.transaction.xa.XAException;
@@ -22,8 +26,6 @@
import junit.framework.Assert;
-import org.hornetq.api.core.*;
-import org.hornetq.api.core.client.*;
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.Interceptor;
import org.hornetq.api.core.Message;
@@ -34,12 +36,11 @@
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.MessageHandler;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.impl.invm.TransportConstants;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.util.RandomUtil;
@@ -2127,35 +2128,13 @@
@Override
protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live)
{
- if (live)
- {
- return new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory");
- }
- else
- {
- Map<String, Object> server1Params = new HashMap<String, Object>();
-
- server1Params.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
-
- return new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory", server1Params);
- }
+ return getInVMTransportAcceptorConfiguration(live);
}
@Override
protected TransportConfiguration getConnectorTransportConfiguration(final boolean live)
{
- if (live)
- {
- return new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory");
- }
- else
- {
- Map<String, Object> server1Params = new HashMap<String, Object>();
-
- server1Params.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
-
- return new TransportConfiguration("org.hornetq.core.remoting.impl.invm.InVMConnectorFactory", server1Params);
- }
+ return getInVMConnectorTransportConfiguration(live);
}
/**
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9922 - branches/2_2_0_HA_Improvements_preMerge.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-11-23 11:01:59 -0500 (Tue, 23 Nov 2010)
New Revision: 9922
Modified:
branches/2_2_0_HA_Improvements_preMerge/build-hornetq.xml
Log:
disabling debug as the testsuite won't run unless I remove this
Modified: branches/2_2_0_HA_Improvements_preMerge/build-hornetq.xml
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/build-hornetq.xml 2010-11-23 15:35:31 UTC (rev 9921)
+++ branches/…
[View More]2_2_0_HA_Improvements_preMerge/build-hornetq.xml 2010-11-23 16:01:59 UTC (rev 9922)
@@ -1726,7 +1726,9 @@
<jvmarg value="-XX:+PrintClassHistogram"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-verbose:gc"/>
+ <!--
<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
+ -->
<!--<jvmarg value="-ea"/>-->
<classpath refid="unit.test.execution.classpath"/>
<formatter type="xml" usefile="${junit.formatter.usefile}"/>
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9921 - in branches/2_2_0_HA_Improvements_preMerge: src/main/org/hornetq/core/client/impl and 6 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-11-23 10:35:31 -0500 (Tue, 23 Nov 2010)
New Revision: 9921
Modified:
branches/2_2_0_HA_Improvements_preMerge/build-hornetq.xml
branches/2_2_0_HA_Improvements_preMerge/build.xml
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryInternal.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/…
[View More]hornetq/core/client/impl/ServerLocatorImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/Topology.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.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/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
close locators for bridges and cluster connections at cluster manager + test fixes
Modified: branches/2_2_0_HA_Improvements_preMerge/build-hornetq.xml
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/build-hornetq.xml 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/build-hornetq.xml 2010-11-23 15:35:31 UTC (rev 9921)
@@ -1672,6 +1672,12 @@
</antcall>
</target>
+ <target name="cluster-tests" depends="jar, compile-unit-tests">
+ <antcall inheritall="true" inheritrefs="true" target="tests">
+ <param name="tests.param" value="**/org/hornetq/tests/integration/cluster/**/*${test-mask}.class"/>
+ </antcall>
+ </target>
+
<target name="concurrent-tests" depends="jar, compile-unit-tests">
<antcall inheritall="true" inheritrefs="true" target="tests">
<param name="tests.param" value="**/org/hornetq/tests/concurrent/**/*${test-mask}.class"/>
@@ -1720,9 +1726,7 @@
<jvmarg value="-XX:+PrintClassHistogram"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-verbose:gc"/>
- <!--
<jvmarg line="-Xmx512M -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
- -->
<!--<jvmarg value="-ea"/>-->
<classpath refid="unit.test.execution.classpath"/>
<formatter type="xml" usefile="${junit.formatter.usefile}"/>
@@ -1734,6 +1738,21 @@
<fileset dir="${test.classes.dir}">
<!-- excluded because of https://jira.jboss.org/jira/browse/HORNETQ-65 -->
<exclude name="**/cluster/failover/*StaticClusterWithBackupFailoverTest.class" />
+
+ <!--exclude any replication tests for now-->
+ <exclude name="**/cluster/failover/*ClusterWithBackupFailoverTestBase.class"/>
+
+ <exclude name="**/cluster/failover/*DiscoveryClusterWithBackupFailoverTest.class"/>
+ <exclude name="**/cluster/failover/*GroupingFailoverReplicationTest.class"/>
+ <exclude name="**/cluster/failover/*Replicated*.class"/>
+ <exclude name="**/cluster/replication/**.class"/>
+ <exclude name="**/cluster/failover/*ReplicatedDistributionTest.class"/>
+ <exclude name="**/cluster/failover/*SharedStoreDistributionTest.class"/>
+ <exclude name="**/cluster/failover/*ReplicatedNettyAsynchronousFailoverTest.class"/>
+ <exclude name="**/cluster/*ReplicatedJMSFailoverTest.class"/>
+ <exclude name="**/integration/replication/*.class"/>
+ <exclude name="**/cluster/failover/Remote*.class"/>
+ <exclude name="**/failover/remote/**.class"/>
<include name="${tests.param}"/>
</fileset>
</batchtest>
Modified: branches/2_2_0_HA_Improvements_preMerge/build.xml
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/build.xml 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/build.xml 2010-11-23 15:35:31 UTC (rev 9921)
@@ -250,6 +250,12 @@
<ant antfile="build-hornetq.xml" target="compile-reports"/>
</target>
+
+ <target name="cluster-tests" depends="createthirdparty">
+ <ant antfile="build-hornetq.xml" target="cluster-tests"/>
+ <ant antfile="build-hornetq.xml" target="compile-reports"/>
+ </target>
+
<target name="spring-tests" depends="createthirdparty">
<ant antfile="build-hornetq.xml" target="spring-tests"/>
<ant antfile="build-hornetq.xml" target="compile-reports"/>
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -63,7 +63,7 @@
/**
* A ClientSessionFactoryImpl
- *
+ *
* Encapsulates a connection to a server
*
* @author Tim Fox
@@ -147,8 +147,6 @@
private final Object waitLock = new Object();
- public static List<ClientSessionFactoryImpl> factories = new ArrayList<ClientSessionFactoryImpl>();
-
// Static
// ---------------------------------------------------------------------------------------
@@ -215,8 +213,6 @@
if (connection == null && failoverOnInitialConnection)
{
- TransportConfiguration backupConfig = serverLocator.getBackup(connectorConfig);
-
if (backupConfig != null)
{
// Try and connect to the backup
@@ -241,6 +237,19 @@
}
+ public TransportConfiguration getConnectorConfiguration()
+ {
+ return connectorConfig;
+ }
+
+ public void setBackupConnector(TransportConfiguration live, TransportConfiguration backUp)
+ {
+ if(live.equals(connectorConfig))
+ {
+ backupConfig = backUp;
+ }
+ }
+
public ClientSession createSession(final String username,
final String password,
final boolean xa,
@@ -887,69 +896,62 @@
long interval = retryInterval;
int count = 0;
- factories.add(this);
- try
+
+ synchronized (waitLock)
{
- synchronized (waitLock)
+ while (true)
{
- while (true)
+ if (exitLoop)
{
- if (exitLoop)
- {
- return;
- }
+ return;
+ }
- getConnection();
+ getConnection();
- if (connection == null)
+ if (connection == null)
+ {
+ // Failed to get connection
+
+ if (reconnectAttempts != 0)
{
- // Failed to get connection
+ count++;
- if (reconnectAttempts != 0)
+ if (reconnectAttempts != -1 && count == reconnectAttempts)
{
- count++;
+ log.warn("Tried " + reconnectAttempts + " times to connect. Now giving up.");
- if (reconnectAttempts != -1 && count == reconnectAttempts)
- {
- log.warn("Tried " + reconnectAttempts + " times to connect. Now giving up.");
+ return;
+ }
- return;
- }
+ try
+ {
+ waitLock.wait(interval);
+ }
+ catch (InterruptedException ignore)
+ {
+ }
- try
- {
- waitLock.wait(interval);
- }
- catch (InterruptedException ignore)
- {
- }
+ // Exponential back-off
+ long newInterval = (long)(interval * retryIntervalMultiplier);
- // Exponential back-off
- long newInterval = (long)(interval * retryIntervalMultiplier);
-
- if (newInterval > maxRetryInterval)
- {
- newInterval = maxRetryInterval;
- }
-
- interval = newInterval;
- }
- else
+ if (newInterval > maxRetryInterval)
{
- return;
+ newInterval = maxRetryInterval;
}
+
+ interval = newInterval;
}
else
{
return;
}
}
+ else
+ {
+ return;
+ }
}
}
- finally
- {
- factories.remove(this);
- }
}
private void cancelScheduledTasks()
@@ -1221,7 +1223,6 @@
SimpleString nodeID = msg.getNodeID();
if (nodeID != null)
{
- backupConfig = serverLocator.getBackup(connectorConfig);
serverLocator.notifyNodeDown(msg.getNodeID().toString());
}
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryInternal.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryInternal.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ClientSessionFactoryInternal.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -13,6 +13,7 @@
package org.hornetq.core.client.impl;
import org.hornetq.api.core.HornetQException;
+import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.SessionFailureListener;
@@ -39,4 +40,8 @@
void removeSession(final ClientSessionInternal session, boolean failingOver);
void connect(int reconnectAttempts, boolean failoverOnInitialConnection) throws HornetQException;
+
+ TransportConfiguration getConnectorConfiguration();
+
+ void setBackupConnector(TransportConfiguration live, TransportConfiguration backUp);
}
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-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -68,8 +68,6 @@
private Pair<TransportConfiguration, TransportConfiguration>[] topologyArray;
- private Map<TransportConfiguration, TransportConfiguration> pairs = new HashMap<TransportConfiguration, TransportConfiguration>();
-
private boolean receivedTopology;
private ExecutorService threadPool;
@@ -159,6 +157,7 @@
private TransportConfiguration clusterTransportConfiguration;
private boolean backup;
+
private final Exception e = new Exception();
private static synchronized ExecutorService getGlobalThreadPool()
@@ -305,7 +304,6 @@
final TransportConfiguration[] transportConfigs)
{
e.fillInStackTrace();
-
this.ha = useHA;
this.discoveryAddress = discoveryAddress;
@@ -425,18 +423,18 @@
public ClientSessionFactory connect() throws Exception
{
- ClientSessionFactory sf;
+ ClientSessionFactoryInternal sf;
// static list of initial connectors
if (initialConnectors != null && discoveryGroup == null)
{
- sf = staticConnector.connect();
+ sf = (ClientSessionFactoryInternal) staticConnector.connect();
}
// wait for discovery group to get the list of initial connectors
else
{
- sf = createSessionFactory();
+ sf = (ClientSessionFactoryInternal) createSessionFactory();
}
- factories.add(sf);
+ addFactory(sf);
return sf;
}
@@ -471,7 +469,7 @@
factory.connect(reconnectAttempts, failoverOnInitialConnection);
- factories.add(factory);
+ addFactory(factory);
return factory;
}
@@ -537,6 +535,8 @@
}
catch (HornetQException e)
{
+ factory.close();
+ factory = null;
if (e.getCode() == HornetQException.NOT_CONNECTED)
{
attempts++;
@@ -591,7 +591,7 @@
}
}
- factories.add(factory);
+ addFactory(factory);
return factory;
}
@@ -1108,8 +1108,6 @@
}
else
{
- pairs.clear();
-
topologyArray = null;
receivedTopology = false;
@@ -1137,8 +1135,21 @@
topology.addMember(nodeID, new TopologyMember(connectorPair, distance));
- updateArraysAndPairs();
+ TopologyMember actMember = topology.getMember(nodeID);
+ if (actMember.getConnector().a != null && actMember.getConnector().b != null)
+ {
+ for (ClientSessionFactory factory : factories)
+ {
+ ((ClientSessionFactoryInternal) factory).setBackupConnector(actMember.getConnector().a, actMember.getConnector().b);
+ }
+ }
+
+ if (connectorPair.a != null)
+ {
+ updateArraysAndPairs();
+ }
+
if (last)
{
receivedTopology = true;
@@ -1161,11 +1172,6 @@
int count = 0;
for (TopologyMember pair : topology.getMembers())
{
- if (pair.getConnector().b != null)
- {
- pairs.put(pair.getConnector().a, pair.getConnector().b);
- }
-
topologyArray[count++] = pair.getConnector();
}
}
@@ -1227,11 +1233,15 @@
topologyListeners.remove(listener);
}
- public synchronized TransportConfiguration getBackup(final TransportConfiguration live)
+ public synchronized void addFactory(ClientSessionFactoryInternal factory)
{
- return pairs.get(live);
+ if (factory != null)
+ {
+ TransportConfiguration backup = topology.getBackupForConnector(factory.getConnectorConfiguration());
+ factory.setBackupConnector(factory.getConnectorConfiguration(), backup);
+ factories.add(factory);
+ }
}
-
public static void shutdown()
{
if (globalScheduledThreadPool != null)
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorInternal.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -32,8 +32,6 @@
void factoryClosed(final ClientSessionFactory factory);
- TransportConfiguration getBackup( TransportConfiguration live);
-
void setNodeID(String nodeID);
String getNodeID();
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/Topology.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/Topology.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/Topology.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -137,4 +137,16 @@
{
return (currentConnector == null && connector != null) || (currentConnector != null && !currentConnector.equals(connector));
}
+
+ public TransportConfiguration getBackupForConnector(TransportConfiguration connectorConfiguration)
+ {
+ for (TopologyMember member : topology.values())
+ {
+ if(member.getConnector().a != null && member.getConnector().a.equals(connectorConfiguration))
+ {
+ return member.getConnector().b;
+ }
+ }
+ return null;
+ }
}
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -210,11 +210,6 @@
{
csf.close();
}
-
- if(serverLocator != null)
- {
- serverLocator.close();
- }
}
executor.execute(new StopRunnable());
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -257,12 +257,6 @@
}
}
- if (serverLocator != null)
- {
- //serverLocator.removeClusterTopologyListener(this);
- serverLocator.close();
- }
-
if (managementService != null)
{
TypedProperties props = new TypedProperties();
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -17,11 +17,7 @@
import java.lang.reflect.Array;
import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@@ -103,8 +99,11 @@
private Set<ClusterTopologyListener> clusterConnectionListeners = new ConcurrentHashSet<ClusterTopologyListener>();
private Topology topology = new Topology();
- private ClientSessionFactory backupSessionFactory;
+ private ServerLocatorInternal backupServerLocator;
+
+ private final List<ServerLocatorInternal> clusterLocators = new ArrayList<ServerLocatorInternal>();
+
public ClusterManagerImpl(final ExecutorFactory executorFactory,
final HornetQServer server,
final PostOffice postOffice,
@@ -214,13 +213,16 @@
bridges.clear();
- if(backupSessionFactory != null)
+ if(backupServerLocator != null)
{
- backupSessionFactory.close();
- backupSessionFactory.getServerLocator().close();
- backupSessionFactory = null;
+ backupServerLocator.close();
}
+ for (ServerLocatorInternal clusterLocator : clusterLocators)
+ {
+ clusterLocator.close();
+ }
+ clusterLocators.clear();
started = false;
}
@@ -350,19 +352,18 @@
member.getConnector().b = null;
}
- if(backupSessionFactory != null)
+ if(backupServerLocator != null)
{
//todo we could use the topology of this to preempt it arriving from the cc
try
{
- backupSessionFactory.close();
- backupSessionFactory.getServerLocator().close();
+ backupServerLocator.close();
}
catch (Exception e)
{
log.warn("problem closing backup session factory", e);
}
- backupSessionFactory = null;
+ backupServerLocator = null;
}
for (BroadcastGroup broadcastGroup : broadcastGroups.values())
@@ -670,7 +671,7 @@
serverLocator.setRetryIntervalMultiplier(config.getRetryIntervalMultiplier());
serverLocator.setClientFailureCheckPeriod(config.getClientFailureCheckPeriod());
serverLocator.setInitialConnectAttempts(config.getReconnectAttempts());
-
+ clusterLocators.add(serverLocator);
Bridge bridge = new BridgeImpl(serverLocator,
nodeUUID,
new SimpleString(config.getName()),
@@ -740,6 +741,7 @@
serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(tcConfigs);
serverLocator.setNodeID(nodeUUID.toString());
serverLocator.setReconnectAttempts(-1);
+ clusterLocators.add(serverLocator);
}
else if (config.getDiscoveryGroupName() != null)
{
@@ -755,6 +757,7 @@
serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(dg.getGroupAddress(), dg.getGroupPort());
serverLocator.setNodeID(nodeUUID.toString());
serverLocator.setReconnectAttempts(-1);
+ clusterLocators.add(serverLocator);
}
else
{
@@ -796,16 +799,14 @@
}
}
- private void announceBackup(ClusterConnectionConfiguration config, TransportConfiguration connector) throws Exception
+ private void announceBackup(final ClusterConnectionConfiguration config, final TransportConfiguration connector) throws Exception
{
- ServerLocatorInternal locator;
-
if (config.getStaticConnectors() != null)
{
TransportConfiguration[] tcConfigs = connectorNameListToArray(config.getStaticConnectors());
- locator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(tcConfigs);
- locator.setReconnectAttempts(-1);
+ backupServerLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(tcConfigs);
+ backupServerLocator.setReconnectAttempts(-1);
}
else if (config.getDiscoveryGroupName() != null)
{
@@ -818,17 +819,30 @@
"'. The cluster connection will not be deployed.");
}
- locator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(dg.getGroupAddress(), dg.getGroupPort());
- locator.setReconnectAttempts(-1);
- locator.setDiscoveryInitialWaitTimeout(0);
+ backupServerLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(dg.getGroupAddress(), dg.getGroupPort());
+ backupServerLocator.setReconnectAttempts(-1);
+ backupServerLocator.setDiscoveryInitialWaitTimeout(0);
}
else
{
return;
}
log.info("announcing backup");
- backupSessionFactory = locator.connect();
- backupSessionFactory.getConnection().getChannel(0, -1).send(new NodeAnnounceMessage(nodeUUID.toString(), nodeUUID.toString(), true, connector));
+ this.executorFactory.getExecutor().execute(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ ClientSessionFactory backupSessionFactory = backupServerLocator.connect();
+ backupSessionFactory.getConnection().getChannel(0, -1).send(new NodeAnnounceMessage(nodeUUID.toString(), nodeUUID.toString(), true, connector));
+ }
+ catch (Exception e)
+ {
+ log.warn("Unable to announce backup", e);
+ }
+ }
+ });
}
private Transformer instantiateTransformer(final String transformerClassName)
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -565,10 +565,6 @@
// start connector service
connectorsService = new ConnectorsService(configuration, storageManager, scheduledPool, postOffice);
connectorsService.start();
-
- started = true;
-
-
}
@Override
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-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -29,6 +29,7 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.*;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.*;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
@@ -105,16 +106,6 @@
@Override
protected void tearDown() throws Exception
{
- UnitTestCase.checkFreePort(ClusterTestBase.PORTS);
-
- servers = null;
-
- sfs = null;
-
- consumers = null;
-
- consumers = new ConsumerHolder[ClusterTestBase.MAX_CONSUMERS];
-
for (ServerLocator locator : locators)
{
try
@@ -127,9 +118,26 @@
}
}
+ locators = null;
+
+ locators = new ServerLocator[ClusterTestBase.MAX_SERVERS];
+ UnitTestCase.checkFreePort(ClusterTestBase.PORTS);
+
+ servers = null;
+
+ sfs = null;
+
+ consumers = null;
+
+ consumers = new ConsumerHolder[ClusterTestBase.MAX_CONSUMERS];
+
+
+
nodeManagers = null;
super.tearDown();
+
+ // ServerLocatorImpl.shutdown();
}
// Private -------------------------------------------------------------------------------------------------------
@@ -426,7 +434,7 @@
if (holder != null)
{
holder.consumer.close();
- holder.session.close();
+ // holder.session.close();
consumers[i] = null;
}
@@ -1468,92 +1476,173 @@
}
servers[node] = server;
}
- protected void setupServerWithDiscovery(final int node,
- final String groupAddress,
- final int port,
- final boolean fileStorage,
- final boolean netty,
- final boolean backup)
- {
- setupServerWithDiscovery(node, groupAddress, port, fileStorage, netty, backup, -1);
- }
- protected void setupServerWithDiscovery(final int node,
- final String groupAddress,
- final int port,
- final boolean fileStorage,
- final boolean netty,
- final int backupNode)
- {
- setupServerWithDiscovery(node, groupAddress, port, fileStorage, netty, false, backupNode);
- }
+ protected void setupLiveServerWithDiscovery(final int node,
+ final String groupAddress,
+ final int port,
+ final boolean fileStorage,
+ final boolean netty,
+ final boolean sharedStorage)
+ {
+ if (servers[node] != null)
+ {
+ throw new IllegalArgumentException("Already a server at node " + node);
+ }
- protected void setupServerWithDiscovery(final int node,
- final String groupAddress,
- final int port,
- final boolean fileStorage,
- final boolean netty,
- final boolean backup,
- final int backupNode)
- {
- if (servers[node] != null)
- {
- throw new IllegalArgumentException("Already a server at node " + node);
- }
+ Configuration configuration = new ConfigurationImpl();
- Configuration configuration = new ConfigurationImpl();
+ configuration.setSecurityEnabled(false);
+ configuration.setBindingsDirectory(getBindingsDir(node, false));
+ configuration.setJournalMinFiles(2);
+ configuration.setJournalDirectory(getJournalDir(node, false));
+ configuration.setJournalFileSize(100 * 1024);
+ configuration.setJournalType(getDefaultJournalType());
+ configuration.setJournalMaxIO_AIO(1000);
+ configuration.setPagingDirectory(getPageDir(node, false));
+ configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, false));
+ configuration.setClustered(true);
+ configuration.setBackup(false);
- configuration.setSecurityEnabled(false);
- configuration.setBindingsDirectory(getBindingsDir(node, false));
- configuration.setJournalMinFiles(2);
- configuration.setJournalDirectory(getJournalDir(node, false));
- configuration.setJournalFileSize(100 * 1024);
- configuration.setJournalType(getDefaultJournalType());
- configuration.setJournalMaxIO_AIO(1000);
- configuration.setPagingDirectory(getPageDir(node, false));
- configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, false));
- configuration.setClustered(true);
- configuration.setBackup(backup);
+ configuration.getAcceptorConfigurations().clear();
- configuration.getAcceptorConfigurations().clear();
+ Map<String, Object> params = generateParams(node, netty);
- Map<String, Object> params = generateParams(node, netty);
+ configuration.getAcceptorConfigurations().add(createTransportConfiguration(netty, true, params));
- configuration.getAcceptorConfigurations().add(createTransportConfiguration(netty, true, params));
+ TransportConfiguration connector = createTransportConfiguration(netty, false, params);
+ configuration.getConnectorConfigurations().put(connector.getName(), connector);
- TransportConfiguration connector = createTransportConfiguration(netty, false, params);
- configuration.getConnectorConfigurations().put(connector.getName(), connector);
+ List<String> connectorPairs = new ArrayList<String>();
+ connectorPairs.add(connector.getName());
- List<String> connectorPairs = new ArrayList<String>();
- connectorPairs.add(connector.getName());
+ BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
+ null,
+ -1,
+ groupAddress,
+ port,
+ 1000,
+ connectorPairs);
- BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
- null,
- -1,
- groupAddress,
- port,
- 1000,
- connectorPairs);
+ configuration.getBroadcastGroupConfigurations().add(bcConfig);
- configuration.getBroadcastGroupConfigurations().add(bcConfig);
+ DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
- DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
+ configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
- configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
+ HornetQServer server;
+ if (fileStorage)
+ {
+ if (sharedStorage)
+ {
+ server = createInVMFailoverServer(true, configuration, nodeManagers[node]);
+ }
+ else
+ {
+ server = HornetQServers.newHornetQServer(configuration);
+ }
+ }
+ else
+ {
+ if (sharedStorage)
+ {
+ server = createInVMFailoverServer(false, configuration, nodeManagers[node]);
+ }
+ else
+ {
+ server = HornetQServers.newHornetQServer(configuration, false);
+ }
+ }
+ servers[node] = server;
+ }
- HornetQServer server;
+ protected void setupBackupServerWithDiscovery(final int node,
+ final int liveNode,
+ final String groupAddress,
+ final int port,
+ final boolean fileStorage,
+ final boolean netty,
+ final boolean sharedStorage)
+ {
+ if (servers[node] != null)
+ {
+ throw new IllegalArgumentException("Already a server at node " + node);
+ }
- if (fileStorage)
- {
- server = HornetQServers.newHornetQServer(configuration);
- }
- else
- {
- server = HornetQServers.newHornetQServer(configuration, false);
- }
- servers[node] = server;
- }
+ Configuration configuration = new ConfigurationImpl();
+ configuration.setSecurityEnabled(false);
+ configuration.setSharedStore(sharedStorage);
+ if (sharedStorage)
+ {
+ // Shared storage will share the node between the backup and live node
+ configuration.setBindingsDirectory(getBindingsDir(liveNode, false));
+ configuration.setJournalDirectory(getJournalDir(liveNode, false));
+ configuration.setPagingDirectory(getPageDir(liveNode, false));
+ configuration.setLargeMessagesDirectory(getLargeMessagesDir(liveNode, false));
+ }
+ else
+ {
+ configuration.setBindingsDirectory(getBindingsDir(node, true));
+ configuration.setJournalDirectory(getJournalDir(node, true));
+ configuration.setPagingDirectory(getPageDir(node, true));
+ configuration.setLargeMessagesDirectory(getLargeMessagesDir(node, true));
+ }
+ configuration.setClustered(true);
+ configuration.setBackup(true);
+
+ configuration.getAcceptorConfigurations().clear();
+
+ Map<String, Object> params = generateParams(node, netty);
+
+ configuration.getAcceptorConfigurations().add(createTransportConfiguration(netty, true, params));
+
+ TransportConfiguration connector = createTransportConfiguration(netty, false, params);
+ configuration.getConnectorConfigurations().put(connector.getName(), connector);
+
+ List<String> connectorPairs = new ArrayList<String>();
+ connectorPairs.add(connector.getName());
+
+ BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
+ null,
+ -1,
+ groupAddress,
+ port,
+ 1000,
+ connectorPairs);
+
+ configuration.getBroadcastGroupConfigurations().add(bcConfig);
+
+ DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
+
+ configuration.getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
+
+ HornetQServer server;
+ if (fileStorage)
+ {
+ if (sharedStorage)
+ {
+ server = createInVMFailoverServer(true, configuration, nodeManagers[liveNode]);
+ }
+ else
+ {
+ server = HornetQServers.newHornetQServer(configuration);
+ }
+ }
+ else
+ {
+ if (sharedStorage)
+ {
+ server = createInVMFailoverServer(false, configuration, nodeManagers[liveNode]);
+ }
+ else
+ {
+ server = HornetQServers.newHornetQServer(configuration, false);
+ }
+ }
+ servers[node] = server;
+ }
+
+
protected void clearServer(final int... nodes)
{
for (int i = 0; i < nodes.length; i++)
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -60,31 +60,31 @@
@Override
protected void setupServers() throws Exception
{
- setupServerWithDiscovery(0,
+ setupLiveServerWithDiscovery(0,
SymmetricClusterWithDiscoveryTest.groupAddress,
SymmetricClusterWithDiscoveryTest.groupPort,
isFileStorage(),
isNetty(),
false);
- setupServerWithDiscovery(1,
+ setupLiveServerWithDiscovery(1,
SymmetricClusterWithDiscoveryTest.groupAddress,
SymmetricClusterWithDiscoveryTest.groupPort,
isFileStorage(),
isNetty(),
false);
- setupServerWithDiscovery(2,
+ setupLiveServerWithDiscovery(2,
SymmetricClusterWithDiscoveryTest.groupAddress,
SymmetricClusterWithDiscoveryTest.groupPort,
isFileStorage(),
isNetty(),
false);
- setupServerWithDiscovery(3,
+ setupLiveServerWithDiscovery(3,
SymmetricClusterWithDiscoveryTest.groupAddress,
SymmetricClusterWithDiscoveryTest.groupPort,
isFileStorage(),
isNetty(),
false);
- setupServerWithDiscovery(4,
+ setupLiveServerWithDiscovery(4,
SymmetricClusterWithDiscoveryTest.groupAddress,
SymmetricClusterWithDiscoveryTest.groupPort,
isFileStorage(),
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -51,8 +51,8 @@
@Override
protected void setupServers()
{
- setupServerWithDiscovery(0, groupAddress, groupPort, isFileStorage(), isNetty(), false);
- setupServerWithDiscovery(1, groupAddress, groupPort, isFileStorage(), isNetty(), false);
+ setupLiveServerWithDiscovery(0, groupAddress, groupPort, isFileStorage(), isNetty(), false);
+ setupLiveServerWithDiscovery(1, groupAddress, groupPort, isFileStorage(), isNetty(), false);
}
// Private -------------------------------------------------------
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -79,8 +79,6 @@
public void testFailLiveNodes() throws Exception
{
- try
- {
setupCluster();
startServers(3, 4, 5, 0, 1, 2);
@@ -190,10 +188,6 @@
stopServers();
ClusterWithBackupFailoverTestBase.log.info("*** test done");
- } catch (Exception e)
- {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
}
public void testFailBackupNodes() throws Exception
@@ -306,12 +300,12 @@
protected void stopServers() throws Exception
{
+
+ closeAllServerLocatorsFactories();
closeAllConsumers();
closeAllSessionFactories();
- closeAllServerLocatorsFactories();
-
stopServers(0, 1, 2, 3, 4, 5);
}
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -63,39 +63,39 @@
protected void setupServers() throws Exception
{
// The lives
- setupServerWithDiscovery(0,
+ setupLiveServerWithDiscovery(0,
DiscoveryClusterWithBackupFailoverTest.groupAddress,
DiscoveryClusterWithBackupFailoverTest.groupPort,
isFileStorage(),
isNetty(),
- 3);
- setupServerWithDiscovery(1,
+ true);
+ setupLiveServerWithDiscovery(1,
DiscoveryClusterWithBackupFailoverTest.groupAddress,
DiscoveryClusterWithBackupFailoverTest.groupPort,
isFileStorage(),
isNetty(),
- 4);
- setupServerWithDiscovery(2,
+ true);
+ setupLiveServerWithDiscovery(2,
DiscoveryClusterWithBackupFailoverTest.groupAddress,
DiscoveryClusterWithBackupFailoverTest.groupPort,
isFileStorage(),
isNetty(),
- 5);
+ true);
// The backups
- setupServerWithDiscovery(3,
+ setupBackupServerWithDiscovery(3,0,
DiscoveryClusterWithBackupFailoverTest.groupAddress,
DiscoveryClusterWithBackupFailoverTest.groupPort,
isFileStorage(),
isNetty(),
true);
- setupServerWithDiscovery(4,
+ setupBackupServerWithDiscovery(4,1,
DiscoveryClusterWithBackupFailoverTest.groupAddress,
DiscoveryClusterWithBackupFailoverTest.groupPort,
isFileStorage(),
isNetty(),
true);
- setupServerWithDiscovery(5,
+ setupBackupServerWithDiscovery(5,2,
DiscoveryClusterWithBackupFailoverTest.groupAddress,
DiscoveryClusterWithBackupFailoverTest.groupPort,
isFileStorage(),
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -54,6 +54,7 @@
public class FailoverTest extends FailoverTestBase
{
private static final Logger log = Logger.getLogger(FailoverTest.class);
+ private ServerLocator locator;
// Constants -----------------------------------------------------
@@ -84,11 +85,23 @@
}
}
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ locator = getServerLocator();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ locator.close();
+ super.tearDown();
+ }
+
//https://jira.jboss.org/browse/HORNETQ-522
public void testNonTransactedWithZeroConsumerWindowSize() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
@@ -176,8 +189,6 @@
{
ClientSessionFactoryInternal sf;
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -238,8 +249,6 @@
public void testConsumeTransacted() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -327,13 +336,12 @@
// https://jira.jboss.org/jira/browse/HORNETQ-285
public void testFailoverOnInitialConnection() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setFailoverOnInitialConnection(true);
locator.setReconnectAttempts(-1);
+
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);
// Crash live server
@@ -386,8 +394,6 @@
public void testTransactedMessagesSentSoRollback() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -451,8 +457,6 @@
*/
public void testTransactedMessagesSentSoRollbackAndContinueWork() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -524,8 +528,6 @@
public void testTransactedMessagesNotSentSoNoRollback() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -598,8 +600,6 @@
public void testTransactedMessagesWithConsumerStartedBeforeFailover() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -680,8 +680,6 @@
public void testTransactedMessagesConsumedSoRollback() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -756,8 +754,6 @@
public void testTransactedMessagesNotConsumedSoNoRollback() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -844,8 +840,6 @@
public void testXAMessagesSentSoRollbackOnEnd() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -907,8 +901,6 @@
public void testXAMessagesSentSoRollbackOnPrepare() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -973,8 +965,6 @@
// This might happen if 1PC optimisation kicks in
public void testXAMessagesSentSoRollbackOnCommit() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1040,8 +1030,6 @@
public void testXAMessagesNotSentSoNoRollbackOnCommit() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1122,8 +1110,6 @@
public void testXAMessagesConsumedSoRollbackOnEnd() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1200,8 +1186,6 @@
public void testXAMessagesConsumedSoRollbackOnPrepare() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1281,8 +1265,6 @@
// 1PC optimisation
public void testXAMessagesConsumedSoRollbackOnCommit() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1362,8 +1344,6 @@
public void testCreateNewFactoryAfterFailover() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setFailoverOnInitialConnection(true);
@@ -1392,8 +1372,6 @@
public void testFailoverMultipleSessionsWithConsumers() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1492,8 +1470,6 @@
*/
public void testFailWithBrowser() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1564,8 +1540,6 @@
public void testFailThenReceiveMoreMessagesAfterFailover() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -1639,8 +1613,6 @@
public void testFailThenReceiveMoreMessagesAfterFailover2() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setBlockOnAcknowledge(true);
@@ -1744,8 +1716,6 @@
private void testSimpleSendAfterFailover(final boolean durable, final boolean temporary) throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setBlockOnAcknowledge(true);
@@ -1809,7 +1779,6 @@
public void _testForceBlockingReturn() throws Exception
{
- ServerLocator locator = getServerLocator();
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setBlockOnAcknowledge(true);
@@ -1875,8 +1844,6 @@
public void testCommitOccurredUnblockedAndResendNoDuplicates() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setReconnectAttempts(-1);
@@ -2028,8 +1995,6 @@
public void testCommitDidNotOccurUnblockedAndResend() throws Exception
{
- ServerLocator locator = getServerLocator();
-
locator.setBlockOnNonDurableSend(true);
locator.setBlockOnDurableSend(true);
locator.setBlockOnAcknowledge(true);
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -49,11 +49,11 @@
protected void setupServers() throws Exception
{
- setupServerWithDiscovery(0, groupAddress, groupPort, isFileStorage(), isNetty(), false);
- setupServerWithDiscovery(1, groupAddress, groupPort, isFileStorage(), isNetty(), false);
- setupServerWithDiscovery(2, groupAddress, groupPort, isFileStorage(), isNetty(), false);
- setupServerWithDiscovery(3, groupAddress, groupPort, isFileStorage(), isNetty(), false);
- setupServerWithDiscovery(4, groupAddress, groupPort, isFileStorage(), isNetty(), false);
+ setupLiveServerWithDiscovery(0, groupAddress, groupPort, isFileStorage(), isNetty(), false);
+ setupLiveServerWithDiscovery(1, groupAddress, groupPort, isFileStorage(), isNetty(), false);
+ setupLiveServerWithDiscovery(2, groupAddress, groupPort, isFileStorage(), isNetty(), false);
+ setupLiveServerWithDiscovery(3, groupAddress, groupPort, isFileStorage(), isNetty(), false);
+ setupLiveServerWithDiscovery(4, groupAddress, groupPort, isFileStorage(), isNetty(), false);
}
@Override
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-11-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -86,20 +86,11 @@
}
catch (Exception e)
{
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ e.printStackTrace();
}
}
locators.clear();
- if(!ClientSessionFactoryImpl.factories.isEmpty())
- {
- for (ClientSessionFactoryImpl factory : ClientSessionFactoryImpl.factories)
- {
- // System.out.println(threadDump("oops"));
- //factory.e.printStackTrace();
- // System.exit(0);
- }
- }
- super.tearDown(); //To change body of overridden methods use File | Settings | File Templates.
+ super.tearDown();
checkFreePort(5445);
checkFreePort(5446);
checkFreePort(5447);
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-22 20:21:51 UTC (rev 9920)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-11-23 15:35:31 UTC (rev 9921)
@@ -776,6 +776,21 @@
Assert.fail("test did not close all its files " + AsynchronousFileImpl.getTotalMaxIO());
}
+ /*Map<Thread, StackTraceElement[]> threads = Thread.getAllStackTraces();
+ for (Thread thread : threads.keySet())
+ {
+ if(thread.isAlive())
+ {
+ StackTraceElement[] elements = threads.get(thread);
+ for (StackTraceElement element : elements)
+ {
+ if(element.getMethodName().contains("getConnectionWithRetry"))
+ {
+ System.out.println("UnitTestCase.tearDown");
+ }
+ }
+ }
+ }*/
super.tearDown();
}
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9920 - in branches/2_2_0_HA_Improvements_preMerge: src/main/org/hornetq/core/paging/impl and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-11-22 15:21:51 -0500 (Mon, 22 Nov 2010)
New Revision: 9920
Modified:
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java
Log:
fixing tests
Modified: branches/…
[View More]2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java 2010-11-22 13:11:45 UTC (rev 9919)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/cursor/impl/PageSubscriptionImpl.java 2010-11-22 20:21:51 UTC (rev 9920)
@@ -1093,7 +1093,7 @@
}
// 2nd ... if TX, is it committed?
- if (valid && message.getPagedMessage().getTransactionID() != 0)
+ if (valid && message.getPagedMessage().getTransactionID() >= 0)
{
PageTransactionInfo tx = pageStore.getPagingManager().getTransaction(message.getPagedMessage()
.getTransactionID());
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2010-11-22 13:11:45 UTC (rev 9919)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2010-11-22 20:21:51 UTC (rev 9920)
@@ -940,7 +940,7 @@
{
if (tx == null)
{
- return 0l;
+ return -1;
}
else
{
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-11-22 13:11:45 UTC (rev 9919)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2010-11-22 20:21:51 UTC (rev 9920)
@@ -698,6 +698,8 @@
{
message = session.createMessage(IS_DURABLE_MESSAGE);
message.getBodyBuffer().writeBytes(body);
+ message.putIntProperty("id", numberOfMessages);
+ message.putBooleanProperty("new", false);
// Stop sending message as soon as we start paging
if (server.getPostOffice().getPagingManager().getPageStore(PagingTest.ADDRESS).isPaging())
@@ -727,10 +729,19 @@
{
ClientMessage msg = consumer.receive(PagingTest.RECEIVE_TIMEOUT);
msg.acknowledge();
+ assertEquals(j, msg.getIntProperty("id").intValue());
+ assertFalse(msg.getBooleanProperty("new"));
Assert.assertNotNull(msg);
}
+
+ ClientMessage msgReceived = consumer.receiveImmediate();
+
+ if (msgReceived != null)
+ {
+ System.out.println("new = " + msgReceived.getBooleanProperty("new") + " id = " + msgReceived.getIntProperty("id"));
+ }
- Assert.assertNull(consumer.receiveImmediate());
+ Assert.assertNull(msgReceived);
consumer.close();
}
@@ -1275,16 +1286,6 @@
locator.setBlockOnAcknowledge(true);
final ClientSessionFactory sf = locator.createSessionFactory();
- ClientSession session = sf.createSession(null, null, false, true, true, false, 0);
-
- session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
-
- session.close();
-
- session = null;
-
- ClientProducer producer = session.createProducer(PagingTest.ADDRESS);
-
final CountDownLatch ready = new CountDownLatch(1);
final byte[] body = new byte[messageSize];
@@ -1345,7 +1346,7 @@
}
};
- session = sf.createSession(true, true, 0);
+ ClientSession session = sf.createSession(true, true, 0);
session.start();
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9919 - branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-11-22 08:11:45 -0500 (Mon, 22 Nov 2010)
New Revision: 9919
Modified:
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
branches/2_2_0_HA_Improvements_preMerge/…
[View More]tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
Log:
make sure bridge tests clearup resources
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-11-22 10:53:44 UTC (rev 9918)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2010-11-22 13:11:45 UTC (rev 9919)
@@ -144,66 +144,76 @@
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
service2.getConfiguration().setQueueConfigurations(queueConfigs1);
- service2.start();
- server1.start();
- server0.start();
+ ServerLocator locator = null;
+ try
+ {
+ service2.start();
+ server1.start();
+ server0.start();
- BridgeReconnectTest.log.info("** failing connection");
- // Now we will simulate a failure of the bridge connection between server0 and server1
- /*Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- RemotingConnection forwardingConnection = getForwardingConnection(bridge);
- forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));*/
- server0.kill();
+ BridgeReconnectTest.log.info("** failing connection");
+ // Now we will simulate a failure of the bridge connection between server0 and server1
+ /*Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ RemotingConnection forwardingConnection = getForwardingConnection(bridge);
+ forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));*/
+ server0.kill();
- waitForServerStart(service2);
+ waitForServerStart(service2);
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server2tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server2tc);
- ClientSessionFactory csf0 = locator.createSessionFactory(server2tc);
+ ClientSessionFactory csf0 = locator.createSessionFactory(server2tc);
- ClientSession session0 = csf0.createSession(false, true, true);
+ ClientSession session0 = csf0.createSession(false, true, true);
- ClientProducer prod0 = session0.createProducer(testAddress);
-
- ClientSessionFactory csf2 = locator.createSessionFactory(server2tc);
+ ClientProducer prod0 = session0.createProducer(testAddress);
- ClientSession session2 = csf2.createSession(false, true, true);
+ ClientSessionFactory csf2 = locator.createSessionFactory(server2tc);
- ClientConsumer cons2 = session2.createConsumer(queueName0);
+ ClientSession session2 = csf2.createSession(false, true, true);
- session2.start();
-
- final int numMessages = 10;
+ ClientConsumer cons2 = session2.createConsumer(queueName0);
- SimpleString propKey = new SimpleString("propkey");
+ session2.start();
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(true);
- message.putIntProperty(propKey, i);
+ final int numMessages = 10;
- prod0.send(message);
+ SimpleString propKey = new SimpleString("propkey");
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(true);
+ message.putIntProperty(propKey, i);
+
+ prod0.send(message);
+ }
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage r1 = cons2.receive(1500);
+ Assert.assertNotNull(r1);
+ Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ }
+
+ session0.close();
+ session2.close();
}
+ finally
+ {
+ if (locator != null)
+ {
+ locator.close();
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage r1 = cons2.receive(1500);
- Assert.assertNotNull(r1);
- Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ server0.stop();
+ server1.stop();
+ service2.stop();
}
- session0.close();
- session2.close();
- locator.close();
-
- server0.stop();
- server1.stop();
- service2.stop();
-
Assert.assertEquals(0, server0.getRemotingService().getConnections().size());
Assert.assertEquals(0, server1.getRemotingService().getConnections().size());
Assert.assertEquals(0, service2.getRemotingService().getConnections().size());
@@ -283,56 +293,66 @@
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
service2.getConfiguration().setQueueConfigurations(queueConfigs1);
- service2.start();
- server1.start();
- server0.start();
- // Now we will simulate a failure of the bridge connection between server0 and server1
- server0.kill();
+ ServerLocator locator = null;
+ try
+ {
+ service2.start();
+ server1.start();
+ server0.start();
+ // Now we will simulate a failure of the bridge connection between server0 and server1
+ server0.kill();
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(server2tc);
- locator.setReconnectAttempts(100);
- ClientSessionFactory csf0 = locator.createSessionFactory(server2tc);
- ClientSession session0 = csf0.createSession(false, true, true);
+ locator = HornetQClient.createServerLocatorWithHA(server2tc);
+ locator.setReconnectAttempts(100);
+ ClientSessionFactory csf0 = locator.createSessionFactory(server2tc);
+ ClientSession session0 = csf0.createSession(false, true, true);
- ClientSessionFactory csf2 = locator.createSessionFactory(server2tc);
- ClientSession session2 = csf2.createSession(false, true, true);
+ ClientSessionFactory csf2 = locator.createSessionFactory(server2tc);
+ ClientSession session2 = csf2.createSession(false, true, true);
- ClientProducer prod0 = session0.createProducer(testAddress);
+ ClientProducer prod0 = session0.createProducer(testAddress);
- ClientConsumer cons2 = session2.createConsumer(queueName0);
+ ClientConsumer cons2 = session2.createConsumer(queueName0);
- session2.start();
-
+ session2.start();
- final int numMessages = 10;
- SimpleString propKey = new SimpleString("propkey");
+ final int numMessages = 10;
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ SimpleString propKey = new SimpleString("propkey");
- prod0.send(message);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
+
+ prod0.send(message);
+ }
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage r1 = cons2.receive(1500);
+ Assert.assertNotNull(r1);
+ Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ }
+
+ session0.close();
+ session2.close();
}
+ finally
+ {
+ if (locator != null)
+ {
+ locator.close();
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage r1 = cons2.receive(1500);
- Assert.assertNotNull(r1);
- Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ server0.stop();
+ server1.stop();
+ service2.stop();
}
- session0.close();
- session2.close();
- locator.close();
-
- server0.stop();
- server1.stop();
- service2.stop();
-
Assert.assertEquals(0, server0.getRemotingService().getConnections().size());
Assert.assertEquals(0, server1.getRemotingService().getConnections().size());
Assert.assertEquals(0, service2.getRemotingService().getConnections().size());
@@ -401,59 +421,69 @@
queueConfigs1.add(queueConfig1);
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
- server0.start();
+ ServerLocator locator = null;
+ try
+ {
+ server1.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(server0tc, server1tc);
- ClientSessionFactory csf0 = locator.createSessionFactory(server0tc);
- ClientSession session0 = csf0.createSession(false, true, true);
+ locator = HornetQClient.createServerLocatorWithHA(server0tc, server1tc);
+ ClientSessionFactory csf0 = locator.createSessionFactory(server0tc);
+ ClientSession session0 = csf0.createSession(false, true, true);
- ClientSessionFactory csf1 = locator.createSessionFactory(server1tc);
- ClientSession session1 = csf1.createSession(false, true, true);
+ ClientSessionFactory csf1 = locator.createSessionFactory(server1tc);
+ ClientSession session1 = csf1.createSession(false, true, true);
- ClientProducer prod0 = session0.createProducer(testAddress);
+ ClientProducer prod0 = session0.createProducer(testAddress);
- ClientConsumer cons1 = session1.createConsumer(queueName0);
+ ClientConsumer cons1 = session1.createConsumer(queueName0);
- session1.start();
+ session1.start();
- // Now we will simulate a failure of the bridge connection between server0 and server1
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- RemotingConnection forwardingConnection = getForwardingConnection(bridge);
- InVMConnector.failOnCreateConnection = true;
- InVMConnector.numberOfFailures = reconnectAttempts - 1;
- forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
+ // Now we will simulate a failure of the bridge connection between server0 and server1
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ RemotingConnection forwardingConnection = getForwardingConnection(bridge);
+ InVMConnector.failOnCreateConnection = true;
+ InVMConnector.numberOfFailures = reconnectAttempts - 1;
+ forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
- forwardingConnection = getForwardingConnection(bridge);
- forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
+ forwardingConnection = getForwardingConnection(bridge);
+ forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
- final int numMessages = 10;
+ final int numMessages = 10;
- SimpleString propKey = new SimpleString("propkey");
+ SimpleString propKey = new SimpleString("propkey");
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- prod0.send(message);
+ prod0.send(message);
+ }
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage r1 = cons1.receive(1500);
+ Assert.assertNotNull(r1);
+ Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ }
+
+ session0.close();
+ session1.close();
}
+ finally
+ {
+ if (locator != null)
+ {
+ locator.close();
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage r1 = cons1.receive(1500);
- Assert.assertNotNull(r1);
- Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ server0.stop();
+ server1.stop();
}
- session0.close();
- session1.close();
- locator.close();
-
- server0.stop();
- server1.stop();
-
Assert.assertEquals(0, server0.getRemotingService().getConnections().size());
Assert.assertEquals(0, server1.getRemotingService().getConnections().size());
}
@@ -533,65 +563,75 @@
queueConfigs1.add(queueConfig1);
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
- server0.start();
+ ServerLocator locator = null;
+ try
+ {
+ server1.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(server0tc, server1tc);
- ClientSessionFactory csf0 = locator.createSessionFactory(server0tc);
- ClientSession session0 = csf0.createSession(false, true, true);
+ locator = HornetQClient.createServerLocatorWithHA(server0tc, server1tc);
+ ClientSessionFactory csf0 = locator.createSessionFactory(server0tc);
+ ClientSession session0 = csf0.createSession(false, true, true);
- ClientProducer prod0 = session0.createProducer(testAddress);
+ ClientProducer prod0 = session0.createProducer(testAddress);
- BridgeReconnectTest.log.info("stopping server1");
- server1.stop();
+ BridgeReconnectTest.log.info("stopping server1");
+ server1.stop();
- if (sleep)
- {
- Thread.sleep(2 * clientFailureCheckPeriod);
- }
+ if (sleep)
+ {
+ Thread.sleep(2 * clientFailureCheckPeriod);
+ }
- BridgeReconnectTest.log.info("restarting server1");
- server1.start();
- BridgeReconnectTest.log.info("server 1 restarted");
+ BridgeReconnectTest.log.info("restarting server1");
+ server1.start();
+ BridgeReconnectTest.log.info("server 1 restarted");
- ClientSessionFactory csf1 = locator.createSessionFactory(server1tc);
- ClientSession session1 = csf1.createSession(false, true, true);
+ ClientSessionFactory csf1 = locator.createSessionFactory(server1tc);
+ ClientSession session1 = csf1.createSession(false, true, true);
- ClientConsumer cons1 = session1.createConsumer(queueName0);
+ ClientConsumer cons1 = session1.createConsumer(queueName0);
- session1.start();
+ session1.start();
- final int numMessages = 10;
+ final int numMessages = 10;
- SimpleString propKey = new SimpleString("propkey");
+ SimpleString propKey = new SimpleString("propkey");
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- prod0.send(message);
- }
+ prod0.send(message);
+ }
- BridgeReconnectTest.log.info("sent messages");
+ BridgeReconnectTest.log.info("sent messages");
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage r1 = cons1.receive(30000);
- Assert.assertNotNull(r1);
- Assert.assertEquals(i, r1.getObjectProperty(propKey));
- BridgeReconnectTest.log.info("got message " + r1.getObjectProperty(propKey));
- }
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage r1 = cons1.receive(30000);
+ Assert.assertNotNull(r1);
+ Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ BridgeReconnectTest.log.info("got message " + r1.getObjectProperty(propKey));
+ }
- BridgeReconnectTest.log.info("got messages");
+ BridgeReconnectTest.log.info("got messages");
- session0.close();
- session1.close();
+ session0.close();
+ session1.close();
+ }
+ finally
+ {
+ if (locator != null)
+ {
+ locator.close();
+ }
- locator.close();
+ server0.stop();
+ server1.stop();
+ }
- server0.stop();
- server1.stop();
Assert.assertEquals(0, server0.getRemotingService().getConnections().size());
Assert.assertEquals(0, server1.getRemotingService().getConnections().size());
@@ -658,76 +698,86 @@
queueConfigs1.add(queueConfig1);
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
- server0.start();
+ ServerLocator locator = null;
+ try
+ {
+ server1.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(server0tc, server1tc);
- ClientSessionFactory csf0 = locator.createSessionFactory(server0tc);
- ClientSession session0 = csf0.createSession(false, true, true);
+ locator = HornetQClient.createServerLocatorWithHA(server0tc, server1tc);
+ ClientSessionFactory csf0 = locator.createSessionFactory(server0tc);
+ ClientSession session0 = csf0.createSession(false, true, true);
- ClientSessionFactory csf1 = locator.createSessionFactory(server1tc);
- ClientSession session1 = csf1.createSession(false, true, true);
+ ClientSessionFactory csf1 = locator.createSessionFactory(server1tc);
+ ClientSession session1 = csf1.createSession(false, true, true);
- ClientProducer prod0 = session0.createProducer(testAddress);
+ ClientProducer prod0 = session0.createProducer(testAddress);
- ClientConsumer cons1 = session1.createConsumer(queueName0);
+ ClientConsumer cons1 = session1.createConsumer(queueName0);
- session1.start();
+ session1.start();
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- RemotingConnection forwardingConnection = getForwardingConnection(bridge);
- InVMConnector.failOnCreateConnection = true;
- InVMConnector.numberOfFailures = reconnectAttempts - 1;
- forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ RemotingConnection forwardingConnection = getForwardingConnection(bridge);
+ InVMConnector.failOnCreateConnection = true;
+ InVMConnector.numberOfFailures = reconnectAttempts - 1;
+ forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
- final int numMessages = 10;
+ final int numMessages = 10;
- SimpleString propKey = new SimpleString("propkey");
+ SimpleString propKey = new SimpleString("propkey");
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- prod0.send(message);
- }
+ prod0.send(message);
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage r1 = cons1.receive(1500);
- Assert.assertNotNull(r1);
- Assert.assertEquals(i, r1.getObjectProperty(propKey));
- }
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage r1 = cons1.receive(1500);
+ Assert.assertNotNull(r1);
+ Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ }
- // Fail again - should reconnect
- forwardingConnection = ((BridgeImpl)bridge).getForwardingConnection();
- InVMConnector.failOnCreateConnection = true;
- InVMConnector.numberOfFailures = reconnectAttempts - 1;
- forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
+ // Fail again - should reconnect
+ forwardingConnection = ((BridgeImpl)bridge).getForwardingConnection();
+ InVMConnector.failOnCreateConnection = true;
+ InVMConnector.numberOfFailures = reconnectAttempts - 1;
+ forwardingConnection.fail(new HornetQException(HornetQException.NOT_CONNECTED));
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- prod0.send(message);
+ prod0.send(message);
+ }
+
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage r1 = cons1.receive(1500);
+ Assert.assertNotNull(r1);
+ Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ }
+
+ session0.close();
+ session1.close();
}
+ finally
+ {
+ if (locator != null)
+ {
+ locator.close();
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage r1 = cons1.receive(1500);
- Assert.assertNotNull(r1);
- Assert.assertEquals(i, r1.getObjectProperty(propKey));
+ server0.stop();
+ server1.stop();
}
- session0.close();
- session1.close();
- locator.close();
-
- server0.stop();
- server1.stop();
-
Assert.assertEquals(0, server0.getRemotingService().getConnections().size());
Assert.assertEquals(0, server1.getRemotingService().getConnections().size());
}
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-11-22 10:53:44 UTC (rev 9918)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-11-22 13:11:45 UTC (rev 9919)
@@ -79,7 +79,7 @@
server1Params.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
}
HornetQServer server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params);
-
+ ServerLocator locator = null;
try
{
final String testAddress = "testAddress";
@@ -132,7 +132,7 @@
server1.start();
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
@@ -213,6 +213,11 @@
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
+
server0.stop();
server1.stop();
@@ -286,14 +291,14 @@
List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
queueConfigs1.add(queueConfig1);
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
-
+ ServerLocator locator = null;
try
{
// Don't start server 1 yet
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
@@ -422,6 +427,11 @@
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
+
server0.stop();
server1.stop();
@@ -448,7 +458,7 @@
final String queueName0 = "queue0";
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
-
+ ServerLocator locator = null;
try
{
Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
@@ -497,7 +507,7 @@
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
@@ -564,10 +574,14 @@
sf0.close();
- locator.close();
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
+
server0.stop();
server1.stop();
@@ -595,7 +609,7 @@
final String queueName0 = "queue0";
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
-
+ ServerLocator locator = null;
try
{
Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
@@ -644,7 +658,7 @@
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
@@ -759,11 +773,13 @@
session0.close();
sf0.close();
-
- locator.close();
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
server0.stop();
server1.stop();
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-11-22 10:53:44 UTC (rev 9918)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-11-22 13:11:45 UTC (rev 9919)
@@ -88,7 +88,7 @@
{
HornetQServer server0 = null;
HornetQServer server1 = null;
-
+ ServerLocator locator = null;
try
{
Map<String, Object> server0Params = new HashMap<String, Object>();
@@ -153,7 +153,7 @@
server1.start();
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
@@ -214,11 +214,13 @@
sf1.close();
- locator.close();
-
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
try
{
server0.stop();
@@ -290,7 +292,7 @@
{
HornetQServer server0 = null;
HornetQServer server1 = null;
-
+ ServerLocator locator = null;
try
{
@@ -350,7 +352,7 @@
server1.start();
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
@@ -430,12 +432,14 @@
sf0.close();
sf1.close();
-
- locator.close();
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
try
{
server0.stop();
@@ -520,72 +524,82 @@
queueConfigs1.add(queueConfig1);
server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
- server0.start();
+ ServerLocator locator = null;
+ try
+ {
+ server1.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- session1.start();
+ session1.start();
- final int numMessages = 10;
+ final int numMessages = 10;
- final SimpleString propKey = new SimpleString("wibble");
+ final SimpleString propKey = new SimpleString("wibble");
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- message.putStringProperty(propKey, new SimpleString("bing"));
+ message.putStringProperty(propKey, new SimpleString("bing"));
- message.getBodyBuffer().writeString("doo be doo be doo be doo");
+ message.getBodyBuffer().writeString("doo be doo be doo be doo");
- producer0.send(message);
- }
+ producer0.send(message);
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(200);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(200);
- Assert.assertNotNull(message);
+ Assert.assertNotNull(message);
- SimpleString val = (SimpleString)message.getObjectProperty(propKey);
+ SimpleString val = (SimpleString)message.getObjectProperty(propKey);
- Assert.assertEquals(new SimpleString("bong"), val);
+ Assert.assertEquals(new SimpleString("bong"), val);
- String sval = message.getBodyBuffer().readString();
+ String sval = message.getBodyBuffer().readString();
- Assert.assertEquals("dee be dee be dee be dee", sval);
+ Assert.assertEquals("dee be dee be dee be dee", sval);
- message.acknowledge();
+ message.acknowledge();
- }
+ }
- Assert.assertNull(consumer1.receiveImmediate());
+ Assert.assertNull(consumer1.receiveImmediate());
- session0.close();
+ session0.close();
- session1.close();
+ session1.close();
- sf0.close();
+ sf0.close();
- sf1.close();
+ sf1.close();
+ }
+ finally
+ {
+ if (locator != null)
+ {
+ locator.close();
+ }
- locator.close();
+ server0.stop();
- server0.stop();
+ server1.stop();
+ }
- server1.stop();
}
public void testBridgeWithPaging() throws Exception
@@ -596,7 +610,7 @@
final int PAGE_MAX = 100 * 1024;
final int PAGE_SIZE = 10 * 1024;
-
+ ServerLocator locator = null;
try
{
@@ -656,7 +670,7 @@
server1.start();
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
@@ -705,11 +719,13 @@
sf1.close();
- locator.close();
-
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
try
{
server0.stop();
@@ -733,7 +749,7 @@
{
HornetQServer server0 = null;
HornetQServer server1 = null;
-
+ ServerLocator locator = null;
try
{
Map<String, Object> server0Params = new HashMap<String, Object>();
@@ -798,7 +814,7 @@
server1.start();
server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
@@ -849,11 +865,13 @@
sf1.close();
- locator.close();
-
}
finally
{
+ if(locator != null)
+ {
+ locator.close();
+ }
try
{
server0.stop();
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-22 10:53:44 UTC (rev 9918)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2010-11-22 13:11:45 UTC (rev 9919)
@@ -72,158 +72,168 @@
server1Params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, 1);
}
HornetQServer server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params);
+ ServerLocator locator = null;
+ try
+ {
+ Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
+ TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
+ TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
+ connectors.put(server1tc.getName(), server1tc);
- Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
- TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
- TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
- connectors.put(server1tc.getName(), server1tc);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
- server0.getConfiguration().setConnectorConfigurations(connectors);
+ final String testAddress = "testAddress";
+ final String queueName0 = "queue0";
+ final String forwardAddress = "forwardAddress";
+ final String queueName1 = "queue1";
- final String testAddress = "testAddress";
- final String queueName0 = "queue0";
- final String forwardAddress = "forwardAddress";
- final String queueName1 = "queue1";
+ final String groupAddress = getUDPDiscoveryAddress();
+ final int port = getUDPDiscoveryPort();
- final String groupAddress = getUDPDiscoveryAddress();
- final int port = getUDPDiscoveryPort();
+ ArrayList<String> list = new ArrayList<String>();
+ list.add(server1tc.getName());
+ BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
+ null,
+ -1,
+ groupAddress,
+ port,
+ 250,
+ list);
- ArrayList<String> list = new ArrayList<String>();
- list.add(server1tc.getName());
- BroadcastGroupConfiguration bcConfig = new BroadcastGroupConfiguration("bg1",
- null,
- -1,
- groupAddress,
- port,
- 250,
- list);
+ server0.getConfiguration().getBroadcastGroupConfigurations().add(bcConfig);
- server0.getConfiguration().getBroadcastGroupConfigurations().add(bcConfig);
+ DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
- DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration("dg1", null, groupAddress, port, 5000, 5000);
+ server0.getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
- server0.getConfiguration().getDiscoveryGroupConfigurations().put(dcConfig.getName(), dcConfig);
+ final String bridgeName = "bridge1";
- final String bridgeName = "bridge1";
+ ArrayList<String> staticConnectors = new ArrayList<String>();
+ staticConnectors.add(server1tc.getName());
+ BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
+ queueName0,
+ forwardAddress,
+ null,
+ null,
+ 1000,
+ 1d,
+ 0,
+ true,
+ 1024,
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ staticConnectors,
+ false,
+ ConfigurationImpl.DEFAULT_CLUSTER_USER,
+ ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
- ArrayList<String> staticConnectors = new ArrayList<String>();
- staticConnectors.add(server1tc.getName());
- BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
- queueName0,
- forwardAddress,
- null,
- null,
- 1000,
- 1d,
- 0,
- true,
- 1024,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
- false,
- ConfigurationImpl.DEFAULT_CLUSTER_USER,
- ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
+ List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
+ bridgeConfigs.add(bridgeConfiguration);
+ server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
- List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
- bridgeConfigs.add(bridgeConfiguration);
- server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
+ CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
+ List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs0.add(queueConfig0);
+ server0.getConfiguration().setQueueConfigurations(queueConfigs0);
- CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
- List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs0.add(queueConfig0);
- server0.getConfiguration().setQueueConfigurations(queueConfigs0);
+ CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
+ List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs1.add(queueConfig1);
+ server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
- List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs1.add(queueConfig1);
- server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+ server1.start();
+ server0.start();
- server1.start();
- server0.start();
+ locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
- ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
+ ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ session1.start();
- session1.start();
+ final int numMessages = 10;
- final int numMessages = 10;
+ final SimpleString propKey = new SimpleString("testkey");
- final SimpleString propKey = new SimpleString("testkey");
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(BridgeWithDiscoveryGroupStartTest.TIMEOUT);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(BridgeWithDiscoveryGroupStartTest.TIMEOUT);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ bridge.stop();
- bridge.stop();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ bridge.start();
- bridge.start();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(BridgeWithDiscoveryGroupStartTest.TIMEOUT);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(BridgeWithDiscoveryGroupStartTest.TIMEOUT);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ session0.close();
- session0.close();
+ session1.close();
- session1.close();
+ sf0.close();
- sf0.close();
+ sf1.close();
+ }
+ finally
+ {
+ if(locator != null)
+ {
+ locator.close();
+ }
+ server0.stop();
- sf1.close();
+ server1.stop();
+ }
- server0.stop();
-
- server1.stop();
}
/**
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9918 - in branches/2_2_0_HA_Improvements_preMerge: src/main/org/hornetq/core/server/cluster/impl and 6 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-11-22 05:53:44 -0500 (Mon, 22 Nov 2010)
New Revision: 9918
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/server/cluster/impl/BridgeImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/…
[View More]management/impl/ManagementServiceImpl.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.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/cluster/distribution/ClusteredGroupingTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java
branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
fixed tests to close server locator and small fixes
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:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/client/impl/ServerLocatorImpl.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -173,7 +173,7 @@
return globalThreadPool;
}
- private static synchronized ScheduledExecutorService getGlobalScheduledThreadPool()
+ public static synchronized ScheduledExecutorService getGlobalScheduledThreadPool()
{
if (globalScheduledThreadPool == null)
{
@@ -533,7 +533,7 @@
threadPool,
scheduledThreadPool,
interceptors);
- factory.connect(reconnectAttempts, failoverOnInitialConnection);
+ factory.connect(initialConnectAttempts, failoverOnInitialConnection);
}
catch (HornetQException e)
{
@@ -1216,7 +1216,7 @@
{
return topology;
}
-
+
public void addClusterTopologyListener(final ClusterTopologyListener listener)
{
topologyListeners.add(listener);
@@ -1232,6 +1232,20 @@
return pairs.get(live);
}
+ public static void shutdown()
+ {
+ if (globalScheduledThreadPool != null)
+ {
+ globalScheduledThreadPool.shutdown();
+ globalScheduledThreadPool = null;
+ }
+ if (globalThreadPool != null)
+ {
+ globalThreadPool.shutdown();
+ globalThreadPool = null;
+ }
+ }
+
class StaticConnector implements Serializable
{
private List<Connector> connectors;
@@ -1251,7 +1265,7 @@
{
throw new HornetQException(HornetQException.INTERNAL_ERROR, "Failed to initialise session factory", e);
}
-
+
ClientSessionFactory csf = null;
createConnectors();
@@ -1337,7 +1351,7 @@
super.finalize();
}
-
+
class Connector implements Callable<ClientSessionFactory>
{
private TransportConfiguration initialConnector;
@@ -1391,7 +1405,7 @@
public void disconnect()
{
interrupted = true;
-
+
if (factory != null)
{
factory.causeExit();
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -51,7 +51,7 @@
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
+ *
* Created 12 Nov 2008 11:37:35
*
*
@@ -66,7 +66,7 @@
// Attributes ----------------------------------------------------
protected final ServerLocatorInternal serverLocator;
-
+
private final UUID nodeUUID;
private final SimpleString name;
@@ -125,7 +125,7 @@
final StorageManager storageManager) throws Exception
{
this.serverLocator = serverLocator;
-
+
this.nodeUUID = nodeUUID;
this.name = name;
@@ -210,6 +210,11 @@
{
csf.close();
}
+
+ if(serverLocator != null)
+ {
+ serverLocator.close();
+ }
}
executor.execute(new StopRunnable());
@@ -312,7 +317,7 @@
}
// Consumer implementation ---------------------------------------
-
+
/* Hook for processing message before forwarding */
protected ServerMessage beforeForward(ServerMessage message)
{
@@ -341,7 +346,7 @@
{
message = transformer.transform(message);
}
-
+
return message;
}
@@ -366,7 +371,7 @@
refs.add(ref);
message = beforeForward(message);
-
+
SimpleString dest;
if (forwardingAddress != null)
@@ -460,7 +465,7 @@
BridgeImpl.log.error("Failed to cancel refs", e);
}
}
-
+
/* Hook for doing extra stuff after connection */
protected void afterConnect() throws Exception
{
@@ -488,7 +493,7 @@
BridgeImpl.log.info("Connecting bridge " + name + " to its destination [" + nodeUUID.toString() + "]");
try
- {
+ {
csf = createSessionFactory();
// Session is pre-acknowledge
session = (ClientSessionInternal)csf.createSession(user, password, false, true, true, true, 1);
@@ -592,7 +597,7 @@
{
queue.deliverAsync();
}
-
+
log.info("stopped bridge " + name);
}
catch (Exception e)
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -356,6 +356,7 @@
try
{
backupSessionFactory.close();
+ backupSessionFactory.getServerLocator().close();
}
catch (Exception e)
{
Modified: branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/src/main/org/hornetq/core/server/management/impl/ManagementServiceImpl.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -15,12 +15,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.ScheduledExecutorService;
import javax.management.MBeanServer;
@@ -474,7 +469,8 @@
public Object[] getResources(final Class<?> resourceType)
{
List<Object> resources = new ArrayList<Object>();
- for (Object entry : registry.values())
+ Collection<Object> clone = new ArrayList<Object>(registry.values());
+ for (Object entry : clone)
{
if (resourceType.isAssignableFrom(entry.getClass()))
{
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -43,6 +43,7 @@
private HornetQServer server;
private ClientSession clientSession;
+ private ServerLocator locator;
public void testBasicSend() throws Exception
{
@@ -465,7 +466,7 @@
// start the server
server.start();
// then we create a client as normal
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sessionFactory = locator.createSessionFactory();
clientSession = sessionFactory.createSession(false, true, false);
}
@@ -484,6 +485,17 @@
//
}
}
+ if(locator != null)
+ {
+ try
+ {
+ locator.close();
+ }
+ catch (Exception e)
+ {
+ //
+ }
+ }
if (server != null && server.isStarted())
{
try
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/HornetQCrashTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -32,6 +32,7 @@
public HornetQServer server;
private volatile boolean ackReceived;
+ private ServerLocator locator;
public void testHang() throws Exception
{
@@ -46,7 +47,6 @@
server.getRemotingService().addInterceptor(new AckInterceptor(server));
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
@@ -115,8 +115,19 @@
}
@Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+
+ locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
+ }
+
+ @Override
protected void tearDown() throws Exception
{
+ locator.close();
+
super.tearDown();
server = null;
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -41,6 +41,7 @@
private HornetQServer server;
private ClientSession session;
+ private ServerLocator locator;
// Static --------------------------------------------------------
@@ -80,7 +81,7 @@
config.setSecurityEnabled(false);
server = HornetQServers.newHornetQServer(config, false);
server.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
sf = locator.createSessionFactory();
session = sf.createSession(false, true, true);
}
@@ -94,6 +95,8 @@
sf.close();
+ locator.close();
+
server.stop();
server = null;
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/QueueBrowserTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -64,10 +64,6 @@
public void testSimpleConsumerBrowser() throws Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
-
-
-
locator.setBlockOnNonDurableSend(true);
sf = locator.createSessionFactory();
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -44,6 +44,7 @@
private HornetQServer service;
private ClientSessionFactory sf;
+ private ServerLocator locator;
// Static --------------------------------------------------------
@@ -85,7 +86,6 @@
SimpleString requestAddress = RandomUtil.randomSimpleString();
SimpleString requestQueue = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -119,7 +119,6 @@
SimpleString requestAddress = RandomUtil.randomSimpleString();
SimpleString requestQueue = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -150,7 +149,6 @@
{
final SimpleString requestAddress = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -174,7 +172,6 @@
SimpleString requestAddress = RandomUtil.randomSimpleString();
SimpleString requestQueue = RandomUtil.randomSimpleString();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
ClientSessionFactory sf = locator.createSessionFactory();
final ClientSession session = sf.createSession(false, true, true);
@@ -225,7 +222,7 @@
service = HornetQServers.newHornetQServer(conf, false);
service.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
sf = locator.createSessionFactory();
}
@@ -236,6 +233,10 @@
sf.close();
+ locator.close();
+
+ locator = null;
+
sf = null;
service = null;
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -405,6 +405,10 @@
session.close();
+ locator.close();
+
+ locator = null;
+
server.stop();
session = null;
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -80,138 +80,144 @@
}
HornetQServer server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params);
- final String testAddress = "testAddress";
- final String queueName0 = "queue0";
- final String forwardAddress = "forwardAddress";
- final String queueName1 = "queue1";
+ try
+ {
+ final String testAddress = "testAddress";
+ final String queueName0 = "queue0";
+ final String forwardAddress = "forwardAddress";
+ final String queueName1 = "queue1";
- Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
- TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
- TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
- connectors.put(server1tc.getName(), server1tc);
+ Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
+ TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
+ TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
+ connectors.put(server1tc.getName(), server1tc);
- server0.getConfiguration().setConnectorConfigurations(connectors);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
+ ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(server1tc.getName());
- final String bridgeName = "bridge1";
+ final String bridgeName = "bridge1";
- BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
- queueName0,
- forwardAddress,
- null,
- null,
- 1000,
- 1d,
- 0,
- true,
- 1024,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
- false,
- ConfigurationImpl.DEFAULT_CLUSTER_USER,
- ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
+ BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
+ queueName0,
+ forwardAddress,
+ null,
+ null,
+ 1000,
+ 1d,
+ 0,
+ true,
+ 1024,
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ staticConnectors,
+ false,
+ ConfigurationImpl.DEFAULT_CLUSTER_USER,
+ ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
- List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
- bridgeConfigs.add(bridgeConfiguration);
- server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
+ List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
+ bridgeConfigs.add(bridgeConfiguration);
+ server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
- CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
- List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs0.add(queueConfig0);
- server0.getConfiguration().setQueueConfigurations(queueConfigs0);
+ CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
+ List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs0.add(queueConfig0);
+ server0.getConfiguration().setQueueConfigurations(queueConfigs0);
- CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
- List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs1.add(queueConfig1);
- server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+ CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
+ List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs1.add(queueConfig1);
+ server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
- server0.start();
+ server1.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
- ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
- ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
+ ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- session1.start();
+ session1.start();
- final int numMessages = 10;
+ final int numMessages = 10;
- final SimpleString propKey = new SimpleString("testkey");
+ final SimpleString propKey = new SimpleString("testkey");
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ message.putIntProperty(propKey, i);
- producer0.send(message);
- }
+ producer0.send(message);
+ }
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(200);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(200);
- Assert.assertNotNull(message);
+ Assert.assertNotNull(message);
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- message.acknowledge();
- }
+ message.acknowledge();
+ }
- Assert.assertNull(consumer1.receiveImmediate());
+ Assert.assertNull(consumer1.receiveImmediate());
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- bridge.stop();
+ bridge.stop();
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- message.putIntProperty(propKey, i);
+ message.putIntProperty(propKey, i);
- producer0.send(message);
- }
+ producer0.send(message);
+ }
- Assert.assertNull(consumer1.receiveImmediate());
+ Assert.assertNull(consumer1.receiveImmediate());
- bridge.start();
+ bridge.start();
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- Assert.assertNotNull(message);
+ Assert.assertNotNull(message);
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- message.acknowledge();
- }
+ message.acknowledge();
+ }
- Assert.assertNull(consumer1.receiveImmediate());
+ Assert.assertNull(consumer1.receiveImmediate());
- session0.close();
+ session0.close();
- session1.close();
+ session1.close();
- sf0.close();
+ sf0.close();
- sf1.close();
+ sf1.close();
+ }
+ finally
+ {
+ server0.stop();
- server0.stop();
+ server1.stop();
+ }
- server1.stop();
}
public void testTargetServerUpAndDown() throws Exception
@@ -411,6 +417,8 @@
session0.close();
sf0.close();
+
+ locator.close();
}
finally
{
@@ -441,123 +449,130 @@
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
- Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
- TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
- TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
- connectors.put(server1tc.getName(), server1tc);
+ try
+ {
+ Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
+ TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
+ TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
+ connectors.put(server1tc.getName(), server1tc);
- server0.getConfiguration().setConnectorConfigurations(connectors);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
+ ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(server1tc.getName());
- final String bridgeName = "bridge1";
+ final String bridgeName = "bridge1";
- BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
- queueName0,
- forwardAddress,
- null,
- null,
- 1000,
- 1d,
- 0,
- false,
- 1024,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
- false,
- ConfigurationImpl.DEFAULT_CLUSTER_USER,
- ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
+ BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
+ queueName0,
+ forwardAddress,
+ null,
+ null,
+ 1000,
+ 1d,
+ 0,
+ false,
+ 1024,
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ staticConnectors,
+ false,
+ ConfigurationImpl.DEFAULT_CLUSTER_USER,
+ ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
- List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
- bridgeConfigs.add(bridgeConfiguration);
- server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
+ List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
+ bridgeConfigs.add(bridgeConfiguration);
+ server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
- CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
- List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs0.add(queueConfig0);
- server0.getConfiguration().setQueueConfigurations(queueConfigs0);
+ CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
+ List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs0.add(queueConfig0);
+ server0.getConfiguration().setQueueConfigurations(queueConfigs0);
- CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
- List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs1.add(queueConfig1);
- server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+ CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
+ List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs1.add(queueConfig1);
+ server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- // Don't start server 1 yet
+ // Don't start server 1 yet
- server0.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ final int numMessages = 10;
- final int numMessages = 10;
+ final SimpleString propKey = new SimpleString("testkey");
- final SimpleString propKey = new SimpleString("testkey");
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ // Wait a bit
+ Thread.sleep(1000);
- // Wait a bit
- Thread.sleep(1000);
+ // JMSBridge should be stopped since retries = 0
- // JMSBridge should be stopped since retries = 0
+ server1.start();
+ ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- server1.start();
- ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ session1.start();
- session1.start();
+ // Won't be received since the bridge was deactivated
+ Assert.assertNull(consumer1.receiveImmediate());
- // Won't be received since the bridge was deactivated
- Assert.assertNull(consumer1.receiveImmediate());
+ // Now start the bridge manually
- // Now start the bridge manually
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ bridge.start();
- bridge.start();
+ // Messages should now be received
- // Messages should now be received
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ session1.close();
- session1.close();
+ sf1.close();
- sf1.close();
+ session0.close();
- session0.close();
+ sf0.close();
- sf0.close();
+ locator.close();
+ }
+ finally
+ {
+ server0.stop();
- server0.stop();
+ server1.stop();
+ }
- server1.stop();
}
public void testManualStopStart() throws Exception
@@ -581,172 +596,179 @@
final String forwardAddress = "forwardAddress";
final String queueName1 = "queue1";
- Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
- TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
- TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
- connectors.put(server1tc.getName(), server1tc);
+ try
+ {
+ Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
+ TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params);
+ TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params);
+ connectors.put(server1tc.getName(), server1tc);
- server0.getConfiguration().setConnectorConfigurations(connectors);
+ server0.getConfiguration().setConnectorConfigurations(connectors);
- ArrayList<String> staticConnectors = new ArrayList<String>();
+ ArrayList<String> staticConnectors = new ArrayList<String>();
staticConnectors.add(server1tc.getName());
- final String bridgeName = "bridge1";
+ final String bridgeName = "bridge1";
- BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
- queueName0,
- forwardAddress,
- null,
- null,
- 1000,
- 1d,
- 1,
- true,
- 1024,
- HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
- staticConnectors,
- false,
- ConfigurationImpl.DEFAULT_CLUSTER_USER,
- ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
+ BridgeConfiguration bridgeConfiguration = new BridgeConfiguration(bridgeName,
+ queueName0,
+ forwardAddress,
+ null,
+ null,
+ 1000,
+ 1d,
+ 1,
+ true,
+ 1024,
+ HornetQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ staticConnectors,
+ false,
+ ConfigurationImpl.DEFAULT_CLUSTER_USER,
+ ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD);
- List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
- bridgeConfigs.add(bridgeConfiguration);
- server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
+ List<BridgeConfiguration> bridgeConfigs = new ArrayList<BridgeConfiguration>();
+ bridgeConfigs.add(bridgeConfiguration);
+ server0.getConfiguration().setBridgeConfigurations(bridgeConfigs);
- CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
- List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs0.add(queueConfig0);
- server0.getConfiguration().setQueueConfigurations(queueConfigs0);
+ CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration(testAddress, queueName0, null, true);
+ List<CoreQueueConfiguration> queueConfigs0 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs0.add(queueConfig0);
+ server0.getConfiguration().setQueueConfigurations(queueConfigs0);
- CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
- List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
- queueConfigs1.add(queueConfig1);
- server1.getConfiguration().setQueueConfigurations(queueConfigs1);
+ CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration(forwardAddress, queueName1, null, true);
+ List<CoreQueueConfiguration> queueConfigs1 = new ArrayList<CoreQueueConfiguration>();
+ queueConfigs1.add(queueConfig1);
+ server1.getConfiguration().setQueueConfigurations(queueConfigs1);
- server1.start();
+ server1.start();
- server0.start();
+ server0.start();
- ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(server0tc, server1tc);
ClientSessionFactory sf0 = locator.createSessionFactory(server0tc);
+ ClientSession session0 = sf0.createSession(false, true, true);
- ClientSession session0 = sf0.createSession(false, true, true);
+ ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
- ClientProducer producer0 = session0.createProducer(new SimpleString(testAddress));
+ final int numMessages = 10;
- final int numMessages = 10;
+ final SimpleString propKey = new SimpleString("testkey");
- final SimpleString propKey = new SimpleString("testkey");
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
+ ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
- producer0.send(message);
- }
- ClientSessionFactory sf1 = locator.createSessionFactory(server1tc);
+ ClientSession session1 = sf1.createSession(false, true, true);
- ClientSession session1 = sf1.createSession(false, true, true);
+ ClientConsumer consumer1 = session1.createConsumer(queueName1);
- ClientConsumer consumer1 = session1.createConsumer(queueName1);
+ session1.start();
- session1.start();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ // Now stop the bridge manually
- // Now stop the bridge manually
+ Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
- Bridge bridge = server0.getClusterManager().getBridges().get(bridgeName);
+ BridgeStartTest.log.info("stopping bridge manually");
- BridgeStartTest.log.info("stopping bridge manually");
+ bridge.stop();
- bridge.stop();
+ for (int i = numMessages; i < numMessages * 2; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = numMessages; i < numMessages * 2; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ bridge.start();
- bridge.start();
+ BridgeStartTest.log.info("started bridge");
- BridgeStartTest.log.info("started bridge");
+ // The previous messages will get resent, but with duplicate detection they will be rejected
+ // at the target
- // The previous messages will get resent, but with duplicate detection they will be rejected
- // at the target
+ for (int i = numMessages; i < numMessages * 2; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = numMessages; i < numMessages * 2; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ bridge.stop();
- bridge.stop();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = session0.createMessage(false);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = session0.createMessage(false);
+ message.putIntProperty(propKey, i);
- message.putIntProperty(propKey, i);
+ producer0.send(message);
+ }
- producer0.send(message);
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ bridge.start();
- bridge.start();
+ for (int i = 0; i < numMessages; i++)
+ {
+ ClientMessage message = consumer1.receive(1000);
- for (int i = 0; i < numMessages; i++)
- {
- ClientMessage message = consumer1.receive(1000);
+ Assert.assertNotNull(message);
- Assert.assertNotNull(message);
+ Assert.assertEquals(i, message.getObjectProperty(propKey));
- Assert.assertEquals(i, message.getObjectProperty(propKey));
+ message.acknowledge();
+ }
- message.acknowledge();
- }
+ Assert.assertNull(consumer1.receiveImmediate());
- Assert.assertNull(consumer1.receiveImmediate());
+ session1.close();
- session1.close();
+ sf1.close();
- sf1.close();
+ session0.close();
- session0.close();
+ sf0.close();
- sf0.close();
+ locator.close();
+ }
+ finally
+ {
+ server0.stop();
- server0.stop();
+ server1.stop();
+ }
- server1.stop();
}
@Override
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -214,6 +214,8 @@
sf1.close();
+ locator.close();
+
}
finally
{
@@ -428,6 +430,8 @@
sf0.close();
sf1.close();
+
+ locator.close();
}
finally
@@ -577,6 +581,8 @@
sf1.close();
+ locator.close();
+
server0.stop();
server1.stop();
@@ -699,6 +705,8 @@
sf1.close();
+ locator.close();
+
}
finally
{
@@ -841,6 +849,8 @@
sf1.close();
+ locator.close();
+
}
finally
{
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:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -115,6 +115,18 @@
consumers = new ConsumerHolder[ClusterTestBase.MAX_CONSUMERS];
+ for (ServerLocator locator : locators)
+ {
+ try
+ {
+ locator.close();
+ }
+ catch (Exception e)
+ {
+ //
+ }
+ }
+
nodeManagers = null;
super.tearDown();
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -1052,16 +1052,6 @@
@Override
protected void tearDown() throws Exception
{
- if(locators != null)
- {
- for (ServerLocator locator : locators)
- {
- if(locator != null)
- {
- System.out.println("ClusteredGroupingTest.tearDown");
- }
- }
- }
super.tearDown(); //To change body of overridden methods use File | Settings | File Templates.
}
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -362,7 +362,7 @@
protected ServerLocatorInternal getServerLocator() throws Exception
{
- ServerLocator locator = HornetQClient.createServerLocatorWithHA(getConnectorTransportConfiguration(true));// , getConnectorTransportConfiguration(false));
+ ServerLocator locator = HornetQClient.createServerLocatorWithHA(getConnectorTransportConfiguration(true), getConnectorTransportConfiguration(false));
return (ServerLocatorInternal) locator;
}
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverSharedServerTest.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -19,6 +19,7 @@
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.core.server.impl.InVMNodeManager;
import org.hornetq.tests.util.ServiceTestBase;
/**
@@ -71,7 +72,11 @@
if (fileStorage)
{
- server = HornetQServers.newHornetQServer(configuration);
+ if(nodeManagers[backupNode] == null)
+ {
+ nodeManagers[backupNode] = new InVMNodeManager();
+ }
+ server = createInVMFailoverServer(true, configuration, nodeManagers[backupNode]);
}
else
{
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/integration/cluster/failover/GroupingFailoverTestBase.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -80,22 +80,8 @@
closeSessionFactory(0);
- final CountDownLatch latch = new CountDownLatch(1);
-
- class MyListener implements FailureListener
- {
- public void connectionFailed(final HornetQException me, boolean failedOver)
- {
- latch.countDown();
- }
- }
-
- Map<String, MessageFlowRecord> records = ((ClusterConnectionImpl)getServer(1).getClusterManager()
- .getClusterConnection(new SimpleString("cluster1"))).getRecords();
- RemotingConnection rc = records.get("0").getBridge().getForwardingConnection();
- rc.addFailureListener(new MyListener());
- fail(rc, latch);
-
+ servers[0].kill();
+
waitForServerRestart(2);
setupSessionFactory(2, isNetty());
Modified: branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-11-20 18:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -36,6 +36,7 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.core.remoting.impl.invm.InVMRegistry;
import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.server.HornetQServer;
@@ -99,6 +100,13 @@
}
}
super.tearDown(); //To change body of overridden methods use File | Settings | File Templates.
+ checkFreePort(5445);
+ checkFreePort(5446);
+ checkFreePort(5447);
+ if(InVMRegistry.instance.size() > 0)
+ {
+ System.exit(0);
+ }
}
protected static Map<String, Object> generateParams(final int node, final boolean netty)
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:29:51 UTC (rev 9917)
+++ branches/2_2_0_HA_Improvements_preMerge/tests/src/org/hornetq/tests/util/UnitTestCase.java 2010-11-22 10:53:44 UTC (rev 9918)
@@ -434,7 +434,8 @@
}
catch (Exception e)
{
- Assert.fail("port " + port + " is already bound");
+ System.out.println("port " + port + " is already bound");
+ System.exit(0);
}
finally
{
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9917 - in branches/2_2_0_HA_Improvements_preMerge: src/config/common/schema and 26 other directories.
by do-not-reply@jboss.org
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/…
[View More]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)
[View Less]
14 years, 1 month
JBoss hornetq SVN: r9916 - in branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src: main/java/org/hornetq/rest/queue and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-11-20 13:23:29 -0500 (Sat, 20 Nov 2010)
New Revision: 9916
Modified:
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java
…
[View More] branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java
branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java
Log:
fixing rest compilation
Modified: branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java 2010-11-19 07:29:42 UTC (rev 9915)
+++ branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/MessageServiceManager.java 2010-11-20 18:23:29 UTC (rev 9916)
@@ -2,7 +2,9 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.registry.JndiBindingRegistry;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
@@ -140,14 +142,21 @@
HashMap<String, Object> transportConfig = new HashMap<String, Object>();
transportConfig.put(TransportConstants.SERVER_ID_PROP_NAME, configuration.getInVmId());
- ClientSessionFactory consumerSessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+
+
+ ServerLocator consumerLocator = new ServerLocatorImpl(false, new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+
if (configuration.getConsumerWindowSize() != -1)
{
- consumerSessionFactory.setConsumerWindowSize(configuration.getConsumerWindowSize());
+ consumerLocator.setConsumerWindowSize(configuration.getConsumerWindowSize());
}
- ClientSessionFactory sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ ClientSessionFactory consumerSessionFactory = consumerLocator.createSessionFactory();
+
+ ServerLocator defaultLocator = new ServerLocatorImpl(false, new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ ClientSessionFactory sessionFactory = defaultLocator.createSessionFactory();
+
LinkStrategy linkStrategy = new LinkHeaderLinkStrategy();
if (configuration.isUseLinkHeaders())
{
@@ -158,8 +167,10 @@
linkStrategy = new CustomHeaderLinkStrategy();
}
+ queueManager.setServerLocator(defaultLocator);
queueManager.setSessionFactory(sessionFactory);
queueManager.setTimeoutTask(timeoutTask);
+ queueManager.setConsumerServerLocator(consumerLocator);
queueManager.setConsumerSessionFactory(consumerSessionFactory);
queueManager.setDefaultSettings(defaultSettings);
queueManager.setPushStoreFile(configuration.getQueuePushStoreDirectory());
@@ -167,8 +178,10 @@
queueManager.setLinkStrategy(linkStrategy);
queueManager.setRegistry(registry);
+ queueManager.setServerLocator(defaultLocator);
topicManager.setSessionFactory(sessionFactory);
topicManager.setTimeoutTask(timeoutTask);
+ topicManager.setConsumerServerLocator(consumerLocator);
topicManager.setConsumerSessionFactory(consumerSessionFactory);
topicManager.setDefaultSettings(defaultSettings);
topicManager.setPushStoreFile(configuration.getTopicPushStoreDirectory());
Modified: branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java 2010-11-19 07:29:42 UTC (rev 9915)
+++ branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/main/java/org/hornetq/rest/queue/DestinationServiceManager.java 2010-11-20 18:23:29 UTC (rev 9916)
@@ -4,7 +4,6 @@
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.rest.util.LinkStrategy;
import org.hornetq.rest.util.TimeoutTask;
@@ -18,6 +17,7 @@
{
protected ServerLocator locator;
protected ClientSessionFactory sessionFactory;
+ protected ServerLocator consumerServerLocator;
protected ClientSessionFactory consumerSessionFactory;
protected boolean started;
protected String pushStoreFile;
@@ -67,8 +67,22 @@
{
this.consumerSessionFactory = consumerSessionFactory;
}
-
- public TimeoutTask getTimeoutTask()
+
+ /**
+ * @return the consumerServerLocator
+ */
+ public ServerLocator getConsumerServerLocator() {
+ return consumerServerLocator;
+ }
+
+ /**
+ * @param consumerServerLocator the consumerServerLocator to set
+ */
+ public void setConsumerServerLocator(ServerLocator consumerServerLocator) {
+ this.consumerServerLocator = consumerServerLocator;
+ }
+
+ public TimeoutTask getTimeoutTask()
{
return timeoutTask;
}
@@ -87,6 +101,16 @@
{
this.defaultSettings = defaultSettings;
}
+
+ public ServerLocator getServerLocator()
+ {
+ return this.locator;
+ }
+
+ public void setServerLocator(ServerLocator locator)
+ {
+ this.locator = locator;
+ }
public ClientSessionFactory getSessionFactory()
{
Modified: branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java 2010-11-19 07:29:42 UTC (rev 9915)
+++ branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/JMSTest.java 2010-11-20 18:23:29 UTC (rev 9916)
@@ -40,7 +40,7 @@
@BeforeClass
public static void setup() throws Exception
{
- connectionFactory = new HornetQJMSConnectionFactory(manager.getQueueManager().getSessionFactory());
+ connectionFactory = new HornetQJMSConnectionFactory(manager.getQueueManager().getServerLocator());
}
@XmlRootElement
Modified: branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java 2010-11-19 07:29:42 UTC (rev 9915)
+++ branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawAckTest.java 2010-11-20 18:23:29 UTC (rev 9916)
@@ -1,5 +1,7 @@
package org.hornetq.rest.test;
+import java.util.HashMap;
+
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.ClientConsumer;
@@ -7,7 +9,8 @@
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.api.core.client.ServerLocator;
+import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -19,8 +22,6 @@
import org.junit.BeforeClass;
import org.junit.Test;
-import java.util.HashMap;
-
/**
* Play with HornetQ
*
@@ -30,6 +31,7 @@
public class RawAckTest
{
protected static HornetQServer hornetqServer;
+ static ServerLocator serverLocator;
static ClientSessionFactory sessionFactory;
static ClientSessionFactory consumerSessionFactory;
static ClientProducer producer;
@@ -47,8 +49,10 @@
hornetqServer.start();
HashMap<String, Object> transportConfig = new HashMap<String, Object>();
- sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
- consumerSessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+
+ serverLocator = new ServerLocatorImpl(false, new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ sessionFactory = serverLocator.createSessionFactory();
+ consumerSessionFactory = serverLocator.createSessionFactory();
hornetqServer.createQueue(new SimpleString("testQueue"), new SimpleString("testQueue"), null, false, false);
session = sessionFactory.createSession(true, true);
@@ -59,6 +63,7 @@
@AfterClass
public static void shutdown() throws Exception
{
+ serverLocator.close();
hornetqServer.stop();
}
Modified: branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java 2010-11-19 07:29:42 UTC (rev 9915)
+++ branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/RawRestartTest.java 2010-11-20 18:23:29 UTC (rev 9916)
@@ -8,7 +8,9 @@
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
import org.hornetq.api.core.client.MessageHandler;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.client.impl.ServerLocatorImpl;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -32,6 +34,7 @@
public class RawRestartTest
{
protected static HornetQServer hornetqServer;
+ static ServerLocator serverLocator;
static ClientSessionFactory sessionFactory;
static ClientSessionFactory consumerSessionFactory;
static ClientProducer producer;
@@ -51,11 +54,12 @@
session.start();
}
- private static void createFactories()
+ private static void createFactories() throws Exception
{
HashMap<String, Object> transportConfig = new HashMap<String, Object>();
- sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
- consumerSessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ serverLocator = new ServerLocatorImpl(false, new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig));
+ sessionFactory = serverLocator.createSessionFactory();
+ consumerSessionFactory = serverLocator.createSessionFactory();
}
private static void startupTheServer()
Modified: branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java
===================================================================
--- branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java 2010-11-19 07:29:42 UTC (rev 9915)
+++ branches/2_2_0_HA_Improvements_preMerge/hornetq-rest/hornetq-rest/src/test/java/org/hornetq/rest/test/SelectorTest.java 2010-11-20 18:23:29 UTC (rev 9916)
@@ -39,7 +39,7 @@
@BeforeClass
public static void setup() throws Exception
{
- connectionFactory = new HornetQJMSConnectionFactory(manager.getQueueManager().getSessionFactory());
+ connectionFactory = new HornetQJMSConnectionFactory(manager.getQueueManager().getServerLocator());
System.out.println("Queue name: " + topicName);
TopicDeployment deployment = new TopicDeployment();
deployment.setDuplicatesAllowed(true);
[View Less]
14 years, 1 month