rwaldhoff 01/08/14 16:06:46 Modified: httpclient/src/test/org/apache/commons/httpclient Tag: rlwrefactoring TestWebappMethods.java TestWebappRedirect.java Log: Make use of rudimentary response body buffering to HttpMethodBase and methods in PutMethod to return this data Revision Changes Path No revision No revision 1.1.2.2 +7 -8 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappMethods.java Index: TestWebappMethods.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappMethods.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- TestWebappMethods.java 2001/08/13 16:02:57 1.1.2.1 +++ TestWebappMethods.java 2001/08/14 23:06:46 1.1.2.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappMethods.java,v 1.1.2.1 2001/08/13 16:02:57 rwaldhoff Exp $ - * $Revision: 1.1.2.1 $ - * $Date: 2001/08/13 16:02:57 $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappMethods.java,v 1.1.2.2 2001/08/14 23:06:46 rwaldhoff Exp $ + * $Revision: 1.1.2.2 $ + * $Date: 2001/08/14 23:06:46 $ * ==================================================================== * Copyright (C) The Apache Software Foundation. All rights reserved. * @@ -32,7 +32,7 @@ * "httpclient.test.webappContext" property. * * @author Rodney Waldhoff - * @version $Id: TestWebappMethods.java,v 1.1.2.1 2001/08/13 16:02:57 rwaldhoff Exp $ + * @version $Id: TestWebappMethods.java,v 1.1.2.2 2001/08/14 23:06:46 rwaldhoff Exp $ */ public class TestWebappMethods extends TestCase { @@ -243,6 +243,7 @@ fail("Unable to execute method : " + t.toString()); } assertEquals(200,method.getStatusCode()); + assert(method.getResponseBodyAsString(),method.getResponseBodyAsString().indexOf("<title>Param Servlet: PUT</title>") >= 0); method.recycle(); @@ -254,6 +255,7 @@ fail("Unable to execute method : " + t.toString()); } assertEquals(200,method.getStatusCode()); + assert(method.getResponseBodyAsString(),method.getResponseBodyAsString().indexOf("<title>Param Servlet: PUT</title>") >= 0); } //// @@ -279,7 +281,6 @@ HttpClient client = new HttpClient(); client.startSession(host, port); PutMethod method = new PutMethod("/" + context + "/body"); - //method.setUseDisk(false); method.setData("This is data to be sent in the body of an HTTP PUT."); try { client.executeMethod(method); @@ -287,11 +288,9 @@ t.printStackTrace(); fail("Unable to execute method : " + t.toString()); } - //System.out.println(method.getDataAsString()); - //assert(method.getDataAsString().indexOf("<tt>quote=It+was+the+best+of+times%2C+it+was+the+worst+of+times.</tt>") >= 0); + assert(method.getResponseBodyAsString(),method.getResponseBodyAsString().indexOf("<tt>This is data to be sent in the body of an HTTP PUT.</tt>") >= 0); assertEquals(200,method.getStatusCode()); } } - 1.1.2.2 +4 -3 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappRedirect.java Index: TestWebappRedirect.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappRedirect.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- TestWebappRedirect.java 2001/08/14 22:39:21 1.1.2.1 +++ TestWebappRedirect.java 2001/08/14 23:06:46 1.1.2.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappRedirect.java,v 1.1.2.1 2001/08/14 22:39:21 rwaldhoff Exp $ - * $Revision: 1.1.2.1 $ - * $Date: 2001/08/14 22:39:21 $ + * $Header: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/Attic/TestWebappRedirect.java,v 1.1.2.2 2001/08/14 23:06:46 rwaldhoff Exp $ + * $Revision: 1.1.2.2 $ + * $Date: 2001/08/14 23:06:46 $ * ==================================================================== * Copyright (C) The Apache Software Foundation. All rights reserved. * @@ -33,7 +33,7 @@ * "httpclient.test.webappContext" property. * * @author Rodney Waldhoff - * @version $Id: TestWebappRedirect.java,v 1.1.2.1 2001/08/14 22:39:21 rwaldhoff Exp $ + * @version $Id: TestWebappRedirect.java,v 1.1.2.2 2001/08/14 23:06:46 rwaldhoff Exp $ */ public class TestWebappRedirect extends TestCase { @@ -159,6 +159,7 @@ t.printStackTrace(); fail("Unable to execute method : " + t.toString()); } + assert(method.getResponseBodyAsString(),method.getResponseBodyAsString().indexOf("<tt>This is data to be sent in the body of an HTTP PUT.</tt>") >= 0); assertEquals(200,method.getStatusCode()); } }