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]
>
>

Reply via email to