jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Servlet Testing with Attributes
Date Wed, 17 Apr 2002 07:44:19 GMT


> -----Original Message-----
> From: Arathi.Bhaskar@itsindia.com [mailto:Arathi.Bhaskar@itsindia.com]
> Sent: 17 April 2002 04:38
> To: Cactus Users List
> Subject: RE: Servlet Testing with Attributes
> 
> 
> First of all, I want to say that I am using Cactus 1.1. What happened
was
> as Laurent had mentioned, I included request.setURL(..... ) with all
> required parameters, incl. Query String.
> 
> In my actual servlet, I gave a System.out message to see if I am
getting
> the request.getQueryString. It is printing the values I passed. 

I already mentioned it in a previous email but let me clear the
confusion completely : setURL() in Cactus 1.1 and 1.2 does not pass any
parameter that you specify in the query string to getParameter().
However someone rightly suggested that it should and thus it has been
added in Cactus 1.3.

P.S.: I haven't been clear in my previous email in the sense that I said
it would not work. Sorry Laurent about this. It isn't completely true :
it will work with Cactus 1.3 but not with Cactus 1.2 nor Cactus 1.1.
However, the preferred method (the way it was initially designed) is to
use WebRequest.addParameter(). If you also specify parameters in
setURL() Cactus will merge them with the ones you defined through
addParameter().

Sorry for the confusion.

> But the
> funniest part is when i say
> 
> request.getParameter("strScreenId")
> request.getParameter("strMinRoleID"), both are coming as null.
> 
> After that I am assigning these values to session variables & trying
to
> print them in Test Method. It gives everything as null.
> 
> Could you tell me what this problem could me.
> 

Please check what I said in my previous email for how to do that.

> Thanks & Regards
> Arathi

Thanks
-Vincent

> 
> 
> 
> 
> 
>                     "Vincent
>                     Massol"              To:     "'Cactus Users List'"
>                     <vmassol@octo.
<cactus-user@jakarta.apache.org>
>                     com>                 cc:
>                                          Subject:     RE: Servlet
Testing
> with Attributes
>                     04/15/02 12:44
>                     AM
>                     Please respond
>                     to "Cactus
>                     Users List"
> 
> 
> 
> 
> 
> 
> Yes, that looks fine to me. What error do you get ?
> -Vincent
> 
> > -----Original Message-----
> > From: Arathi.Bhaskar@itsindia.com
[mailto:Arathi.Bhaskar@itsindia.com]
> > Sent: 16 April 2002 12:44
> > To: Cactus Users List
> > Subject: Re: Servlet Testing with Attributes
> >
> >
> > Hi
> >
> > This is the code I have:
> >
> >      public void beginGetMethod(ServletTestRequest theRequest) {
> >           theRequest.addParameter("strScreenId", "5");
> >           theRequest.addParameter("strMinRoleId", "1");
> >      }
> >
> >      public void testGetMethod() throws IOException
> >      {
> >
> >         System.out.println("Inside testGetMethod........");
> >
> >         try {
> >              servlet.doGet(request, response);
> >         } catch (Exception e) {
> >              System.out.println(e.toString());
> >         }
> >
> >        System.out.println("Completed testGetMethod.....");
> >      }
> >
> > My actual Servlet being tested uses request.getParameter() method to
> > retrieve the values of strScreenId, strMinRoleId.
> >
> > Will this not work???
> >
> > Thanks & Regards
> > Arathi
> >
> >
> >
> >
> >
> >                     laurent.duperv
> >                     al@masq.ca           To:     cactus-
> > user@jakarta.apache.org
> >                                          cc:
> >                     04/16/02 05:15       Subject:     Re: Servlet
> Testing
> > with Attributes
> >                     PM
> >                     Please respond
> >                     to "Cactus
> >                     Users List"
> >
> >
> >
> >
> >
> >
> > On 16 Apr, Arathi.Bhaskar@itsindia.com wrote:
> > > Hi
> > >
> > > I have a test servlet , which does the following:
> > >
> > > 1. In the setup method, i am instantiating the actual servlet to
be
> > tested.
> > > 2. In the test method, i am calling the servlet's doGet method,
> which is
> > to
> > > be tested. doGet method in the actual servlet accepts two
parameters
> as
> > > part of the Query String. (thru getAttribute).
> > >
> > > My question is, how can I set this in my test method before
calling
> the
> > > doGet method.
> > >
> >
> > I think this is the correct way:
> >
> > public void beginDoGet(WebRequest theRequest) {
> >         theRequest.setURL("localhost:8080", "/servletcontext",
> >         "/YourTestServlet", null, "param1=foo,param2=bar");
> > }
> >
> > L
> >
> > --
> > Laurent Duperval <mailto:laurent.duperval@masq.ca>
> >
> > People have one thing in common--they are all different.
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   <
> > mailto:cactus-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <
> > mailto:cactus-user-help@jakarta.apache.org>
> >
> >
> >
> >
> >
> > -----------------------Disclaimer------------------------
> >
> > The views of the author may not necessarily reflect those
> > of the Company. All liability is excluded to the extent
> > permitted by law for any claims arising as a result of the
> > use of this medium to transmit information by or to
> > IT Solutions (India) Pvt. Ltd.
> >
> > We have taken precautions to minimize the risk of
> > transmitting software viruses, but we advise you to
> > carry out your own virus checks on any attachment to
> > this message.  We cannot accept liability for any loss or
> > damage caused by software viruses.
> >
> > ------------------------Disclaimer------------------------
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:cactus-user-
> > unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:cactus-user-
> > help@jakarta.apache.org>
> >
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <
> mailto:cactus-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <
> mailto:cactus-user-help@jakarta.apache.org>
> 
> 
> 
> 
> 
> -----------------------Disclaimer------------------------
> 
> The views of the author may not necessarily reflect those
> of the Company. All liability is excluded to the extent
> permitted by law for any claims arising as a result of the
> use of this medium to transmit information by or to
> IT Solutions (India) Pvt. Ltd.
> 
> We have taken precautions to minimize the risk of
> transmitting software viruses, but we advise you to
> carry out your own virus checks on any attachment to
> this message.  We cannot accept liability for any loss or
> damage caused by software viruses.
> 
> ------------------------Disclaimer------------------------
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message