jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zhang, Li" <Li.Zh...@eal.ab.ca>
Subject RE: Cannot use "runservertest" in an Ant build.xml to start JRun 3.1
Date Mon, 04 Feb 2002 18:48:15 GMT
Hi, Vincent,

I agree with you. The "runservertests" does start the tests after starting
the app server and loading all "load-on-startup" servlets. I've confirmed
this by checking the JRun's event log file. The problem is the pre-loaded
servlet (which has a "load-on-startup" tag in the web.xml) of my application
creates a thread in its init method to periodically check/load the
configuration file of my application. That's why I couldn't run the tests
without the "sleep".

Setting the "testURL" to the pre-loaded servlet is a good idea which avoids
the use of "sleep". There are two points that need to be taken into
consideration if the servlet starts a thread which does its own
initialization: 

1) the pre-loaded servlet should detect if the thread finishes the loading
of the config file
2) the pre-loaded servet has to return a response to the caller; 

In my application, the pre-loaded servlet does nothing but starts a thread
which periodically checks/loads the configuration data. The doGet/doPost
does nothing but just return. So the "runservertests" thinks the application
server is still not yet ready for doing the tests. It hangs there and keeps
waiting for a response from the testURL.

Anyway, I only need to add some extra lines in my pre-loaded servlet to use
"runservertests" correctly. Cactus is really a good framework to do
server-side testing. You have done a great job.

Thank you.

Li

> 

The only reason why I wrote the runservertests custom task was to get
rid of the "wait" !! I'm also loading servlets at startup time (with the
load-on-startup attribute in web.xml)and I have not found any issue with
any servlet engine so far (in other word, they seem to finish loading
all servlets before servicing requests). Also, you could put the testURL
to be the path to your servlet if you wish.

-Vincent

> Li
> 
> 
> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@octo.com]
> Sent: Saturday, February 02, 2002 4:04 AM
> To: 'Cactus Users List'
> Subject: RE: Cannot use "runservertest" in an Ant build.xml to start
> JRun 3.1
> 
> 
> Li,
> 
> I've looked at your scripts and they look fine (although there is no
> need to sleep with the runservertests task - which is why it is better
> than the parallel/sequential stuff).
> 
> Indeed, it appears that start_jrun is not called by runservertests ...
> The only case when it would not be called is if the testURL URL
succeeds
> in connecting to a server. The rationale behing this is : if the
server
> is already started, runservertests will not start it again nor will it
> stop it after the tests have run. This is to allow the use of dynamic
> reloading of containers and thus shorten the time to test.
> 
> Prior to starting the Ant, can you verify with a browser that
connection
> to http://localhost/asp fails (404 error) ?
> 
> Something I don't understand : you said earlier that if you removed
> "startTarget=xxx" then stop_jrun was executed... I don't understand
this
> as internally the code is :
> 
>         // Verify that a test URL has been specified
>         if (this.testURL == null) {
>             throw new BuildException("A testURL attribute must be
> specified");
>         }
> 
>         // Verify that a start target has been specified
>         if (this.startTarget == null) {
>             throw new BuildException("A startTarget Ant target name
must
> " +
>                 "be specified");
>         }
> 
> which means Ant will report an error if you start to run the
> runservertests without a startTarget attribute.
> 
> Something wrong here...
> -Vincent
> 
> > -----Original Message-----
> > From: Zhang, Li [mailto:Li.Zhang@eal.ab.ca]
> > Sent: 01 February 2002 23:29
> > To: 'Cactus Users List'
> > Subject: RE: Cannot use "runservertest" in an Ant build.xml to start
> JRun
> > 3.1
> >
> >
> >
> > Hi, Vincent and other cactus/Ant gurus:
> >
> > I have attached the ant build files and ant console output here. The
> > bad-build.xml uses runservertests and generated bad-output.txt. The
> > good-build.xml uses Ant tasks to start/stop JRun and generated
> > good-output.txt.
> >
> > Thank you.
> >
> > Li
> >
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@octo.com]
> > Sent: Friday, February 01, 2002 12:25 PM
> > To: 'Cactus Users List'
> > Subject: RE: Cannot use "runservertest" in an Ant build.xml to start
> > JRun 3.1
> >
> >
> > Li,
> >
> > Have you had a look at the example build files in the sample/build
> > directory of the cactus distribution. They may help you.
> >
> > Are you sure the testURL is valid (can you manually start JRun and
use
> a
> > browser to connect to http://localhost/myapp ?
> >
> > Can you send us your build.xml file and the ant console output ?
> >
> > Thanks
> > -Vincent
> >
> > P.S.: testTarget="tests" but the target you define below is "test"
> >
> > > -----Original Message-----
> > > From: Zhang, Li [mailto:Li.Zhang@eal.ab.ca]
> > > Sent: 30 January 2002 17:46
> > > To: 'Cactus Users List'
> > > Subject: Cannot use "runservertest" in an Ant build.xml to start
> JRun
> > 3.1
> > >
> > > Have anyone experienced problem to start the application server
with
> > > "runservertests" cactus ant task?
> > >
> > > I first define the task useing "taskdef" and map "runservertests"
to
> > > org.apache.cactus.ant.RunServerTestsTask; then I define a task
which
> > calls
> > > the "runservertests" as follows:
> > >
> > > <target name="tests_jrun">
> > >   <runservertests testURL="http://localhost/myapp"
> > > startTarget="start_jrun"
> > > stopTarget="stop_jrun" testTarget="tests"/>
> > > </target>
> > >
> > > <target name="start_jrun">
> > >  ...
> > > </target>
> > > <target name="stop_jrun">
> > >  ...
> > > </target>
> > > <target name="test">
> > >  ...
> > > </target>
> > >
> > > It looks like Ant ignores the "startTarget" attribute of the
cactus
> > ant
> > > customized task because jRun is never started. If I remove
> > > "startTarget="start_jrun" then Ant does invoke the "stop_jrun"
> target.
> > But
> > > if I run "ant start_jrun", this time jRun will start as expected
> > (which
> > > means there's no problem with my "start_jrun" target).
> > >
> > > Any ideas?
> > >
> > > I'm using Ant 1.4 + cactus 1.2 + JRun 3.1 on Windows 2000.
> > >
> > > BTW: If I use "parallel","sequential","junit","java" tasks in the
> > > "tests_jrun" target, I have no problem to start JRun, run tests,
and
> > stop
> > > JRun.
> > >
> > > Thanks.
> > >
> > > Li
> > >
> > > --
> > > 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>
> 
> 
> 
> 
> --
> 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>
> 




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