-
15. Re: Unit testing with Embeddable EJB 3.0 container
melsom Jan 10, 2006 6:46 AM (in response to rwallace)Sorry. Wrong version of persistence.xml. This is the correct one.
<entity-manager> <name>test</name> <jta-data-source>java:/MySqlDS</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="none"/> <property name="hibernate.default_catalog" value="EJB3"/> <property name="hibernate.jdbc.batch_size" value="10"/> <!-- --> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" /> <!-- <property name="hibernate.cache.provider_class" value="org.jboss.ejb3.entity.TreeCacheProviderHook"/> <property name="hibernate.treecache.mbean.object_name" value="jboss.cache:service=EJB3EntityTreeCache"/> --> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> <class>model.value.Person</class> </properties> </entity-manager>
The problem is still present... -
16. Re: Unit testing with Embeddable EJB 3.0 container
melsom Jan 11, 2006 7:17 AM (in response to rwallace)Ok. I got the project working when running from a main-method within the same project.
When running from another project and inside a test-case (the same code as the main method mentioned) i get a NameNotFoundException (see below) and that my session bean is not bound. I asume this is because it cannot find my EJBs on the classpath and therefore do not bind them. Correct?
I have checked your list several times, and I have no idea what to do. I have tried to manipulate the classpath settings, tried to add the EJB project to the reference panel of the test project (in eclipse) and tried to add a jar with all the EJBs to the test project. Nothing helps..javax.naming.NameNotFoundException: org.jboss.tutorial.archive.CustomerDAOLocal not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:516) at org.jnp.server.NamingServer.getBinding(NamingServer.java:524) at org.jnp.server.NamingServer.getObject(NamingServer.java:530) at org.jnp.server.NamingServer.lookup(NamingServer.java:282) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572) at javax.naming.InitialContext.lookup(InitialContext.java:351) at test.CustomerTest.testFindCustomer(CustomerTest.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Anyone got an idea? -
17. Re: Unit testing with Embeddable EJB 3.0 container
bill.burke Jan 11, 2006 12:48 PM (in response to rwallace)there are alternatives to scanClasspath(). See the tutorials for more details.
-
18. Re: Unit testing with Embeddable EJB 3.0 container
mazz Feb 22, 2006 9:10 PM (in response to rwallace)"bill.burke@jboss.com" wrote:
I'm looking for a volunteer to create a sample Eclipse project that does a junit test. Interested?
A few days ago I put a skeleton EJB3 Eclipse project on the wiki - I just updated it that incorporates TestNG.
http://wiki.jboss.org/wiki/Wiki.jsp?page=StarterSkeletonEclipseProject -
19. Re: Unit testing with Embeddable EJB 3.0 container
utdrew Feb 27, 2006 7:09 PM (in response to rwallace)>>there are alternatives to scanClasspath(). See the tutorials for more details.
Can someone please elaborate on this? I d/l the latest alpha (_5) and that method doesn't even exist anymore. Then I went and checked cvs and the entire EJB3StandaloneBootstrap has been deleted. Getting this setup is a pain in the a** so if the tutorials could be brought up to date that'd be awesome. -
20. Re: Unit testing with Embeddable EJB 3.0 container
bill.burke Feb 27, 2006 7:31 PM (in response to rwallace)The tutorials *are* up to date. The Javadocs are available online:
http://docs.jboss.org/ejb3/embedded/api/index.html
scanClasspath is overloaded. First scans the entire classpath, the second allows you to specify exactly which jars in your classpath should be scanned. There's also the advanced deployment methods shown in the tutorials.