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 st...@apache.org on 2002/09/06 22:41:29 UTC

cvs commit: xml-axis/java/test/httpunit/src/test HttpUnitTestBase.java JwsTest.java ServicesTest.java

stevel      2002/09/06 13:41:29

  Modified:    java/test/httpunit build.xml
               java/test/httpunit/lib Tidy.jar httpunit.jar junit.jar
               java/test/httpunit/src/test HttpUnitTestBase.java
                        JwsTest.java ServicesTest.java
  Log:
  some more tests
  
  Revision  Changes    Path
  1.4       +3 -0      xml-axis/java/test/httpunit/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/httpunit/build.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- build.xml	4 Sep 2002 19:16:31 -0000	1.3
  +++ build.xml	6 Sep 2002 20:41:28 -0000	1.4
  @@ -88,11 +88,14 @@
   
     <target name="default" 
       depends="compile"
  +    description="compile the tests"
       />
   
     <!-- cleanup target -->
     <target name="clean" description="cleanup"/>
   
  +  <target name="all" depends="compile,run-test" 
  +    description="compile and run the tests"/>
     
     <!-- init configures things -->
     <target name="init" >
  
  
  
  1.2       +483 -542  xml-axis/java/test/httpunit/lib/Tidy.jar
  
  	<<Binary file>>
  
  
  1.2       +906 -627  xml-axis/java/test/httpunit/lib/httpunit.jar
  
  	<<Binary file>>
  
  
  1.2       +404 -424  xml-axis/java/test/httpunit/lib/junit.jar
  
  	<<Binary file>>
  
  
  1.2       +13 -1     xml-axis/java/test/httpunit/src/test/HttpUnitTestBase.java
  
  Index: HttpUnitTestBase.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/httpunit/src/test/HttpUnitTestBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpUnitTestBase.java	23 Jul 2002 23:42:49 -0000	1.1
  +++ HttpUnitTestBase.java	6 Sep 2002 20:41:29 -0000	1.2
  @@ -118,9 +118,21 @@
                                          String searchfor
                                          )
                   throws IOException, org.xml.sax.SAXException {
  +        WebResponse response = makeRequest(request);
  +        assertStringInBody(response,searchfor,request.getURL().toString());
  +    }
  +
  +    /**
  +     * make a request in a new session
  +     * @param request   request to make
  +     * @return the response
  +     * @throws IOException
  +     * @throws SAXException
  +     */
  +    protected WebResponse makeRequest(WebRequest request) throws IOException, SAXException {
           WebConversation session = new WebConversation();
           WebResponse response=session.getResponse(request);
  -        assertStringInBody(response,searchfor,request.getURL().toString());
  +        return response;
       }
   
       /**
  
  
  
  1.2       +61 -0     xml-axis/java/test/httpunit/src/test/JwsTest.java
  
  Index: JwsTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/httpunit/src/test/JwsTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JwsTest.java	23 Jul 2002 23:42:49 -0000	1.1
  +++ JwsTest.java	6 Sep 2002 20:41:29 -0000	1.2
  @@ -74,4 +74,65 @@
           WebRequest request = new GetMethodWebRequest(url+"/StockQuoteService.jws?wsdl");
           assertStringInBody(request,"<wsdl:definitions");
       }
  +
  +    public void testEchoHeadersWsdl() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(url + "/EchoHeaders.jws?wsdl");
  +        assertStringInBody(request, "<wsdl:definitions");
  +    }
  +
  +
  +    public void testEchoHeaders() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(url + "/EchoHeaders.jws");
  +        assertStringInBody(request, "Some Services");
  +    }
  +
  +    /**
  +     * see that we get a hello back
  +     * @throws Exception
  +     */
  +    public void testEchoHeadersWhoami() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(url
  +                + "/EchoHeaders.jws");
  +        request.setParameter("method", "whoami");
  +        assertStringInBody(request, "Hello");
  +    }
  +
  +    /**
  +     * do we get a list of headers back?
  +     * @throws Exception
  +     */
  +    public void testEchoHeadersList() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(url
  +                + "/EchoHeaders.jws");
  +        request.setHeaderField("x-header","echo-header-test");
  +        request.setParameter("method", "list");
  +        assertStringInBody(request, "echo-header-test");
  +    }
  +
  +    /**
  +     * send an echo with a space down
  +     * @throws Exception
  +     */
  +    public void testEchoHeadersEcho() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(url
  +                + "/EchoHeaders.jws");
  +        request.setParameter("method","echo");
  +        request.setParameter("param", "foo bar");
  +        assertStringInBody(request, "foo bar");
  +    }
  +
  +    /**
  +     * send a complex unicode round the loop and see what happens
  +     * @throws Exception
  +     */
  +    /* this is failing but it may be in the test code
  +    public void testEchoHeadersEchoUnicode() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(url
  +                + "/EchoHeaders.jws");
  +        request.setParameter("method", "echo");
  +        request.setParameter("param", "\u221a");
  +        assertStringInBody(request, "\u221a");
  +    }
  +    */
  +
   }
  
  
  
  1.3       +20 -3     xml-axis/java/test/httpunit/src/test/ServicesTest.java
  
  Index: ServicesTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/httpunit/src/test/ServicesTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServicesTest.java	14 Aug 2002 06:32:50 -0000	1.2
  +++ ServicesTest.java	6 Sep 2002 20:41:29 -0000	1.3
  @@ -57,6 +57,7 @@
   
   import com.meterware.httpunit.WebRequest;
   import com.meterware.httpunit.GetMethodWebRequest;
  +import com.meterware.httpunit.WebResponse;
   
   /**
    * test the services
  @@ -64,7 +65,7 @@
    * @created Jul 10, 2002 12:09:06 AM
    */
   
  -public class ServicesTest extends HttpUnitTestBase{
  +public class ServicesTest extends HttpUnitTestBase {
   
       private String services;
   
  @@ -134,9 +135,25 @@
        * test version call
        * @throws Exception
        */
  -    public void testVersion() throws Exception {
  -        WebRequest request = new GetMethodWebRequest(services+"/Version?wsdl");
  +    public void testVersionWSDL() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(services
  +                +"Version?wsdl");
           assertStringInBody(request,"<wsdl:definitions");
       }
  +
  +    /**
  +     * test version call
  +     * @throws Exception
  +     */
  +    public void testVersionMethod() throws Exception {
  +        WebRequest request = new GetMethodWebRequest(services
  +                + "Version?method=getVersion");
  +        WebResponse response=makeRequest(request);
  +        String body = response.getText();
  +        assertTrue(body.indexOf("<?xml") ==0);
  +        assertTrue(body.indexOf("<getVersionReturn")>0);
  +    }
  +
  +
   
   }