ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Les Hughes <leslie.hug...@rubus.com>
Subject RE: Running junit tests that access EJBs
Date Wed, 11 Apr 2001 08:39:16 GMT
Hi,

I dont use wlrun as at the moment, wlrun blocks until wls exits. I think
this is due to be 'fixed' at some point (maybe already has?). However, I
feel happier if WLS runs in it's own VM without all of the Ant classes lying
around.

So my build shell script that's kicked off by cron is basically:

setup Ant environment
ant -buildfile build.xml -listener mycustomerlogger
check return code for successful build
startWebLogic.sh &
sleep 60 (wait for wls to start up)
ant -buildfile test.xml -listener mycustomerlogger
stopWebLogic.sh 
ant -buildfile stylelogs.xml 


My 'normal' junit tests are run forked inside test.xml using the junit
task(I guess I could include these as a different target in build.xml but
hey....) Forking was the only way I could get it to work (Ideas anyone?)

BTW, the classpath for the boot shell script has both Ant and WLS classes,
the startWebLogic.sh script resets the classpath for WLS only.


Les




> -----Original Message-----
> From: Atul Tiwary [mailto:atul@cedera.com]
> Sent: 11 April 2001 01:11
> To: ant-user@jakarta.apache.org; asliwk@bea.com
> Subject: RE: Running junit tests that access EJBs
> 
> 
> could someone send me an excerpt of there build.xml where you use
> <wlrun> to start weblogic.
> Thanks,
> -Atul
> 
> -----Original Message-----
> From: Andrew Sliwkowski [mailto:asliwk@bea.com]
> Sent: Tuesday, April 10, 2001 5:13 PM
> To: ant-user@jakarta.apache.org
> Subject: RE: Running junit tests that access EJBs
> 
> 
> Check out http://junit.org
> and
> http://sourceforge.net
> for lots of good ideas
> /andrew
> 
> Andrew Sliwkowski
> Bea Systems Inc
> Cluster Engineering
> <email:  asliwk@beasys.com>
> <phone:  603.579.2572>
> 
> -----Original Message-----
> From: Jim Doyle [mailto:jdoyle@iso-ne.com]
> Sent: Tuesday, April 10, 2001 4:19 PM
> To: ant-user@jakarta.apache.org
> Subject: Running junit tests that access EJBs
> 
> 
> Hi,
>     I looked on this list for some suggestions about how to use Ant to
> manage unit tests for EJBs,
> and it seemed that a couple people had the approach of running the
> server in one Ant instance (using wlrun) and running the junit test in
> another Ant instance.  I've got the server part working fine, but I'm
> having trouble with my client.
> 
>     I can run the JUnit test from the command line with no problem.  I
> can also run it with a forked java task, like this:
>   <property name="jdbc.driver.class.path"
> value="c:/JavaTools/Oracle/JDBCdrivers/oracle8.1.7-jdk1.2/lib/
> classes12.zip"
> />
> 
>   <property name="weblogic.home"
> value="c:/JavaTools/weblogic/weblogic51"/>
>   <property name="weblogic.class.path"
> value="${jdbc.driver.class.path};${weblogic.home}/lib/weblogic
> 510sp8.jar;${w
> eblogic.home}/classes;${weblogic.home}/lib/weblogicaux.jar"/>
> 
>   <target name="test.ejb.java.fork" depends="compile">
>     <java classname="junit.textui.TestRunner" fork="yes">
>       <sysproperty key="java.naming.provider.url"
> value="t3://localhost:7001"/>
>       <arg value="PowerSystemEjbTest"/>
>       <classpath
> path="${basedir};c:/JavaTools/Junit/junit3.2/junit.jar;${weblo
> gic.class.path
> }"/>
> 
>     </java>
>   </target>
> 
> But I would like to use the junit task, which I use for my other unit
> tests, and that doesn't work unless I put weblogic in my CLASSPATH for
> Ant.  I've tried:
>   <target name="test.ejb.cp" depends="compile">
>     <junit haltonfailure="yes">
>       <sysproperty key="java.naming.provider.url"
> value="t3://localhost:7001"/>
>       <classpath path="${weblogic.class.path}"/>
>       <batchtest>
>         <formatter type="plain" usefile="no"/>
>         <fileset dir="${basedir}">
>           <include name="PowerSystemEjbTest.java"/>
>         </fileset>
>       </batchtest>
>     </junit>
>   </target>
> but it throws a "java.lang.NoClassDefFoundError:
> javax/ejb/CreateException".
> I've also tried eliminating the classpath element, and it throws a
> "javax.naming.NoInitialContextException,
> java.lang.ClassNotFoundException:
> weblogic.jndi.WLInitialContextFactory".
> 
> If I put my weblogic classpath into the Ant classpath, it 
> works OK, but
> I'd prefer to have the classpath in my build file.
> 
> So:
> 1) Does anybody know why the class loading is behaving the 
> way it does?
> I can dump some debugging output if it would help.
> 2) How are others out there running JUnit tests that use EJBs?  Do you
> use a forked java task, or put weblogic in Ant's CLASSPATH, 
> or is there
> some other way?
> 
> Thanks for your help!
> 
> --
> Jim Doyle
> jdoyle@iso-ne.com
> 
> 
> 

Mime
View raw message