ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Michali <...@cisco.com>
Subject Re: How to set a property from a custom task? (LONG)
Date Thu, 20 Sep 2001 19:07:38 GMT


"Frank E. Weiss" wrote:
> 
> I'm wondering if you've ruled out using dependency instead of a property.
> Something like:
> 
> <JUnit name="testmail" depends="mailserverup">
>    ...
> </JUnit>
> 
> <script name="mailserverup">
>     // start mail server, check if up
>     // fail task otherwise (can this be done in ant, or does it need a custom
> task?)
> </script>

I'm not sure that will work. I need to check to see if the server is
running and
if it is, I don't want to try to start (another instance).

What I have right now is starting to look kludgey and complex...


<target name="check.mail.server">
    <dixiecheck />
</target>

<target name="start.mail.server" depends="check.mail.server"
unless="dixie.running">
    <java classname="dixie" fork="yes" failonerror="yes">
        <classpath>
            <pathelement path="..\..\dixie1.7\dixie.jar" />
        </classpath>
    </java>
</target>

<target name="recheck.mail.server" depends="start.mail.server"
unless="dixie.running">
    <dixiecheck />
</target>

<target name="checkpoint" depends="recheck.mail.server"
unless="dixie.running">
    <fail message="Unable to start Dixie Mail server for unit testing"/>
</target>

<target name="test" depends="compile.tests,checkpoint"
if="junit.present" ...


I'm also having trouble figuring out how to run the start.mail.server
target and
then continuing with the next step. If anyone has any more ideas I can
try them, but
otherwise I may take the suggestion of Thomas Tuft Muller's reply and
add this
server startup to a JUnit test case.

BTW: If I do try to add this to the test case, how do I invoke this
operation
(starting the server) only once for a set of test cases (putting it in
setup()
would be a bit of overkill as it runs many times for the various
tests)?  I
thought I remember hearing there was some high level method that is
called only
once for the whole JUnit run. Note: I'm letting JUnit find the test
cases using
reflection, so I have no control over order of test invocation (I
think).


PCM (Paul Michali)

Carrier Voice Gateway Business Unit (CVGBU)
Cisco Systems, Inc.
250 Apollo Drive
Chelmsford, MA 01824

Phone : (800) 572-6771 x 45817  (978) 244-5817 [direct]
Paging: (800) 365-4578 [voice]  pcm@epage.cisco.com [email page]

Mime
View raw message