[JBoss-user] [JBoss Seam] - Re: Configuring SEAM test with junit

2006-06-01 Thread Newlukai
Hi there,

I've got the same problem. I want to test my Seam application with JUnit 4.1 
and JBoss Eclipse IDE 1.6.

I've a little test class that needs an EntityManager:
public class LoginActionTest {
  | private static EntityManagerFactory emf;
  | private EntityManager em;
  | private EntityTransaction transaction;
  | 
  | @BeforeClass
  | public static void initClass() {
  | emf = Persistence.createEntityManagerFactory(aresDatabase);
  | }
  | 
  | @Before
  | public void init() {
  | em = emf.createEntityManager();
  | transaction = em.getTransaction();
  | transaction.begin();
  | }
  | 
  | @After
  | public void destroy() {
  | transaction.commit();
  | em.close();
  | }
  | 
  | @AfterClass
  | public static void destroyClass() {
  | emf.close();
  | }
  | 
  | @Test
  | public void login() {
  | User jewe = new User();
  | jewe.setID(JEWE);
  | 
  | LoginAction loginAction = new LoginAction();
  | loginAction.setAresDatabase(em);
  | loginAction.setUser(jewe);
  | 
  | assert main.equals(loginAction.login());
  | 
  | }
  | 
  | public static junit.framework.Test suite() {
  | return new JUnit4TestAdapter(LoginActionTest.class);
  | }
  | }

I've included the junit41.jar, jboss-commons.jar, dom4j.jar and ciglib.jar. 
Without them there are NoClassDefFoundErrors. After including those jars I ran 
the test and Eclipse resp. JUnit tells me

Console wrote : 01.06.2006 08:34:11 org.hibernate.cfg.Environment 
  | INFO: Hibernate 3.2 alpha2
  | 01.06.2006 08:34:11 org.hibernate.cfg.Environment 
  | INFO: hibernate.properties not found
  | 01.06.2006 08:34:11 org.hibernate.cfg.Environment 
  | INFO: using bytecode reflection optimizer
  | 01.06.2006 08:34:11 org.hibernate.cfg.Environment buildBytecodeProvider
  | INFO: Bytecode provider name : cglib
  | 01.06.2006 08:34:11 org.hibernate.cfg.Environment 
  | INFO: using JDK 1.4 java.sql.Timestamp handling

and
Stacktrace wrote : javax.persistence.PersistenceException: No Persistence 
provider for EntityManager named aresDatabase
  | at 
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:41)
  | at 
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
  | at 
com.idsscheer.ares.test.LoginActionTest.initClass(LoginActionTest.java:26)
  | 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 
org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
  | at 
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
  | at 
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
  | at 
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
  | at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:32)
  | 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)
  | 

I guess it's because I'm not running those tests in a server environment but 
directly from Eclipse. So all the config files are not found.

Is there any HowTo that describes how I can write JUnit tests in Eclipse for 
Seam/Hibernate applications?

I know, it might not be the right forum, but perhaps anybody has an idea?!?

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3948279#3948279

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3948279


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnkkid=107521bid=248729dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [JBoss Seam] - Re: Configuring SEAM test with junit

2006-03-22 Thread JXerXes
Thanks for the quick answer! I'll try that...

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3931859#3931859

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3931859


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [JBoss Seam] - Re: Configuring SEAM test with junit

2006-03-21 Thread [EMAIL PROTECTED]
This isn't really a Seam question. You need Emmanuel to answer this one. Try 
the JBoss or Hibernate EJB3 forums.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3931759#3931759

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3931759


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user