I don't quite understand the reason why you would want to run the test cases
before the app server is started.  Can you just run a task to start the
appserver, then run the tests.

Another possiblity.  Are you using an Http Server on port 80, then the
appserver hooked to another port.  You may be getting a response from an
http server before the app server is ready.  FYI - This does happen with IBM
Http Server and WebSphere app server.  If this is the case...  Start app
server, then start http server, then start test cases....

Hope it helps.

Nick

-----Original Message-----
From: Keith Hatton [mailto:[EMAIL PROTECTED]
Sent: Friday, February 13, 2004 4:37 AM
To: Ant-User (E-mail 2)
Subject: Waiting for server to start


Hi all,

Part of my build file starts an application server, performs test cases
against it, and shuts down the server. I'm successfully using the <parallel>
task to achive this, conceptually like so:

        |
  +-----+-----+
  |           |
start       wait
  |           |
  |        run tests
  |           |
  |         stop
  |           |
  +-----+-----+
        |


My problem is the "wait" part. I have been using <waitfor> and <url> to
check for the app server's URL, but recently I have noticed that sometimes
the URL is available before the server initialisation has really completed,
which can lead to spurious test failures, and (for very small projects) even
the possibility that the "stop" task is called before the server has really
started.

The server is JBoss, and strictly I should be checking the server output for
a text string. Any ideas on the best way to do this?

(Current "start" target):
            <echo>Starting JBoss ...</echo>
            <exec dir="${jboss.home}/bin" executable="cmd.exe" os="Windows
2000" output="jboss.out">
                <arg line="/c run.bat"/>
                <env key="NOPAUSE" value="true"/>
            </exec>
            <echo>JBoss has stopped</echo>

(Current "wait" target ... the <sleep> is a hack to work around the
problem):
            <echo>Waiting for JBoss ...</echo>
            <waitfor maxwait="120" maxwaitunit="second" checkevery="20"
checkeveryunit="second">
                <http url="http://localhost:8080/jmx-console"/>
            </waitfor>
            <sleep seconds="10"/>
            <echo>JBoss has started</echo>


Thanks for any suggestions
Keith

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


- - - - - - 
This e-mail message is intended only for the use of the individual or entity
identified in the alias address of this message and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution of this e-mail message is strictly prohibited. If you have
received this e-mail message in error, please notify the sender immediately
by reply e-mail and delete this message from your system. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to