struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kawczynski, David" <david_kawczyn...@merck.com>
Subject RE: Struts 2.1.6 Test Examples
Date Wed, 13 May 2009 19:00:01 GMT
I'm certainly no magician, but was still able to do this. 

If your action depends on session info, implement SessionAware 
and provide it with a Map of name-value pairs in the testcase.

If your action depends on request info, implement RequestAware 
and provide it with a Map of name-value pairs in the testcase.

If everything is spring-driven, you can start Spring without a 
web container via ClassPathXmlApplicationContext:

AbstractApplicationContext springContext = 
	new ClassPathXmlApplicationContext("applicationContext.xml");

springContext.registerShutdownHook();

SomeAction someAction = 
	(SomeAction)springContext.getBean("someAction");



-----Original Message-----
From: Jim Collings [mailto:jlistnews@gmail.com] 
Sent: Wednesday, May 13, 2009 2:24 PM
To: Struts Users Mailing List
Subject: Re: Struts 2.1.6 Test Examples

Ya. That sounds like a magic trick.  ;-)

On 5/13/09, Doug Pham <dougtpham@yahoo.com> wrote:
> Hi All,
>      In the main page one of the bullet point is:
> Easy-to-test Actions - Test Struts2 Actions directly, without resorting to
> mock HTTP objects.
>
> I would love to see a few examples of these.
>
> Cheers,
> Doug
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or
MSD and in Japan, as Banyu - direct contact information for affiliates is
available at http://www.merck.com/contact/contacts.html) that may be
confidential, proprietary copyrighted and/or legally privileged. It is
intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please notify us immediately by reply e-mail and
then delete it from your system.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message