You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2003/02/26 08:37:16 UTC

cvs commit: jakarta-cactus/samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit TestHttpHeaders.java TestHttpUnitIntegration.java

vmassol     2003/02/25 23:37:16

  Modified:    samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit
                        TestHttpHeaders.java TestHttpUnitIntegration.java
  Log:
  Add tests to verify that headers set in the response can be assrted in endXXX
  
  Revision  Changes    Path
  1.2       +31 -1     jakarta-cactus/samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit/TestHttpHeaders.java
  
  Index: TestHttpHeaders.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit/TestHttpHeaders.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestHttpHeaders.java	8 Feb 2003 11:17:10 -0000	1.1
  +++ TestHttpHeaders.java	26 Feb 2003 07:37:15 -0000	1.2
  @@ -55,6 +55,7 @@
   
   import org.apache.cactus.ServletTestCase;
   import org.apache.cactus.WebRequest;
  +import org.apache.cactus.WebResponse;
   
   /**
    * Tests manipulating HTTP headers.
  @@ -160,6 +161,35 @@
       public void testSetContentTypeHeader()
       {
           assertEquals("text/xml", request.getContentType());
  +    }
  +
  +    //-------------------------------------------------------------------------
  +
  +    /**
  +     * Verify that we can set several headers in the response and
  +     * assert them in endXXX().
  +     */
  +    public void testResponseAddHeaders()
  +    {
  +        response.addHeader("X-Access-Header1", "value1");
  +        response.addHeader("X-Access-Header2", "value2");
  +    }
  +
  +    /**
  +     * Verify that we can set several headers in the response and
  +     * assert them in endXXX().
  +     *
  +     * @param theResponse the response from the server side.
  +     */
  +    public void endResponseAddHeaders(WebResponse theResponse) 
  +    {
  +        String value1 = 
  +            theResponse.getConnection().getHeaderField("X-Access-Header1");
  +        String value2 = 
  +            theResponse.getConnection().getHeaderField("X-Access-Header2");
  +
  +        assertEquals("value1", value1);
  +        assertEquals("value2", value2);
       }
   
   }
  
  
  
  1.2       +30 -1     jakarta-cactus/samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit/TestHttpUnitIntegration.java
  
  Index: TestHttpUnitIntegration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/samples/servlet/src/test-cactus/share/org/apache/cactus/sample/unit/TestHttpUnitIntegration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestHttpUnitIntegration.java	8 Feb 2003 11:17:09 -0000	1.1
  +++ TestHttpUnitIntegration.java	26 Feb 2003 07:37:15 -0000	1.2
  @@ -105,4 +105,33 @@
   
           assertEquals("something to return for the test", text);
       }
  +
  +    //-------------------------------------------------------------------------
  +
  +    /**
  +     * Verify that we can set several headers in the response and
  +     * assert them in endXXX().
  +     */
  +    public void testResponseAddHeadersHttpUnit()
  +    {
  +        response.addHeader("X-Access-Header1", "value1");
  +        response.addHeader("X-Access-Header2", "value2");
  +    }
  +
  +    /**
  +     * Verify that we can set several headers in the response and
  +     * assert them in endXXX().
  +     *
  +     * @param theResponse the response from the server side.
  +     */
  +    public void endResponseAddHeadersHttpUnit(
  +    com.meterware.httpunit.WebResponse theResponse)
  +    {
  +        String value1 = theResponse.getHeaderField("X-Access-Header1");
  +        String value2 = theResponse.getHeaderField("X-Access-Header2");
  +
  +        assertEquals("value1", value1);
  +        assertEquals("value2", value2);
  +    }
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org