Hello,

I used to be able to boot JBoss embedded from Seam tests in my app in the 1.2.1 
and earlier days (was it only 6 months ago?).  Anyway, now when I run my tests, 
I am getting null-pointer exceptions from a class called SeamBaseTest.  For 
example:


  | public class PersistenceUnitConfigurationTest extends SeamTest {
  | 
  |     private Log log = 
LogFactory.getLog(PersistenceUnitConfigurationTest.class);
  | 
  |     @Test
  |      public void test_GetManagedPersistenceContext_from_Seam() throws 
Exception {
  | 
  |          new FacesRequest() {
  |              protected void invokeApplication() throws Exception {
  |                  EntityManager em = (EntityManager) 
getInstance("entityManager");
  |                  assert em != null;
  |              }
  |          }.run();
  | 
  |      }
  | }
  | 
 yields

  | 
-------------------------------------------------------------------------------
  | Test set: SampleEJB3Test
  | 
-------------------------------------------------------------------------------
  | Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.198 sec 
<<< FAILURE!
  | test_GetManagedPersistenceContext_from_Seam  Time elapsed: 0.047 sec  <<< 
FAILURE!
  | java.lang.NullPointerException
  |         at 
org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:504)
  |         at 
com.javaplant.mapper.police.PersistenceUnitConfigurationTest.test_GetManagedPersistenceContext_from_Seam(PersistenceUnitConfigurationTest.java:22)
  | 

Ok - so it looks like there is now something called a ComponentTest, so I'll 
try that instead:


  | public class PersistenceUnitConfigurationTest extends SeamTest {
  | 
  |     private Log log = 
LogFactory.getLog(PersistenceUnitConfigurationTest.class);
  | 
  |     @Test
  |      public void test_GetManagedPersistenceContext_from_Seam() throws 
Exception {
  | 
  |          new ComponentTest() {
  | 
  |              protected void testComponents() throws Exception {
  |                  EntityManager em = (EntityManager) 
getInstance("entityManager");
  |                  assert em != null;
  |              }
  |          }.run();
  | 
  |      }
  | }
  | 
and this yields:


  | 
-------------------------------------------------------------------------------
  | Test set: SampleEJB3Test
  | 
-------------------------------------------------------------------------------
  | Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.195 sec 
<<< FAILURE!
  | test_GetManagedPersistenceContext_from_Seam  Time elapsed: 0.07 sec  <<< 
FAILURE!
  | java.lang.NullPointerException
  |         at 
org.jboss.seam.servlet.ServletSessionMap.get(ServletSessionMap.java:54)
  |         at org.jboss.seam.contexts.BasicContext.get(BasicContext.java:48)
  |         at 
org.jboss.seam.contexts.Contexts.lookupInStatefulContexts(Contexts.java:199)
  |         at org.jboss.seam.Component.getInstance(Component.java:1844)
  |         at org.jboss.seam.Component.getInstance(Component.java:1839)
  |         at 
org.jboss.seam.mock.BaseSeamTest.getInstance(BaseSeamTest.java:98)
  |         at 
com.javaplant.mapper.police.PersistenceUnitConfigurationTest.access$000(PersistenceUnitConfigurationTest.java:15)
  |         at 
com.javaplant.mapper.police.PersistenceUnitConfigurationTest$1.testComponents(PersistenceUnitConfigurationTest.java:25)
  |         at 
org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:164)
  |         at 
com.javaplant.mapper.police.PersistenceUnitConfigurationTest.test_GetManagedPersistenceContext_from_Seam(PersistenceUnitConfigurationTest.java:22)
  | 

So what's going on with SeamBaseTest?

Thanks,
Brad Smith

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099682#4099682

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099682
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to