Sure, attached converter I use. It looks for the files as resources and regular 
files and makes a copy of them so if FileBean.delete is called we don't care.

WARNING: It is quick and dirty and ContentTypes is just our own little class 
that looks up based off extension....so will need to be replaced with whatever 
you want to have in there.

Put this in our stripes ext packaged and I was off and running.

-Nick

Attachment: FileBeanConverter.java
Description: Binary data




On Jan 28, 2010, at 12:43 PM, Newman, John W wrote:

> I ran into this a while back, see 
> http://old.nabble.com/forum/ViewPost.jtp?post=16314703&framed=y
> 
> I don't think sts-265 is related, but adding that constructor has been fine.  
> Actually a type converter in test only would probably be better, can you 
> share that maybe?  I still think something should happen in the trunk to 
> support file beans from MockRoundtrip.
> 
> 
> 
> -----Original Message-----
> From: Nick Stuart [mailto:nstu...@speranzasystems.com] 
> Sent: Thursday, January 28, 2010 9:53 AM
> To: Stripes Users List
> Subject: Re: [Stripes-users] Testing File uploads
> 
> Answering my own question here, I made a simple file bean converter in my 
> test packages that converts strings to file beans! Yeah for extensions and 
> flexibility. Of course, you never want to put this type of converter into 
> production as it would be dangerous to be able to turn any string parameter 
> passed in into a file.....
> 
> 
> 
> On Jan 27, 2010, at 3:40 PM, Nick Stuart wrote:
> 
>> Hey all, I'm trying to piece together some integration tests, and while 
>> strictly speaking I don't need to test that file uploads work, I need a way 
>> to pass files to my action beans during tests to make sure they do the right 
>> thing with them. 
>> 
>> I am using the MockServletContext and MockRoundTrip which work great for my 
>> 'normal' parameters, but not sure what to do with files. Can I just convert 
>> a byte array of the file contents to a string and pass it that way? Anyone 
>> have to deal with this before?
>> 
>> Thanks for any pointers! 
>> -Nick
> 
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to