Jason van Zyl wrote:
>
> On 9/18/01 10:46 PM, "William Lee" <[EMAIL PROTECTED]> wrote:
>
> > Does anybody use Turbine with Cactus? I'm very new to Cactus but I'm
> > trying to think of a way to better unit-test (or in some way,
> > function-test) my Turbine screen and action modules. What I would like
> > to do is to submit a request, go through Turbine's doGet or doPost
> > method, and verify the final Velocity context in the session's rundata.
> > Is it possible to do so using Turbine? I can't seem to think of a way
> > to write the beginXXX(), testXXX(), and endXXX() methods. Any help
> > would be greatly appreciated.
> >
It certainly is possible. I am assuming you want to call one of your
Turbine actions / screens etc. and test the state of the Velocity
context afterwards?
In my experience, there are a few basic steps needed to accomplish this:
In your setup method:
1.) You need an instance of RunData. Use RunDataFactory.getRunData()
with the 'request', 'response', and 'config' parameters supplied by
Cactus to get a fresh instance.
2.) Get an instance of ActionLoader using ActionLoader.getInstance().
In your test method.
3.) Prepare the RunData and Velocity context. Add all the parameters to
the RunData and the objects to the Context that your action needs to
execute.
4.) Execute the action using ActionLoader's exec( RunData, "actionName"
) method. If it is an ActionEvent, you will need to add the appropriate
'eventSubmit_doXXX' parameter to the RunData as well.
5.) Once the action has executed, you can use the RunData object to
retrieve the VelocityContext and do all the asserts you want.
You will also need to configure a few things to get Cactus working with
Turbine. As Jason mentioned, Jetspeed should give you an indication of
how this should be done. There is at least one example of how to write a
unit test in the Jetspeed CVS.
I suggest doing a search on the users and developers mailing lists. This
issue has been brought up a few times before and you might find more
information in some of the other posts.
Hope this helps.
- Johnny.
>
> We are currently trying to integrate cactus into the TDK and it will be in
> the next release of the TDK. There are some examples in Jetspeed as they are
> currently using cactus for some tests. I am new to cactus too, but Kurt is
> working on the cactus integration and we'll probably have something to share
> soon :-)
>
> --
>
> jvz.
>
> Jason van Zyl
>
> http://tambora.zenplex.org
> http://jakarta.apache.org/turbine
> http://jakarta.apache.org/velocity
> http://jakarta.apache.org/alexandria
> http://jakarta.apache.org/commons
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]