Carissa,

There is no choice. Cactus has chosen to use option 2 and *not* option 1.
The assumption table was jsut to explain the thought process that led to
Cactus' architecture. The architecture is described below.

Now, it is really very simple. Have a look at
http://jakarta.apache.org/commons/cactus/using.html which is really a
tutorial that explains how to write test cases. You only need to look at the
architecture part if you want to understand how Cactus works internally.

Also when you download Cactus, there is a sample application that is bundled
with it that shows how to use Cactus.

Hope it helps.
Vincnent

----- Original Message -----
From: "Paus, Carissa" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 6:26 PM
Subject: RE: [cactus]ServletContext


> Vincent,
>
> Then please explain how to use option 1 on assumption 3 in the
Architecture
> link on the cactus website
>
> ASSUMPTION 3: "We need to call this servlet. Again 2 solutions : (1) open
> a browser and call the servlet URL or (2) write some java code that uses
the
> URLConnection class to automatically call the servlet. This is what I call
> the client side part of Cactus. Of course the best solution is (2) for the
> following reasons :
> - The tests can be automated, i.e. it is possible to do automatic
regression
> tests. See the eXtreme Programming philosophy for better understanding
this.
> The rationale is : everytime you modify some piece of code, you run all
the
> tests again to make sure everything is still working.
> - It is possible to verify the results returned by the Servlet : cookies,
> headers, ... By calling directly the Servlet URL in a browser, it is not
> possible to do so."
>
> I am very unclear on how all of the pieces fit together.  How does the
test
> script talk to and get information from the servlet if not in the
> URLConnection.  Why do you even suggestion option 2 above?  You even state
> the solution (2) is the best.  Please explain if there is another way I am
> supposed to use the URLConnection.
>
> Carissa
>
> -----Original Message-----
> From: Vincent Massol [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 18, 2001 12:07 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [cactus]ServletContext
>
>
> Hi Carissa,
>
> Cactus does not currently offer the option of viewing directly the test
> result in a browser. You have to start it using a JUnit Test Runner (be it
> the text runner or the graphical runners). Also, what you are doing in
your
> beginXXX() method is what is done by the Cactus framework itself and
you're
> not supposed to call the Redirector servlet yourself as a lot of internal
> HTTP parameters are also passed to it ... In other words, the Redirector
> Servlet is not meant to be a public API, meaning it can change a lot
between
> different releases of Cactus.
>
> Thanks
> Vincent
>
> ----- Original Message -----
> From: "Paus, Carissa" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 18, 2001 5:27 PM
> Subject: RE: [cactus]ServletContext
>
>
> > Hi Vincent,
> >
> > I am using the URLConnection method instead of opening a browser and
> calling
> > the servlet URL.  Per assumption 3 under the Architect link.  I did the
> > URLConnection because I didn't understand how opening a browser and
> calling
> > servlet URL was supposed to link the code in my test case and the code I
> was
> > trying to test (ie client/server).  Maybe you can better explain how I
am
> > supposed to use the servlet URL though the browser.
> >
> > Carissa
> >
> > -----Original Message-----
> > From: Vincent Massol [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, June 18, 2001 11:16 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [cactus]ServletContext
> >
> >
> > Hi Carissa,
> >
> > I'm not sure I understand your question and what you are trying to
> achieve.
> > For a start I don't understand why you create an HTTP connection in your
> > beginXXX() method ... ? This is supposed to be done for you by Cactus
> itself
> > ...
> >
> > Also, check
> >
>
http://jakarta.apache.org:8080/jyve-faq/Turbine/screen/DisplayQuestionAnswer
> > /action/SetAll/project_id/2/faq_id/39/topic_id/211/question_id/807 as it
> > might help.
> >
> > Thanks
> > Vincent.
> >
> > ----- Original Message -----
> > From: "Paus, Carissa" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, June 15, 2001 3:03 PM
> > Subject: [cactus]ServletContext
> >
> >
> > > Does anyone know how to pull out the servlet context using cactus?  I
am
> > > using the URLConnection method.  My client is connecting to the server
> > just
> > > fine and the ServletRedirector is getting kicked off (init) on the
> server
> > > side great.  The problem that I am not sure how to get out the servlet
> > > config.  The current way I am trying is giving me a
> NullPointerException.
> > > See example code below:
> > >
> > >   public void beginXXX( ServletTestRequest servlet )
> > >     {
> > >         try
> > >         {
> > >             System.out.println( "Starting begin" );
> > >         System.out.println( "Setting up URL" );
> > >         URLConnection connect;
> > >         URL open = new URL( "http", "Some IP", Some Port,
> > >
> > > "org.apache.commons.cactus.server.ServletTestRedirector");
> > >
> > >         System.out.println( "Calling openConnection" );
> > >         connect = open.openConnection();
> > >
> > >         System.out.println( "Setting values on connect" );
> > >         connect.setAllowUserInteraction( true );
> > >         connect.setDoInput( true );
> > >         connect.setDoOutput( true );
> > >         //connect.setIfModifiedSince();
> > >         connect.setUseCaches( true );
> > >
> > >         System.out.println( "Calling connect" );
> > >         connect.connect();
> > >
> > >  protected void setUp()
> > > {
> > >     try
> > >     {
> > >         //I instantiate an inner class and then try to set some
> > > member variables
> > >
> > >         System.out.println( "Setting ServletContext" );
> > >   //This is the line that causes the NullPointerException
> > >         //Where can I get this from?
> > >         info.servletContext = config.getServletContext();
> > >     }
> > > }
> > >
> > >  public void testExecuteActivity()
> > >     {
> > >
> > >        //Do some stuff
> > >     }
> > >
> > > Thanks
> > >
> > > Carissa
> > >
> >
>

Reply via email to