Author: jfrederic.clere(a)jboss.com
Date: 2008-04-25 10:00:45 -0400 (Fri, 25 Apr 2008)
New Revision: 1567
Modified:
sandbox/httpd/src/java/TestHttpClient.java
sandbox/httpd/src/java/TestHttpClient.sh
Log:
Make it more flexible.
Modified: sandbox/httpd/src/java/TestHttpClient.java
===================================================================
--- sandbox/httpd/src/java/TestHttpClient.java 2008-04-25 11:51:16 UTC (rev 1566)
+++ sandbox/httpd/src/java/TestHttpClient.java 2008-04-25 14:00:45 UTC (rev 1567)
@@ -4,6 +4,8 @@
public class TestHttpClient
{
+ public static String JVMRoute = System.getProperty("JVMRoute",
"node1");
+ public static String Host = System.getProperty("Host",
"localhost");
/**
*
* Usage:
@@ -14,7 +16,7 @@
* Argument 1 is the command to execute.
*
*/
- public static void main(String[] args) throws Exception
+ public static void main(String[] args) throws Exception
{
if (args.length != 2)
{
@@ -30,30 +32,30 @@
PostMethod pm = null;
if (command.compareToIgnoreCase("ENABLE")==0) {
pm = (PostMethod) new EnableMethod(URL);
- pm.addParameter("JVMRoute","node1");
+ pm.addParameter("JVMRoute", JVMRoute);
pm.addParameter("context", "/myapp");
System.out.println("ENABLE");
}
else if (command.compareToIgnoreCase("DISABLE")==0) {
pm = (PostMethod) new DisableMethod(URL);
- pm.addParameter("JVMRoute","node1");
+ pm.addParameter("JVMRoute", JVMRoute);
pm.addParameter("context", "/myapp");
}
else if (command.compareToIgnoreCase("STOP")==0) {
pm = (PostMethod) new StopMethod(URL);
- pm.addParameter("JVMRoute","node1");
+ pm.addParameter("JVMRoute", JVMRoute);
pm.addParameter("context", "/myapp");
}
else if (command.compareToIgnoreCase("REMOVE")==0) {
pm = (PostMethod) new RemoveMethod(URL);
- pm.addParameter("JVMRoute","node1");
+ pm.addParameter("JVMRoute", JVMRoute);
pm.addParameter("context", "/hisapp");
}
else if (command.compareToIgnoreCase("CONFIG")==0) {
pm = (PostMethod) new ConfigMethod(URL);
- pm.addParameter("JVMRoute","node1");
+ pm.addParameter("JVMRoute", JVMRoute);
pm.addParameter("Domain", "domain1");
- pm.addParameter("Host", "localhost");
+ pm.addParameter("Host", Host);
pm.addParameter("Port", "8009");
pm.addParameter("Type", "ajp");
pm.addParameter("Context", "/hisapp,/ourapp");
@@ -63,7 +65,7 @@
}
else if (command.compareToIgnoreCase("STATUS")==0) {
pm = (PostMethod) new StatusMethod(URL);
- pm.addParameter("JVMRoute","node1");
+ pm.addParameter("JVMRoute", JVMRoute);
pm.addParameter("Load", "50");
}
else
@@ -83,7 +85,7 @@
System.out.println("response: " + httpResponseCode);
System.out.println("response: " + pm.getStatusLine());
int len = (int) pm.getResponseContentLength();
- System.out.println("response: " +
pm.getResponseBodyAsString(len));
+ System.out.println("response:\n" +
pm.getResponseBodyAsString(len));
} catch(HttpException e) {
e.printStackTrace();
}
Modified: sandbox/httpd/src/java/TestHttpClient.sh
===================================================================
--- sandbox/httpd/src/java/TestHttpClient.sh 2008-04-25 11:51:16 UTC (rev 1566)
+++ sandbox/httpd/src/java/TestHttpClient.sh 2008-04-25 14:00:45 UTC (rev 1567)
@@ -16,21 +16,28 @@
javac -classpath $CLASSES:. TestHttpClient.java
CLASSES=$CLASSES:$HOME/java/commons-logging-1.0.4/commons-logging.jar:$HOME/java/commons-codec-1.3/commons-codec-1.3.jar:.
+HTTPD=jfcpc
+JVMROUTE=neo
+HOST=neo
+SCHEME=http
+SECURITY="-Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=changeit
-Djavax.net.ssl.keyStoreType=\"PKCS12\""
+
+
# Send a CONFIG command.
-java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ CONFIG
+java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST}
-DJVMRoute=${JVMROUTE} -DHost=${HOST} TestHttpClient ${SCHEME}://${HTTPD}:6666/test_bla/
CONFIG
-java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ DUMP
+java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST} TestHttpClient
${SCHEME}://${HTTPD}:6666/test_bla/ DUMP
# Send a ENABLE for /myapp
-java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ ENABLE
+java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST} TestHttpClient
${SCHEME}://${HTTPD}:6666/test_bla/ ENABLE
-java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ DUMP
+java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST} TestHttpClient
${SCHEME}://${HTTPD}:6666/test_bla/ DUMP
# Send a REMOVE for /hisapp
-java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ REMOVE
+java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST} TestHttpClient
${SCHEME}://${HTTPD}:6666/test_bla/ REMOVE
-java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ DUMP
+java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST} TestHttpClient
${SCHEME}://${HTTPD}:6666/test_bla/ DUMP
-java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ STATUS
+java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST} TestHttpClient
${SCHEME}://${HTTPD}:6666/test_bla/ STATUS
-#java -Djavax.net.ssl.trustStore=$HOME/.keystore
-Djavax.net.ssl.keyStore=$HOME/CERTS/demoCA/test.p12
-Djavax.net.ssl.keyStorePassword=adelina -Djavax.net.ssl.keyStoreType="PKCS12"
-classpath $CLASSES TestHttpClient
https://localhost:6666/test_bla/ INFO
+#java ${SECURITY} -classpath $CLASSES -DJVMRoute=${JVMROUTE} -DHost=${HOST}
TestHttpClient ${SCHEME}://${HTTPD}:6666/test_bla/ INFO