Hi Daniel,

Thanks for the tip--it was very helpful. I was able to get this working
running my app in Jetty, but not when running my testng tests. I don't think
the modules are getting loaded the way I think they are. I'm using
PageTester, which claims

PageTester(String appPackage, String appName, String contextPath, Class...
moduleClasses)
          Initializes a PageTester that acts as a browser and a servlet
container to test drive your Tapestry pages.

I've tried adding various module classes but the
contributeApplicationInitialization code is still not being called. Any
ideas?



Daniel Jue wrote:
> 
> BTW ApplicationInitializerFilter is the interface you want to implement.
> 
> On Tue, Jun 24, 2008 at 5:45 PM, Daniel Jue <[EMAIL PROTECTED]> wrote:
> 
>> Try looking for
>> public class UserInitializerImpl implements ApplicationInitializerFilter
>> {
>> ...
>>  void initializeApplication(Context context, ApplicationInitializer
>> initializer){..reset your stuff in here..}
>> ..
>> }
>>
>>
>> Then in your app module (or just the module you use for testing)
>> contribute
>> that app initializer
>> like this:
>>
>>     /**
>>      * This is a initializer class that will be run when Tapestry starts.
>>      * @param configuration The registry's configuration
>>      * @param passwordEncoder built automatically and injected in
>>      * @param saltSource built automatically and injected in
>>      * @param session built automatically and injected in
>>      */
>>     public static void contributeApplicationInitializer(
>>             OrderedConfiguration<ApplicationInitializerFilter>
>> configuration,
>>             final PasswordEncoder passwordEncoder,
>>             final SaltSourceService saltSource, final Session session) {
>>         configuration.add("UserInitializer", new UserInitializerImpl(
>>                 passwordEncoder, saltSource, session));
>>     }
>>
>> The example above shows how you can pass in things like a session, etc. 
>> Of
>> course this is not always needed.
>>
>> On Tue, Jun 24, 2008 at 4:56 PM, Mohan Zhang
>> <[EMAIL PROTECTED]<[EMAIL PROTECTED]>>
>> wrote:
>>
>>>
>>> Is there anything in Tapestry 5 that makes it easy to programmatically
>>> clear
>>> the database? I'm unit-testing my DAOs and it'd be cool if I could write
>>> an
>>> @BeforeMethod that clears the database. I suppose I could always write a
>>> TestDao that encapsulates these operations, but I just thought I'd check
>>> in
>>> case anyone had come up with a better way. I noticed that a lot of
>>> what's
>>> in
>>> tapestry-test deals with the front-end.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/T5%3A-Programmatically-clearing-the-database-on-unit-tests-tp18099886p18099886.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Programmatically-clearing-the-database-on-unit-tests-tp18099886p18102148.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to