JBoss Native SVN: r1799 - in trunk/mod_cluster/test/java: org/jboss/mod_cluster and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-09-11 10:30:52 -0400 (Thu, 11 Sep 2008)
New Revision: 1799
Added:
trunk/mod_cluster/test/java/README.txt
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Test_Chunk_JBWEB_117.java
Modified:
trunk/mod_cluster/test/java/build.xml
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestJBWEB_117.java
Log:
Add some more test and allow a single test by:
ant one -Dtest=test
Added: trunk/mod_cluster/test/java/README.txt
===================================================================
--- trunk/mod_cluster/test/java/README.txt (rev 0)
+++ trunk/mod_cluster/test/java/README.txt 2008-09-11 14:30:52 UTC (rev 1799)
@@ -0,0 +1,7 @@
+The test directory contains to kind of tests:
+1 - small test using httpclient that allows to read directly information from httpd (TestHttpClient).
+2 - small test suite:
+ to run it:
+ ant
+ to run a single test:
+ ant one -Dtest=test where test is for example Test_Chunk_JBWEB_117
Modified: trunk/mod_cluster/test/java/build.xml
===================================================================
--- trunk/mod_cluster/test/java/build.xml 2008-09-11 12:06:47 UTC (rev 1798)
+++ trunk/mod_cluster/test/java/build.xml 2008-09-11 14:30:52 UTC (rev 1799)
@@ -89,4 +89,13 @@
</java>
</target>
+ <target name="one" depends="compile">
+ <copy file="conf/web.xml" todir="${test.classes}/conf"/>
+ <java dir="${test.classes}" classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
+ <arg value="org.jboss.mod_cluster.Maintest"/>
+ <jvmarg value="-Dtest=${test}"/>
+ <classpath refid="tomcat.test.classpath"/>
+ </java>
+
+ </target>
</project>
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2008-09-11 12:06:47 UTC (rev 1798)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2008-09-11 14:30:52 UTC (rev 1799)
@@ -27,6 +27,10 @@
package org.jboss.mod_cluster;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
@@ -39,6 +43,7 @@
String post = null;
String user = null;
String pass = null;
+ InputStream fd = null;
private int nbtest = 10;
private int delay = 1000;
@@ -70,6 +75,32 @@
ex.printStackTrace();
}
}
+
+ /**
+ * Run the first test.
+ *
+ * @param URL URL to connect to.
+ * @param nbtest number of test the thread will run (not counting this one).
+ * @param checkcookie check that the jsessionid cookie is not changing during the test.
+ * @param post data to send in the POST.
+ * @param user username of the BASIC authentication.
+ * @param pass password of the usr for the BASIC authentication.
+ * @param fd file containing the data to send chuncked in the POST (post content is ignored in this case).
+ *
+ * @return The http code returned by the server.
+ *
+ * @throws IOException for any failures.
+ */
+ public int runit(String URL, int nbtest, boolean checkcookie, String post, String user, String pass, InputStream fd) throws Exception
+ {
+ this.fd = fd;
+ return runit(URL, nbtest, checkcookie, post, user, pass);
+ }
+ public int runit(String URL, int nbtest, boolean checkcookie, String post, String user, String pass, File fd) throws Exception
+ {
+ this.fd = new FileInputStream(fd);
+ return runit(URL, nbtest, checkcookie, post, user, pass);
+ }
public int runit(String URL, int nbtest, boolean checkcookie, String post, String user, String pass) throws Exception
{
this.post = post;
@@ -94,16 +125,22 @@
PostMethod pm = null;
GetMethod gm = null;
HttpMethodBase bm = null;
- if (post == null) {
- gm = new GetMethod(URL);
- bm = gm;
- } else {
+ if (fd != null) {
pm = new PostMethod(URL);
+ pm.setRequestBody(fd);
+ pm.setHttp11(true);
+ pm.setRequestContentLength(PostMethod.CONTENT_LENGTH_CHUNKED);
+ bm = pm;
+ } else if (post != null) {
+ pm = new PostMethod(URL);
pm.setRequestEntity(new StringRequestEntity(post,
"application/x-www-form-urlencoded",
"UTF8"));
bm = pm;
- }
+ } else {
+ gm = new GetMethod(URL);
+ bm = gm;
+ }
if (user != null) {
Credentials cred = new UsernamePasswordCredentials(user,pass);
httpClient.getState().setCredentials(org.apache.commons.httpclient.auth.AuthScope.ANY, cred);
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2008-09-11 12:06:47 UTC (rev 1798)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2008-09-11 14:30:52 UTC (rev 1799)
@@ -49,16 +49,32 @@
public static Test suite() {
TestSuite suite = new TestSuite();
server = (StandardServer) ServerFactory.getServer();
-/*
- suite.addTest(new TestSuite(TestAddDel.class));
- System.gc();
- suite.addTest(new TestSuite(TestBase.class));
- System.gc();
- suite.addTest(new TestSuite(TestFailover.class));
- System.gc();
- */
- suite.addTest(new TestSuite(TestJBWEB_117.class));
- System.gc();
+
+ // Read the -Dtest="value".
+ String test = System.getProperty("test");
+ if (test != null) {
+ System.out.println("Running single test: " + test);
+ try {
+ Class clazz = Class.forName("org.jboss.mod_cluster." + test);
+ suite.addTest(new TestSuite(clazz));
+ } catch (ClassNotFoundException ex) {
+ System.out.println("Running single test: " + test + "Not found");
+ return null;
+ }
+ } else {
+ suite.addTest(new TestSuite(TestAddDel.class));
+ System.gc();
+ suite.addTest(new TestSuite(TestBase.class));
+ System.gc();
+ suite.addTest(new TestSuite(TestFailover.class));
+ System.gc();
+ suite.addTest(new TestSuite(TestJBWEB_117.class));
+ System.gc();
+ suite.addTest(new TestSuite(Test_Native_JBWEB_117.class));
+ System.gc();
+ suite.addTest(new TestSuite(Test_Chunk_JBWEB_117.class));
+ System.gc();
+ }
return suite;
}
static StandardServer getServer() {
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestJBWEB_117.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestJBWEB_117.java 2008-09-11 12:06:47 UTC (rev 1798)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestJBWEB_117.java 2008-09-11 14:30:52 UTC (rev 1799)
@@ -28,6 +28,10 @@
package org.jboss.mod_cluster;
import java.io.IOException;
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.ByteArrayInputStream;
import junit.framework.TestCase;
@@ -47,6 +51,20 @@
/* Test for JBWEB-117 */
public void testJBWEB_117() {
+ testJBWEB_117(false, (File) null);
+ }
+ public void testJBWEB_117(boolean nat, File fd) {
+ InputStream in = null;
+ if (fd != null)
+ try {
+ in = new FileInputStream(fd);
+ } catch(IOException ex) {
+ ex.printStackTrace();
+ fail("can't start service");
+ }
+ testJBWEB_117(nat, in);
+ }
+ public void testJBWEB_117(boolean nat, InputStream fd) {
boolean clienterror = false;
StandardServer server = Maintest.getServer();
@@ -55,8 +73,12 @@
try {
// server = (StandardServer) ServerFactory.getServer();
- service = new JBossWeb("node1", "localhost", true);
- service.addConnector(8009, "org.apache.coyote.ajp.AjpAprProtocol");
+ service = new JBossWeb("node1", "localhost", nat);
+ if (nat)
+ service.addConnector(8009, "org.apache.coyote.ajp.AjpAprProtocol");
+ else
+ service.addConnector(8009, "ajp");
+
service.addWAR("JBWEB-117.war", "node1");
server.addService(service);
@@ -68,8 +90,10 @@
server.addLifecycleListener((LifecycleListener) cluster);
// Add AprLifecycleListener.
- AprLifecycleListener listener = new AprLifecycleListener();
- server.addLifecycleListener((LifecycleListener) listener);
+ if (nat) {
+ AprLifecycleListener listener = new AprLifecycleListener();
+ server.addLifecycleListener((LifecycleListener) listener);
+ }
// Debug Stuff
Maintest.listServices();
@@ -99,7 +123,7 @@
data = data.concat("a");
int ret = 0;
try {
- ret = client.runit("http://localhost:7779/JBWEB-117/JBWEB_117", 1, true, data, "manager" , "manager");
+ ret = client.runit("http://localhost:7779/JBWEB-117/JBWEB_117", 1, true, data, "manager" , "manager", fd);
client.start();
client.join();
} catch (Exception ex) {
Added: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Test_Chunk_JBWEB_117.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Test_Chunk_JBWEB_117.java (rev 0)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Test_Chunk_JBWEB_117.java 2008-09-11 14:30:52 UTC (rev 1799)
@@ -0,0 +1,59 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 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 java.io.File;
+import java.io.FileOutputStream;
+import java.io.ByteArrayInputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.Engine;
+import org.apache.catalina.ServerFactory;
+import org.apache.catalina.Service;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardServer;
+
+import org.jboss.web.cluster.ClusterListener;
+
+import org.apache.catalina.core.AprLifecycleListener;
+
+public class Test_Chunk_JBWEB_117 extends TestJBWEB_117 {
+
+ /* Test for JBWEB-117 */
+ public void test_Chunk_JBWEB_117() {
+ byte [] buf = new byte[1024*6];
+ for (int i=0; i<buf.length;i++)
+ buf[i] = 'a';
+ ByteArrayInputStream fd = new ByteArrayInputStream(buf);
+ super.testJBWEB_117(false, fd);
+ }
+}
15 years, 7 months
JBoss Native SVN: r1798 - trunk/build/daemon.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-09-11 08:06:47 -0400 (Thu, 11 Sep 2008)
New Revision: 1798
Added:
trunk/build/daemon/buildmdc.sh
trunk/build/daemon/buildnat.bat
trunk/build/daemon/buildnat.sh
Log:
Separe the builds of mod_cluster (httpd) and jbossnative.
Added: trunk/build/daemon/buildmdc.sh
===================================================================
--- trunk/build/daemon/buildmdc.sh (rev 0)
+++ trunk/build/daemon/buildmdc.sh 2008-09-11 12:06:47 UTC (rev 1798)
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Copyright(c) 2007 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 Mladen Turk
+#
+echo ""
+echo "Running `basename $0` $LastChangedDate: 2008-07-23 16:17:15 +0200 (Wed, 23 Jul 2008) $"
+echo ""
+echo "Started : `date`"
+echo "Params : $@"
+echo ""
+
+build_ssl=true
+
+while [ "x" != "x$1" ]
+do
+ case $1 in
+ -env)
+ echo "Dumping environment"
+ env
+ echo ""
+ ;;
+ -no-ssl)
+ build_ssl=false
+ ;;
+ esac
+ shift
+done
+
+(cd ../unix
+ if $build_ssl; then
+ ./build.sh rhel-httpd -ssl -cache
+ fi
+ ./build.sh rhel-httpd -cache
+)
Property changes on: trunk/build/daemon/buildmdc.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/build/daemon/buildnat.bat
===================================================================
--- trunk/build/daemon/buildnat.bat (rev 0)
+++ trunk/build/daemon/buildnat.bat 2008-09-11 12:06:47 UTC (rev 1798)
@@ -0,0 +1,58 @@
+@echo off
+REM Copyright(c) 2007 Red Hat Middleware, LLC,
+REM and individual contributors as indicated by the @authors tag.
+REM See the copyright.txt in the distribution for a
+REM full listing of individual contributors.
+REM
+REM This library is free software; you can redistribute it and/or
+REM modify it under the terms of the GNU Lesser General Public
+REM License as published by the Free Software Foundation; either
+REM version 2 of the License, or (at your option) any later version.
+REM
+REM This library is distributed in the hope that it will be useful,
+REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+REM Lesser General Public License for more details.
+REM
+REM You should have received a copy of the GNU Lesser General Public
+REM License along with this library in the file COPYING.LIB;
+REM if not, write to the Free Software Foundation, Inc.,
+REM 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+REM
+REM @author Mladen Turk
+REM
+
+@if not "%ECHO%" == "" echo %ECHO%
+@if "%OS%" == "Windows_NT" setlocal
+
+if "%OS%" == "Windows_NT" (
+set "DIRNAME=%~dp0%"
+set "PROGNAME=%~nx0%"
+) else (
+set DIRNAME=.\
+set PROGNAME=buildall.bat
+)
+
+pushd %DIRNAME%..
+set BUILD_HOME=%CD%
+popd
+
+echo.
+echo Running : %PROGNAME% $LastChangedDate: 2008-07-23 16:17:15 +0200 (Wed, 23 Jul 2008) $
+echo.
+echo Started : %DATE% %TIME%
+echo.
+
+
+pushd %BUILD_HOME%\windows
+
+call build.bat sdk x86 jboss-native -ssl -cache
+call build.bat sdk x64 jboss-native -ssl -cache
+call build.bat sdk i64 jboss-native -ssl -cache
+
+REM Uncomment for building sight
+REM call build.bat sdk x86 jboss-sight -cache
+REM call build.bat sdk x64 jboss-sight -cache
+REM call build.bat sdk i64 jboss-sight -cache
+
+popd
Added: trunk/build/daemon/buildnat.sh
===================================================================
--- trunk/build/daemon/buildnat.sh (rev 0)
+++ trunk/build/daemon/buildnat.sh 2008-09-11 12:06:47 UTC (rev 1798)
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Copyright(c) 2007 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 Mladen Turk
+#
+echo ""
+echo "Running `basename $0` $LastChangedDate: 2008-07-23 16:17:15 +0200 (Wed, 23 Jul 2008) $"
+echo ""
+echo "Started : `date`"
+echo "Params : $@"
+echo ""
+
+build_ssl=true
+
+while [ "x" != "x$1" ]
+do
+ case $1 in
+ -env)
+ echo "Dumping environment"
+ env
+ echo ""
+ ;;
+ -no-ssl)
+ build_ssl=false
+ ;;
+ esac
+ shift
+done
+
+(cd ../unix
+ if $build_ssl; then
+ ./build.sh jboss-native -ssl -cache
+ fi
+ ./build.sh jboss-native -cache
+)
Property changes on: trunk/build/daemon/buildnat.sh
___________________________________________________________________
Name: svn:executable
+ *
15 years, 7 months
JBoss Native SVN: r1797 - trunk/build/daemon.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-09-11 05:37:15 -0400 (Thu, 11 Sep 2008)
New Revision: 1797
Added:
trunk/build/daemon/buildmdc.bat
Removed:
trunk/build/daemon/builmdc.bat
Log:
Oops wrong name...
Copied: trunk/build/daemon/buildmdc.bat (from rev 1796, trunk/build/daemon/builmdc.bat)
===================================================================
--- trunk/build/daemon/buildmdc.bat (rev 0)
+++ trunk/build/daemon/buildmdc.bat 2008-09-11 09:37:15 UTC (rev 1797)
@@ -0,0 +1,54 @@
+@echo off
+REM Copyright(c) 2007 Red Hat Middleware, LLC,
+REM and individual contributors as indicated by the @authors tag.
+REM See the copyright.txt in the distribution for a
+REM full listing of individual contributors.
+REM
+REM This library is free software; you can redistribute it and/or
+REM modify it under the terms of the GNU Lesser General Public
+REM License as published by the Free Software Foundation; either
+REM version 2 of the License, or (at your option) any later version.
+REM
+REM This library is distributed in the hope that it will be useful,
+REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+REM Lesser General Public License for more details.
+REM
+REM You should have received a copy of the GNU Lesser General Public
+REM License along with this library in the file COPYING.LIB;
+REM if not, write to the Free Software Foundation, Inc.,
+REM 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+REM
+REM @author Mladen Turk
+REM
+
+@if not "%ECHO%" == "" echo %ECHO%
+@if "%OS%" == "Windows_NT" setlocal
+
+if "%OS%" == "Windows_NT" (
+set "DIRNAME=%~dp0%"
+set "PROGNAME=%~nx0%"
+) else (
+set DIRNAME=.\
+set PROGNAME=builmdc.bat
+)
+
+pushd %DIRNAME%..
+set BUILD_HOME=%CD%
+popd
+
+echo.
+echo Running : %PROGNAME% $LastChangedDate: 2008-07-23 16:17:15 +0200 (Wed, 23 Jul 2008) $
+echo.
+echo Started : %DATE% %TIME%
+echo.
+
+
+pushd %BUILD_HOME%\windows
+
+REM build http using rhel repos
+call build.bat sdk x86 rhel-httpd -ssl -cache
+call build.bat sdk x64 rhel-httpd -ssl -cache
+call build.bat sdk i64 rhel-httpd -ssl -cache
+
+popd
Deleted: trunk/build/daemon/builmdc.bat
===================================================================
--- trunk/build/daemon/builmdc.bat 2008-09-11 09:08:15 UTC (rev 1796)
+++ trunk/build/daemon/builmdc.bat 2008-09-11 09:37:15 UTC (rev 1797)
@@ -1,54 +0,0 @@
-@echo off
-REM Copyright(c) 2007 Red Hat Middleware, LLC,
-REM and individual contributors as indicated by the @authors tag.
-REM See the copyright.txt in the distribution for a
-REM full listing of individual contributors.
-REM
-REM This library is free software; you can redistribute it and/or
-REM modify it under the terms of the GNU Lesser General Public
-REM License as published by the Free Software Foundation; either
-REM version 2 of the License, or (at your option) any later version.
-REM
-REM This library is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-REM Lesser General Public License for more details.
-REM
-REM You should have received a copy of the GNU Lesser General Public
-REM License along with this library in the file COPYING.LIB;
-REM if not, write to the Free Software Foundation, Inc.,
-REM 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-REM
-REM @author Mladen Turk
-REM
-
-@if not "%ECHO%" == "" echo %ECHO%
-@if "%OS%" == "Windows_NT" setlocal
-
-if "%OS%" == "Windows_NT" (
-set "DIRNAME=%~dp0%"
-set "PROGNAME=%~nx0%"
-) else (
-set DIRNAME=.\
-set PROGNAME=builmdc.bat
-)
-
-pushd %DIRNAME%..
-set BUILD_HOME=%CD%
-popd
-
-echo.
-echo Running : %PROGNAME% $LastChangedDate: 2008-07-23 16:17:15 +0200 (Wed, 23 Jul 2008) $
-echo.
-echo Started : %DATE% %TIME%
-echo.
-
-
-pushd %BUILD_HOME%\windows
-
-REM build http using rhel repos
-call build.bat sdk x86 rhel-httpd -ssl -cache
-call build.bat sdk x64 rhel-httpd -ssl -cache
-call build.bat sdk i64 rhel-httpd -ssl -cache
-
-popd
15 years, 7 months
JBoss Native SVN: r1796 - trunk/build/daemon.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-09-11 05:08:15 -0400 (Thu, 11 Sep 2008)
New Revision: 1796
Added:
trunk/build/daemon/builmdc.bat
Log:
Add a script for mod_cluster (httpd bundles).
Added: trunk/build/daemon/builmdc.bat
===================================================================
--- trunk/build/daemon/builmdc.bat (rev 0)
+++ trunk/build/daemon/builmdc.bat 2008-09-11 09:08:15 UTC (rev 1796)
@@ -0,0 +1,54 @@
+@echo off
+REM Copyright(c) 2007 Red Hat Middleware, LLC,
+REM and individual contributors as indicated by the @authors tag.
+REM See the copyright.txt in the distribution for a
+REM full listing of individual contributors.
+REM
+REM This library is free software; you can redistribute it and/or
+REM modify it under the terms of the GNU Lesser General Public
+REM License as published by the Free Software Foundation; either
+REM version 2 of the License, or (at your option) any later version.
+REM
+REM This library is distributed in the hope that it will be useful,
+REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+REM Lesser General Public License for more details.
+REM
+REM You should have received a copy of the GNU Lesser General Public
+REM License along with this library in the file COPYING.LIB;
+REM if not, write to the Free Software Foundation, Inc.,
+REM 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+REM
+REM @author Mladen Turk
+REM
+
+@if not "%ECHO%" == "" echo %ECHO%
+@if "%OS%" == "Windows_NT" setlocal
+
+if "%OS%" == "Windows_NT" (
+set "DIRNAME=%~dp0%"
+set "PROGNAME=%~nx0%"
+) else (
+set DIRNAME=.\
+set PROGNAME=builmdc.bat
+)
+
+pushd %DIRNAME%..
+set BUILD_HOME=%CD%
+popd
+
+echo.
+echo Running : %PROGNAME% $LastChangedDate: 2008-07-23 16:17:15 +0200 (Wed, 23 Jul 2008) $
+echo.
+echo Started : %DATE% %TIME%
+echo.
+
+
+pushd %BUILD_HOME%\windows
+
+REM build http using rhel repos
+call build.bat sdk x86 rhel-httpd -ssl -cache
+call build.bat sdk x64 rhel-httpd -ssl -cache
+call build.bat sdk i64 rhel-httpd -ssl -cache
+
+popd
15 years, 7 months
JBoss Native SVN: r1795 - tags.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-09-10 04:32:36 -0400 (Wed, 10 Sep 2008)
New Revision: 1795
Added:
tags/2.0.5/
Log:
Tag the release.
Copied: tags/2.0.5 (from rev 1794, trunk)
15 years, 8 months
JBoss Native SVN: r1794 - trunk/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2008-09-09 18:42:38 -0400 (Tue, 09 Sep 2008)
New Revision: 1794
Modified:
trunk/mod_cluster/.classpath
Log:
Use separate output dir for test classes, as done in maven build.
Modified: trunk/mod_cluster/.classpath
===================================================================
--- trunk/mod_cluster/.classpath 2008-09-09 22:33:01 UTC (rev 1793)
+++ trunk/mod_cluster/.classpath 2008-09-09 22:42:38 UTC (rev 1794)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/cluster/jboss-ha-server-api/1.1.0.GA/jboss-ha-server-api-1.1.0.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/jboss/web/jbossweb/2.1.1.CR6/jbossweb-2.1.1.CR6.jar"/>
15 years, 8 months
JBoss Native SVN: r1793 - in trunk/mod_cluster/src: main/java/org/jboss/modcluster/advertise and 6 other directories.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2008-09-09 18:33:01 -0400 (Tue, 09 Sep 2008)
New Revision: 1793
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterService.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/AdvertiseListenerFactory.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerFactoryImpl.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerImpl.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPHandler.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerTestCase.java
Log:
Replace MCMPHandler.getConfiguration() with injection where necessary.
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/DefaultJBossWebEventHandler.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -51,7 +51,7 @@
*/
public class DefaultJBossWebEventHandler implements JBossWebEventHandler
{
- protected static Logger log = Logger.getLogger(DefaultJBossWebEventHandler.class);
+ static Logger log = Logger.getLogger(DefaultJBossWebEventHandler.class);
// ----------------------------------------------------------------- Fields
@@ -59,8 +59,9 @@
* The string manager for this package.
*/
private final StringManager sm = StringManager.getManager(Constants.Package);
- private final NodeConfiguration nodeConfiguration;
- private final BalancerConfiguration balancerConfiguration;
+ private final NodeConfiguration nodeConfig;
+ private final BalancerConfiguration balancerConfig;
+ private final MCMPHandlerConfiguration mcmpHandlerConfig;
private final MCMPHandler mcmpHandler;
private final LoadBalanceFactorProvider loadBalanceFactorProvider;
private final AdvertiseListenerFactory listenerFactory;
@@ -72,16 +73,18 @@
// ----------------------------------------------------------- Constructors
public DefaultJBossWebEventHandler(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig,
- MCMPHandler mcmpHandler, LoadBalanceFactorProvider loadBalanceFactorProvider)
+ MCMPHandlerConfiguration mcmpHandlerConfig, MCMPHandler mcmpHandler, LoadBalanceFactorProvider loadBalanceFactorProvider)
{
- this(nodeConfig, balancerConfig, mcmpHandler, loadBalanceFactorProvider, new AdvertiseListenerFactoryImpl());
+ this(nodeConfig, balancerConfig, mcmpHandlerConfig, mcmpHandler, loadBalanceFactorProvider, new AdvertiseListenerFactoryImpl());
}
- protected DefaultJBossWebEventHandler(NodeConfiguration nodeConfiguration, BalancerConfiguration balancerConfiguration,
- MCMPHandler mcmpHandler, LoadBalanceFactorProvider loadBalanceFactorProvider, AdvertiseListenerFactory listenerFactory)
+ protected DefaultJBossWebEventHandler(NodeConfiguration nodeConfig, BalancerConfiguration balancerConfig,
+ MCMPHandlerConfiguration mcmpHandlerConfig, MCMPHandler mcmpHandler,
+ LoadBalanceFactorProvider loadBalanceFactorProvider, AdvertiseListenerFactory listenerFactory)
{
- this.nodeConfiguration = nodeConfiguration;
- this.balancerConfiguration = balancerConfiguration;
+ this.nodeConfig = nodeConfig;
+ this.balancerConfig = balancerConfig;
+ this.mcmpHandlerConfig = mcmpHandlerConfig;
this.mcmpHandler = mcmpHandler;
this.loadBalanceFactorProvider = loadBalanceFactorProvider;
this.listenerFactory = listenerFactory;
@@ -91,15 +94,14 @@
public synchronized void init()
{
- MCMPHandlerConfiguration handlerConfig = this.mcmpHandler.getConfiguration();
- List<AddressPort> initialProxies = MCMPUtils.parseProxies(handlerConfig.getProxyList());
+ List<AddressPort> initialProxies = MCMPUtils.parseProxies(this.mcmpHandlerConfig.getProxyList());
this.mcmpHandler.init(initialProxies);
- Boolean advertise = handlerConfig.getAdvertise();
+ Boolean advertise = this.mcmpHandlerConfig.getAdvertise();
if (Boolean.TRUE.equals(advertise) || (advertise == null && initialProxies.isEmpty()))
{
- this.advertiseListener = this.listenerFactory.createListener(this.mcmpHandler);
+ this.advertiseListener = this.listenerFactory.createListener(this.mcmpHandler, this.mcmpHandlerConfig);
try
{
@@ -192,7 +194,7 @@
return;
}
- MCMPRequest request = MCMPUtils.createConfigRequest(engine, this.nodeConfiguration, this.balancerConfiguration);
+ MCMPRequest request = MCMPUtils.createConfigRequest(engine, this.nodeConfig, this.balancerConfig);
// Send CONFIG request
this.mcmpHandler.sendRequest(request);
@@ -277,23 +279,6 @@
this.mcmpHandler.sendRequest(request);
}
- // ----------------------------------------------------------------- Public
-
- public BalancerConfiguration getBalancerConfiguration()
- {
- return this.balancerConfiguration;
- }
-
- public NodeConfiguration getNodeConfiguration()
- {
- return this.nodeConfiguration;
- }
-
- public LoadBalanceFactorProvider getLoadBalanceFactorProvider()
- {
- return this.loadBalanceFactorProvider;
- }
-
// ---------------------------------------------------------------- Private
private void checkInit()
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterService.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterService.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterService.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -152,7 +152,7 @@
// this.localHandler.init();
this.clusteredHandler = new ClusteredMCMPHandlerImpl(this.localHandler, this, this);
this.loadManager = loadFactorProvider;
- this.eventHandlerDelegate = new DefaultJBossWebEventHandler(config, config, this.clusteredHandler, loadFactorProvider);
+ this.eventHandlerDelegate = new DefaultJBossWebEventHandler(config, config, config, this.clusteredHandler, loadFactorProvider);
this.domain = config.getDomain();
this.masterPerDomain = config.isMasterPerDomain();
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/AdvertiseListenerFactory.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/AdvertiseListenerFactory.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/AdvertiseListenerFactory.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -21,6 +21,7 @@
*/
package org.jboss.modcluster.advertise;
+import org.jboss.modcluster.config.MCMPHandlerConfiguration;
import org.jboss.modcluster.mcmp.MCMPHandler;
/**
@@ -29,5 +30,5 @@
*/
public interface AdvertiseListenerFactory
{
- public AdvertiseListener createListener(MCMPHandler handler);
+ public AdvertiseListener createListener(MCMPHandler handler, MCMPHandlerConfiguration config);
}
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerFactoryImpl.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerFactoryImpl.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerFactoryImpl.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -23,6 +23,7 @@
import org.jboss.modcluster.advertise.AdvertiseListener;
import org.jboss.modcluster.advertise.AdvertiseListenerFactory;
+import org.jboss.modcluster.config.MCMPHandlerConfiguration;
import org.jboss.modcluster.mcmp.MCMPHandler;
/**
@@ -36,8 +37,8 @@
* @{inheritDoc}
* @see org.jboss.modcluster.advertise.AdvertiseListenerFactory#createListener(org.jboss.modcluster.mcmp.MCMPHandler)
*/
- public AdvertiseListener createListener(MCMPHandler handler)
+ public AdvertiseListener createListener(MCMPHandler handler, MCMPHandlerConfiguration config)
{
- return new AdvertiseListenerImpl(handler);
+ return new AdvertiseListenerImpl(handler, config);
}
}
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -114,12 +114,10 @@
* @param eventHandler The event handler that will be used for
* status and new server notifications.
*/
- public AdvertiseListenerImpl(MCMPHandler commHandler)
+ public AdvertiseListenerImpl(MCMPHandler commHandler, MCMPHandlerConfiguration config)
{
this.commHandler = commHandler;
- MCMPHandlerConfiguration config = commHandler.getConfiguration();
-
try
{
this.setGroupAddress(config.getAdvertiseGroupAddress());
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerImpl.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerImpl.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerImpl.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -222,15 +222,6 @@
/**
* @{inheritDoc}
- * @see org.jboss.modcluster.mcmp.MCMPHandler#getConfiguration()
- */
- public MCMPHandlerConfiguration getConfiguration()
- {
- return this.localHandler.getConfiguration();
- }
-
- /**
- * @{inheritDoc}
* @see org.jboss.modcluster.mcmp.MCMPHandler#addProxy(java.net.InetAddress, int)
*/
public synchronized void addProxy(InetAddress address, int port)
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPHandler.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPHandler.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/MCMPHandler.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -27,8 +27,6 @@
import java.util.List;
import java.util.Set;
-import org.jboss.modcluster.config.MCMPHandlerConfiguration;
-
/**
* Handles communication via MCMP with the httpd side.
*
@@ -37,9 +35,6 @@
*/
public interface MCMPHandler
{
- /** Gets this handler's configuration */
- MCMPHandlerConfiguration getConfiguration();
-
/** Initialize the handler with the given list of proxies */
void init(List<AddressPort> initialProxies);
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/mcmp/impl/DefaultMCMPHandler.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -78,37 +78,19 @@
/** Our configuration */
private final MCMPHandlerConfiguration config;
-
- /**
- * Source for reset requests when we need to reset a proxy.
- */
+ /** Source for reset requests when we need to reset a proxy. */
private final ResetRequestSource resetRequestSource;
-
- /**
- * URL encoder used to generate requests bodies.
- */
+
+ /** URL encoder used to generate requests bodies. */
private UEncoder encoder = new UEncoder();
-
- /**
- * Proxies.
- */
+ /** Proxies. */
private volatile Proxy[] proxies = new Proxy[0];
-
- /**
- * Add proxy list.
- */
+ /** Add proxy list. */
private List<Proxy> addProxies = new ArrayList<Proxy>();
-
- /**
- * Remove proxy list.
- */
+ /** Remove proxy list. */
private List<Proxy> removeProxies = new ArrayList<Proxy>();
-
- /**
- * Socket factory.
- */
+ /** Socket factory. */
private JSSESocketFactory sslSocketFactory = null;
-
/** Initialization completion flag */
private boolean init;
@@ -125,20 +107,8 @@
}
}
- // -------------------------------------------------------------- Properties
-
- public ResetRequestSource getResetRequestSource()
- {
- return this.resetRequestSource;
- }
-
// ------------------------------------------------------------ MCMPHandler
- public MCMPHandlerConfiguration getConfiguration()
- {
- return this.config;
- }
-
public synchronized void init(List<AddressPort> initialProxies)
{
if (this.init) return;
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/DefaultJBossWebEventHandlerTestCase.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -59,6 +59,7 @@
{
private final NodeConfiguration nodeConfig = EasyMock.createStrictMock(NodeConfiguration.class);
private final BalancerConfiguration balancerConfig = EasyMock.createStrictMock(BalancerConfiguration.class);
+ private final MCMPHandlerConfiguration mcmpHandlerConfig = EasyMock.createStrictMock(MCMPHandlerConfiguration.class);
private final MCMPHandler mcmpHandler = EasyMock.createStrictMock(MCMPHandler.class);
private final LoadBalanceFactorProvider provider = EasyMock.createStrictMock(LoadBalanceFactorProvider.class);
private final AdvertiseListenerFactory listenerFactory = EasyMock.createStrictMock(AdvertiseListenerFactory.class);
@@ -72,7 +73,7 @@
@Override
protected void setUp() throws Exception
{
- this.handler = new DefaultJBossWebEventHandler(this.nodeConfig, this.balancerConfig, this.mcmpHandler, this.provider, this.listenerFactory);
+ this.handler = new DefaultJBossWebEventHandler(this.nodeConfig, this.balancerConfig, this.mcmpHandlerConfig, this.mcmpHandler, this.provider, this.listenerFactory);
}
public void testInit() throws IOException
@@ -80,81 +81,76 @@
InetAddress localAddress = InetAddress.getLocalHost();
String localHostName = localAddress.getHostName();
- MCMPHandlerConfiguration config = EasyMock.createStrictMock(MCMPHandlerConfiguration.class);
AdvertiseListener listener = EasyMock.createStrictMock(AdvertiseListener.class);
// Test advertise = false
- EasyMock.expect(this.mcmpHandler.getConfiguration()).andReturn(config);
- EasyMock.expect(config.getProxyList()).andReturn(localHostName);
+ EasyMock.expect(this.mcmpHandlerConfig.getProxyList()).andReturn(localHostName);
this.mcmpHandler.init(Collections.singletonList(new AddressPort(localAddress, 8000)));
- EasyMock.expect(config.getAdvertise()).andReturn(Boolean.FALSE);
+ EasyMock.expect(this.mcmpHandlerConfig.getAdvertise()).andReturn(Boolean.FALSE);
- EasyMock.replay(this.mcmpHandler, config, listener);
+ EasyMock.replay(this.mcmpHandler, this.mcmpHandlerConfig, listener);
this.handler.init();
- EasyMock.verify(this.mcmpHandler, config, listener);
- EasyMock.reset(this.mcmpHandler, config, listener);
+ EasyMock.verify(this.mcmpHandler, this.mcmpHandlerConfig, listener);
+ EasyMock.reset(this.mcmpHandler, this.mcmpHandlerConfig, listener);
// Test advertise = true
- EasyMock.expect(this.mcmpHandler.getConfiguration()).andReturn(config);
- EasyMock.expect(config.getProxyList()).andReturn(localHostName);
+ EasyMock.expect(this.mcmpHandlerConfig.getProxyList()).andReturn(localHostName);
this.mcmpHandler.init(Collections.singletonList(new AddressPort(localAddress, 8000)));
- EasyMock.expect(config.getAdvertise()).andReturn(Boolean.TRUE);
+ EasyMock.expect(this.mcmpHandlerConfig.getAdvertise()).andReturn(Boolean.TRUE);
- EasyMock.expect(this.listenerFactory.createListener(this.mcmpHandler)).andReturn(listener);
+ EasyMock.expect(this.listenerFactory.createListener(this.mcmpHandler, this.mcmpHandlerConfig)).andReturn(listener);
listener.start();
- EasyMock.replay(this.mcmpHandler, this.listenerFactory, config, listener);
+ EasyMock.replay(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
this.handler.init();
- EasyMock.verify(this.mcmpHandler, this.listenerFactory, config, listener);
- EasyMock.reset(this.mcmpHandler, this.listenerFactory, config, listener);
+ EasyMock.verify(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
+ EasyMock.reset(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
// Test advertise = null, proxies configured
- EasyMock.expect(this.mcmpHandler.getConfiguration()).andReturn(config);
- EasyMock.expect(config.getProxyList()).andReturn(localHostName);
+ EasyMock.expect(this.mcmpHandlerConfig.getProxyList()).andReturn(localHostName);
this.mcmpHandler.init(Collections.singletonList(new AddressPort(localAddress, 8000)));
- EasyMock.expect(config.getAdvertise()).andReturn(null);
+ EasyMock.expect(this.mcmpHandlerConfig.getAdvertise()).andReturn(null);
- EasyMock.replay(this.mcmpHandler, config, listener);
+ EasyMock.replay(this.mcmpHandler, this.mcmpHandlerConfig, listener);
this.handler.init();
- EasyMock.verify(this.mcmpHandler, config, listener);
- EasyMock.reset(this.mcmpHandler, config, listener);
+ EasyMock.verify(this.mcmpHandler, this.mcmpHandlerConfig, listener);
+ EasyMock.reset(this.mcmpHandler, this.mcmpHandlerConfig, listener);
// Test advertise = null, no proxies configured
- EasyMock.expect(this.mcmpHandler.getConfiguration()).andReturn(config);
- EasyMock.expect(config.getProxyList()).andReturn(null);
+ EasyMock.expect(this.mcmpHandlerConfig.getProxyList()).andReturn(null);
List<AddressPort> emptyList = Collections.emptyList();
this.mcmpHandler.init(emptyList);
- EasyMock.expect(config.getAdvertise()).andReturn(null);
+ EasyMock.expect(this.mcmpHandlerConfig.getAdvertise()).andReturn(null);
- EasyMock.expect(this.listenerFactory.createListener(this.mcmpHandler)).andReturn(listener);
+ EasyMock.expect(this.listenerFactory.createListener(this.mcmpHandler, this.mcmpHandlerConfig)).andReturn(listener);
listener.start();
- EasyMock.replay(this.mcmpHandler, this.listenerFactory, config, listener);
+ EasyMock.replay(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
this.handler.init();
- EasyMock.verify(this.mcmpHandler, this.listenerFactory, config, listener);
- EasyMock.reset(this.mcmpHandler, this.listenerFactory, config, listener);
+ EasyMock.verify(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
+ EasyMock.reset(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
}
public void testShutdown() throws IOException
@@ -175,26 +171,24 @@
InetAddress localAddress = InetAddress.getLocalHost();
String localHostName = localAddress.getHostName();
- MCMPHandlerConfiguration config = EasyMock.createStrictMock(MCMPHandlerConfiguration.class);
AdvertiseListener listener = EasyMock.createStrictMock(AdvertiseListener.class);
- EasyMock.expect(this.mcmpHandler.getConfiguration()).andReturn(config);
- EasyMock.expect(config.getProxyList()).andReturn(localHostName);
+ EasyMock.expect(this.mcmpHandlerConfig.getProxyList()).andReturn(localHostName);
this.mcmpHandler.init(Collections.singletonList(new AddressPort(localAddress, 8000)));
- EasyMock.expect(config.getAdvertise()).andReturn(Boolean.TRUE);
+ EasyMock.expect(this.mcmpHandlerConfig.getAdvertise()).andReturn(Boolean.TRUE);
- EasyMock.expect(this.listenerFactory.createListener(this.mcmpHandler)).andReturn(listener);
+ EasyMock.expect(this.listenerFactory.createListener(this.mcmpHandler, this.mcmpHandlerConfig)).andReturn(listener);
listener.start();
- EasyMock.replay(this.mcmpHandler, this.listenerFactory, config, listener);
+ EasyMock.replay(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
this.handler.init();
- EasyMock.verify(this.mcmpHandler, this.listenerFactory, config, listener);
- EasyMock.reset(this.mcmpHandler, this.listenerFactory, config, listener);
+ EasyMock.verify(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
+ EasyMock.reset(this.mcmpHandler, this.listenerFactory, this.mcmpHandlerConfig, listener);
// Now test shutdown()
listener.destroy();
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerTestCase.java 2008-09-09 22:27:15 UTC (rev 1792)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/ClusteredMCMPHandlerTestCase.java 2008-09-09 22:33:01 UTC (rev 1793)
@@ -37,9 +37,6 @@
import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.ha.framework.interfaces.HAServiceKeyProvider;
import org.jboss.ha.framework.interfaces.HASingletonMBean;
-import org.jboss.modcluster.config.MCMPHandlerConfiguration;
-import org.jboss.modcluster.ha.ClusteredMCMPHandler;
-import org.jboss.modcluster.ha.ClusteredMCMPHandlerImpl;
import org.jboss.modcluster.ha.rpc.BooleanGroupRpcResponse;
import org.jboss.modcluster.ha.rpc.GroupRpcResponse;
import org.jboss.modcluster.ha.rpc.GroupRpcResponseFilter;
@@ -188,23 +185,6 @@
EasyMock.reset(this.localHandler, this.singleton, server, state);
}
- public void testGetConfiguration()
- {
- MCMPHandlerConfiguration configuration = EasyMock.createMock(MCMPHandlerConfiguration.class);
-
- EasyMock.expect(this.localHandler.getConfiguration()).andReturn(configuration);
-
- EasyMock.replay(this.localHandler, this.singleton);
-
- MCMPHandlerConfiguration result = this.handler.getConfiguration();
-
- EasyMock.verify(this.localHandler, this.singleton);
-
- assertSame(configuration, result);
-
- EasyMock.reset(this.localHandler, this.singleton);
- }
-
public void testAddProxy() throws Exception
{
InetAddress address = InetAddress.getLocalHost();
15 years, 8 months
JBoss Native SVN: r1792 - trunk/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2008-09-09 18:27:15 -0400 (Tue, 09 Sep 2008)
New Revision: 1792
Modified:
trunk/mod_cluster/.classpath
Log:
Change build output to match maven.
Modified: trunk/mod_cluster/.classpath
===================================================================
--- trunk/mod_cluster/.classpath 2008-09-09 20:35:46 UTC (rev 1791)
+++ trunk/mod_cluster/.classpath 2008-09-09 22:27:15 UTC (rev 1792)
@@ -11,5 +11,5 @@
<classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta17/jboss-kernel-2.0.0.Beta17.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
- <classpathentry kind="output" path="target"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
15 years, 8 months
JBoss Native SVN: r1791 - trunk/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2008-09-09 16:35:46 -0400 (Tue, 09 Sep 2008)
New Revision: 1791
Modified:
trunk/mod_cluster/
trunk/mod_cluster/.classpath
Log:
Added servlet-api as test dependency.
Property changes on: trunk/mod_cluster
___________________________________________________________________
Name: svn:ignore
+ target
Modified: trunk/mod_cluster/.classpath
===================================================================
--- trunk/mod_cluster/.classpath 2008-09-09 20:30:20 UTC (rev 1790)
+++ trunk/mod_cluster/.classpath 2008-09-09 20:35:46 UTC (rev 1791)
@@ -10,5 +10,6 @@
<classpathentry kind="var" path="M2_REPO/org/easymock/easymock/2.4/easymock-2.4.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.Beta17/jboss-kernel-2.0.0.Beta17.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
<classpathentry kind="output" path="target"/>
</classpath>
15 years, 8 months
JBoss Native SVN: r1790 - in trunk/mod_cluster/src/test/java/org/jboss/modcluster: ha and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2008-09-09 16:30:20 -0400 (Tue, 09 Sep 2008)
New Revision: 1790
Added:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HASingletonAwareResetRequestSourceTestCase.java
Log:
Unit test
Added: trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java (rev 0)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java 2008-09-09 20:30:20 UTC (rev 1790)
@@ -0,0 +1,544 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.modcluster;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Server;
+import org.apache.catalina.Service;
+import org.apache.catalina.connector.Connector;
+import org.easymock.Capture;
+import org.easymock.EasyMock;
+import org.jboss.ha.framework.interfaces.ClusterNode;
+import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.interfaces.HASingletonElectionPolicy;
+import org.jboss.modcluster.config.BalancerConfiguration;
+import org.jboss.modcluster.config.MCMPHandlerConfiguration;
+import org.jboss.modcluster.config.NodeConfiguration;
+import org.jboss.modcluster.ha.ClusteredMCMPHandler;
+import org.jboss.modcluster.ha.HASingletonAwareResetRequestSource;
+import org.jboss.modcluster.ha.ModClusterServiceDRMEntry;
+import org.jboss.modcluster.ha.rpc.MCMPServerDiscoveryEvent;
+import org.jboss.modcluster.ha.rpc.ModClusterServiceStateGroupRpcResponse;
+import org.jboss.modcluster.ha.rpc.PeerMCMPDiscoveryStatus;
+import org.jboss.modcluster.load.LoadBalanceFactorProvider;
+import org.jboss.modcluster.mcmp.AddressPort;
+import org.jboss.modcluster.mcmp.MCMPHandler;
+import org.jboss.modcluster.mcmp.MCMPRequest;
+import org.jboss.modcluster.mcmp.MCMPRequestType;
+import org.jboss.modcluster.mcmp.MCMPServerState;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class ModClusterServiceTestCase extends TestCase
+{
+ private HAPartition partition = EasyMock.createStrictMock(HAPartition.class);
+ private NodeConfiguration nodeConfig = EasyMock.createMock(NodeConfiguration.class);
+ private BalancerConfiguration balancerConfig = EasyMock.createMock(BalancerConfiguration.class);
+ private MCMPHandlerConfiguration mcmpHandlerConfig = EasyMock.createMock(MCMPHandlerConfiguration.class);
+ private MCMPHandler mcmpHandler = EasyMock.createStrictMock(MCMPHandler.class);
+ private HASingletonAwareResetRequestSource resetRequestSource = EasyMock.createStrictMock(HASingletonAwareResetRequestSource.class);
+ private ClusteredMCMPHandler clusteredMCMPHandler = EasyMock.createStrictMock(ClusteredMCMPHandler.class);
+ private LoadBalanceFactorProvider lbfProvider = EasyMock.createStrictMock(LoadBalanceFactorProvider.class);
+ private JBossWebEventHandler eventHandler = EasyMock.createStrictMock(JBossWebEventHandler.class);
+ private HASingletonElectionPolicy electionPolicy = EasyMock.createStrictMock(HASingletonElectionPolicy.class);
+ private ClusterNode node = EasyMock.createStrictMock(ClusterNode.class);
+
+ private static final boolean MASTER_PER_DOMAIN = true;
+ private static final String SERVICE_HA_NAME = "myservice";
+ private static final String DOMAIN = "domain";
+
+ private ModClusterService modClusterService;
+
+ /**
+ * @{inheritDoc}
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception
+ {
+ EasyMock.expect(this.mcmpHandlerConfig.isMasterPerDomain()).andReturn(MASTER_PER_DOMAIN);
+ EasyMock.expect(this.nodeConfig.getDomain()).andReturn(DOMAIN);
+
+ EasyMock.expect(this.partition.getClusterNode()).andReturn(this.node).times(2);
+
+ EasyMock.replay(this.mcmpHandlerConfig, this.nodeConfig, this.partition);
+
+ this.modClusterService = new ModClusterService(this.partition, this.nodeConfig, this.balancerConfig, this.mcmpHandlerConfig, this.mcmpHandler, this.resetRequestSource, this.clusteredMCMPHandler, this.lbfProvider, this.eventHandler, this.electionPolicy);
+ this.modClusterService.setServiceHAName(SERVICE_HA_NAME);
+
+ EasyMock.verify(this.mcmpHandlerConfig, this.nodeConfig, this.partition);
+ EasyMock.reset(this.mcmpHandlerConfig, this.nodeConfig, this.partition);
+ }
+
+ public void testAddProxy()
+ {
+ String host = "172.0.0.1";
+ int port = 0;
+
+ this.clusteredMCMPHandler.addProxy(host, port);
+
+ EasyMock.replay(this.clusteredMCMPHandler);
+
+ this.modClusterService.addProxy(host, port);
+
+ EasyMock.verify(this.clusteredMCMPHandler);
+ EasyMock.reset(this.clusteredMCMPHandler);
+ }
+
+ public void testRemoveProxy()
+ {
+ String host = "172.0.0.1";
+ int port = 0;
+
+ this.clusteredMCMPHandler.removeProxy(host, port);
+
+ EasyMock.replay(this.clusteredMCMPHandler);
+
+ this.modClusterService.removeProxy(host, port);
+
+ EasyMock.verify(this.clusteredMCMPHandler);
+ EasyMock.reset(this.clusteredMCMPHandler);
+ }
+
+ public void testGetProxyConfiguration()
+ {
+ EasyMock.expect(this.clusteredMCMPHandler.getProxyConfiguration()).andReturn("configuration");
+
+ EasyMock.replay(this.clusteredMCMPHandler);
+
+ String result = this.modClusterService.getProxyConfiguration();
+
+ EasyMock.verify(this.clusteredMCMPHandler);
+
+ assertEquals("configuration", result);
+
+ EasyMock.reset(this.clusteredMCMPHandler);
+ }
+
+ public void testReset()
+ {
+ this.clusteredMCMPHandler.reset();
+
+ EasyMock.replay(this.clusteredMCMPHandler);
+
+ this.modClusterService.reset();
+
+ EasyMock.verify(this.clusteredMCMPHandler);
+ EasyMock.reset(this.clusteredMCMPHandler);
+ }
+
+ public void testRefresh()
+ {
+ this.clusteredMCMPHandler.markProxiesInError();
+
+ EasyMock.replay(this.clusteredMCMPHandler);
+
+ this.modClusterService.refresh();
+
+ EasyMock.verify(this.clusteredMCMPHandler);
+ EasyMock.reset(this.clusteredMCMPHandler);
+ }
+
+ public void testInit()
+ {
+ this.eventHandler.init();
+
+ EasyMock.replay(this.eventHandler);
+
+ this.modClusterService.init();
+
+ EasyMock.verify(this.eventHandler);
+ EasyMock.reset(this.eventHandler);
+ }
+
+ public void testStartServer()
+ {
+ Server server = EasyMock.createMock(Server.class);
+
+ this.resetRequestSource.setJbossWebServer(server);
+ this.eventHandler.startServer(server);
+
+ EasyMock.replay(this.resetRequestSource, this.eventHandler);
+
+ this.modClusterService.startServer(server);
+
+ EasyMock.verify(this.resetRequestSource, this.eventHandler);
+ EasyMock.reset(this.resetRequestSource, this.eventHandler);
+ }
+
+ public void testStopServer()
+ {
+ Server server = EasyMock.createStrictMock(Server.class);
+
+ this.eventHandler.stopServer(server);
+
+ EasyMock.replay(this.eventHandler);
+
+ this.modClusterService.stopServer(server);
+
+ EasyMock.verify(this.eventHandler);
+ EasyMock.reset(this.eventHandler);
+ }
+
+ public void testConfig() throws Exception
+ {
+ ModClusterServiceDRMEntry drmEntry = this.verifyConfig(EasyMock.createStrictMock(Engine.class), "host1");
+
+ assertEquals(Collections.singleton("host1"), drmEntry.getJvmRoutes());
+ assertNull(drmEntry.getMCMPServerStates());
+ assertSame(this.node, drmEntry.getPeer());
+ }
+
+ private ModClusterServiceDRMEntry verifyConfig(Engine engine, String host) throws Exception
+ {
+ Service service = EasyMock.createStrictMock(Service.class);
+ DistributedReplicantManager drm = EasyMock.createStrictMock(DistributedReplicantManager.class);
+ Capture<ModClusterServiceDRMEntry> capturedDRMEntry = new Capture<ModClusterServiceDRMEntry>();
+ Connector connector = new Connector("AJP/1.3");
+
+ EasyMock.expect(engine.getService()).andReturn(service);
+ EasyMock.expect(service.findConnectors()).andReturn(new Connector[] { connector });
+ EasyMock.expect(engine.getJvmRoute()).andReturn(null);
+ Set<MCMPServerState> states = Collections.emptySet();
+ EasyMock.expect(this.clusteredMCMPHandler.getProxyStates()).andReturn(states);
+
+ EasyMock.expect(engine.getJvmRoute()).andReturn(host);
+ EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(drm);
+ drm.add(EasyMock.eq(SERVICE_HA_NAME + ":" + DOMAIN), EasyMock.capture(capturedDRMEntry));
+ this.eventHandler.config(engine);
+
+ EasyMock.replay(engine, service, drm, this.clusteredMCMPHandler, this.partition, this.eventHandler);
+
+ this.modClusterService.config(engine);
+
+ EasyMock.verify(engine, service, drm, this.clusteredMCMPHandler, this.partition, this.eventHandler);
+ EasyMock.reset(engine, service, drm, this.clusteredMCMPHandler, this.partition, this.eventHandler);
+
+ return capturedDRMEntry.getValue();
+ }
+
+ public void testRemoveAll() throws Exception
+ {
+ Engine engine = EasyMock.createStrictMock(Engine.class);
+
+ // First config
+ ModClusterServiceDRMEntry drmEntry = this.verifyConfig(engine, "host1");
+
+ assertEquals(Collections.singleton("host1"), drmEntry.getJvmRoutes());
+ assertNull(drmEntry.getMCMPServerStates());
+ assertSame(this.node, drmEntry.getPeer());
+
+ Capture<ModClusterServiceDRMEntry> capturedDRMEntry = new Capture<ModClusterServiceDRMEntry>();
+ DistributedReplicantManager drm = EasyMock.createStrictMock(DistributedReplicantManager.class);
+
+ this.eventHandler.removeAll(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(drm);
+ drm.add(EasyMock.eq(SERVICE_HA_NAME + ":" + DOMAIN), EasyMock.capture(capturedDRMEntry));
+
+ EasyMock.replay(drm, this.eventHandler, engine, this.partition);
+
+ this.modClusterService.removeAll(engine);
+
+ EasyMock.verify(drm, this.eventHandler, engine, this.partition);
+
+ drmEntry = capturedDRMEntry.getValue();
+
+ assertEquals(Collections.emptySet(), drmEntry.getJvmRoutes());
+ assertNull(drmEntry.getMCMPServerStates());
+ assertSame(this.node, drmEntry.getPeer());
+
+ EasyMock.reset(drm, this.eventHandler, engine, this.partition);
+ }
+
+ public void testAddContext()
+ {
+ Context context = EasyMock.createMock(Context.class);
+
+ this.eventHandler.addContext(context);
+
+ EasyMock.replay(this.eventHandler);
+
+ this.modClusterService.addContext(context);
+
+ EasyMock.verify(this.eventHandler);
+ EasyMock.reset(this.eventHandler);
+ }
+
+ public void testStartContext()
+ {
+ Context context = EasyMock.createMock(Context.class);
+
+ this.eventHandler.startContext(context);
+
+ EasyMock.replay(this.eventHandler);
+
+ this.modClusterService.startContext(context);
+
+ EasyMock.verify(this.eventHandler);
+ EasyMock.reset(this.eventHandler);
+ }
+
+ public void testStopContext()
+ {
+ Context context = EasyMock.createMock(Context.class);
+
+ this.eventHandler.stopContext(context);
+
+ EasyMock.replay(this.eventHandler);
+
+ this.modClusterService.stopContext(context);
+
+ EasyMock.verify(this.eventHandler);
+ EasyMock.reset(this.eventHandler);
+ }
+
+ public void testRemoveContext()
+ {
+ Context context = EasyMock.createMock(Context.class);
+
+ this.eventHandler.removeContext(context);
+
+ EasyMock.replay(this.eventHandler);
+
+ this.modClusterService.removeContext(context);
+
+ EasyMock.verify(this.eventHandler);
+ EasyMock.reset(this.eventHandler);
+ }
+
+ public void testStatus() throws Exception
+ {
+ Engine engine = EasyMock.createMock(Engine.class);
+
+ // Test non-master status
+ EasyMock.expect(this.lbfProvider.getLoadBalanceFactor()).andReturn(10);
+
+ EasyMock.replay(this.lbfProvider);
+
+ this.modClusterService.status(engine);
+
+ EasyMock.verify(this.lbfProvider);
+ EasyMock.reset(this.lbfProvider);
+
+
+ // Make master
+ String key = SERVICE_HA_NAME + ":" + DOMAIN;
+ DistributedReplicantManager drm = EasyMock.createStrictMock(DistributedReplicantManager.class);
+
+ this.modClusterService.setElectionPolicy(null);
+
+ EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(drm);
+ EasyMock.expect(drm.isMasterReplica(key)).andReturn(true);
+
+ this.partition.callAsynchMethodOnCluster(EasyMock.eq("myservice"), EasyMock.eq("stopOldMaster"), EasyMock.aryEq(new Object[0]), EasyMock.aryEq(new Class[0]), EasyMock.eq(true));
+
+ EasyMock.replay(this.partition, drm);
+
+ this.modClusterService.replicantsChanged(key, Collections.EMPTY_LIST, 1, false);
+
+ EasyMock.verify(this.partition, drm);
+
+ assertTrue(this.modClusterService.isMasterNode());
+
+ EasyMock.reset(this.partition, drm);
+
+ // Create drm entries
+ ClusterNode remoteNode1 = EasyMock.createMock(ClusterNode.class);
+ MCMPServerState remoteState1 = EasyMock.createMock(MCMPServerState.class);
+
+ EasyMock.expect(remoteState1.getState()).andReturn(MCMPServerState.State.OK);
+ EasyMock.expect(remoteState1.isEstablished()).andReturn(true);
+
+ EasyMock.replay(remoteState1);
+
+ ModClusterServiceDRMEntry drmEntry1 = new ModClusterServiceDRMEntry(remoteNode1, Collections.singleton(remoteState1));
+ drmEntry1.addJvmRoute("host1");
+
+ EasyMock.verify(remoteState1);
+ EasyMock.reset(remoteState1);
+
+
+ MCMPServerState remoteState2 = EasyMock.createMock(MCMPServerState.class);
+ ClusterNode remoteNode2 = EasyMock.createMock(ClusterNode.class);
+
+ EasyMock.expect(remoteState2.getState()).andReturn(MCMPServerState.State.DOWN);
+ EasyMock.expect(remoteState2.isEstablished()).andReturn(false);
+
+ EasyMock.replay(remoteState2);
+
+ ModClusterServiceDRMEntry drmEntry2 = new ModClusterServiceDRMEntry(remoteNode2, Collections.singleton(remoteState2));
+ drmEntry2.addJvmRoute("host2");
+
+ EasyMock.verify(remoteState2);
+ EasyMock.reset(remoteState2);
+
+ // Test master status
+ MCMPServerState localState = EasyMock.createMock(MCMPServerState.class);
+ ModClusterServiceDRMEntry drmEntry = new ModClusterServiceDRMEntry(this.node, null);
+ InetAddress address1 = InetAddress.getByName("172.0.0.1");
+ InetAddress address2 = InetAddress.getByName("172.0.1.1");
+ MCMPServerDiscoveryEvent event1 = new MCMPServerDiscoveryEvent(remoteNode1, new AddressPort(address1, 1), true, 1);
+ MCMPServerDiscoveryEvent event2 = new MCMPServerDiscoveryEvent(remoteNode2, new AddressPort(address2, 2), false, 2);
+
+ MCMPRequest request1 = new MCMPRequest(MCMPRequestType.ENABLE_APP, false, new TreeMap<String, String>());
+ MCMPRequest request2 = new MCMPRequest(MCMPRequestType.DISABLE_APP, false, new TreeMap<String, String>());
+ Capture<List<MCMPRequest>> capturedRequests = new Capture<List<MCMPRequest>>();
+ Capture<ModClusterServiceDRMEntry> capturedEntry = new Capture<ModClusterServiceDRMEntry>();
+ Capture<Object[]> capturedArgs = new Capture<Object[]>();
+
+ ModClusterServiceStateGroupRpcResponse response1 = new ModClusterServiceStateGroupRpcResponse(remoteNode1, 10, new TreeSet<MCMPServerState>(), Collections.singletonList(event1), new ArrayList<MCMPRequest>());
+ ModClusterServiceStateGroupRpcResponse response2 = new ModClusterServiceStateGroupRpcResponse(remoteNode2, 20, new TreeSet<MCMPServerState>(), Collections.singletonList(event2), new ArrayList<MCMPRequest>());
+
+ EasyMock.expect(this.lbfProvider.getLoadBalanceFactor()).andReturn(10);
+
+ this.mcmpHandler.status();
+
+ EasyMock.expect(this.mcmpHandler.getProxyStates()).andReturn(new TreeSet<MCMPServerState>());
+
+ EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(drm);
+ EasyMock.expect(drm.lookupReplicants(key)).andReturn(Collections.singletonList(drmEntry));
+ EasyMock.expect(this.partition.getClusterNode()).andReturn(this.node);
+ EasyMock.expect(this.partition.callMethodOnCluster(EasyMock.eq(SERVICE_HA_NAME), EasyMock.eq("getClusterCoordinatorState"), EasyMock.aryEq(new Object[] { new TreeSet<MCMPServerState>() }), EasyMock.aryEq(new Class[] { Set.class }), EasyMock.eq(true))).andReturn(new ArrayList<Object>(Arrays.asList(response1, response2)));
+
+ // Process discovery events
+ this.mcmpHandler.addProxy(address1, 1);
+ this.mcmpHandler.removeProxy(address2, 2);
+
+ // Start over - this time with no discovery events
+ response1 = new ModClusterServiceStateGroupRpcResponse(remoteNode1, 10, Collections.singleton(remoteState1), new ArrayList<MCMPServerDiscoveryEvent>(), Collections.singletonList(request1));
+ response2 = new ModClusterServiceStateGroupRpcResponse(remoteNode2, 20, Collections.singleton(remoteState2), new ArrayList<MCMPServerDiscoveryEvent>(), Collections.singletonList(request2));
+
+ this.mcmpHandler.status();
+
+ Set<MCMPServerState> states = new LinkedHashSet<MCMPServerState>(Arrays.asList(remoteState1, remoteState2));
+
+ EasyMock.expect(this.mcmpHandler.getProxyStates()).andReturn(states);
+
+ EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(drm);
+ EasyMock.expect(drm.lookupReplicants(key)).andReturn(Arrays.asList(drmEntry1, drmEntry2));
+ EasyMock.expect(this.partition.getClusterNode()).andReturn(this.node);
+ EasyMock.expect(this.partition.callMethodOnCluster(EasyMock.eq(SERVICE_HA_NAME), EasyMock.eq("getClusterCoordinatorState"), EasyMock.aryEq(new Object[] { states }), EasyMock.aryEq(new Class[] { Set.class }), EasyMock.eq(true))).andReturn(new ArrayList<Object>(Arrays.asList(response1, response2)));
+
+ EasyMock.expect(remoteState1.getState()).andReturn(MCMPServerState.State.OK);
+ EasyMock.expect(remoteState1.isEstablished()).andReturn(true);
+ EasyMock.expect(remoteState2.getState()).andReturn(MCMPServerState.State.DOWN);
+ EasyMock.expect(remoteState2.isEstablished()).andReturn(false);
+
+ this.mcmpHandler.sendRequests(Arrays.asList(request1, request2));
+ this.mcmpHandler.sendRequests(EasyMock.capture(capturedRequests));
+
+ EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(drm);
+ EasyMock.expect(drm.lookupLocalReplicant(key)).andReturn(drmEntry);
+
+ EasyMock.expect(this.partition.getClusterNode()).andReturn(this.node);
+
+ EasyMock.expect(remoteState1.getState()).andReturn(MCMPServerState.State.OK);
+ EasyMock.expect(remoteState1.isEstablished()).andReturn(true);
+ EasyMock.expect(remoteState2.getState()).andReturn(MCMPServerState.State.DOWN);
+ EasyMock.expect(remoteState2.isEstablished()).andReturn(false);
+
+ EasyMock.expect(this.partition.getDistributedReplicantManager()).andReturn(drm);
+
+ drm.add(EasyMock.eq(key), EasyMock.capture(capturedEntry));
+
+ EasyMock.expect(this.partition.callMethodOnCluster(EasyMock.eq("myservice"), EasyMock.eq("clusterStatusComplete"), EasyMock.capture(capturedArgs), EasyMock.aryEq(new Class[] { Map.class }), EasyMock.eq(true))).andReturn(null);
+
+ EasyMock.replay(this.lbfProvider, this.mcmpHandler, this.partition, drm, localState, this.node, remoteState1, remoteState2, remoteNode1, remoteNode2);
+
+ this.modClusterService.status(engine);
+
+ EasyMock.verify(this.lbfProvider, this.mcmpHandler, this.partition, drm, localState, this.node, remoteState1, remoteState2, remoteNode1, remoteNode2);
+
+ List<MCMPRequest> requests = capturedRequests.getValue();
+
+ assertEquals(2, requests.size());
+
+ assertSame(MCMPRequestType.STATUS, requests.get(0).getRequestType());
+ assertFalse(requests.get(0).isWildcard());
+ assertEquals(2, requests.get(0).getParameters().size());
+ assertEquals("host2", requests.get(0).getParameters().get("JVMRoute"));
+ assertEquals("20", requests.get(0).getParameters().get("Load"));
+
+ assertSame(MCMPRequestType.STATUS, requests.get(1).getRequestType());
+ assertFalse(requests.get(1).isWildcard());
+ assertEquals(2, requests.get(1).getParameters().size());
+ assertEquals("host1", requests.get(1).getParameters().get("JVMRoute"));
+ assertEquals("10", requests.get(1).getParameters().get("Load"));
+
+ ModClusterServiceDRMEntry entry = capturedEntry.getValue();
+
+ assertSame(this.node, entry.getPeer());
+ assertEquals(states, entry.getMCMPServerStates());
+ assertTrue(entry.getJvmRoutes().isEmpty());
+
+ Object[] args = capturedArgs.getValue();
+ assertEquals(1, args.length);
+ assertTrue(args[0] instanceof Map);
+
+ Map<ClusterNode, PeerMCMPDiscoveryStatus> map = (Map) args[0];
+
+ assertEquals(2, map.size());
+ assertTrue(map.containsKey(remoteNode1));
+ assertTrue(map.containsKey(remoteNode2));
+
+ PeerMCMPDiscoveryStatus status1 = map.get(remoteNode1);
+
+ assertSame(remoteNode1, status1.getPeer());
+ assertEquals(Collections.singleton(remoteState1), status1.getMCMPServerStates());
+ assertTrue(status1.getJvmRoutes().isEmpty());
+ assertNull(status1.getLatestDiscoveryEvent());
+
+ EasyMock.reset(this.lbfProvider, this.mcmpHandler, this.partition, drm, localState, this.node, remoteState1, remoteState2, remoteNode1, remoteNode2);
+
+
+ // Test master status, but off-frequency
+ this.modClusterService.setProcessStatusFrequency(2);
+
+ EasyMock.expect(this.lbfProvider.getLoadBalanceFactor()).andReturn(10);
+
+ EasyMock.replay(this.lbfProvider);
+
+ this.modClusterService.status(engine);
+
+ EasyMock.verify(this.lbfProvider);
+ EasyMock.reset(this.lbfProvider);
+ }
+}
Added: trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HASingletonAwareResetRequestSourceTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HASingletonAwareResetRequestSourceTestCase.java (rev 0)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HASingletonAwareResetRequestSourceTestCase.java 2008-09-09 20:30:20 UTC (rev 1790)
@@ -0,0 +1,312 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.modcluster.ha;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.Container;
+import org.apache.catalina.Context;
+import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
+import org.apache.catalina.Server;
+import org.apache.catalina.Service;
+import org.apache.catalina.connector.Connector;
+import org.easymock.EasyMock;
+import org.jboss.ha.framework.interfaces.ClusterNode;
+import org.jboss.ha.framework.interfaces.HAPartition;
+import org.jboss.ha.framework.interfaces.HAServiceKeyProvider;
+import org.jboss.ha.framework.interfaces.HASingletonMBean;
+import org.jboss.modcluster.config.BalancerConfiguration;
+import org.jboss.modcluster.config.NodeConfiguration;
+import org.jboss.modcluster.ha.rpc.ResetRequestGroupRpcResponse;
+import org.jboss.modcluster.mcmp.MCMPRequest;
+import org.jboss.modcluster.mcmp.MCMPRequestType;
+
+/**
+ * @author Paul Ferraro
+ *
+ */
+public class HASingletonAwareResetRequestSourceTestCase extends TestCase
+{
+ private NodeConfiguration nodeConfig = EasyMock.createStrictMock(NodeConfiguration.class);
+ private BalancerConfiguration balancerConfig = EasyMock.createStrictMock(BalancerConfiguration.class);
+ private HAServiceKeyProvider key = EasyMock.createStrictMock(HAServiceKeyProvider.class);
+ private HASingletonMBean singleton = EasyMock.createStrictMock(HASingletonMBean.class);
+ private HAPartition partition = EasyMock.createStrictMock(HAPartition.class);
+
+ private HASingletonAwareResetRequestSource source = new HASingletonAwareResetRequestSourceImpl(this.nodeConfig, this.balancerConfig, this.singleton, this.key);
+
+ public void testGetResetRequests() throws Exception
+ {
+ MCMPRequest request1 = new MCMPRequest(MCMPRequestType.ENABLE_APP, false, Collections.singletonMap("JVMRoute", "host1"));
+ MCMPRequest request2 = new MCMPRequest(MCMPRequestType.REMOVE_APP, false, Collections.singletonMap("JVMRoute", "host2"));
+
+ ResetRequestGroupRpcResponse response1 = new ResetRequestGroupRpcResponse(EasyMock.createMock(ClusterNode.class), Collections.singletonList(request1));
+ ResetRequestGroupRpcResponse response2 = new ResetRequestGroupRpcResponse(EasyMock.createMock(ClusterNode.class), Collections.singletonList(request2));
+
+ // Test master - w/out server
+ EasyMock.expect(this.singleton.isMasterNode()).andReturn(true);
+
+ EasyMock.expect(this.key.getHAPartition()).andReturn(this.partition);
+ EasyMock.expect(this.key.getHAServiceKey()).andReturn("service:domain");
+ EasyMock.expect(this.partition.callMethodOnCluster(EasyMock.eq("service:domain"), EasyMock.eq("getResetRequests"), EasyMock.aryEq(new Object[0]), EasyMock.aryEq(new Class[0]), EasyMock.eq(true))).andReturn(new ArrayList<ResetRequestGroupRpcResponse>(Arrays.asList(response1, response2)));
+
+ EasyMock.replay(this.singleton, this.key, this.partition);
+
+ List<MCMPRequest> results = this.source.getResetRequests();
+
+ EasyMock.verify(this.singleton, this.key, this.partition);
+
+ assertEquals(2, results.size());
+ assertSame(request1, results.get(0));
+ assertSame(request2, results.get(1));
+
+ EasyMock.reset(this.singleton, this.key, this.partition);
+
+
+ // Test master - w/server
+ Server server = EasyMock.createStrictMock(Server.class);
+ Service service = EasyMock.createStrictMock(Service.class);
+ Engine engine = EasyMock.createStrictMock(Engine.class);
+ Container container = EasyMock.createStrictMock(Container.class);
+ Context context = EasyMock.createStrictMock(Context.class);
+ Host host = EasyMock.createStrictMock(Host.class);
+ Connector connector = new Connector("AJP/1.3");
+
+ this.source.setJbossWebServer(server);
+
+ EasyMock.expect(this.singleton.isMasterNode()).andReturn(true);
+
+ EasyMock.expect(this.key.getHAPartition()).andReturn(this.partition);
+ EasyMock.expect(this.key.getHAServiceKey()).andReturn("service:domain");
+ EasyMock.expect(this.partition.callMethodOnCluster(EasyMock.eq("service:domain"), EasyMock.eq("getResetRequests"), EasyMock.aryEq(new Object[0]), EasyMock.aryEq(new Class[0]), EasyMock.eq(true))).andReturn(new ArrayList<ResetRequestGroupRpcResponse>(Arrays.asList(response1, response2)));
+
+ EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
+ EasyMock.expect(service.getContainer()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host").times(2);
+
+ EasyMock.expect(engine.getService()).andReturn(service);
+ EasyMock.expect(service.findConnectors()).andReturn(new Connector[] { connector });
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+
+ EasyMock.expect(this.nodeConfig.getDomain()).andReturn("domain");
+ EasyMock.expect(this.nodeConfig.getFlushPackets()).andReturn(Boolean.TRUE);
+ EasyMock.expect(this.nodeConfig.getFlushWait()).andReturn(1);
+ EasyMock.expect(this.nodeConfig.getPing()).andReturn(2);
+ EasyMock.expect(this.nodeConfig.getSmax()).andReturn(3);
+ EasyMock.expect(this.nodeConfig.getTtl()).andReturn(4);
+ EasyMock.expect(this.nodeConfig.getNodeTimeout()).andReturn(5);
+ EasyMock.expect(this.nodeConfig.getBalancer()).andReturn("S");
+
+ EasyMock.expect(this.balancerConfig.getStickySession()).andReturn(Boolean.FALSE);
+ EasyMock.expect(this.balancerConfig.getStickySessionRemove()).andReturn(Boolean.TRUE);
+ EasyMock.expect(this.balancerConfig.getStickySessionForce()).andReturn(Boolean.FALSE);
+ EasyMock.expect(this.balancerConfig.getWorkerTimeout()).andReturn(6);
+ EasyMock.expect(this.balancerConfig.getMaxAttempts()).andReturn(7);
+
+ EasyMock.expect(engine.findChildren()).andReturn(new Container[] { container });
+ EasyMock.expect(container.findChildren()).andReturn(new Container[] { context });
+ EasyMock.expect(context.isStarted()).andReturn(true);
+
+ EasyMock.expect(context.getParent()).andReturn(container);
+ EasyMock.expect(container.getParent()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getPath()).andReturn("/context");
+ EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getName()).andReturn("host");
+ EasyMock.expect(host.findAliases()).andReturn(new String[] { "alias1", "alias2" });
+
+ EasyMock.replay(this.singleton, this.key, this.partition, server, service, engine, container, context, host, this.nodeConfig, this.balancerConfig);
+
+ results = this.source.getResetRequests();
+
+ EasyMock.verify(this.singleton, this.key, this.partition, server, service, engine, container, context, host, this.nodeConfig, this.balancerConfig);
+
+ assertEquals(5, results.size());
+
+ MCMPRequest request = results.get(0);
+ Map<String, String> parameters = request.getParameters();
+
+ assertSame(MCMPRequestType.REMOVE_APP, request.getRequestType());
+ assertTrue(request.isWildcard());
+ assertEquals(1, parameters.size());
+ assertEquals("host", parameters.get("JVMRoute"));
+
+ request = results.get(1);
+ parameters = request.getParameters();
+
+ assertSame(MCMPRequestType.CONFIG, request.getRequestType());
+ assertFalse(request.isWildcard());
+ assertEquals(17, parameters.size());
+ assertEquals("host1", parameters.get("JVMRoute"));
+ assertEquals("172.0.0.1", parameters.get("Host"));
+ assertEquals("0", parameters.get("Port"));
+ assertEquals("ajp", parameters.get("Type"));
+ assertEquals("domain", parameters.get("Domain"));
+ assertEquals("On", parameters.get("flushpackets"));
+ assertEquals("1", parameters.get("flushwait"));
+ assertEquals("2", parameters.get("ping"));
+ assertEquals("3", parameters.get("smax"));
+ assertEquals("4", parameters.get("ttl"));
+ assertEquals("5", parameters.get("Timeout"));
+ assertEquals("S", parameters.get("Balancer"));
+ assertEquals("No", parameters.get("StickySession"));
+ assertEquals("Yes", parameters.get("StickySessionRemove"));
+ assertEquals("No", parameters.get("StickySessionForce"));
+ assertEquals("6", parameters.get("WaitWorker"));
+ assertEquals("7", parameters.get("Maxattempts"));
+
+ request = results.get(2);
+ parameters = request.getParameters();
+
+ assertSame(MCMPRequestType.ENABLE_APP, request.getRequestType());
+ assertFalse(request.isWildcard());
+ assertEquals(3, parameters.size());
+ assertEquals("host1", parameters.get("JVMRoute"));
+ assertEquals("/context", parameters.get("Context"));
+ assertEquals("host,alias1,alias2", parameters.get("Alias"));
+
+ assertSame(request1, results.get(3));
+ assertSame(request2, results.get(4));
+
+ EasyMock.reset(this.singleton, this.key, this.partition, server, service, engine, container, context, host, this.nodeConfig, this.balancerConfig);
+
+
+ // Test non-master
+ results = this.source.getResetRequests();
+
+ assertTrue(results.isEmpty());
+ }
+
+ public void testGetLocalResetRequests() throws Exception
+ {
+ // Test w/out server
+ List<MCMPRequest> results = this.source.getLocalResetRequests();
+
+ assertTrue(results.isEmpty());
+
+
+ // Test w/server
+ Server server = EasyMock.createStrictMock(Server.class);
+ Service service = EasyMock.createStrictMock(Service.class);
+ Engine engine = EasyMock.createStrictMock(Engine.class);
+ Container container = EasyMock.createStrictMock(Container.class);
+ Context context = EasyMock.createStrictMock(Context.class);
+ Host host = EasyMock.createStrictMock(Host.class);
+ Connector connector = new Connector("AJP/1.3");
+
+ this.source.setJbossWebServer(server);
+
+ EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
+ EasyMock.expect(service.getContainer()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host").times(2);
+
+ EasyMock.expect(engine.getService()).andReturn(service);
+ EasyMock.expect(service.findConnectors()).andReturn(new Connector[] { connector });
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+
+ EasyMock.expect(this.nodeConfig.getDomain()).andReturn("domain");
+ EasyMock.expect(this.nodeConfig.getFlushPackets()).andReturn(Boolean.TRUE);
+ EasyMock.expect(this.nodeConfig.getFlushWait()).andReturn(1);
+ EasyMock.expect(this.nodeConfig.getPing()).andReturn(2);
+ EasyMock.expect(this.nodeConfig.getSmax()).andReturn(3);
+ EasyMock.expect(this.nodeConfig.getTtl()).andReturn(4);
+ EasyMock.expect(this.nodeConfig.getNodeTimeout()).andReturn(5);
+ EasyMock.expect(this.nodeConfig.getBalancer()).andReturn("S");
+
+ EasyMock.expect(this.balancerConfig.getStickySession()).andReturn(Boolean.FALSE);
+ EasyMock.expect(this.balancerConfig.getStickySessionRemove()).andReturn(Boolean.TRUE);
+ EasyMock.expect(this.balancerConfig.getStickySessionForce()).andReturn(Boolean.FALSE);
+ EasyMock.expect(this.balancerConfig.getWorkerTimeout()).andReturn(6);
+ EasyMock.expect(this.balancerConfig.getMaxAttempts()).andReturn(7);
+
+ EasyMock.expect(engine.findChildren()).andReturn(new Container[] { container });
+ EasyMock.expect(container.findChildren()).andReturn(new Container[] { context });
+ EasyMock.expect(context.isStarted()).andReturn(true);
+
+ EasyMock.expect(context.getParent()).andReturn(container);
+ EasyMock.expect(container.getParent()).andReturn(engine);
+ EasyMock.expect(engine.getJvmRoute()).andReturn("host1");
+ EasyMock.expect(context.getPath()).andReturn("/context");
+ EasyMock.expect(context.getParent()).andReturn(host);
+ EasyMock.expect(host.getName()).andReturn("host");
+ EasyMock.expect(host.findAliases()).andReturn(new String[] { "alias1", "alias2" });
+
+ EasyMock.replay(this.singleton, this.key, this.partition, server, service, engine, container, context, host, this.nodeConfig, this.balancerConfig);
+
+ results = this.source.getLocalResetRequests();
+
+ EasyMock.verify(this.singleton, this.key, this.partition, server, service, engine, container, context, host, this.nodeConfig, this.balancerConfig);
+
+ assertEquals(3, results.size());
+
+ MCMPRequest request = results.get(0);
+ Map<String, String> parameters = request.getParameters();
+
+ assertSame(MCMPRequestType.REMOVE_APP, request.getRequestType());
+ assertTrue(request.isWildcard());
+ assertEquals(1, parameters.size());
+ assertEquals("host", parameters.get("JVMRoute"));
+
+ request = results.get(1);
+ parameters = request.getParameters();
+
+ assertSame(MCMPRequestType.CONFIG, request.getRequestType());
+ assertFalse(request.isWildcard());
+ assertEquals(17, parameters.size());
+ assertEquals("host1", parameters.get("JVMRoute"));
+ assertEquals("172.0.0.1", parameters.get("Host"));
+ assertEquals("0", parameters.get("Port"));
+ assertEquals("ajp", parameters.get("Type"));
+ assertEquals("domain", parameters.get("Domain"));
+ assertEquals("On", parameters.get("flushpackets"));
+ assertEquals("1", parameters.get("flushwait"));
+ assertEquals("2", parameters.get("ping"));
+ assertEquals("3", parameters.get("smax"));
+ assertEquals("4", parameters.get("ttl"));
+ assertEquals("5", parameters.get("Timeout"));
+ assertEquals("S", parameters.get("Balancer"));
+ assertEquals("No", parameters.get("StickySession"));
+ assertEquals("Yes", parameters.get("StickySessionRemove"));
+ assertEquals("No", parameters.get("StickySessionForce"));
+ assertEquals("6", parameters.get("WaitWorker"));
+ assertEquals("7", parameters.get("Maxattempts"));
+
+ request = results.get(2);
+ parameters = request.getParameters();
+
+ assertSame(MCMPRequestType.ENABLE_APP, request.getRequestType());
+ assertFalse(request.isWildcard());
+ assertEquals(3, parameters.size());
+ assertEquals("host1", parameters.get("JVMRoute"));
+ assertEquals("/context", parameters.get("Context"));
+ assertEquals("host,alias1,alias2", parameters.get("Alias"));
+
+ EasyMock.reset(this.singleton, this.key, this.partition, server, service, engine, container, context, host, this.nodeConfig, this.balancerConfig);
+ }
+}
15 years, 8 months