| Author |
Junit test EJB
|
Forest Huge
Greenhorn
Joined: Oct 10, 2002
Posts: 15
|
|
We are using JUNIT to test EJB in WSAD(IE)5.0.1, in the beginning we always got naming exception. Later on, I added props.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:900/"); This temporary solved problem. I am not sure I am doing the right way. So any suggestion about JUNIT test EJB? THanks
|
 |
Vincent Massol
Author
Ranch Hand
Joined: Aug 09, 2003
Posts: 70
|
|
Originally posted by Forest Lin: We are using JUNIT to test EJB in WSAD(IE)5.0.1, in the beginning we always got naming exception. Later on, I added props.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:900/"); This temporary solved problem. I am not sure I am doing the right way. So any suggestion about JUNIT test EJB? THanks
That's normal. This is because you are running your tests outside the container.
|
-Vincent<br /><a href="http://www.manning.com/massol" target="_blank" rel="nofollow">JUnit in Action</a> author
|
 |
Forest Huge
Greenhorn
Joined: Oct 10, 2002
Posts: 15
|
|
|
So could you please give a brief description how to use Junit to test EJB? thanks
|
 |
Vincent Massol
Author
Ranch Hand
Joined: Aug 09, 2003
Posts: 70
|
|
Originally posted by Forest Lin: So could you please give a brief description how to use Junit to test EJB? thanks
This would be a bit long to describe here as there are several techniques. One is with JUnit/mock objects (this requires refactoring of your code if it's already written). Another is to use JUnit doing remote calls or Cactus. There are 45 pages about this in the book (chapter 12).
|
 |
Benson Fung
Ranch Hand
Joined: Apr 10, 2003
Posts: 207
|
|
It is only for remote interface EJB. However, if it is a local interface EJB, how I can test it from JUNIT? Benson
|
 |
Nguyen Phuc Hai
Greenhorn
Joined: Jul 12, 2003
Posts: 2
|
|
|
You can test EJB using Local interface if you write a jsp/servlet item and test EJB from them (In order jsp/servlet can call local interface if it belong the same container with EJB). Or you test EJB by using Cactus (The way to write test are the same but it help you test EJB local interface although from a remote machine)
|
 |
 |
|
|
subject: Junit test EJB
|
|
|