larryi      01/09/21 19:45:45

  Modified:    src/share/org/apache/tomcat/util/test TestDefaults.java
                        HttpClient.java GTest.java
  Log:
  Update to be compatible with Ant 1.4.  Ant 1.4's TaskAdapter.execute() will
  call setProject(Project) on the proxy.
  
  Now that there is a way to get the Project it should be possible to store
  information in the Project, such as the session cookie.  This could allow
  a sequence of tests to imitate being part of the same session.
  
  Revision  Changes    Path
  1.4       +4 -1      
jakarta-tomcat/src/share/org/apache/tomcat/util/test/TestDefaults.java
  
  Index: TestDefaults.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/TestDefaults.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestDefaults.java 2001/07/17 13:34:01     1.3
  +++ TestDefaults.java 2001/09/22 02:45:45     1.4
  @@ -62,8 +62,8 @@
   import java.io.*;
   import java.util.*;
   import java.net.*;
  +import org.apache.tools.ant.*;
   
  -
   /** Set default values for HttpClient and GTest.
    */
   public class TestDefaults {
  @@ -90,6 +90,9 @@
   
       public void setOutputType(String t  ) {
        Report.setDefaultOutput(t);
  +    }
  +
  +    public void setProject(Project p ) {
       }
   
       public void execute() {
  
  
  
  1.9       +10 -0     
jakarta-tomcat/src/share/org/apache/tomcat/util/test/HttpClient.java
  
  Index: HttpClient.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/HttpClient.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- HttpClient.java   2001/07/17 13:34:01     1.8
  +++ HttpClient.java   2001/09/22 02:45:45     1.9
  @@ -59,6 +59,7 @@
   package org.apache.tomcat.util.test;
   
   import org.apache.tomcat.util.test.matchers.*;
  +import org.apache.tools.ant.*;
   import java.net.*;
   import java.io.*;
   import java.util.*;
  @@ -80,6 +81,7 @@
   public class HttpClient {
       static Report defaultReport=new Report();
   
  +    Project project=null;
       HttpRequest firstRequest=null;
       Vector actions=new Vector();
       String id;
  @@ -91,6 +93,14 @@
       String outType=null;
       
       public HttpClient() {
  +    }
  +
  +    public void setProject(Project p ) {
  +        project=p;
  +    }
  +
  +    public Project getProject() {
  +        return project;
       }
   
       /** Set an unique id to this request. This allows it to be
  
  
  
  1.13      +10 -0     jakarta-tomcat/src/share/org/apache/tomcat/util/test/GTest.java
  
  Index: GTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/test/GTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- GTest.java        2001/07/17 13:34:00     1.12
  +++ GTest.java        2001/09/22 02:45:45     1.13
  @@ -63,6 +63,7 @@
   import java.util.*;
   import java.net.*;
   import org.apache.tomcat.util.test.matchers.*;
  +import org.apache.tools.ant.*;
   
   /** Original tester for a web application. Will send a http request and
       verify the response code, compare the response with a golden
  @@ -83,6 +84,8 @@
   
       // Instance variables
   
  +    Project project=null;
  +
       // The "real" thing.
       // GTest is here to support the old ( and simpler ) syntax .
       // The real work is done in HttpClient, which is a lot more
  @@ -160,6 +163,12 @@
        HttpClient.getHttpClients().clear();
       }
       
  +    // ----------------- Ant Properie -----------------
  +
  +    public void setProject(Project p ) {
  +        project=p;
  +    }
  +
       // -------------------- GTest behavior --------------------
       public void setWriter( PrintWriter pw ) {
        out=pw;
  @@ -312,6 +321,7 @@
            //   System.out.println("XXX " + outType + " " + defaultOutType);
            if( debug==-1) debug=defaultDebug;
   
  +            httpClient.setProject(project);
            initMatchers();
               httpClient.setWriter(out);
               httpClient.setOutput(outType);
  
  
  

Reply via email to