JBoss hornetq SVN: r11440 - in branches/Branch_2_2_EAP/tests/src/org/hornetq/tests: integration/cluster/distribution and 5 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic
Date: 2011-09-28 12:32:50 -0400 (Wed, 28 Sep 2011)
New Revision: 11440
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JmsNettyNioStressTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
no semantic change on this commit, just format and other tweaks on test base classes
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JmsNettyNioStressTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JmsNettyNioStressTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/JmsNettyNioStressTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -39,7 +39,6 @@
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.client.HornetQDestination;
import org.hornetq.tests.util.ServiceTestBase;
-import org.hornetq.tests.util.UnitTestCase;
/**
* -- https://issues.jboss.org/browse/HORNETQ-746
@@ -91,7 +90,7 @@
// minimize threads to maximize possibility for deadlock
params.put(TransportConstants.NIO_REMOTING_THREADS_PROPNAME, 1);
params.put(TransportConstants.BATCH_DELAY, 50);
- Configuration config = UnitTestCase.createDefaultConfig(params, ServiceTestBase.NETTY_ACCEPTOR_FACTORY);
+ Configuration config = createDefaultConfig(params, ServiceTestBase.NETTY_ACCEPTOR_FACTORY);
HornetQServer server = createServer(true, config);
server.getConfiguration().setThreadPoolMaxSize(2);
server.start();
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -36,9 +36,9 @@
{
private static final Logger log = Logger.getLogger(SymmetricClusterWithDiscoveryTest.class);
- protected static final String groupAddress = getUDPDiscoveryAddress();
+ protected final String groupAddress = getUDPDiscoveryAddress();
- protected static final int groupPort = getUDPDiscoveryPort();
+ protected final int groupPort = getUDPDiscoveryPort();
protected boolean isNetty()
{
@@ -83,8 +83,8 @@
protected void setServer(final boolean forwardWhenNoConsumers, int server)
{
setupLiveServerWithDiscovery(server,
- SymmetricClusterWithDiscoveryTest.groupAddress,
- SymmetricClusterWithDiscoveryTest.groupPort,
+ groupAddress,
+ groupPort,
isFileStorage(),
isNetty(),
false);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -28,9 +28,9 @@
{
private static final Logger log = Logger.getLogger(SymmetricClusterWithDiscoveryTest.class);
- protected static final String groupAddress = getUDPDiscoveryAddress();
+ protected final String groupAddress = getUDPDiscoveryAddress();
- protected static final int groupPort = getUDPDiscoveryPort();
+ protected final int groupPort = getUDPDiscoveryPort();
protected boolean isNetty()
{
@@ -61,32 +61,32 @@
protected void setupServers() throws Exception
{
setupLiveServerWithDiscovery(0,
- SymmetricClusterWithDiscoveryTest.groupAddress,
- SymmetricClusterWithDiscoveryTest.groupPort,
+ groupAddress,
+ groupPort,
isFileStorage(),
isNetty(),
false);
setupLiveServerWithDiscovery(1,
- SymmetricClusterWithDiscoveryTest.groupAddress,
- SymmetricClusterWithDiscoveryTest.groupPort,
+ groupAddress,
+ groupPort,
isFileStorage(),
isNetty(),
false);
setupLiveServerWithDiscovery(2,
- SymmetricClusterWithDiscoveryTest.groupAddress,
- SymmetricClusterWithDiscoveryTest.groupPort,
+ groupAddress,
+ groupPort,
isFileStorage(),
isNetty(),
false);
setupLiveServerWithDiscovery(3,
- SymmetricClusterWithDiscoveryTest.groupAddress,
- SymmetricClusterWithDiscoveryTest.groupPort,
+ groupAddress,
+ groupPort,
isFileStorage(),
isNetty(),
false);
setupLiveServerWithDiscovery(4,
- SymmetricClusterWithDiscoveryTest.groupAddress,
- SymmetricClusterWithDiscoveryTest.groupPort,
+ groupAddress,
+ groupPort,
isFileStorage(),
isNetty(),
false);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -35,9 +35,9 @@
{
private static final Logger log = Logger.getLogger(DiscoveryClusterWithBackupFailoverTest.class);
- protected static final String groupAddress = getUDPDiscoveryAddress();
+ protected final String groupAddress = getUDPDiscoveryAddress();
- protected static final int groupPort = getUDPDiscoveryPort();
+ protected final int groupPort = getUDPDiscoveryPort();
@Override
protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
@@ -63,44 +63,14 @@
protected void setupServers() throws Exception
{
// The lives
- setupLiveServerWithDiscovery(0,
- DiscoveryClusterWithBackupFailoverTest.groupAddress,
- DiscoveryClusterWithBackupFailoverTest.groupPort,
- isFileStorage(),
- isNetty(),
- true);
- setupLiveServerWithDiscovery(1,
- DiscoveryClusterWithBackupFailoverTest.groupAddress,
- DiscoveryClusterWithBackupFailoverTest.groupPort,
- isFileStorage(),
- isNetty(),
- true);
- setupLiveServerWithDiscovery(2,
- DiscoveryClusterWithBackupFailoverTest.groupAddress,
- DiscoveryClusterWithBackupFailoverTest.groupPort,
- isFileStorage(),
- isNetty(),
- true);
+ setupLiveServerWithDiscovery(0, groupAddress, groupPort, isFileStorage(), isNetty(), true);
+ setupLiveServerWithDiscovery(1, groupAddress, groupPort, isFileStorage(), isNetty(), true);
+ setupLiveServerWithDiscovery(2, groupAddress, groupPort, isFileStorage(), isNetty(), true);
// The backups
- setupBackupServerWithDiscovery(3,0,
- DiscoveryClusterWithBackupFailoverTest.groupAddress,
- DiscoveryClusterWithBackupFailoverTest.groupPort,
- isFileStorage(),
- isNetty(),
- true);
- setupBackupServerWithDiscovery(4,1,
- DiscoveryClusterWithBackupFailoverTest.groupAddress,
- DiscoveryClusterWithBackupFailoverTest.groupPort,
- isFileStorage(),
- isNetty(),
- true);
- setupBackupServerWithDiscovery(5,2,
- DiscoveryClusterWithBackupFailoverTest.groupAddress,
- DiscoveryClusterWithBackupFailoverTest.groupPort,
- isFileStorage(),
- isNetty(),
- true);
+ setupBackupServerWithDiscovery(3, 0, groupAddress, groupPort, isFileStorage(), isNetty(), true);
+ setupBackupServerWithDiscovery(4, 1, groupAddress, groupPort, isFileStorage(), isNetty(), true);
+ setupBackupServerWithDiscovery(5, 2, groupAddress, groupPort, isFileStorage(), isNetty(), true);
}
}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteFailoverTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -43,7 +43,7 @@
// Static --------------------------------------------------------
- public static class SharedLiveServerConfiguration extends RemoteServerConfiguration
+ public class SharedLiveServerConfiguration extends RemoteServerConfiguration
{
@Override
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteMultipleLivesMultipleBackupsFailoverTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -41,8 +41,9 @@
// Attributes ----------------------------------------------------
private static Map<Integer, String> lives = new HashMap<Integer, String>();
+
private static Map<Integer, String> backups = new HashMap<Integer, String>();
-
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -66,20 +67,17 @@
backups.put(4, SharedBackupServerConfiguration4.class.getName());
backups.put(5, SharedBackupServerConfiguration5.class.getName());
}
-
+
protected boolean isNetty()
{
return true;
}
-
protected void createLiveConfig(int liveNode, int... otherLiveNodes)
{
servers.put(liveNode, new RemoteProcessHornetQServer(lives.get(liveNode)));
}
-
-
-
+
protected void createBackupConfig(int liveNode,
int nodeid,
boolean createClusterConnections,
@@ -88,12 +86,12 @@
{
servers.put(nodeid, new RemoteProcessHornetQServer(backups.get(nodeid)));
}
-
+
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
-
- public static class LiveServerConfiguration0 extends RemoteServerConfiguration
+
+ public class LiveServerConfiguration0 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -102,7 +100,7 @@
}
}
- public static class LiveServerConfiguration3 extends RemoteServerConfiguration
+ public class LiveServerConfiguration3 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -110,44 +108,48 @@
return createLiveConfiguration(3, 0, 1, 2);
}
}
-
- public static class SharedBackupServerConfiguration1 extends RemoteServerConfiguration
+
+ public class SharedBackupServerConfiguration1 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
{
- return createBackupConfiguration(0, 1, true, new int[] {0, 2}, 3, 4, 5);
+ return createBackupConfiguration(0, 1, true, new int[] { 0, 2 }, 3, 4, 5);
}
}
- public static class SharedBackupServerConfiguration2 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration2 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
{
- return createBackupConfiguration(0, 2, true, new int[] {0, 1}, 3, 4, 5);
+ return createBackupConfiguration(0, 2, true, new int[] { 0, 1 }, 3, 4, 5);
}
}
- public static class SharedBackupServerConfiguration4 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration4 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
{
- return createBackupConfiguration(3, 4, true, new int[] {3, 5}, 0, 1, 2);
+ return createBackupConfiguration(3, 4, true, new int[] { 3, 5 }, 0, 1, 2);
}
}
- public static class SharedBackupServerConfiguration5 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration5 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
{
- return createBackupConfiguration(3, 5, true, new int[] {3, 4}, 0, 1, 2);
+ return createBackupConfiguration(3, 5, true, new int[] { 3, 4 }, 0, 1, 2);
}
}
- protected static Configuration createBackupConfiguration(int liveNode, int nodeid, boolean createClusterConnections, int[] otherBackupNodes, int... otherClusterNodes)
+ protected Configuration createBackupConfiguration(int liveNode,
+ int nodeid,
+ boolean createClusterConnections,
+ int[] otherBackupNodes,
+ int... otherClusterNodes)
{
Configuration config1 = createBasicConfig();
config1.getAcceptorConfigurations().add(createTransportConfiguration(true, true, generateParams(nodeid, true)));
@@ -174,11 +176,18 @@
config1.getConnectorConfigurations().put(connector.getName(), connector);
clusterNodes.add(connector.getName());
}
- ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1", "jms", backupConnector.getName(), -1, false, false, 1, 1, clusterNodes, false);
+ ClusterConnectionConfiguration ccc1 = new ClusterConnectionConfiguration("cluster1",
+ "jms",
+ backupConnector.getName(),
+ -1,
+ false,
+ false,
+ 1,
+ 1,
+ clusterNodes,
+ false);
config1.getClusterConfigurations().add(ccc1);
-
-
config1.setBindingsDirectory(config1.getBindingsDirectory() + "_" + liveNode);
config1.setJournalDirectory(config1.getJournalDirectory() + "_" + liveNode);
config1.setPagingDirectory(config1.getPagingDirectory() + "_" + liveNode);
@@ -187,7 +196,7 @@
return config1;
}
- protected static Configuration createLiveConfiguration(int liveNode, int... otherLiveNodes)
+ protected Configuration createLiveConfiguration(int liveNode, int... otherLiveNodes)
{
Configuration config0 = createBasicConfig();
TransportConfiguration liveConnector = createTransportConfiguration(true, false, generateParams(liveNode, true));
@@ -200,13 +209,23 @@
List<String> pairs = new ArrayList<String>();
for (int node : otherLiveNodes)
{
- TransportConfiguration otherLiveConnector = createTransportConfiguration(true, false, generateParams(node, true));
+ TransportConfiguration otherLiveConnector = createTransportConfiguration(true,
+ false,
+ generateParams(node, true));
config0.getConnectorConfigurations().put(otherLiveConnector.getName(), otherLiveConnector);
- pairs.add(otherLiveConnector.getName());
+ pairs.add(otherLiveConnector.getName());
}
- ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1", "jms", liveConnector.getName(), -1, false, false, 1, 1,
- pairs, false);
+ ClusterConnectionConfiguration ccc0 = new ClusterConnectionConfiguration("cluster1",
+ "jms",
+ liveConnector.getName(),
+ -1,
+ false,
+ false,
+ 1,
+ 1,
+ pairs,
+ false);
config0.getClusterConfigurations().add(ccc0);
config0.getConnectorConfigurations().put(liveConnector.getName(), liveConnector);
@@ -214,7 +233,7 @@
config0.setJournalDirectory(config0.getJournalDirectory() + "_" + liveNode);
config0.setPagingDirectory(config0.getPagingDirectory() + "_" + liveNode);
config0.setLargeMessagesDirectory(config0.getLargeMessagesDirectory() + "_" + liveNode);
-
+
return config0;
}
}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/RemoteSingleLiveMultipleBackupsFailoverTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -157,7 +157,7 @@
// Inner classes -------------------------------------------------
- public static class SharedLiveServerConfiguration extends RemoteServerConfiguration
+ public class SharedLiveServerConfiguration extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -209,7 +209,7 @@
}
}
- public static class SharedBackupServerConfiguration0 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration0 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -218,7 +218,7 @@
}
}
- public static class SharedBackupServerConfiguration1 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration1 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -227,7 +227,7 @@
}
}
- public static class SharedBackupServerConfiguration2 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration2 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -236,7 +236,7 @@
}
}
- public static class SharedBackupServerConfiguration3 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration3 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -245,7 +245,7 @@
}
}
- public static class SharedBackupServerConfiguration4 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration4 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -254,7 +254,7 @@
}
}
- public static class SharedBackupServerConfiguration5 extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration5 extends RemoteServerConfiguration
{
@Override
public Configuration getConfiguration()
@@ -263,10 +263,10 @@
}
}
- protected static Configuration createBackupConfiguration(int liveNode,
- int nodeid,
- boolean createClusterConnections,
- int... nodes)
+ protected Configuration createBackupConfiguration(int liveNode,
+ int nodeid,
+ boolean createClusterConnections,
+ int... nodes)
{
Configuration config1 = createBasicConfig();
config1.getAcceptorConfigurations().add(createTransportConfiguration(true, true, generateParams(nodeid, true)));
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/failover/remote/FailoverWithSharedStoreTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -54,7 +54,7 @@
// Public --------------------------------------------------------
- public static class SharedLiveServerConfiguration extends RemoteServerConfiguration
+ public class SharedLiveServerConfiguration extends RemoteServerConfiguration
{
@Override
@@ -82,7 +82,7 @@
}
- public static class SharedBackupServerConfiguration extends RemoteServerConfiguration
+ public class SharedBackupServerConfiguration extends RemoteServerConfiguration
{
@Override
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -25,9 +25,9 @@
{
private static final Logger log = Logger.getLogger(HAClientTopologyWithDiscoveryTest.class);
- protected static final String groupAddress = getUDPDiscoveryAddress();
+ protected final String groupAddress = getUDPDiscoveryAddress();
- protected static final int groupPort = getUDPDiscoveryPort();
+ protected final int groupPort = getUDPDiscoveryPort();
protected boolean isNetty()
{
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -144,7 +144,7 @@
// Server1 with two acceptors, each acceptor on a different cluster connection
// talking to a different connector.
// i.e. two cluster connections isolated on the same node
- Configuration config1 = UnitTestCase.createBasicConfig(0);
+ Configuration config1 = createBasicConfig(0);
config1.setClustered(true);
@@ -212,7 +212,7 @@
// Server1 with two acceptors, each acceptor on a different cluster connection
// talking to a different connector.
// i.e. two cluster connections isolated on the same node
- Configuration config1 = UnitTestCase.createBasicConfig(3);
+ Configuration config1 = createBasicConfig(3);
config1.setClustered(true);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -57,16 +57,15 @@
{
private static final Logger log = Logger.getLogger(DiscoveryTest.class);
- private static final String address1 = getUDPDiscoveryAddress();
+ private final String address1 = getUDPDiscoveryAddress();
- private static final String address2 = getUDPDiscoveryAddress(1);
+ private final String address2 = getUDPDiscoveryAddress(1);
- private static final String address3 = getUDPDiscoveryAddress(2);
+ private final String address3 = getUDPDiscoveryAddress(2);
-
public void testSimpleBroadcast() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -109,53 +108,54 @@
dg.stop();
}
-
+
public void testSimpleBroadcastSpecificNIC() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
final String nodeID = RandomUtil.randomString();
-
- //We need to choose a real NIC on the local machine - note this will silently pass if the machine
- //has no usable NIC!
-
+
+ // We need to choose a real NIC on the local machine - note this will silently pass if the machine
+ // has no usable NIC!
+
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
-
+
InetAddress localAddress = null;
-
+
outer: while (networkInterfaces.hasMoreElements())
{
NetworkInterface networkInterface = networkInterfaces.nextElement();
- if (networkInterface.isLoopback() || networkInterface.isVirtual() || !networkInterface.isUp() ||
- !networkInterface.supportsMulticast())
+ if (networkInterface.isLoopback() || networkInterface.isVirtual() ||
+ !networkInterface.isUp() ||
+ !networkInterface.supportsMulticast())
{
continue;
}
-
+
Enumeration<InetAddress> en = networkInterface.getInetAddresses();
-
+
while (en.hasMoreElements())
{
InetAddress ia = en.nextElement();
-
+
if (ia.getAddress().length == 4)
{
localAddress = ia;
-
+
break outer;
}
}
}
-
+
if (localAddress == null)
{
log.warn("Can't find address to use");
-
+
return;
}
-
+
log.info("Local address is " + localAddress);
BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
@@ -198,7 +198,7 @@
public void testSimpleBroadcastWithStopStartDiscoveryGroup() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -216,7 +216,6 @@
TransportConfiguration live1 = generateTC();
-
bg.addConnector(live1);
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
@@ -253,15 +252,15 @@
entries = dg.getDiscoveryEntries();
assertEqualsDiscoveryEntries(Arrays.asList(live1), entries);
-
+
dg.stop();
-
+
bg.stop();
}
public void testIgnoreTrafficFromOwnNode() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -279,10 +278,14 @@
TransportConfiguration live1 = generateTC();
-
bg.addConnector(live1);
- DiscoveryGroup dg = new DiscoveryGroupImpl(nodeID, RandomUtil.randomString(), null, groupAddress, groupPort, timeout);
+ DiscoveryGroup dg = new DiscoveryGroupImpl(nodeID,
+ RandomUtil.randomString(),
+ null,
+ groupAddress,
+ groupPort,
+ timeout);
dg.start();
@@ -390,7 +393,7 @@
public void testSimpleBroadcastDifferentAddressAndPort() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -408,7 +411,7 @@
bg.addConnector(live1);
- final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
+ final InetAddress groupAddress2 = InetAddress.getByName(address2);
final int port2 = getUDPDiscoveryPort(1);
DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
@@ -436,14 +439,14 @@
final int groupPort1 = getUDPDiscoveryPort();
final int groupPort2 = getUDPDiscoveryPort(1);
-
+
final int groupPort3 = getUDPDiscoveryPort(2);
- final InetAddress groupAddress1 = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress1 = InetAddress.getByName(address1);
- final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
+ final InetAddress groupAddress2 = InetAddress.getByName(address2);
- final InetAddress groupAddress3 = InetAddress.getByName(DiscoveryTest.address3);
+ final InetAddress groupAddress3 = InetAddress.getByName(address3);
final int timeout = 5000;
@@ -544,53 +547,53 @@
dg3.stop();
}
-// -- fix this test
-// public void testBroadcastNullBackup() throws Exception
-// {
-// final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-// final int groupPort = getUDPDiscoveryPort();
-// final int timeout = 500;
-//
-// String nodeID = RandomUtil.randomString();
-//
-// BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
-// RandomUtil.randomString(),
-// null,
-// -1,
-// groupAddress,
-// groupPort,
-// true);
-//
-// bg.start();
-//
-// TransportConfiguration live1 = generateTC();
-//
-// Pair<TransportConfiguration, TransportConfiguration> connectorPair = new Pair<TransportConfiguration, TransportConfiguration>(live1,
-// null);
-//
-// bg.addConnectorPair(connectorPair);
-//
-// DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
-// RandomUtil.randomString(),
-// null,
-// groupAddress,
-// groupPort,
-// timeout,
-// Executors.newFixedThreadPool(1));
-//
-// dg.start();
-//
-// bg.broadcastConnectors();
-//
-// boolean ok = dg.waitForBroadcast(1000);
-//
-// Assert.assertTrue(ok);
-// }
+ // -- fix this test
+ // public void testBroadcastNullBackup() throws Exception
+ // {
+ // final InetAddress groupAddress = InetAddress.getByName(address1);
+ // final int groupPort = getUDPDiscoveryPort();
+ // final int timeout = 500;
+ //
+ // String nodeID = RandomUtil.randomString();
+ //
+ // BroadcastGroup bg = new BroadcastGroupImpl(nodeID,
+ // RandomUtil.randomString(),
+ // null,
+ // -1,
+ // groupAddress,
+ // groupPort,
+ // true);
+ //
+ // bg.start();
+ //
+ // TransportConfiguration live1 = generateTC();
+ //
+ // Pair<TransportConfiguration, TransportConfiguration> connectorPair = new Pair<TransportConfiguration,
+ // TransportConfiguration>(live1,
+ // null);
+ //
+ // bg.addConnectorPair(connectorPair);
+ //
+ // DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
+ // RandomUtil.randomString(),
+ // null,
+ // groupAddress,
+ // groupPort,
+ // timeout,
+ // Executors.newFixedThreadPool(1));
+ //
+ // dg.start();
+ //
+ // bg.broadcastConnectors();
+ //
+ // boolean ok = dg.waitForBroadcast(1000);
+ //
+ // Assert.assertTrue(ok);
+ // }
-
public void testDiscoveryListenersCalled() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -655,7 +658,7 @@
public void testConnectorsUpdatedMultipleBroadcasters() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -845,7 +848,7 @@
public void testMultipleDiscoveryGroups() throws Exception
{
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -920,7 +923,7 @@
SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
notifService.addNotificationListener(notifListener);
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
final int timeout = 500;
@@ -959,7 +962,7 @@
SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
notifService.addNotificationListener(notifListener);
- final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
+ final InetAddress groupAddress = InetAddress.getByName(address1);
final int groupPort = getUDPDiscoveryPort();
BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
@@ -1004,7 +1007,6 @@
return tc;
}
-
private TransportConfiguration generateTC()
{
return generateTC("");
@@ -1019,12 +1021,11 @@
called = true;
}
}
-
-
+
private static void assertEqualsDiscoveryEntries(List<TransportConfiguration> expected, List<DiscoveryEntry> actual)
{
assertNotNull(actual);
-
+
List<TransportConfiguration> sortedExpected = new ArrayList<TransportConfiguration>(expected);
Collections.sort(sortedExpected, new Comparator<TransportConfiguration>()
{
@@ -1042,14 +1043,14 @@
return o2.getConnector().toString().compareTo(o1.getConnector().toString());
}
});
- if(sortedExpected.size() != sortedActual.size())
+ if (sortedExpected.size() != sortedActual.size())
{
dump(sortedExpected, sortedActual);
}
assertEquals(sortedExpected.size(), sortedActual.size());
for (int i = 0; i < sortedExpected.size(); i++)
{
- if(!sortedExpected.get(i).equals(sortedActual.get(i).getConnector()))
+ if (!sortedExpected.get(i).equals(sortedActual.get(i).getConnector()))
{
dump(sortedExpected, sortedActual);
}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-09-28 05:10:08 UTC (rev 11439)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-09-28 16:32:50 UTC (rev 11440)
@@ -135,7 +135,7 @@
}
}
- protected static Configuration createClusteredDefaultConfig(final int index,
+ protected Configuration createClusteredDefaultConfig(final int index,
final Map<String, Object> params,
final String... acceptors)
{
@@ -146,9 +146,9 @@
return config;
}
- protected static Configuration createDefaultConfig(final int index,
- final Map<String, Object> params,
- final String... acceptors)
+ protected Configuration createDefaultConfig(final int index,
+ final Map<String, Object> params,
+ final String... acceptors)
{
Configuration configuration = createBasicConfig(index);
@@ -163,7 +163,7 @@
return configuration;
}
- protected static ConfigurationImpl createBasicConfig()
+ protected ConfigurationImpl createBasicConfig()
{
return createBasicConfig(0);
}
@@ -172,7 +172,7 @@
* @param serverID
* @return
*/
- protected static ConfigurationImpl createBasicConfig(final int serverID)
+ protected ConfigurationImpl createBasicConfig(final int serverID)
{
ConfigurationImpl configuration = new ConfigurationImpl();
configuration.setSecurityEnabled(false);
@@ -188,7 +188,7 @@
return configuration;
}
- protected static Configuration createDefaultConfig(final Map<String, Object> params, final String... acceptors)
+ protected Configuration createDefaultConfig(final Map<String, Object> params, final String... acceptors)
{
Configuration configuration = new ConfigurationImpl();
configuration.setSecurityEnabled(false);
@@ -217,12 +217,12 @@
return configuration;
}
- protected static String getUDPDiscoveryAddress()
+ protected String getUDPDiscoveryAddress()
{
return System.getProperty("TEST-UDP-ADDRESS", "230.1.2.3");
}
- protected static String getUDPDiscoveryAddress(int variant)
+ protected String getUDPDiscoveryAddress(int variant)
{
String value = getUDPDiscoveryAddress();
@@ -233,12 +233,12 @@
return value.substring(0, posPoint + 1) + (last + variant);
}
- public static int getUDPDiscoveryPort()
+ public int getUDPDiscoveryPort()
{
return Integer.parseInt(System.getProperty("TEST-UDP-PORT", "6750"));
}
- public static int getUDPDiscoveryPort(final int variant)
+ public int getUDPDiscoveryPort(final int variant)
{
return getUDPDiscoveryPort() + variant;
}
@@ -376,7 +376,7 @@
return str.toString();
}
-
+
/** Sends the message to both logger and System.out (for unit report) */
public void logAndSystemOut(String message, Exception e)
{
@@ -627,19 +627,19 @@
/**
* @return the journalDir
*/
- public static String getJournalDir()
+ public String getJournalDir()
{
- return getJournalDir(testDir);
+ return getJournalDir(getTestDir());
}
- protected static String getJournalDir(final String testDir)
+ protected String getJournalDir(final String testDir)
{
return testDir + "/journal";
}
- protected static String getJournalDir(final int index, final boolean backup)
+ protected String getJournalDir(final int index, final boolean backup)
{
- String dir = getJournalDir(testDir) + index + "-" + (backup ? "B" : "L");
+ String dir = getJournalDir(getTestDir()) + index + "-" + (backup ? "B" : "L");
return dir;
}
@@ -647,15 +647,15 @@
/**
* @return the bindingsDir
*/
- protected static String getBindingsDir()
+ protected String getBindingsDir()
{
- return getBindingsDir(testDir);
+ return getBindingsDir(getTestDir());
}
/**
* @return the bindingsDir
*/
- protected static String getBindingsDir(final String testDir)
+ protected String getBindingsDir(final String testDir)
{
return testDir + "/bindings";
}
@@ -663,51 +663,51 @@
/**
* @return the bindingsDir
*/
- protected static String getBindingsDir(final int index, final boolean backup)
+ protected String getBindingsDir(final int index, final boolean backup)
{
- return getBindingsDir(testDir) + index + "-" + (backup ? "B" : "L");
+ return getBindingsDir(getTestDir()) + index + "-" + (backup ? "B" : "L");
}
/**
* @return the pageDir
*/
- protected static String getPageDir()
+ protected String getPageDir()
{
- return getPageDir(testDir);
+ return getPageDir(getTestDir());
}
/**
* @return the pageDir
*/
- protected static String getPageDir(final String testDir)
+ protected String getPageDir(final String testDir)
{
return testDir + "/page";
}
- protected static String getPageDir(final int index, final boolean backup)
+ protected String getPageDir(final int index, final boolean backup)
{
- return getPageDir(testDir) + index + "-" + (backup ? "B" : "L");
+ return getPageDir(getTestDir()) + index + "-" + (backup ? "B" : "L");
}
/**
* @return the largeMessagesDir
*/
- protected static String getLargeMessagesDir()
+ protected String getLargeMessagesDir()
{
- return getLargeMessagesDir(testDir);
+ return getLargeMessagesDir(getTestDir());
}
/**
* @return the largeMessagesDir
*/
- protected static String getLargeMessagesDir(final String testDir)
+ protected String getLargeMessagesDir(final String testDir)
{
return testDir + "/large-msg";
}
- protected static String getLargeMessagesDir(final int index, final boolean backup)
+ protected String getLargeMessagesDir(final int index, final boolean backup)
{
- return getLargeMessagesDir(testDir) + index + "-" + (backup ? "B" : "L");
+ return getLargeMessagesDir(getTestDir()) + index + "-" + (backup ? "B" : "L");
}
/**
@@ -715,7 +715,7 @@
*/
protected String getClientLargeMessagesDir()
{
- return getClientLargeMessagesDir(testDir);
+ return getClientLargeMessagesDir(getTestDir());
}
/**
@@ -731,7 +731,7 @@
*/
protected String getTemporaryDir()
{
- return getTemporaryDir(testDir);
+ return getTemporaryDir(getTestDir());
}
/**
@@ -889,7 +889,7 @@
protected void setUp() throws Exception
{
super.setUp();
-
+
OperationContextImpl.clearContext();
deleteDirectory(new File(getTestDir()));
@@ -941,19 +941,17 @@
}
}
-
-
StringBuffer buffer = null;
-
- boolean failed = true;
-
+
+ boolean failed = true;
+
long timeout = System.currentTimeMillis() + 60000;
while (failed && timeout > System.currentTimeMillis())
{
buffer = new StringBuffer();
-
+
failed = checkThread(buffer);
-
+
if (failed)
{
forceGC();
@@ -961,13 +959,16 @@
log.info("There are still threads running, trying again");
}
}
-
+
if (failed)
{
- logAndSystemOut("Thread leaked on test " + this.getClass().getName() + "::" +
- this.getName() + "\n" + buffer.toString());
+ logAndSystemOut("Thread leaked on test " + this.getClass().getName() +
+ "::" +
+ this.getName() +
+ "\n" +
+ buffer.toString());
logAndSystemOut("Thread leakage");
-
+
fail("Thread leaked");
}
@@ -986,13 +987,14 @@
if (postThreads.size() > previousThreads.size())
{
-
+
buffer.append("*********************************************************************************\n");
buffer.append("LEAKING THREADS\n");
-
+
for (Thread aliveThread : postThreads.keySet())
{
- if (!aliveThread.getName().contains("SunPKCS11") && !aliveThread.getName().contains("Attach Listener") && !previousThreads.containsKey(aliveThread))
+ if (!aliveThread.getName().contains("SunPKCS11") && !aliveThread.getName().contains("Attach Listener") &&
+ !previousThreads.containsKey(aliveThread))
{
failedThread = true;
buffer.append("=============================================================================\n");
@@ -1027,7 +1029,7 @@
}
long timeout = System.currentTimeMillis() + 15000;
-
+
while (AsynchronousFileImpl.getTotalMaxIO() != 0 && System.currentTimeMillis() > timeout)
{
try
@@ -1038,13 +1040,13 @@
{
}
}
-
+
if (AsynchronousFileImpl.getTotalMaxIO() != 0)
{
AsynchronousFileImpl.resetMaxAIO();
Assert.fail("test did not close all its files " + AsynchronousFileImpl.getTotalMaxIO());
}
-
+
// We shutdown the global pools to give a better isolation between tests
try
{
@@ -1314,6 +1316,7 @@
}
return bindingsFound;
}
+
/**
* It will inspect the journal directly and determine if there are queues on this journal,
* @return a Map containing the reference counts per queue
@@ -1322,7 +1325,8 @@
*/
protected Map<Long, AtomicInteger> loadQueues(HornetQServer serverToInvestigate) throws Exception
{
- SequentialFileFactory messagesFF = new NIOSequentialFileFactory(serverToInvestigate.getConfiguration().getJournalDirectory());
+ SequentialFileFactory messagesFF = new NIOSequentialFileFactory(serverToInvestigate.getConfiguration()
+ .getJournalDirectory());
JournalImpl messagesJournal = new JournalImpl(serverToInvestigate.getConfiguration().getJournalFileSize(),
serverToInvestigate.getConfiguration().getJournalMinFiles(),
@@ -1333,16 +1337,15 @@
"hq",
1);
List<RecordInfo> records = new LinkedList<RecordInfo>();
-
+
List<PreparedTransactionInfo> preparedTransactions = new LinkedList<PreparedTransactionInfo>();
messagesJournal.start();
messagesJournal.load(records, preparedTransactions, null);
-
+
// These are more immutable integers
Map<Long, AtomicInteger> messageRefCounts = new HashMap<Long, AtomicInteger>();
-
-
+
for (RecordInfo info : records)
{
Object o = JournalStorageManager.newObjectEncoding(info);
@@ -1361,16 +1364,13 @@
}
}
}
-
-
+
messagesJournal.stop();
-
-
+
return messageRefCounts;
}
-
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
13 years, 2 months
JBoss hornetq SVN: r11439 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-28 01:10:08 -0400 (Wed, 28 Sep 2011)
New Revision: 11439
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
Log:
tweaks
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java 2011-09-28 05:03:36 UTC (rev 11438)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java 2011-09-28 05:10:08 UTC (rev 11439)
@@ -866,7 +866,7 @@
waitForBindings(0, "queues.testaddress", 1, 0, false);
- getServer(0).getPagingManager().getPageStore(new SimpleString("queue.testaddress")).startPaging();
+ getServer(0).getPagingManager().getPageStore(new SimpleString("queues.testaddress")).startPaging();
ClientSession session0 = sfs[0].createSession(true, true, 0);
ClientProducer producer0 = session0.createProducer("queues.testaddress");
13 years, 2 months
JBoss hornetq SVN: r11438 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-28 01:03:36 -0400 (Wed, 28 Sep 2011)
New Revision: 11438
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
Log:
tweak on a comment only
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java 2011-09-28 04:58:35 UTC (rev 11437)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java 2011-09-28 05:03:36 UTC (rev 11438)
@@ -891,7 +891,7 @@
msg = consumer0.receive(5000);
assertNotNull(msg);
assertEquals(i, msg.getIntProperty("i").intValue());
- // msg.acknowledge(); // -- do not ack message on consumer0, to make sure the message will be routed
+ // msg.acknowledge(); // -- do not ack message on consumer0, to make sure the messages will be paged
msg = consumer1.receive(5000);
assertNotNull(msg);
13 years, 2 months
JBoss hornetq SVN: r11437 - in branches/Branch_2_2_EAP: tests/src/org/hornetq/tests/integration/cluster/distribution and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-28 00:58:35 -0400 (Wed, 28 Sep 2011)
New Revision: 11437
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
Log:
HORNETQ-783 - fix on messages stuck on paging while clustering
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java 2011-09-28 01:35:42 UTC (rev 11436)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java 2011-09-28 04:58:35 UTC (rev 11437)
@@ -182,13 +182,13 @@
{
addRouteContextToMessage(message);
- List<Queue> durableQueuesOnContext = context.getDurableQueues(address);
+ List<Queue> durableQueuesOnContext = context.getDurableQueues(storeAndForwardQueue.getAddress());
if (!durableQueuesOnContext.contains(storeAndForwardQueue))
{
// There can be many remote bindings for the same node, we only want to add the message once to
// the s & f queue for that node
- context.addQueue(address, storeAndForwardQueue);
+ context.addQueue(storeAndForwardQueue.getAddress(), storeAndForwardQueue);
}
}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java 2011-09-28 01:35:42 UTC (rev 11436)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionTest.java 2011-09-28 04:58:35 UTC (rev 11437)
@@ -19,6 +19,7 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
+import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientProducer;
@@ -26,6 +27,7 @@
import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageImpl;
import org.hornetq.core.server.impl.QueueImpl;
+import org.hornetq.core.settings.impl.AddressFullMessagePolicy;
import org.hornetq.core.settings.impl.AddressSettings;
/**
@@ -123,7 +125,7 @@
removeConsumer(1);
- verifyReceiveRoundRobinInSomeOrderWithCounts(false, ids1, 0, 2);
+ verifyReceiveRoundRobinInSomeOrderWithCounts(false, ids1, 0, 2);
MessageRedistributionTest.log.info("Test done");
}
@@ -274,68 +276,67 @@
servers[0].getAddressSettingsRepository().addMatch("queue0", setting);
servers[1].getAddressSettingsRepository().addMatch("queue0", setting);
servers[1].getAddressSettingsRepository().addMatch("queues.testaddress", setting);
-
+
startServers(0);
-
+
setupSessionFactory(0, isNetty());
-
+
createQueue(0, "queues.testaddress", "queue0", null, false);
-
+
ClientSession session0 = sfs[0].createSession(false, false, false);
-
+
ClientProducer prod0 = session0.createProducer("queues.testaddress");
-
- for (int i = 0 ; i < 100; i++)
+
+ for (int i = 0; i < 100; i++)
{
ClientMessage msg = session0.createMessage(true);
msg.putIntProperty("key", i);
-
+
byte[] bytes = new byte[24];
-
+
ByteBuffer bb = ByteBuffer.wrap(bytes);
-
+
bb.putLong((long)i);
-
+
msg.putBytesProperty(MessageImpl.HDR_BRIDGE_DUPLICATE_ID, bytes);
prod0.send(msg);
-
+
session0.commit();
}
-
+
session0.close();
-
+
session0 = sfs[0].createSession(true, false, false);
ClientConsumer consumer0 = session0.createConsumer("queue0");
-
+
session0.start();
-
+
ArrayList<Xid> xids = new ArrayList<Xid>();
-
- for (int i = 0 ; i < 100; i++)
+
+ for (int i = 0; i < 100; i++)
{
Xid xid = newXID();
-
+
session0.start(xid, XAResource.TMNOFLAGS);
-
+
ClientMessage msg = consumer0.receive(5000);
-
+
msg.acknowledge();
-
+
session0.end(xid, XAResource.TMSUCCESS);
-
+
session0.prepare(xid);
-
+
xids.add(xid);
}
-
+
session0.close();
-
+
sfs[0].close();
sfs[0] = null;
-
-
+
startServers(0, 1, 2);
setupSessionFactory(0, isNetty());
@@ -344,11 +345,11 @@
createQueue(1, "queues.testaddress", "queue0", null, false);
createQueue(2, "queues.testaddress", "queue0", null, false);
-
+
ClientSession session1 = sfs[1].createSession(false, false);
session1.start();
ClientConsumer consumer1 = session1.createConsumer("queue0");
-
+
waitForBindings(0, "queues.testaddress", 1, 0, true);
waitForBindings(1, "queues.testaddress", 1, 1, true);
waitForBindings(2, "queues.testaddress", 1, 0, true);
@@ -356,24 +357,23 @@
waitForBindings(0, "queues.testaddress", 2, 1, false);
waitForBindings(1, "queues.testaddress", 2, 0, false);
waitForBindings(2, "queues.testaddress", 2, 1, false);
-
+
session0 = sfs[0].createSession(true, false, false);
-
- for (Xid xid: xids)
+
+ for (Xid xid : xids)
{
session0.rollback(xid);
}
-
-
- for (int i = 0 ; i < 100; i++)
+
+ for (int i = 0; i < 100; i++)
{
ClientMessage msg = consumer1.receive(15000);
assertNotNull(msg);
msg.acknowledge();
}
-
+
session1.commit();
-
+
}
public void testRedistributionWhenConsumerIsClosedQueuesWithFilters() throws Exception
@@ -834,6 +834,75 @@
verifyNotReceive(0);
}
+ public void testRedistributionWithPagingOnTarget() throws Exception
+ {
+ setupCluster(false);
+
+ AddressSettings as = new AddressSettings();
+ as.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
+ as.setPageSizeBytes(10000);
+ as.setMaxSizeBytes(20000);
+
+ getServer(0).getAddressSettingsRepository().addMatch("queues.*", as);
+ getServer(1).getAddressSettingsRepository().addMatch("queues.*", as);
+ getServer(2).getAddressSettingsRepository().addMatch("queues.*", as);
+
+ startServers(0);
+
+ startServers(1);
+
+ waitForTopology(getServer(0), 2);
+ waitForTopology(getServer(1), 2);
+
+ setupSessionFactory(0, isNetty());
+
+ setupSessionFactory(1, isNetty());
+
+ createQueue(0, "queues.testaddress", "queue0", null, true);
+
+ createQueue(1, "queues.testaddress", "queue0", null, true);
+
+ waitForBindings(1, "queues.testaddress", 1, 0, true);
+
+ waitForBindings(0, "queues.testaddress", 1, 0, false);
+
+ getServer(0).getPagingManager().getPageStore(new SimpleString("queue.testaddress")).startPaging();
+
+ ClientSession session0 = sfs[0].createSession(true, true, 0);
+ ClientProducer producer0 = session0.createProducer("queues.testaddress");
+
+ ClientConsumer consumer0 = session0.createConsumer("queue0");
+ session0.start();
+
+
+ ClientSession session1 = sfs[1].createSession(true, true, 0);
+ ClientConsumer consumer1 = session1.createConsumer("queue0");
+ session1.start();
+
+
+ for (int i = 0 ; i < 10; i++)
+ {
+ ClientMessage msg = session0.createMessage(true);
+ msg.putIntProperty("i", i);
+ // send two identical messages so they are routed on the cluster
+ producer0.send(msg);
+ producer0.send(msg);
+
+ msg = consumer0.receive(5000);
+ assertNotNull(msg);
+ assertEquals(i, msg.getIntProperty("i").intValue());
+ // msg.acknowledge(); // -- do not ack message on consumer0, to make sure the message will be routed
+
+ msg = consumer1.receive(5000);
+ assertNotNull(msg);
+ assertEquals(i, msg.getIntProperty("i").intValue());
+ msg.acknowledge();
+ }
+
+ session0.close();
+ session1.close();
+ }
+
protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
{
setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1, 2);
13 years, 2 months
JBoss hornetq SVN: r11436 - in branches/Branch_2_2_EAP/src/main/org/hornetq: core/management/impl and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic
Date: 2011-09-27 21:35:42 -0400 (Tue, 27 Sep 2011)
New Revision: 11436
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/AddressControlImpl.java
Log:
HORNETQ-786 - exposing isPaging on the AddressControl
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressControl.java 2011-09-27 22:24:35 UTC (rev 11435)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/AddressControl.java 2011-09-28 01:35:42 UTC (rev 11436)
@@ -50,6 +50,8 @@
* Returns the number of pages used by this address.
*/
int getNumberOfPages() throws Exception;
+
+ boolean isPaging() throws Exception;
/**
* Returns the number of bytes used by each page for this address.
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/AddressControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/AddressControlImpl.java 2011-09-27 22:24:35 UTC (rev 11435)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/AddressControlImpl.java 2011-09-28 01:35:42 UTC (rev 11436)
@@ -23,6 +23,7 @@
import org.hornetq.api.core.management.AddressControl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.paging.PagingManager;
+import org.hornetq.core.paging.PagingStore;
import org.hornetq.core.persistence.StorageManager;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.Bindings;
@@ -194,13 +195,35 @@
blockOnIO();
}
}
+
+ public boolean isPaging() throws Exception
+ {
+ clearIO();
+ try
+ {
+ return pagingManager.getPageStore(address).isPaging();
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
public int getNumberOfPages() throws Exception
{
clearIO();
try
{
- return pagingManager.getPageStore(address).getNumberOfPages();
+ PagingStore pageStore = pagingManager.getPageStore(address);
+
+ if (!pageStore.isPaging())
+ {
+ return 0;
+ }
+ else
+ {
+ return pagingManager.getPageStore(address).getNumberOfPages();
+ }
}
finally
{
13 years, 2 months
JBoss hornetq SVN: r11435 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-27 18:24:35 -0400 (Tue, 27 Sep 2011)
New Revision: 11435
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
Log:
improving test
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java 2011-09-27 20:42:05 UTC (rev 11434)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java 2011-09-27 22:24:35 UTC (rev 11435)
@@ -18,12 +18,17 @@
import java.util.List;
import java.util.Map;
+import junit.framework.Assert;
+
import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.client.impl.Topology;
+import org.hornetq.core.client.impl.TopologyMember;
import org.hornetq.core.config.ClusterConnectionConfiguration;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.remoting.impl.netty.TransportConstants;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
+import org.hornetq.tests.util.UnitTestCase;
/**
* A IsolatedTopologyTest
@@ -34,52 +39,73 @@
*/
public class IsolatedTopologyTest extends ServiceTestBase
{
-
+
+ @Override
public void setUp() throws Exception
{
super.setUp();
}
-
+ @Override
public void tearDown() throws Exception
{
super.tearDown();
}
-
-
+
public void testIsolatedClusters() throws Exception
{
-
+
HornetQServer server1 = createServer1();
HornetQServer server2 = createServer2();
-
+
try
{
server1.start();
- Thread.sleep(500);
server2.start();
-
- Thread.sleep(2000);
-
- System.out.println(server1.getClusterManager().getClusterConnection("cc1").getTopology().describe());
-
- System.out.println(server1.getClusterManager().getClusterConnection("cc2").getTopology().describe());
-
- System.out.println(server2.getClusterManager().getClusterConnection("cc1").getTopology().describe());
-
- System.out.println(server2.getClusterManager().getClusterConnection("cc2").getTopology().describe());
-
+
waitForTopology(server1, "cc1", 2, 5000);
-
+
waitForTopology(server1, "cc2", 2, 5000);
-
+
waitForTopology(server2, "cc1", 2, 5000);
-
+
waitForTopology(server2, "cc2", 2, 5000);
+
+ String node1 = server1.getNodeID().toString();
+ String node2 = server2.getNodeID().toString();
+
+ checkTopology(server1,
+ "cc1",
+ node1,
+ node2,
+ createInVMTransportConnectorConfig(1, "srv1"),
+ createInVMTransportConnectorConfig(3, "srv1"));
+
+ checkTopology(server2,
+ "cc1",
+ node1,
+ node2,
+ createInVMTransportConnectorConfig(1, "srv1"),
+ createInVMTransportConnectorConfig(3, "srv1"));
+
+ checkTopology(server1,
+ "cc2",
+ node1,
+ node2,
+ createInVMTransportConnectorConfig(2, "srv1"),
+ createInVMTransportConnectorConfig(4, "srv1"));
+
+ checkTopology(server2,
+ "cc2",
+ node1,
+ node2,
+ createInVMTransportConnectorConfig(2, "srv1"),
+ createInVMTransportConnectorConfig(4, "srv1"));
}
finally
{
+ Thread.sleep(500);
try
{
server1.stop();
@@ -87,7 +113,7 @@
catch (Throwable ignored)
{
}
-
+
try
{
server2.stop();
@@ -98,135 +124,154 @@
}
}
+ private void checkTopology(final HornetQServer serverParameter,
+ final String clusterName,
+ final String nodeId1,
+ final String nodeId2,
+ final TransportConfiguration cfg1,
+ final TransportConfiguration cfg2)
+ {
+ Topology topology = serverParameter.getClusterManager().getClusterConnection(clusterName).getTopology();
+ TopologyMember member1 = topology.getMember(nodeId1);
+ TopologyMember member2 = topology.getMember(nodeId2);
+ Assert.assertEquals(member1.getA().toString(), cfg1.toString());
+ Assert.assertEquals(member2.getA().toString(), cfg2.toString());
+ }
+
private HornetQServer createServer1()
{
// Server1 with two acceptors, each acceptor on a different cluster connection
// talking to a different connector.
// i.e. two cluster connections isolated on the same node
- Configuration config1 = createBasicConfig(0);
-
+ Configuration config1 = UnitTestCase.createBasicConfig(0);
+
config1.setClustered(true);
-
+
Map<String, Object> params = new HashMap<String, Object>();
params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
-
- TransportConfiguration acceptor1VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc1");
+
+ TransportConfiguration acceptor1VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
+ params,
+ "acceptor-cc1");
config1.getAcceptorConfigurations().add(acceptor1VM1);
-
+
config1.getConnectorConfigurations().put("local-cc1", createInVMTransportConnectorConfig(1, "local-cc1"));
config1.getConnectorConfigurations().put("local-cc2", createInVMTransportConnectorConfig(2, "local-cc2"));
config1.getConnectorConfigurations().put("other-cc1", createInVMTransportConnectorConfig(3, "other-cc1"));
config1.getConnectorConfigurations().put("other-cc2", createInVMTransportConnectorConfig(4, "other-cc2"));
-
params = new HashMap<String, Object>();
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "2");
-
- TransportConfiguration acceptor2VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc2");
+
+ TransportConfiguration acceptor2VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
+ params,
+ "acceptor-cc2");
config1.getAcceptorConfigurations().add(acceptor2VM1);
-
+
List<String> connectTo = new ArrayList<String>();
connectTo.add("other-cc1");
-
+
ClusterConnectionConfiguration server1CC1 = new ClusterConnectionConfiguration("cc1",
- "jms",
- "local-cc1",
- 250,
- true,
- false,
- 1,
- 1024,
- connectTo,
- false);
-
+ "jms",
+ "local-cc1",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
config1.getClusterConfigurations().add(server1CC1);
-
+
connectTo = new ArrayList<String>();
connectTo.add("other-cc2");
-
+
ClusterConnectionConfiguration server1CC2 = new ClusterConnectionConfiguration("cc2",
- "jms",
- "local-cc2",
- 250,
- true,
- false,
- 1,
- 1024,
- connectTo,
- false);
-
+ "jms",
+ "local-cc2",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
config1.getClusterConfigurations().add(server1CC2);
-
+
return createServer(false, config1);
}
-
private HornetQServer createServer2()
{
// Server1 with two acceptors, each acceptor on a different cluster connection
// talking to a different connector.
// i.e. two cluster connections isolated on the same node
- Configuration config1 = createBasicConfig(3);
-
+ Configuration config1 = UnitTestCase.createBasicConfig(3);
+
config1.setClustered(true);
-
+
Map<String, Object> params = new HashMap<String, Object>();
params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "3");
-
- TransportConfiguration acceptor1VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc1");
+
+ TransportConfiguration acceptor1VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
+ params,
+ "acceptor-cc1");
config1.getAcceptorConfigurations().add(acceptor1VM1);
-
+
config1.getConnectorConfigurations().put("local-cc1", createInVMTransportConnectorConfig(3, "local-cc1"));
config1.getConnectorConfigurations().put("local-cc2", createInVMTransportConnectorConfig(4, "local-cc2"));
config1.getConnectorConfigurations().put("other-cc1", createInVMTransportConnectorConfig(1, "other-cc1"));
config1.getConnectorConfigurations().put("other-cc2", createInVMTransportConnectorConfig(2, "other-cc2"));
-
params = new HashMap<String, Object>();
params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "4");
-
- TransportConfiguration acceptor2VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc2");
+
+ TransportConfiguration acceptor2VM1 = new TransportConfiguration(ServiceTestBase.INVM_ACCEPTOR_FACTORY,
+ params,
+ "acceptor-cc2");
config1.getAcceptorConfigurations().add(acceptor2VM1);
-
+
List<String> connectTo = new ArrayList<String>();
connectTo.add("other-cc1");
-
+
ClusterConnectionConfiguration server1CC1 = new ClusterConnectionConfiguration("cc1",
- "jms",
- "local-cc1",
- 250,
- true,
- false,
- 1,
- 1024,
- connectTo,
- false);
-
+ "jms",
+ "local-cc1",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
config1.getClusterConfigurations().add(server1CC1);
-
+
connectTo = new ArrayList<String>();
connectTo.add("other-cc2");
-
+
ClusterConnectionConfiguration server1CC2 = new ClusterConnectionConfiguration("cc2",
- "jms",
- "local-cc2",
- 250,
- true,
- false,
- 1,
- 1024,
- connectTo,
- false);
-
+ "jms",
+ "local-cc2",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
config1.getClusterConfigurations().add(server1CC2);
-
+
return createServer(false, config1);
}
13 years, 2 months
JBoss hornetq SVN: r11434 - in branches/Branch_2_2_EAP: src/main/org/hornetq/core/remoting/impl/netty and 5 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-27 16:42:05 -0400 (Tue, 27 Sep 2011)
New Revision: 11434
Added:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/TransportConstants.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/ClusterManager.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/ServiceTestBase.java
Log:
Parameterizing the cluster-connection on the acceptors
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java 2011-09-27 20:06:33 UTC (rev 11433)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/invm/TransportConstants.java 2011-09-27 20:42:05 UTC (rev 11434)
@@ -34,12 +34,13 @@
{
Set<String> allowableAcceptorKeys = new HashSet<String>();
allowableAcceptorKeys.add(TransportConstants.SERVER_ID_PROP_NAME);
+ allowableAcceptorKeys.add(org.hornetq.core.remoting.impl.netty.TransportConstants.CLUSTER_CONNECTION);
- ALLOWABLE_CONNECTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
-
+ ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
+
Set<String> allowableConnectorKeys = new HashSet<String>();
allowableConnectorKeys.add(TransportConstants.SERVER_ID_PROP_NAME);
- ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableConnectorKeys);
+ ALLOWABLE_CONNECTOR_KEYS = Collections.unmodifiableSet(allowableConnectorKeys);
}
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/TransportConstants.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/TransportConstants.java 2011-09-27 20:06:33 UTC (rev 11433)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/impl/netty/TransportConstants.java 2011-09-27 20:42:05 UTC (rev 11434)
@@ -74,6 +74,8 @@
public static final String DIRECT_DELIVER = "direct-deliver";
+ public static final String CLUSTER_CONNECTION = "cluster-connection";
+
public static final boolean DEFAULT_SSL_ENABLED = false;
public static final boolean DEFAULT_USE_NIO_SERVER = false;
@@ -151,6 +153,7 @@
allowableAcceptorKeys.add(TransportConstants.NIO_REMOTING_THREADS_PROPNAME);
allowableAcceptorKeys.add(TransportConstants.BATCH_DELAY);
allowableAcceptorKeys.add(TransportConstants.DIRECT_DELIVER);
+ allowableAcceptorKeys.add(TransportConstants.CLUSTER_CONNECTION);
ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys);
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2011-09-27 20:06:33 UTC (rev 11433)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java 2011-09-27 20:42:05 UTC (rev 11434)
@@ -39,6 +39,7 @@
import org.hornetq.core.remoting.impl.netty.TransportConstants;
import org.hornetq.core.remoting.server.RemotingService;
import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.cluster.ClusterConnection;
import org.hornetq.core.server.cluster.ClusterManager;
import org.hornetq.core.server.impl.ServerSessionImpl;
import org.hornetq.core.server.management.ManagementService;
@@ -207,9 +208,10 @@
ProtocolType protocol = ProtocolType.valueOf(protocolString.toUpperCase());
ProtocolManager manager = protocolMap.get(protocol);
-
- // TODO: parameterize the cluster connection
- Acceptor acceptor = factory.createAcceptor(clusterManager.getDefaultConnection(),
+
+ ClusterConnection clusterConnection = lookupClusterConnection(info);
+
+ Acceptor acceptor = factory.createAcceptor(clusterConnection,
info.getParams(),
new DelegatingBufferHandler(),
manager,
@@ -480,6 +482,24 @@
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
+
+ private ClusterConnection lookupClusterConnection(TransportConfiguration config)
+ {
+ String clusterConnectionName = (String)config.getParams().get(org.hornetq.core.remoting.impl.netty.TransportConstants.CLUSTER_CONNECTION);
+
+ ClusterConnection clusterConnection = null;
+ if (clusterConnectionName != null)
+ {
+ clusterConnection = clusterManager.getClusterConnection(clusterConnectionName);
+ }
+
+ if (clusterConnection == null)
+ {
+ clusterConnection = clusterManager.getDefaultConnection();
+ }
+
+ return clusterConnection;
+ }
// Inner classes -------------------------------------------------
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/ClusterManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/ClusterManager.java 2011-09-27 20:06:33 UTC (rev 11433)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/ClusterManager.java 2011-09-27 20:42:05 UTC (rev 11434)
@@ -40,7 +40,7 @@
*/
ClusterConnection getDefaultConnection();
- ClusterConnection getClusterConnection(SimpleString name);
+ ClusterConnection getClusterConnection(String name);
Set<BroadcastGroup> getBroadcastGroups();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-09-27 20:06:33 UTC (rev 11433)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/cluster/impl/ClusterManagerImpl.java 2011-09-27 20:42:05 UTC (rev 11434)
@@ -57,6 +57,7 @@
* A ClusterManagerImpl
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author Clebert Suconic
*
* Created 18 Nov 2008 09:23:49
*
@@ -302,9 +303,9 @@
return new HashSet<BroadcastGroup>(broadcastGroups.values());
}
- public ClusterConnection getClusterConnection(final SimpleString name)
+ public ClusterConnection getClusterConnection(final String name)
{
- return clusterConnections.get(name.toString());
+ return clusterConnections.get(name);
}
// backup node becomes live
Added: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java (rev 0)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/cluster/topology/IsolatedTopologyTest.java 2011-09-27 20:42:05 UTC (rev 11434)
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.topology;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.core.config.ClusterConnectionConfiguration;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.remoting.impl.netty.TransportConstants;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * A IsolatedTopologyTest
+ *
+ * @author clebertsuconic
+ *
+ *
+ */
+public class IsolatedTopologyTest extends ServiceTestBase
+{
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+
+
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+
+ public void testIsolatedClusters() throws Exception
+ {
+
+ HornetQServer server1 = createServer1();
+
+ HornetQServer server2 = createServer2();
+
+ try
+ {
+ server1.start();
+ Thread.sleep(500);
+ server2.start();
+
+ Thread.sleep(2000);
+
+ System.out.println(server1.getClusterManager().getClusterConnection("cc1").getTopology().describe());
+
+ System.out.println(server1.getClusterManager().getClusterConnection("cc2").getTopology().describe());
+
+ System.out.println(server2.getClusterManager().getClusterConnection("cc1").getTopology().describe());
+
+ System.out.println(server2.getClusterManager().getClusterConnection("cc2").getTopology().describe());
+
+ waitForTopology(server1, "cc1", 2, 5000);
+
+ waitForTopology(server1, "cc2", 2, 5000);
+
+ waitForTopology(server2, "cc1", 2, 5000);
+
+ waitForTopology(server2, "cc2", 2, 5000);
+ }
+ finally
+ {
+ try
+ {
+ server1.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+
+ try
+ {
+ server2.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ }
+
+
+ private HornetQServer createServer1()
+ {
+ // Server1 with two acceptors, each acceptor on a different cluster connection
+ // talking to a different connector.
+ // i.e. two cluster connections isolated on the same node
+ Configuration config1 = createBasicConfig(0);
+
+ config1.setClustered(true);
+
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
+ params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1");
+
+ TransportConfiguration acceptor1VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc1");
+ config1.getAcceptorConfigurations().add(acceptor1VM1);
+
+ config1.getConnectorConfigurations().put("local-cc1", createInVMTransportConnectorConfig(1, "local-cc1"));
+ config1.getConnectorConfigurations().put("local-cc2", createInVMTransportConnectorConfig(2, "local-cc2"));
+
+ config1.getConnectorConfigurations().put("other-cc1", createInVMTransportConnectorConfig(3, "other-cc1"));
+ config1.getConnectorConfigurations().put("other-cc2", createInVMTransportConnectorConfig(4, "other-cc2"));
+
+
+ params = new HashMap<String, Object>();
+ params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
+ params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "2");
+
+ TransportConfiguration acceptor2VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc2");
+ config1.getAcceptorConfigurations().add(acceptor2VM1);
+
+ List<String> connectTo = new ArrayList<String>();
+ connectTo.add("other-cc1");
+
+ ClusterConnectionConfiguration server1CC1 = new ClusterConnectionConfiguration("cc1",
+ "jms",
+ "local-cc1",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
+ config1.getClusterConfigurations().add(server1CC1);
+
+ connectTo = new ArrayList<String>();
+ connectTo.add("other-cc2");
+
+ ClusterConnectionConfiguration server1CC2 = new ClusterConnectionConfiguration("cc2",
+ "jms",
+ "local-cc2",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
+ config1.getClusterConfigurations().add(server1CC2);
+
+ return createServer(false, config1);
+ }
+
+
+ private HornetQServer createServer2()
+ {
+ // Server1 with two acceptors, each acceptor on a different cluster connection
+ // talking to a different connector.
+ // i.e. two cluster connections isolated on the same node
+ Configuration config1 = createBasicConfig(3);
+
+ config1.setClustered(true);
+
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put(TransportConstants.CLUSTER_CONNECTION, "cc1");
+ params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "3");
+
+ TransportConfiguration acceptor1VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc1");
+ config1.getAcceptorConfigurations().add(acceptor1VM1);
+
+ config1.getConnectorConfigurations().put("local-cc1", createInVMTransportConnectorConfig(3, "local-cc1"));
+ config1.getConnectorConfigurations().put("local-cc2", createInVMTransportConnectorConfig(4, "local-cc2"));
+
+ config1.getConnectorConfigurations().put("other-cc1", createInVMTransportConnectorConfig(1, "other-cc1"));
+ config1.getConnectorConfigurations().put("other-cc2", createInVMTransportConnectorConfig(2, "other-cc2"));
+
+
+ params = new HashMap<String, Object>();
+ params.put(TransportConstants.CLUSTER_CONNECTION, "cc2");
+ params.put(org.hornetq.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "4");
+
+ TransportConfiguration acceptor2VM1 = new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params, "acceptor-cc2");
+ config1.getAcceptorConfigurations().add(acceptor2VM1);
+
+ List<String> connectTo = new ArrayList<String>();
+ connectTo.add("other-cc1");
+
+ ClusterConnectionConfiguration server1CC1 = new ClusterConnectionConfiguration("cc1",
+ "jms",
+ "local-cc1",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
+ config1.getClusterConfigurations().add(server1CC1);
+
+ connectTo = new ArrayList<String>();
+ connectTo.add("other-cc2");
+
+ ClusterConnectionConfiguration server1CC2 = new ClusterConnectionConfiguration("cc2",
+ "jms",
+ "local-cc2",
+ 250,
+ true,
+ false,
+ 1,
+ 1024,
+ connectTo,
+ false);
+
+ config1.getClusterConfigurations().add(server1CC2);
+
+ return createServer(false, config1);
+ }
+
+}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/ServiceTestBase.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2011-09-27 20:06:33 UTC (rev 11433)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/util/ServiceTestBase.java 2011-09-27 20:42:05 UTC (rev 11434)
@@ -52,6 +52,7 @@
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.spi.core.security.HornetQSecurityManager;
import org.hornetq.spi.core.security.HornetQSecurityManagerImpl;
+import org.hornetq.utils.UUIDGenerator;
/**
*
@@ -149,6 +150,41 @@
}
+ protected void waitForTopology(final HornetQServer server, String clusterConnectionName, final int nodes, final long timeout) throws Exception
+ {
+ log.debug("waiting for " + nodes + " on the topology for server = " + server);
+
+ long start = System.currentTimeMillis();
+
+ ClusterConnection clusterConnection = server.getClusterManager().getClusterConnection(clusterConnectionName);
+
+
+ Topology topology = clusterConnection.getTopology();
+
+ do
+ {
+ if (nodes == topology.getMembers().size())
+ {
+ return;
+ }
+
+ Thread.sleep(10);
+ }
+ while (System.currentTimeMillis() - start < timeout);
+
+ String msg = "Timed out waiting for cluster topology of " + nodes +
+ " (received " +
+ topology.getMembers().size() +
+ ") topology = " +
+ topology +
+ ")";
+
+ log.error(msg);
+
+ throw new Exception(msg);
+ }
+
+
protected static Map<String, Object> generateParams(final int node, final boolean netty)
{
Map<String, Object> params = new HashMap<String, Object>();
@@ -537,6 +573,17 @@
protected ServerLocator createInVMLocator(final int serverID)
{
+ TransportConfiguration tnspConfig = createInVMTransportConnectorConfig(serverID, UUIDGenerator.getInstance().generateStringUUID());
+
+ return HornetQClient.createServerLocatorWithHA(tnspConfig);
+ }
+
+ /**
+ * @param serverID
+ * @return
+ */
+ protected TransportConfiguration createInVMTransportConnectorConfig(final int serverID, String name)
+ {
Map<String, Object> server1Params = new HashMap<String, Object>();
if (serverID != 0)
@@ -544,7 +591,8 @@
server1Params.put(TransportConstants.SERVER_ID_PROP_NAME, serverID);
}
- return HornetQClient.createServerLocatorWithHA(new TransportConfiguration(INVM_CONNECTOR_FACTORY, server1Params));
+ TransportConfiguration tnspConfig = new TransportConfiguration(INVM_CONNECTOR_FACTORY, server1Params, name);
+ return tnspConfig;
}
protected ClientSessionFactoryImpl createFactory(final String connectorClass) throws Exception
13 years, 2 months
JBoss hornetq SVN: r11433 - branches/Branch_2_2_EAP.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-27 16:06:33 -0400 (Tue, 27 Sep 2011)
New Revision: 11433
Modified:
branches/Branch_2_2_EAP/pom.xml
Log:
updating netty
Modified: branches/Branch_2_2_EAP/pom.xml
===================================================================
--- branches/Branch_2_2_EAP/pom.xml 2011-09-27 03:36:01 UTC (rev 11432)
+++ branches/Branch_2_2_EAP/pom.xml 2011-09-27 20:06:33 UTC (rev 11433)
@@ -236,7 +236,7 @@
<dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
- <version>3.2.3.Final</version>
+ <version>3.2.5.Final</version>
</dependency>
<!--needed to compile the logging jar-->
<dependency>
13 years, 2 months
JBoss hornetq SVN: r11432 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-26 23:36:01 -0400 (Mon, 26 Sep 2011)
New Revision: 11432
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java
Log:
fixing a test
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java 2011-09-27 03:17:15 UTC (rev 11431)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/ra/HornetQResourceAdapterConfigTest.java 2011-09-27 03:36:01 UTC (rev 11432)
@@ -273,6 +273,18 @@
" <config-property-type>long</config-property-type>\n" +
" <config-property-value></config-property-value>\n" +
" </config-property>\n" +
+ " <config-property>" +
+ " <description></description>" +
+ " <config-property-name>TransactionManagerLocatorMethod</config-property-name>" +
+ " <config-property-type>java.lang.String</config-property-type>" +
+ " <config-property-value></config-property-value>" +
+ " </config-property>" +
+ " <config-property>" +
+ " <description></description>" +
+ " <config-property-name>TransactionManagerLocatorClass</config-property-name>" +
+ " <config-property-type>java.lang.String</config-property-type>" +
+ " <config-property-value></config-property-value>" +
+ " </config-property>" +
" <config-property>\n" +
" <description>How many attempts should be made when connecting the MDB</description>\n" +
" <config-property-name>SetupAttempts</config-property-name>\n" +
@@ -323,14 +335,15 @@
if(!methodList.isEmpty())
{
StringBuffer newConfig = new StringBuffer(commentedOutConfigs);
+ newConfig.append("\n");
for (Method method : methodList.values())
{
- newConfig.append(" <config-property>\n");
- newConfig.append(" <description>***add***</description>\n");
- newConfig.append(" <config-property-name>").append(method.getName().substring(3)).append("</config-property-name>\n");
- newConfig.append(" <config-property-type>").append(method.getParameterTypes()[0].getName()).append("</config-property-type>\n");
- newConfig.append(" <config-property-value></config-property-value>\n");
- newConfig.append(" </config-property>\n");
+ newConfig.append("\" <config-property>\" + \n");
+ newConfig.append("\" <description>***add***</description>\" + \n");
+ newConfig.append("\" <config-property-name>").append(method.getName().substring(3)).append("</config-property-name>\" + \n");
+ newConfig.append("\" <config-property-type>").append(method.getParameterTypes()[0].getName()).append("</config-property-type>\" + \n");
+ newConfig.append("\" <config-property-value></config-property-value>\" + \n");
+ newConfig.append("\" </config-property>\" + \n");
}
System.out.println(newConfig);
fail("methods not shown please see previous and add");
13 years, 3 months
JBoss hornetq SVN: r11431 - in branches/Branch_2_2_EAP: src/main/org/hornetq/ra/recovery and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-09-26 23:17:15 -0400 (Mon, 26 Sep 2011)
New Revision: 11431
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/recovery/RecoveryManager.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/ra/ResourceAdapterTest.java
Log:
fixing tests
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-09-27 02:59:26 UTC (rev 11430)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-09-27 03:17:15 UTC (rev 11431)
@@ -41,7 +41,6 @@
import org.hornetq.api.jms.JMSFactoryType;
import org.hornetq.core.logging.Logger;
import org.hornetq.jms.client.HornetQConnectionFactory;
-import org.hornetq.jms.server.recovery.RecoveryRegistry;
import org.hornetq.jms.server.recovery.XARecoveryConfig;
import org.hornetq.ra.inflow.HornetQActivation;
import org.hornetq.ra.inflow.HornetQActivationSpec;
@@ -1380,6 +1379,42 @@
return defaultHornetQConnectionFactory;
}
+ /**
+ * @param transactionManagerLocatorClass
+ * @see org.hornetq.ra.HornetQRAProperties#setTransactionManagerLocatorClass(java.lang.String)
+ */
+ public void setTransactionManagerLocatorClass(String transactionManagerLocatorClass)
+ {
+ raProperties.setTransactionManagerLocatorClass(transactionManagerLocatorClass);
+ }
+
+ /**
+ * @return
+ * @see org.hornetq.ra.HornetQRAProperties#getTransactionManagerLocatorClass()
+ */
+ public String getTransactionManagerLocatorClass()
+ {
+ return raProperties.getTransactionManagerLocatorClass();
+ }
+
+ /**
+ * @return
+ * @see org.hornetq.ra.HornetQRAProperties#getTransactionManagerLocatorMethod()
+ */
+ public String getTransactionManagerLocatorMethod()
+ {
+ return raProperties.getTransactionManagerLocatorMethod();
+ }
+
+ /**
+ * @param transactionManagerLocatorMethod
+ * @see org.hornetq.ra.HornetQRAProperties#setTransactionManagerLocatorMethod(java.lang.String)
+ */
+ public void setTransactionManagerLocatorMethod(String transactionManagerLocatorMethod)
+ {
+ raProperties.setTransactionManagerLocatorMethod(transactionManagerLocatorMethod);
+ }
+
public HornetQConnectionFactory createHornetQConnectionFactory(final ConnectionFactoryProperties overrideProperties)
{
HornetQConnectionFactory cf;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/recovery/RecoveryManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/recovery/RecoveryManager.java 2011-09-27 02:59:26 UTC (rev 11430)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/recovery/RecoveryManager.java 2011-09-27 03:17:15 UTC (rev 11431)
@@ -54,7 +54,7 @@
public HornetQResourceRecovery register(HornetQConnectionFactory factory, String userName, String password)
{
- if(!isRegistered(factory))
+ if(!isRegistered(factory) && registry != null)
{
XARecoveryConfig xaRecoveryConfig = new XARecoveryConfig(factory, userName, password);
HornetQResourceRecovery resourceRecovery = new HornetQResourceRecovery(xaRecoveryConfig);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/ra/ResourceAdapterTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/ra/ResourceAdapterTest.java 2011-09-27 02:59:26 UTC (rev 11430)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/ra/ResourceAdapterTest.java 2011-09-27 03:17:15 UTC (rev 11431)
@@ -32,6 +32,8 @@
{
HornetQResourceAdapter qResourceAdapter = new HornetQResourceAdapter();
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -220,6 +222,8 @@
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -243,6 +247,8 @@
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -267,6 +273,8 @@
qResourceAdapter.setDiscoveryRefreshTimeout(1l);
qResourceAdapter.setDiscoveryInitialWaitTimeout(1l);
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -285,7 +293,12 @@
{
HornetQResourceAdapter qResourceAdapter = new HornetQResourceAdapter();
qResourceAdapter.setDiscoveryAddress("231.7.7.7");
+
+ //qResourceAdapter.getTransactionManagerLocatorClass
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
+
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -312,6 +325,8 @@
qResourceAdapter.setConnectionParameters("server-id=0");
qResourceAdapter.setHA(true);
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -333,6 +348,8 @@
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -355,6 +372,8 @@
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -377,6 +396,8 @@
qResourceAdapter.setConnectionParameters("server-id=0");
qResourceAdapter.setReconnectAttempts(100);
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -398,6 +419,8 @@
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
@@ -419,6 +442,8 @@
qResourceAdapter.setConnectorClassName(INVM_CONNECTOR_FACTORY);
qResourceAdapter.setConnectionParameters("server-id=0");
HornetQRATestBase.MyBootstrapContext ctx = new HornetQRATestBase.MyBootstrapContext();
+
+ qResourceAdapter.setTransactionManagerLocatorClass("");
qResourceAdapter.start(ctx);
HornetQActivationSpec spec = new HornetQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
13 years, 3 months