[mod_cluster-commits] mod_cluster SVN: r818 - trunk/test/java/src/test/java/org/jboss/mod_cluster.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Apr 26 09:28:31 EDT 2012


Author: jfrederic.clere at jboss.com
Date: 2012-04-26 09:28:30 -0400 (Thu, 26 Apr 2012)
New Revision: 818

Modified:
   trunk/test/java/src/test/java/org/jboss/mod_cluster/TestAddDel.java
   trunk/test/java/src/test/java/org/jboss/mod_cluster/TestChunkedMCPM.java
Log:
Make sure we try more than one in fact the nodes may need a while to start and send the CONFIG message to httpd.


Modified: trunk/test/java/src/test/java/org/jboss/mod_cluster/TestAddDel.java
===================================================================
--- trunk/test/java/src/test/java/org/jboss/mod_cluster/TestAddDel.java	2012-04-26 11:52:30 UTC (rev 817)
+++ trunk/test/java/src/test/java/org/jboss/mod_cluster/TestAddDel.java	2012-04-26 13:28:30 UTC (rev 818)
@@ -87,54 +87,63 @@
         }
 
         // Read the result via INFO.
-        String result = Maintest.getProxyInfo(lifecycle);
-
-        ArrayList nodes = new ArrayList();
-        if (result != null) {
-            System.out.println(result);
-            String [] records = result.split("\n");
-            int l = 0;
-            for (int i=0; i<records.length; i++) {
-                // System.out.println("records[" + i + "]: " + records[i]);
-                NodeInfo nodeinfo = null;
-                String [] results = records[i].split(",");
-                for (int j=0; j<results.length; j++, l++) {
-                    // System.out.println("results[" + j + "]: " + results[j]);
-                    String [] data = results[j].split(": ");
-                    // System.out.println("data[" + 0 + "]: " + data[0] + "*");
-                    if ("Node".equals(data[0]) && nodeinfo == null) {
-                        nodeinfo = new NodeInfo();
-                        continue;
+        int count = 0;
+        String result = null;
+        while (count < 20) {        
+            result = Maintest.getProxyInfo(lifecycle);
+            if (result != null) {
+                /* analyse the result */
+                ArrayList nodes = new ArrayList();
+                System.out.println(result);
+                String [] records = result.split("\n");
+                int l = 0;
+                for (int i=0; i<records.length; i++) {
+                    // System.out.println("records[" + i + "]: " + records[i]);
+                    NodeInfo nodeinfo = null;
+                    String [] results = records[i].split(",");
+                    for (int j=0; j<results.length; j++, l++) {
+                        // System.out.println("results[" + j + "]: " + results[j]);
+                        String [] data = results[j].split(": ");
+                        // System.out.println("data[" + 0 + "]: " + data[0] + "*");
+                        if ("Node".equals(data[0]) && nodeinfo == null) {
+                            nodeinfo = new NodeInfo();
+                            continue;
+                        }
+                        if ("Name".equals(data[0])) {
+                            nodeinfo.JVMRoute = data[1];
+                        }
+                        else if ("Load".equals(data[0])) {
+                            nodeinfo.lbfactor = Integer.valueOf(data[1]).intValue();
+                        }
+                        else if ("Elected".equals(data[0])) {
+                            nodeinfo.elected = Integer.valueOf(data[1]).intValue();
+                        }
                     }
-                    if ("Name".equals(data[0])) {
-                        nodeinfo.JVMRoute = data[1];
+                    if (nodeinfo != null) {
+                        // System.out.println("Adding: " + nodeinfo);
+                        nodes.add(nodeinfo);
                     }
-                    else if ("Load".equals(data[0])) {
-                        nodeinfo.lbfactor = Integer.valueOf(data[1]).intValue();
-                    }
-                    else if ("Elected".equals(data[0])) {
-                        nodeinfo.elected = Integer.valueOf(data[1]).intValue();
-                    }
                 }
-                if (nodeinfo != null) {
-                    // System.out.println("Adding: " + nodeinfo);
-                    nodes.add(nodeinfo);
+                if (!NodeInfo.check(nodes, nodenames)) {
+                    System.out.println("getProxyInfo nodes incorrect");
+                    NodeInfo.print(nodes, nodenames);
+                } else {
+                    clienterror = false;
+                    break; /* Done OK */
                 }
             }
-        } else {
+            count++;
+            try {
+                Thread.sleep(3000);
+            } catch (InterruptedException ex) {
+                ex.printStackTrace();
+            }
+        }
+        if (result == null) {
             System.out.println("getProxyInfo failed");
             clienterror = true;
         }
 
-        // Check the nodes.
-        if (!clienterror) {
-            if (!NodeInfo.check(nodes, nodenames)) {
-                System.out.println("getProxyInfo nodes incorrect");
-                NodeInfo.print(nodes, nodenames);
-                clienterror = true;
-            }
-        }
-         
         // Stop the jboss and remove the services.
         try {
             wait.stopit();

Modified: trunk/test/java/src/test/java/org/jboss/mod_cluster/TestChunkedMCPM.java
===================================================================
--- trunk/test/java/src/test/java/org/jboss/mod_cluster/TestChunkedMCPM.java	2012-04-26 11:52:30 UTC (rev 817)
+++ trunk/test/java/src/test/java/org/jboss/mod_cluster/TestChunkedMCPM.java	2012-04-26 13:28:30 UTC (rev 818)
@@ -45,7 +45,7 @@
     /* Test */
     public void testChunkedMCPM() {
 
-        boolean clienterror = false;
+        boolean clienterror = true;
         int numbnodes = 30;
         String [] nodenames = new String [numbnodes];
         JBossWeb [] service = new JBossWeb[numbnodes];
@@ -87,12 +87,51 @@
         }
 
         // Read the result via INFO.
-        String result = null;
         int count = 0;
+        String result = null;
         while (count < 20) {
             result = Maintest.getProxyInfo(lifecycle);
-            if (result != null)
-                break;
+            if (result != null) {
+                /* analyse the result */
+                ArrayList nodes = new ArrayList();
+                System.out.println(result);
+                String [] records = result.split("\n");
+                int l = 0;
+                for (int i=0; i<records.length; i++) {
+                    // System.out.println("records[" + i + "]: " + records[i]);
+                    NodeInfo nodeinfo = null;
+                    String [] results = records[i].split(",");
+                    for (int j=0; j<results.length; j++, l++) {
+                        // System.out.println("results[" + j + "]: " + results[j]);
+                        String [] data = results[j].split(": ");
+                        // System.out.println("data[" + 0 + "]: " + data[0] + "*");
+                        if ("Node".equals(data[0]) && nodeinfo == null) {
+                            nodeinfo = new NodeInfo();
+                            continue;
+                        }
+                        if ("Name".equals(data[0])) {
+                            nodeinfo.JVMRoute = data[1];
+                        }
+                        else if ("Load".equals(data[0])) {
+                            nodeinfo.lbfactor = Integer.valueOf(data[1]).intValue();
+                        }
+                        else if ("Elected".equals(data[0])) {
+                            nodeinfo.elected = Integer.valueOf(data[1]).intValue();
+                        }
+                    }
+                    if (nodeinfo != null) {
+                        // System.out.println("Adding: " + nodeinfo);
+                        nodes.add(nodeinfo);
+                    }
+                }
+                if (!NodeInfo.check(nodes, nodenames)) {
+                    System.out.println("getProxyInfo nodes incorrect");
+                    NodeInfo.print(nodes, nodenames);
+                } else {
+                    clienterror = false;
+                    break; /* Done OK */
+                }
+            }
             count++;
             try {
                 Thread.sleep(3000);
@@ -101,52 +140,11 @@
             }
         }
 
-        ArrayList nodes = new ArrayList();
-        if (result != null) {
-            System.out.println(result);
-            String [] records = result.split("\n");
-            int l = 0;
-            for (int i=0; i<records.length; i++) {
-                // System.out.println("records[" + i + "]: " + records[i]);
-                NodeInfo nodeinfo = null;
-                String [] results = records[i].split(",");
-                for (int j=0; j<results.length; j++, l++) {
-                    // System.out.println("results[" + j + "]: " + results[j]);
-                    String [] data = results[j].split(": ");
-                    // System.out.println("data[" + 0 + "]: " + data[0] + "*");
-                    if ("Node".equals(data[0]) && nodeinfo == null) {
-                        nodeinfo = new NodeInfo();
-                        continue;
-                    }
-                    if ("Name".equals(data[0])) {
-                        nodeinfo.JVMRoute = data[1];
-                    }
-                    else if ("Load".equals(data[0])) {
-                        nodeinfo.lbfactor = Integer.valueOf(data[1]).intValue();
-                    }
-                    else if ("Elected".equals(data[0])) {
-                        nodeinfo.elected = Integer.valueOf(data[1]).intValue();
-                    }
-                }
-                if (nodeinfo != null) {
-                    // System.out.println("Adding: " + nodeinfo);
-                    nodes.add(nodeinfo);
-                }
-            }
-        } else {
+        if (result == null) {
             System.out.println("getProxyInfo failed");
             clienterror = true;
         }
 
-        // Check the nodes.
-        if (!clienterror) {
-            if (!NodeInfo.check(nodes, nodenames)) {
-                System.out.println("getProxyInfo nodes incorrect");
-                NodeInfo.print(nodes, nodenames);
-                clienterror = true;
-            }
-        }
-         
         // Stop the jboss and remove the services.
         try {
             wait.stopit();



More information about the mod_cluster-commits mailing list