Author: jfrederic.clere(a)jboss.com
Date: 2009-01-27 16:32:36 -0500 (Tue, 27 Jan 2009)
New Revision: 2228
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/ClientBasicAuthen.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestBase.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java
Log:
Arrange the traces and tests...
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/ClientBasicAuthen.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/ClientBasicAuthen.java 2009-01-27
21:18:44 UTC (rev 2227)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/ClientBasicAuthen.java 2009-01-27
21:32:36 UTC (rev 2228)
@@ -85,7 +85,7 @@
}
// Debug Stuff
- Maintest.listServices();
+ // Maintest.listServices();
} catch(IOException ex) {
ex.printStackTrace();
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2009-01-27 21:18:44
UTC (rev 2227)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2009-01-27 21:32:36
UTC (rev 2228)
@@ -33,6 +33,7 @@
import junit.textui.TestRunner;
import java.lang.Exception;
+import java.net.Socket;
import org.apache.catalina.ServerFactory;
import org.apache.catalina.Service;
@@ -211,4 +212,37 @@
}
return true;
}
+ public static void testPort(int port) {
+ Socket s = null;
+ try {
+ s = new Socket("localhost", port);
+ s.setSoLinger(true, 0);
+ } catch (Exception e) {
+ System.out.println("Can't connect to " + port);
+ } finally {
+ if (s != null) {
+ System.out.println("Was connected to " + port);
+ try {
+ s.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+ static boolean TestForNodes(LifecycleListener lifecycle, String [] nodes) {
+ int countinfo = 0;
+ while ((!Maintest.checkProxyInfo(lifecycle, nodes)) && countinfo < 20)
{
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ countinfo++;
+ }
+ if (countinfo == 20)
+ return false;
+ else
+ return true;
+ }
+
}
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java 2009-01-27 21:18:44
UTC (rev 2227)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java 2009-01-27 21:32:36
UTC (rev 2228)
@@ -52,6 +52,7 @@
JBossWeb [] service = new JBossWeb[numbnodes];
LifecycleListener lifecycle = null;
+ System.out.println("TestAddDel Started");
StandardServer server = Maintest.getServer();
for (int i=0; i<numbnodes; i++) {
try {
@@ -73,7 +74,7 @@
server.addLifecycleListener(lifecycle);
// Debug Stuff
- Maintest.listServices();
+ // Maintest.listServices();
// start the server thread.
ServerThread wait = new ServerThread(3000, server);
@@ -158,6 +159,7 @@
if (clienterror)
fail("Client error");
+ System.out.println("TestAddDel Done");
}
}
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestBase.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestBase.java 2009-01-27 21:18:44
UTC (rev 2227)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestBase.java 2009-01-27 21:32:36
UTC (rev 2228)
@@ -49,6 +49,8 @@
JBossWeb service = null;
JBossWeb service2 = null;
LifecycleListener cluster = null;
+
+ System.out.println("TestBase Started");
try {
// server = (StandardServer) ServerFactory.getServer();
@@ -64,7 +66,7 @@
server.addLifecycleListener(cluster);
// Debug Stuff
- Maintest.listServices();
+ // Maintest.listServices();
} catch(IOException ex) {
ex.printStackTrace();
@@ -125,6 +127,7 @@
// Wait until httpd as received the stop messages.
countinfo = 0;
+ nodes = null;
while ((!Maintest.checkProxyInfo(cluster, nodes)) && countinfo < 20)
{
try {
Thread.sleep(3000);
@@ -134,5 +137,6 @@
countinfo++;
}
System.gc();
+ System.out.println("TestBase Done");
}
}
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java 2009-01-27
21:18:44 UTC (rev 2227)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java 2009-01-27
21:32:36 UTC (rev 2228)
@@ -53,6 +53,7 @@
Connector connector = null;
Connector connector2 = null;
LifecycleListener cluster = null;
+ System.out.println("TestFailover Started");
try {
// server = (StandardServer) ServerFactory.getServer();
@@ -66,7 +67,7 @@
cluster = Maintest.createClusterListener("232.0.0.2", 23364, false,
"dom1");
server.addLifecycleListener(cluster);
- Maintest.listServices();
+ // Maintest.listServices();
} catch(IOException ex) {
ex.printStackTrace();
@@ -143,14 +144,14 @@
}
// Wait until httpd as received the stop messages.
- try {
- Thread.sleep(5000);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
+ Maintest.TestForNodes(cluster, null);
// Test client result.
if (clienterror)
fail("Client test failed");
+
+ Maintest.testPort(8009);
+ Maintest.testPort(8010);
+ System.out.println("TestFailover Done");
}
}
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java 2009-01-27
21:18:44 UTC (rev 2227)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java 2009-01-27
21:32:36 UTC (rev 2228)
@@ -53,6 +53,7 @@
Connector connector = null;
Connector connector2 = null;
LifecycleListener cluster = null;
+ System.out.println("TestStickyForce Started");
try {
// server = (StandardServer) ServerFactory.getServer();
@@ -66,7 +67,7 @@
cluster = Maintest.createClusterListener("232.0.0.2", 23364,
false);
server.addLifecycleListener(cluster);
- Maintest.listServices();
+ // Maintest.listServices();
} catch(IOException ex) {
ex.printStackTrace();
@@ -105,11 +106,14 @@
// Stop the connector that has received the request...
String node = client.getnode();
+ int port;
if ("sticky4".equals(node)) {
connector = connector2;
node = "sticky3";
+ port = 8010;
} else {
node = "sticky4";
+ port = 8009;
}
if (connector != null) {
try {
@@ -161,9 +165,16 @@
}
countinfo++;
}
+ if (countinfo == 30) {
+ System.out.println("Can't stop...");
+ }
+ Maintest.testPort(8009);
+ Maintest.testPort(8010);
+
// Test client result.
if ( !clienterror && client.httpResponseCode != 503 )
fail("Client test should have failed");
+ System.out.println("TestStickyForce Done");
}
}
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java 2009-01-27
21:18:44 UTC (rev 2227)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java 2009-01-27
21:32:36 UTC (rev 2228)
@@ -53,6 +53,7 @@
Connector connector = null;
Connector connector2 = null;
LifecycleListener cluster = null;
+ System.out.println("TestStickyRemove Started");
try {
// server = (StandardServer) ServerFactory.getServer();
@@ -66,7 +67,7 @@
cluster = Maintest.createClusterListener("232.0.0.2", 23364, false,
null, true, true, false);
server.addLifecycleListener(cluster);
- Maintest.listServices();
+ // Maintest.listServices();
} catch(IOException ex) {
ex.printStackTrace();
@@ -155,5 +156,6 @@
fail("Client test failed");
if (client.requestedSessionId != null)
fail("Client client received a sessionid");
+ System.out.println("TestStickyRemove Done");
}
}