1 Reply Latest reply on Dec 10, 2008 11:08 AM by matt.nirgue

    testng, seamtest and a tale of woe...

    paulmkeogh

      I'm trying to write a testng test that extends seamtest.

      The test fails when run with an error to do with the entitymanager binding.

      I have spent hours trying to figure this out and have concluded that the data source definition is not being deployed to the embedded JBoss container when the test is run. I have arrived at this conclusion by extrapolating various online posts.

      So, can anyone point me in the right direction as to how I might fix this problem ?

      [JDK 1.5.0_17, Seam 2.1.0 SP1, JBoss Tools 3.0.0. Beta 1]

      Thanks,

      [Parser] Running:
        C:\Users\paul\workspace_kannel\kanneldesk-test\temp-testng-customsuite.xml

      WARN  [org.jboss.seam.Component] Component class should be serializable: org.jboss.seam.ui.facelet.mockHttpSession
      WARN  [org.jboss.seam.security.permission.PersistentPermissionResolver] no permission store available - please install a PermissionStore with the name 'org.jboss.seam.security.jpaPermissionStore' if persistent permissions are required.
      INFO  [org.ajax4jsf.cache.CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {org.richfaces.SKIN=blueSky, facelets.DEVELOPMENT=true, javax.faces.DEFAULT_SUFFIX=.xhtml}
      INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance of default capacity
      INFO  [org.ajax4jsf.cache.CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
      INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {org.richfaces.SKIN=blueSky, facelets.DEVELOPMENT=true, javax.faces.DEFAULT_SUFFIX=.xhtml}
      INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance of default capacity
      FAILED: testAddTip
      java.lang.AssertionError: org.jboss.seam.InstantiationException: Could not instantiate Seam component: cdrList
           at org.jboss.seam.mock.AbstractSeamTest$Request.onException(AbstractSeamTest.java:456)
           at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:505)
      ...
           at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:492)
           at org.domain.kanneldesk.test.DataIOTest.testAddTip(DataIOTest.java:17)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: cdrList
           at org.jboss.seam.Component.newInstance(Component.java:2096)
           at org.jboss.seam.Component.getInstance(Component.java:1978)

      ...
           at org.jboss.seam.mock.AbstractSeamTest$Request.access$300(AbstractSeamTest.java:178)
           at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:498)
           ... 44 more
      Caused by: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/kanneldeskEntityManagerFactory
           at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:231)
           at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:78)

      ...
           at org.jboss.seam.Component.callCreateMethod(Component.java:2124)
           at org.jboss.seam.Component.newInstance(Component.java:2084)
           ... 63 more
      Caused by: javax.naming.NameNotFoundException: kanneldeskEntityManagerFactory not bound
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
           at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
           at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
           at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
           at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
           at javax.naming.InitialContext.lookup(InitialContext.java:351)
           at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:227)
           ... 109 more
      ... Removed 34 stack frames