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 -------------------------------------------------