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 di...@apache.org on 2002/07/18 18:41:16 UTC

cvs commit: xml-axis/java/test/functional TestElementSample.java

dims        2002/07/18 09:41:16

  Modified:    java/test build_functional_tests.xml
               java/src/org/apache/axis/transport/http
                        SimpleAxisWorker.java
               java/test/functional TestElementSample.java
  Log:
  Fix for ElementService Test case failure. (Use the same method in SimpleAxisWorker as well the TestCase).
  
  Revision  Changes    Path
  1.50      +1 -0      xml-axis/java/test/build_functional_tests.xml
  
  Index: build_functional_tests.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/build_functional_tests.xml,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- build_functional_tests.xml	3 Jul 2002 18:47:09 -0000	1.49
  +++ build_functional_tests.xml	18 Jul 2002 16:41:15 -0000	1.50
  @@ -29,6 +29,7 @@
     <!--The IP port the service will be targeted at.-->
     <property name="test.functional.ServicePort" value="8080"/>
     <property name="test.functional.fail" value="yes"/>
  +  <property name="test.functional.testcase" value="**/FunctionalTests"/>
   
     <path id="test-classpath">
       <pathelement location="${build.dest}" />
  
  
  
  1.12      +21 -11    xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java
  
  Index: SimpleAxisWorker.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/SimpleAxisWorker.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SimpleAxisWorker.java	17 Jul 2002 20:27:28 -0000	1.11
  +++ SimpleAxisWorker.java	18 Jul 2002 16:41:15 -0000	1.12
  @@ -75,6 +75,7 @@
   import java.io.OutputStream;
   import java.net.Socket;
   import java.net.InetAddress;
  +import java.net.UnknownHostException;
   
   
   public class SimpleAxisWorker implements Runnable {
  @@ -273,18 +274,8 @@
                   msgContext.setProperty(Constants.MC_JWS_CLASSDIR,
                           "jwsClasses");
   
  -                // FIXME
  -                // This doesn't return anything but 0.0.0.0
  -                //  String hostname = serverSocket.getInetAddress().getHostAddress();
  -                // And this returns the hostname of the host on the other
  -                // end of the socket:
  -                //  String hostname = socket.getInetAddress().getHostName();
  -                // This works for 99% of the uses of SimpleAxisServer,
  -                // but is very stupid
  -                String hostname = InetAddress.getLocalHost().getHostAddress();
  -                //hostname="localhost";
                   // !!! Fix string concatenation
  -                String url = "http://" + hostname + ":" +
  +                String url = "http://" + getLocalHost() + ":" +
                           server.getServerSocket().getLocalPort() + "/" +
                           fileName.toString();
                   msgContext.setProperty(MessageContext.TRANS_URL, url);
  @@ -695,5 +686,24 @@
               }
           }
           return count > 0 ? count : -1;
  +    }
  +
  +    /**
  +     * One method for all host name lookups.
  +     */
  +    public static String getLocalHost() {
  +        // FIXME
  +        // This doesn't return anything but 0.0.0.0
  +        //  String hostname = serverSocket.getInetAddress().getHostAddress();
  +        // And this returns the hostname of the host on the other
  +        // end of the socket:
  +        //  String hostname = socket.getInetAddress().getHostName();
  +        // This works for 99% of the uses of SimpleAxisServer,
  +        // but is very stupid
  +        try {
  +            return InetAddress.getLocalHost().getHostAddress();
  +        } catch (UnknownHostException uhe){
  +            return "localhost";
  +        }
       }
   }
  
  
  
  1.12      +2 -1      xml-axis/java/test/functional/TestElementSample.java
  
  Index: TestElementSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestElementSample.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestElementSample.java	17 Jul 2002 20:27:28 -0000	1.11
  +++ TestElementSample.java	18 Jul 2002 16:41:16 -0000	1.12
  @@ -59,6 +59,7 @@
   import org.apache.axis.client.AdminClient;
   
   import org.apache.axis.components.logger.LogFactory;
  +import org.apache.axis.transport.http.SimpleAxisWorker;
   import org.apache.commons.logging.Log;
   
   import samples.encoding.TestElem;
  @@ -75,7 +76,7 @@
       }
       
       public void doTestElement () throws Exception {
  -        String thisHost = "localhost";
  +        String thisHost = SimpleAxisWorker.getLocalHost();
           String thisPort = System.getProperty("test.functional.ServicePort","8080");
   
           String[] args = {thisHost,thisPort};