You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ga...@apache.org on 2006/03/25 08:39:21 UTC
svn commit: r388718 -
/webservices/axis/trunk/java/tools/org/apache/axis/tools/ant/axis/RunAxisFunctionalTestsTask.java
Author: gawor
Date: Fri Mar 24 23:39:19 2006
New Revision: 388718
URL: http://svn.apache.org/viewcvs?rev=388718&view=rev
Log:
ensure the http server is really up
Modified:
webservices/axis/trunk/java/tools/org/apache/axis/tools/ant/axis/RunAxisFunctionalTestsTask.java
Modified: webservices/axis/trunk/java/tools/org/apache/axis/tools/ant/axis/RunAxisFunctionalTestsTask.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/tools/org/apache/axis/tools/ant/axis/RunAxisFunctionalTestsTask.java?rev=388718&r1=388717&r2=388718&view=diff
==============================================================================
--- webservices/axis/trunk/java/tools/org/apache/axis/tools/ant/axis/RunAxisFunctionalTestsTask.java (original)
+++ webservices/axis/trunk/java/tools/org/apache/axis/tools/ant/axis/RunAxisFunctionalTestsTask.java Fri Mar 24 23:39:19 2006
@@ -71,19 +71,19 @@
// Execute the ant target
new Thread(new TaskRunnable(startTarget)).start();
- if (! startTarget.equals(tcpServerTarget))
- return;
-
- // try a ping for the TCP server
while (true) {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
}
try {
- sendOnSocket("ping\r\n");
- // if no exception, return
- System.out.println("RunAxisFunctionalTestsTask.callStart successfully pinged server.");
+ if (startTarget.equals(tcpServerTarget)) {
+ sendOnSocket("ping\r\n");
+ System.out.println("RunAxisFunctionalTestsTask.callStart successfully pinged tcp server.");
+ } else {
+ checkHTTPServer();
+ System.out.println("RunAxisFunctionalTestsTask.callStart successfully pinged http server.");
+ }
return;
} catch (Exception ex) {
// loop & try again
@@ -116,12 +116,8 @@
// second, and more involvedly, stop the http server
// Try connecting in case the server is already stopped.
if (httpServerTarget != null) {
- URL url = new URL("http://localhost:8080/");
try {
- HttpURLConnection connection = (HttpURLConnection)url.openConnection();
- connection.connect();
- readFully(connection);
- connection.disconnect();
+ checkHTTPServer();
} catch (IOException e) {
// Server is not running. Make this task a no-op.
System.out.println("Error from HTTP read: " + e);
@@ -186,6 +182,14 @@
callee.init();
callee.setTarget(taskName);
callee.execute();
+ }
+
+ private void checkHTTPServer() throws IOException {
+ URL url = new URL("http://localhost:8080/");
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ connection.connect();
+ readFully(connection);
+ connection.disconnect();
}
/**