Author: clebert.suconic(a)jboss.com
Date: 2011-07-27 21:34:23 -0400 (Wed, 27 Jul 2011)
New Revision: 11061
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
tweaks
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-28
01:32:47 UTC (rev 11060)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-07-28
01:34:23 UTC (rev 11061)
@@ -249,6 +249,11 @@
protected void waitForTopology(final HornetQServer server, final int nodes) throws
Exception
{
+ waitForTopology(server, nodes, WAIT_TIMEOUT);
+ }
+
+ protected void waitForTopology(final HornetQServer server, final int nodes, final long
timeout) throws Exception
+ {
log.debug("waiting for " + nodes + " on the topology for server =
" + server);
@@ -265,16 +270,13 @@
Thread.sleep(10);
}
- while (System.currentTimeMillis() - start < ClusterTestBase.WAIT_TIMEOUT);
+ while (System.currentTimeMillis() - start < timeout);
String msg = "Timed out waiting for cluster topology of " + nodes +
" (received " + topology.getMembers().size() + ") nodes on server = "
+ server + ")\n Current topology:" + topology.describe();
ClusterTestBase.log.error(msg);
throw new Exception (msg);
-
-
-
}
protected void waitForBindings(final int node,
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-07-28
01:32:47 UTC (rev 11060)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-07-28
01:34:23 UTC (rev 11061)
@@ -88,6 +88,18 @@
verifyReceiveAll(10, 0);
}
+
+ public void _testLoop() throws Exception
+ {
+ for (int i = 0 ; i < 100; i++)
+ {
+ log.info("#test " + i);
+ testRequestResponseNoWaitForBindings();
+ tearDown();
+ setUp();
+ }
+
+ }
/*
* Don't wait for the response queue bindings to get to the other side
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java 2011-07-28
01:32:47 UTC (rev 11060)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java 2011-07-28
01:34:23 UTC (rev 11061)
@@ -36,11 +36,11 @@
setupServers();
setupClusters();
}
-
+
protected void setupServers()
{
setupServer(0, isFileStorage(), isNetty());
- setupServer(1, isFileStorage(), isNetty());
+ setupServer(1, isFileStorage(), isNetty());
}
protected void setupClusters()
@@ -95,7 +95,7 @@
stopServers(0, 1);
}
-
+
public void testStartPauseStartOther() throws Exception
{
@@ -104,11 +104,11 @@
setupSessionFactory(0, isNetty());
createQueue(0, "queues", "queue0", null, false);
addConsumer(0, 0, "queue0", null);
-
- // we let the discovery initial timeout expire,
+
+ // we let the discovery initial timeout expire,
// #0 will be alone in the cluster
Thread.sleep(12000);
-
+
startServers(1);
setupSessionFactory(1, isNetty());
createQueue(1, "queues", "queue0", null, false);
@@ -127,10 +127,10 @@
stopServers(0, 1);
}
-
+
public void _testLoop() throws Exception
{
- for (int i = 0 ; i < 100; i++)
+ for (int i = 0; i < 1000; i++)
{
log.info("#test " + i);
testStopStart();
@@ -139,6 +139,36 @@
}
}
+ public void testRestartTest() throws Throwable
+ {
+ startServers(0, 1);
+ waitForTopology(servers[0], 2);
+
+ // try
+ // {
+ // stopServers(1);
+ // waitForTopology(servers[0], 1);
+ // startServers(1);
+ // waitForTopology(servers[0], 2);
+ // stopServers(0,1);
+ // }
+ // catch (Throwable e)
+ // {
+ // e.printStackTrace(System.out);
+ // throw e;
+ // }
+ for (int i = 0; i < 100; i++)
+ {
+ log.info("#stop #test #" + i);
+ stopServers(1);
+ waitForTopology(servers[0], 1, 2000);
+ log.info("#start #test #" + i);
+ startServers(1);
+ waitForTopology(servers[0], 2, 2000);
+ }
+
+ }
+
public void testStopStart() throws Exception
{
startServers(0, 1);
@@ -163,23 +193,27 @@
verifyNotReceive(0, 1);
removeConsumer(1);
-
+
closeSessionFactory(1);
-
+
log.info("*********** Stopping server 1");
stopServers(1);
log.info("*********** Stopped server 1");
System.out.println(clusterDescription(servers[0]));
-
+
// Sleep some time as the node should be retrying
// The retry here is part of the test
- Thread.sleep(1000);
+ Thread.sleep(10);
- log.info ("********* Starting server 1");
+ waitForTopology(servers[0], 1);
+
+ log.info("********* Starting server 1");
startServers(1);
- log.info ("********* Describing servers");
+ waitForTopology(servers[0], 2);
+
+ log.info("********* Describing servers");
log.info(servers[0].describe());
log.info(servers[1].describe());
@@ -199,6 +233,6 @@
verifyReceiveRoundRobin(10, 0, 1);
verifyNotReceive(0, 1);
- stopServers(0, 1);
+ stopServers(0, 1);
}
}
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-07-28
01:32:47 UTC (rev 11060)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTestBase.java 2011-07-28
01:34:23 UTC (rev 11061)
@@ -214,8 +214,7 @@
}
catch (IOException e)
{
- e.printStackTrace();
- System.exit(9);
+ throw e;
}
try
{
@@ -224,8 +223,7 @@
}
catch (IOException e)
{
- e.printStackTrace();
- System.exit(9);
+ throw e;
}
}
Modified:
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
---
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-07-28
01:32:47 UTC (rev 11060)
+++
branches/Branch_2_2_EAP_cluster_clean2/tests/src/org/hornetq/tests/util/UnitTestCase.java 2011-07-28
01:34:23 UTC (rev 11061)
@@ -961,6 +961,7 @@
if (invmSize > 0)
{
InVMRegistry.instance.clear();
+ log.info(threadDump("Thread dump"));
fail("invm registry still had acceptors registered");
}