The JUnitEJB.zip is available at
http://www27.brinkster.com/seniorhc/emerson/JUnitEJB.zip
it's a eclipse project, but you should be able to run ant externally
without problem.
it has some files you should alter :
- config/jbossxml/login-config.xml (it's configured to use ldap), if you
don't have a ldap server, you must change it or take the jaas stuff out
of everywhere : xdoclets security tags and client jaas use
- config/jbossxml/oracle-service.xml : it has to be copied to
JBOSS_HOME/server/default/deploy (if u use default as the server) to
make the db connection, change this file as needed or use other database
of your preference.
you must have two ENVIRONMENT variables set (it's used for deploy) :
JBOSS_HOME (eg:/home/user/jboss)
JBOSS_SERVER : "default", if you use this server conf.
after all , you should be able to deploy.
type :
ant -> build and deploy
ant test -> run the tests
it try to connect with the server without logging and after it try to
call a method and test it result. It at last call a method in a session
ejb facade that creates a entity bean. This last one was to test
inheritance with entities.
It will give two warnings about not defining accessor methods for CMP
field (it's implemented on the parent, JBoss could verify the parent too
: )) you can safely ignore it.
if you just want to test junit + session beans, you can take out the
calling to create of entity. IN the same way if are not intersted in
using JAAS authentication and authorization, you can take out the JAAS
files and use of Login in the TestCase.
The structure of tests can be better, it's just to show how to do it
using ejb.
I hope it help it to not have to strugle through the problems I had to
make it work : )
if you need some help to make it work beyond of this explanations, just
: ) ask
Dimitri PISSARENKO wrote:
> Hello!
>
>
>>The JBossCMP example in the newest Quick Start guide uses my JUnit
>>extension JUnitEJB, which supports the execution of test on the
>>serverside. This is very useful for testing Local interfaces. I
>>haven't written any docs on it, but you should be able to figure it out
>>>from the code.
>>
>
> Where can I get the code?
>
> Thanks
>
> Dimitri Pissarenko
>
> On Wed, 17 Jul 2002 12:16:23 -0500, you wrote:
>
>
>>The JBossCMP example in the newest Quick Start guide uses my JUnit
>>extension JUnitEJB, which supports the execution of test on the
>>serverside. This is very useful for testing Local interfaces. I
>>haven't written any docs on it, but you should be able to figure it out
>>>from the code.
>>
>>-dain
>>
>>HORTON,NOAH (HP-FtCollins,ex1) wrote:
>>
>>>I would love to see your example of using JUnit with an EJB.
>>>
>>>Thanks!
>>>-Noah Horton
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Emerson Cargnin - SICREDI Servi�os
>>>>[mailto:[EMAIL PROTECTED]]
>>>>Sent: Wednesday, July 17, 2002 10:55 AM
>>>>To: [EMAIL PROTECTED]
>>>>Subject: Re: [JBoss-user] Testing EJBs with JUnit
>>>>
>>>>
>>>>I just did a test with ejb / jaas and junit, let me know if
>>>>you want so
>>>>I can send it to you (about 1 meg). If someone else want too,
>>>>just tell me.
>>>>
>>>>Emerson
>>>>
>>>>John Moore wrote:
>>>>
>>>>
>>>>
>>>>>Yes we're doing itfor all of our beans as well. When it's
>>>>>
>>>>run you need
>>>>
>>>>
>>>>>the jndi.properties file or to pass all of the jndi on the command
>>>>>line. I would guess that you don't have the classes
>>>>>
>>>>available (Home
>>>>
>>>>
>>>>>/Remote interface) available. Also, could that app that you are
>>>>>running through not have the classes in their path OR does
>>>>>
>>>>it have it's
>>>>
>>>>
>>>>>own naming server and the properties for jboss are not
>>>>>
>>>>being used. Dump
>>>>
>>>>
>>>>>out the environment before you do your lookup to see what
>>>>>
>>>>the properties
>>>>
>>>>
>>>>>are set to.
>>>>>
>>>>>John Moore
>>>>>
>>>>>-----Original Message-----
>>>>>From: Dimitri PISSARENKO [mailto:[EMAIL PROTECTED]]
>>>>>Sent: Wednesday, July 17, 2002 6:57 AM
>>>>>To: [EMAIL PROTECTED]
>>>>>Subject: [JBoss-user] Testing EJBs with JUnit
>>>>>
>>>>>
>>>>>Hello!
>>>>>
>>>>>Has someone experience with testing EJBs using JUnit?
>>>>>
>>>>>I've some entity beans and want to ensure that their basic functions
>>>>>(creation, editing and deletion of records in the database) do work
>>>>>properly after changes (see attachment TestProjectBean.java).
>>>>>
>>>>>But I get a NoClassDefFoundError when I run this test, although all
>>>>>classes used are in the classpath (full stacktrace is given in
>>>>>attachment 2002_07_17_stackTrace.txt).
>>>>>
>>>>>If I put the same statements into a normal Java application,
>>>>>everything works fine.
>>>>>
>>>>>Any help is highly appreciated
>>>>>
>>>>>Dimitri Pissarenko
>>>>>
>>>>>
>>>>
>>>>--
>>>>Emerson Cargnin - MSA
>>>>SICREDI - Tel : 3358-4860
>>>>
>>>>
>>>>
>>>>-------------------------------------------------------
>>>>This sf.net email is sponsored by:ThinkGeek
>>>>Welcome to geek heaven.
>>>>http://thinkgeek.com/sf
>>>>_______________________________________________
>>>>JBoss-user mailing list
>>>>[EMAIL PROTECTED]
>>>>https://lists.sourceforge.net/lists/listinfo/jboss-user
>>>>
>>>>
>>>
>>>
>>>-------------------------------------------------------
>>>This sf.net email is sponsored by:ThinkGeek
>>>Welcome to geek heaven.
>>>http://thinkgeek.com/sf
>>>_______________________________________________
>>>JBoss-user mailing list
>>>[EMAIL PROTECTED]
>>>https://lists.sourceforge.net/lists/listinfo/jboss-user
>>>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
>
--
Emerson Cargnin - MSA
SICREDI - Tel : 3358-4860
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user