I decided to write my own MockHttpServletRequest for testing the feature. I agree with Steven that it would be nice not to break out of container testing system on certain occations. But maybe it is not a much requested feature.
Thanks again.
Harun
On 9/12/06, Steven Grimm <[EMAIL PROTECTED]> wrote:
However, I think it would be nice to be able to feed a fake
HttpServletRequest into the out-of-container test system to test this
sort of thing. There's no inherent reason why you have to be running in
a container to instantiate an HttpServletRequest implementation and pass
it to an element, right?
The Spring guys do lots of request mocking in the unit tests for their
MVC code. Here's the Javadoc URL for their mock class:
http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/mock/web/MockHttpServletRequest.html
-Steve
Geert Bevin wrote:
> Hi Harun,
>
> there's not really a way since the point of the testing API is that it
> runs outside of any servlet container. Your only option would be to
> embed a servlet container, like Jetty, and do that part of the testing
> through there. RIFE does this itself for quite a number of its tests,
> you can look at the sources to see how it's done.
>
> Hope this helps,
>
> Geert
>
> On 12 Sep 2006, at 14:58, Harun Hasdal wrote:
>
>> Hi,
>>
>> I am using rife-1.3.1 for jdk1.4 and I came in need of accessing
>> HttpServletRequest from my element.
>> I'm using getHttpServletRequest().getParameterMap() to access the
>> parameters that are not specified as inputs or parameters in the
>> element declaration.
>> The issue when testing the code with MockConversation and
>> MockRequest, getHttpServletRequest() returns null.
>> Is there any way to Mock the HttpServletRequest and be able to set
>> its parameters?
>>
>> Or is there any other way to access the request parameters that are
>> not declared in the element? Below is a sample element and request
>> that better describes what i m trying to do.
>>
>> <element implementation="elements.ExecuteScript">
>> <input name="Identifier"/>
>> <input name="Script"/>
>> </element>
>>
>> Request URL :
>> /executeScript?Identifier=identifier&Script=script1.groovy&Extra=234&AnotherExtra=123
>>
>>
>> Is this the right way to use
>> getHttpServletRequest().getParameterMap() to get the Extra parameters?
>>
>> Thanks
>> Harun.
>> _______________________________________________
>> Rife-users mailing list
>> [email protected]
>> http://lists.uwyn.com/mailman/listinfo/rife-users
>
> --
> Geert Bevin
> Uwyn "Use what you need" - http://uwyn.com
> RIFE Java application framework - http://rifers.org
> Music and words - http://gbevin.com
>
>
> _______________________________________________
> Rife-users mailing list
> [email protected]
> http://lists.uwyn.com/mailman/listinfo/rife-users
>
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users
_______________________________________________ Rife-users mailing list [email protected] http://lists.uwyn.com/mailman/listinfo/rife-users
