From: Michael J. <mic...@gt...> - 2001-08-11 00:09:58
|
Frustrating, ain't it? :) I forgot to mention that one. I got around that by using the text test runner, instead of the GUI test runner. But a message came across the list not too long ago with an actual solution. See this message: http://www.mail-archive.com/jbo...@li.../msg08867.html. Mike ----- Original Message ----- From: "Almquist Justin-P29624" <Jus...@mo...> To: <jbo...@li...> Sent: Friday, August 10, 2001 4:45 PM Subject: RE: [JBoss-user] [unit testing] > Has anyone run across the following issue using JUnit with JBoss? > > I am setting up an EJB client that is a JUnit test class in order to perform my "unit" tests. However, when I lookup the Home interface of the EJB from the client test class I get a "ClassCastException" when narrowing the result of the lookup (even if I don't use PortableRemoteObject.narrow() I still get the exception). > > What's weird is if I take the exact same code out of the JUnit framework it works fine. Any help would be appreciated. Thanks. > > Pertinent info: > - JBoss 2.4 > - JDK 1.3.0 > - JUnit 3.7 > - Running on NT 4.0 > > Test client code snippet: > file://Lookup up the EJB's home interface > InitialContext jndiContext = new InitialContext(); > Object ref = jndiContext.lookup(this.ACCEPT_KEY_REF); > AcceptKeyHome home = (AcceptKeyHome)PortableRemoteObject.narrow(ref, AcceptKeyHome.class); file://Exception thrown here > > Exception: > java.lang.ClassCastException > at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemo teObject.java:296) > at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137) > at unit_test.com.mot.aucserver.Control.KeyManagement.AcceptKeyEJB.AcceptKeyTest .setUp(AcceptKeyTest.java:34) > at junit.framework.TestCase.runBare(TestCase.java:138) > ... > > Justin Almquist > jus...@mo... > > > -----Original Message----- > From: Michael Jara [mailto:mic...@gt...] > Sent: Thursday, August 09, 2001 9:14 AM > To: jbo...@li... > Subject: Re: [JBoss-user] [unit testing] > > > In standalone JBoss 2.2.2, I don't actually do anything special with the > EJBs to use JUnit. To test, I deploy my jar or ear as usual. I then run my > JUnit test class, which is just a normal JUnit test class, but with code for > accessing EJBs as a client. This can run from any machine with access to > the server. > > I haven't tried the JUnit servlet, but I would imagine that the procedure > wouldn't be all that different. If you are using JBoss + Tomcat, you might > just have to include them all in one .ear, which would be a little more > trouble. > > I'm not sure if I answered your question. Does that make sense? > > Mike > > ----- Original Message ----- > From: "David Jencks" <dav...@di...> > To: <jbo...@li...> > Sent: Wednesday, August 08, 2001 9:46 PM > Subject: Re: [JBoss-user] [unit testing] > > > > Out of curiousity, how/where/when do you deploy and undeploy your ejbs? > > What size groups of ejbs do you deploy together when testing? > > > > Thanks > > david jencks > > > > > > On 2001.08.08 22:35:37 -0400 Michael Jara wrote: > > > I usually just implement my JUnit tests as standard EJB clients, one for > > > each EJB. Setup gets the connection, creates any required EJBs, the > test > > > calls methods on that EJB, and teardown cleans up. > > > > > > There is info and an extension to JUnit which is especially for testing > > > EJBs. I beleive that it is a servlet, which lets you run your tests > with > > > a > > > web browser. I think this is it: > > > http://www.javaworld.com/javaworld/jw-05-2000/jw-0526-testinfect_p.html > > > Haven't tried it myself. > > > > > > Mike > > > > > > ----- Original Message ----- > > > From: "Toby Hede" <tob...@in...> > > > To: <jbo...@li...> > > > Sent: Wednesday, August 08, 2001 7:15 PM > > > Subject: [JBoss-user] [unit testing] > > > > > > > > > > does anyone have any resources regarding unit testing within JBoss? I > > > find > > > > JUnit indispensable, but I am not sure how to implement this > > > effectively > > > > within JBoss. > > > > > > > > cheers > > > > > > > > /t > > > > toby hede > > > > > > > > > > > > _______________________________________________ > > > > JBoss-user mailing list > > > > JBo...@li... > > > > http://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > > > > > > > > > _______________________________________________ > > > JBoss-user mailing list > > > JBo...@li... > > > http://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > > > > > > _______________________________________________ > > JBoss-user mailing list > > JBo...@li... > > http://lists.sourceforge.net/lists/listinfo/jboss-user > > > > > _______________________________________________ > JBoss-user mailing list > JBo...@li... > http://lists.sourceforge.net/lists/listinfo/jboss-user > > _______________________________________________ > JBoss-user mailing list > JBo...@li... > http://lists.sourceforge.net/lists/listinfo/jboss-user > |