You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by ericp56 <er...@twcable.com> on 2008/12/18 16:17:56 UTC

OpenEJB Testing in Eclipse

Hello All,

I hope I'm saving someone some time here with this information.

I have an OpenEJB project, using OpenJPA for persistence.  In order for my
junit tests to work, I had to do the following:

Create a Junit configuration in Run Configuration and set the following:

 Choose your test cases

 Add to the classpath any projects etc. that have dependent EJBs

 Add the Apache OpenEJB-3.1 jars to the classpath.

 Add
-javaagent:c:\progra~1\apache~1\openejb-3.1\lib\openejb-javaagent-3.1.jar as
a VM argument (use the path to your openejb jar).


-- 
View this message in context: http://www.nabble.com/OpenEJB-Testing-in-Eclipse-tp21074730s134p21074730.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: OpenEJB Testing in Eclipse

Posted by ericp56 <er...@twcable.com>.
OK.  I have it working using an Ant in Eclipse.  I'm plan on using this for
unit testing only and to continue using Eclipse to create my deployment jar.

I started with a script from the openejb samples and modified it.

I have openejb3.1 on my machine.  I used the Junit 4 jar that's in Eclipse
plugins.

I didn't add an ejb-jar.xml file to this project.  I chose to define
openejb.deployments.classpath.include in the test setup, instead.  Although,
a simple ejb-jar.xml file is the preferred method, I read.

I had to update my local Ant to 1.7.1 because of a bug; javaagent failed to
load when I ran Ant outside of Eclipse.  In Eclipse (with 1.7.0) it seems to
work fine, though.

I hope this saves you some time :).  

I'll add it to the documentation over the holidays.

http://www.nabble.com/file/p21098368/Simple.zip Simple.zip 
-- 
View this message in context: http://www.nabble.com/OpenEJB-Testing-in-Eclipse-tp21074730s134p21098368.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: OpenEJB Testing in Eclipse

Posted by ericp56 <er...@twcable.com>.

I posted too soon.  I had my test cases with EJBs ignored.  I'm running into
the venerable classCastException because of the JUnit ClassLoader.  I'll
have to lick that one, first.
-- 
View this message in context: http://www.nabble.com/OpenEJB-Testing-in-Eclipse-tp21074730s134p21096518.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: OpenEJB Testing in Eclipse

Posted by Kevan Miller <ke...@gmail.com>.
On Dec 18, 2008, at 10:17 AM, ericp56 wrote:

>
> Hello All,
>
> I hope I'm saving someone some time here with this information.
>
> I have an OpenEJB project, using OpenJPA for persistence.  In order  
> for my
> junit tests to work, I had to do the following:
>
> Create a Junit configuration in Run Configuration and set the  
> following:
>
> Choose your test cases
>
> Add to the classpath any projects etc. that have dependent EJBs
>
> Add the Apache OpenEJB-3.1 jars to the classpath.
>
> Add
> -javaagent:c:\progra~1\apache~1\openejb-3.1\lib\openejb- 
> javaagent-3.1.jar as
> a VM argument (use the path to your openejb jar).

Cool. Thanks Eric! Would be good to incorporate this into our 2.2  
wiki...

--kevan