Hi, I'm not starting the SimpleHTTPServer programmatically so I don't have any reference to the instance.
cheers, Jan On Wed, Jan 19, 2011 at 11:21 AM, Michael Ludwig <mil...@gmx.de> wrote: > Jan C. schrieb am 19.01.2011 um 10:17 (+0100): >> My JUnit test need a http server so I also start one in my test: >> >> <target name="mytest" depends="build"> >> <parallel failonany="true" > >> <sequential> >> <!-- Start HTTP server here --> >> <java fork="yes" >> classname="org.apache.axis2.transport.http.SimpleHTTPServer" > >> ... >> </sequential> >> <sequential> >> <!-- Run JUnit tests here--> >> <junit> ... >> </sequential> >> </parallel> >> </target> >> >> >> The problem I have is that the SimpleHTTPServer is running forever so >> even when my JUnit test finish successfully, the ant target does not >> terminate. I can only terminate it using Ctrl+C. Since I want this >> target to be automated, I would like to find a way to "successfully" >> stop the ant target when the junit task finishes. > > You could try calling destroy() on the instance as in this example: > > http://www.devdaily.com/java/jwarehouse/axis2-1.3/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java.shtml > > if (embedded != null) { // this is the SimpleHTTPServer instance > try { > embedded.destroy(); > } catch (Exception e) { > log.error(e.getMessage(), e); > } > } > > Don't know if you'll have to resort to the <script> task to implement > that. > -- > Michael Ludwig > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org