Re: [Stripes-users] MockRoundtrip:: 2-Round Trips / Conversation:: How???

2011-01-30 Thread Nikolaos Giannopoulos
Never mind... I simply used 2 back-to-back MockRountrip's... and re-used 
the context and session created from the 1st trip in the 2nd trip.

--Nikolaos



Nikolaos Giannopoulos wrote:
 Hi,

 Perhaps I am pushing the envelope with MockRoundtrip however what I 
 would like to be able to do is the following integration tests:


 (1) Execute a request based on URL and have MockRoundtrip invoke the 
 appropriate event handler and do whatever bean logic
 e.g.  @UrlBinding(/share/{uuidRadix}/{titleUrlified}/{$event})

 In my test I do the following:

 session = new MockHttpSession(context);
 trip = new MockRoundtrip(context, /share/3gi/_/edit, session);
 trip.execute();
 actionBean = (BaseActionBean) trip.getActionBean(actionBeanClass);

 And all is well... in that the ActionBean has a Share loaded from the DB


 (2) I want to now simulate a form post to this ActionBean to say make 
 changes to the Share and then verify they were committed to the DB.

 The problem is if I do MockRoundtrip again with the appropriate URL or 
 even ActionBean class it will create a NEW ActionBean and process the 
 request.  That is obviously pointless.  But if I try to re-use the 
 MockRoundtrip attempting to try execute(save) results in an error 
 (understandable).


 So how does one use MockRoundtrip to do:

 (A)  Execute initial request... get a bean, state, etc...
 (B)  Execute say a Save request... using the previously loaded bean, 
 state, etc...

 I looked at extending MockRoundtrip but am unsure where to hook in to 
 supply my ActionBean created in (A) when invoking execute(save) is 
 done in (B).

 I would imagine someone has done this before.

 Thanks,

 --Nikolaos


 --
 Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
 Finally, a world-class log management solution at an even better price-free!
 Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
 February 28th, so secure your free ArcSight Logger TODAY! 
 http://p.sf.net/sfu/arcsight-sfd2d
 ___
 Stripes-users mailing list
 Stripes-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/stripes-users

   


-- 
Nikolaos Giannopoulos
Director of Information Technology
BrightMinds Software Inc.
e. nikol...@brightminds.org
w. www.brightminds.org
t. 1.613.822.1700
c. 1.613.797.0036
f. 1.613.822.1915


--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


[Stripes-users] MockRoundtrip:: 2-Round Trips / Conversation:: How???

2011-01-29 Thread Nikolaos Giannopoulos
Hi,

Perhaps I am pushing the envelope with MockRoundtrip however what I 
would like to be able to do is the following integration tests:


(1) Execute a request based on URL and have MockRoundtrip invoke the 
appropriate event handler and do whatever bean logic
e.g.  @UrlBinding(/share/{uuidRadix}/{titleUrlified}/{$event})

In my test I do the following:

session = new MockHttpSession(context);
trip = new MockRoundtrip(context, /share/3gi/_/edit, session);
trip.execute();
actionBean = (BaseActionBean) trip.getActionBean(actionBeanClass);

And all is well... in that the ActionBean has a Share loaded from the DB


(2) I want to now simulate a form post to this ActionBean to say make 
changes to the Share and then verify they were committed to the DB.

The problem is if I do MockRoundtrip again with the appropriate URL or 
even ActionBean class it will create a NEW ActionBean and process the 
request.  That is obviously pointless.  But if I try to re-use the 
MockRoundtrip attempting to try execute(save) results in an error 
(understandable).


So how does one use MockRoundtrip to do:

(A)  Execute initial request... get a bean, state, etc...
(B)  Execute say a Save request... using the previously loaded bean, 
state, etc...

I looked at extending MockRoundtrip but am unsure where to hook in to 
supply my ActionBean created in (A) when invoking execute(save) is 
done in (B).

I would imagine someone has done this before.

Thanks,

--Nikolaos


--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users