Title: Access to HttpServletRequest.getInputStream() in Cactus
 
----- Original Message -----
Sent: Wednesday, May 09, 2001 7:55 PM
Subject: RE: Access to HttpServletRequest.getInputStream() in Cactus

Vincent,
   I may be able to work on it , and send you a patch, if you point
 
kewl ... :)
   me in the right direction. Otherwise  we can't really use Cactus.
   What general area would the change be in ???
 
 
You need to look at the ServletTestRequest class (in org.apache.commons.cactus package) in order to add a new method and the ancillary classes that make the HTTP connection so that they use the input stream provided by that new method. That would be the HttpClientHelper class in package org.apache.commons.cactus.client
 
Thanks
  --- jerome
 
Vincent.
-----Original Message-----
From: Vincent Massol [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 09, 2001 2:02 AM
To: [EMAIL PROTECTED]
Subject: Re: Access to HttpServletRequest.getInputStream() in Cactus

Hi Jerome,
----- Original Message -----
Sent: Tuesday, May 08, 2001 7:12 PM
Subject: Access to HttpServletRequest.getInputStream() in Cactus


  Folks,
   I'm trying to unit test a Servlet which reads XML messages via an HTTP
POST
  and sends back an XML message in the response. The Servlet reads in the
   XML via the HttpServletRequest.getInputStream(). Is there anyway to
"push"
   data into this InputStream from Cactus ( perhaps setting a String buffer
???)

In the current version, no. I have a todo task (http://jakarta.apache.org/commons/cactus/todo.html) for offering an API to end user to be able to get the servlet input stream. So far, only one person asked for it (which is why I added it to the todo list) and I have not had the time to implement it, although it should be quite simple to do. If you have some time, please take a stab at it. Otherwise, I'll try to do it asap but I can't guarantee when ... :) (I'm doing this on my free time). If others want to help ... :)

   Also, I don't quite understand why Cactus needs to be run inside a
WebServer like
   Tomcat. Why can't one create concrete representations of
HttpServletRequest and
  HttpServletResponse, and use that ??? Am I missing something ???

It's actually a very interesting question. Craig gave you the main answer in a follow-up post.

Yesterday, I went to the XtC (eXtreme Tuesday Club, in London) - check www.xpdeveloper.com - and had a very interesting discussion on mock objects vs in container testing. The conclusion was that I actually liked some of their ideas and I will find some time to look at how they do it. There are pros and cons of both. Here is my plan :

- look at it next weekend and come up with an article that I'll put on the Cactus web site that discusses the pros and cons of each method. I'll also try to come up with an example of how to implement some test case in both strategies.

 thanks in advance ...
   --- jerome

Thanks

Vincent.

Reply via email to