[mod_cluster-commits] mod_cluster SVN: r794 - in trunk/test/java: src/test/java/org/jboss/mod_cluster and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Apr 6 03:44:24 EDT 2012


Author: jfrederic.clere at jboss.com
Date: 2012-04-06 03:44:24 -0400 (Fri, 06 Apr 2012)
New Revision: 794

Added:
   trunk/test/java/src/test/java/org/jboss/mod_cluster/TestBaseJgroups.java
Modified:
   trunk/test/java/pom.xml
Log:
Arrange pom.
Prepare JGroups tests.


Modified: trunk/test/java/pom.xml
===================================================================
--- trunk/test/java/pom.xml	2012-04-06 07:35:06 UTC (rev 793)
+++ trunk/test/java/pom.xml	2012-04-06 07:44:24 UTC (rev 794)
@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.jboss.mod_cluster</groupId>
         <artifactId>mod_cluster-parent</artifactId>
-        <version>1.2.0.Beta5-SNAPSHOT</version>
+        <version>1.2.1.Beta2-SNAPSHOT</version>
         <relativePath>../..</relativePath>
     </parent>
     <artifactId>mod_cluster-tests</artifactId>

Added: trunk/test/java/src/test/java/org/jboss/mod_cluster/TestBaseJgroups.java
===================================================================
--- trunk/test/java/src/test/java/org/jboss/mod_cluster/TestBaseJgroups.java	                        (rev 0)
+++ trunk/test/java/src/test/java/org/jboss/mod_cluster/TestBaseJgroups.java	2012-04-06 07:44:24 UTC (rev 794)
@@ -0,0 +1,106 @@
+/*
+ *  mod_cluster
+ *
+ *  Copyright(c) 2012 Red Hat Middleware, LLC,
+ *  and individual contributors as indicated by the @authors tag.
+ *  See the copyright.txt in the distribution for a
+ *  full listing of individual contributors.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library in the file COPYING.LIB;
+ *  if not, write to the Free Software Foundation, Inc.,
+ *  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.mod_cluster;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.Engine;
+import org.apache.catalina.Service;
+import org.jboss.modcluster.ModClusterService;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardServer;
+
+public class TestBaseJgroups extends TestCase {
+
+    /* Test that the sessions are really sticky */
+    public void testBase() {
+
+        boolean clienterror = false;
+        StandardServer server = Maintest.getServer();
+        ModClusterService cluster = null;
+        JBossWeb service = null;
+
+        System.out.println("TestBaseJgroups Started");
+        try {
+            service = new JBossWeb("node1",  "localhost");
+            service.addConnector(8011);
+            server.addService(service);
+            cluster = Maintest.createClusterListener("224.0.1.105", 23364, false, null, true, false, true, "secret");
+        } catch(Exception ex) {
+            ex.printStackTrace();
+            fail("can't start service");
+        }
+
+        // start the server thread.
+        ServerThread wait = new ServerThread(3000, server);
+        wait.start();
+         
+        // Wait until httpd we know about httpd.
+        String [] nodes = new String[1];
+        nodes[0] = "node1";
+        int countinfo = 0;
+        while ((!Maintest.checkProxyInfo(cluster, nodes)) && countinfo < 20) {
+            try {
+                Thread.sleep(3000);
+            } catch (InterruptedException ex) {
+                ex.printStackTrace();
+            }
+            countinfo++;
+        }
+
+        // Stop the jboss and remove the services.
+        try {
+            wait.stopit();
+            wait.join();
+            server.removeService(service);
+        } catch (InterruptedException ex) {
+            ex.printStackTrace();
+            fail("can't stop service");
+        }
+        if (clienterror)
+            fail("Client error");
+
+        // Wait until httpd as received the stop messages.
+        countinfo = 0;
+        while ((!Maintest.checkProxyInfo(cluster, null)) && countinfo < 20) {
+            try {
+                Thread.sleep(3000);
+            } catch (InterruptedException ex) {
+                ex.printStackTrace();
+            }
+            countinfo++;
+        }
+        Maintest.StopClusterListener();
+        
+        System.gc();
+        System.out.println("TestBaseJgroups Done");
+    }
+}



More information about the mod_cluster-commits mailing list