users@glassfish.java.net

calling an ejb from an junit test running in eclipse

From: <glassfish_at_javadesktop.org>
Date: Tue, 05 Feb 2008 09:40:21 PST

Hello Glassfish Community,

I quite new to GlassFish and have a question concering running an EJB client from within Eclipse.

My goal is to run a JUnit test that connects to a Session Bean deployed to GlassFish. What I have achieved after quite some reading is to run a Application Client with a Main Method using the appclient sript. That's not quite what I want, and actually I don't need a real application client...

What I allready did with JBoss and Oracle OC4J was to write a unit test that did some "InitialContext ctx = new InitialContext(); MyBean myBean = (MyBean) ctx.lookup(...)" to get the reference to the bean. Therefore I put a jndi.properties-File in the classpath with the neccessary JNDI properties (ContextFactory, URL, username, password).

Is something like this possible with GlassFish? What are the JNDI-Properties (say for a local default installation: localhost, default ports, admin user "admin/adminadmin", Domain domain1)? Or is there any easy way to start an application client from within eclipse?

Any advices would be very welcome!!!

Regards
Stefan
[Message sent by forum member 'stefan_scheidt' (stefan_scheidt)]

http://forums.java.net/jive/thread.jspa?messageID=257519