[seam-commits] Seam SVN: r13667 - modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Aug 30 18:32:58 EDT 2010


Author: swd847
Date: 2010-08-30 18:32:58 -0400 (Mon, 30 Aug 2010)
New Revision: 13667

Modified:
   modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java
Log:
update flush mode test


Modified: modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java
===================================================================
--- modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java	2010-08-30 13:53:42 UTC (rev 13666)
+++ modules/persistence/trunk/impl/src/test/java/org/jboss/seam/persistence/test/ManagedPersistenceContextFlushModeTest.java	2010-08-30 22:32:58 UTC (rev 13667)
@@ -21,6 +21,7 @@
  */
 package org.jboss.seam.persistence.test;
 
+import javax.enterprise.inject.spi.BeanManager;
 import javax.inject.Inject;
 import javax.persistence.EntityManager;
 import javax.transaction.HeuristicMixedException;
@@ -36,7 +37,9 @@
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.persistence.FlushModeManager;
+import org.jboss.seam.persistence.ManagedPersistenceContext;
 import org.jboss.seam.persistence.PersistenceContextExtension;
+import org.jboss.seam.persistence.PersistenceContexts;
 import org.jboss.seam.persistence.transaction.FlushModeType;
 import org.jboss.seam.persistence.transaction.TransactionExtension;
 import org.jboss.seam.persistence.transaction.scope.TransactionScopeExtension;
@@ -79,11 +82,34 @@
    @Inject
    EntityManager em;
 
+   @Inject
+   ManagedPersistenceContext context;
+
+   @Inject
+   PersistenceContexts pc;
+
+   @Inject
+   BeanManager bm;
+
    @Test
-   public void testPersistnceContextFlushMode() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
+   public void testPersistenceContextDefaultFlushMode() throws NotSupportedException, SystemException, SecurityException, IllegalStateException, RollbackException, HeuristicMixedException, HeuristicRollbackException
    {
       manager.setFlushModeType(FlushModeType.MANUAL);
       Assert.assertEquals(FlushMode.MANUAL, ((Session) em.getDelegate()).getFlushMode());
    }
 
+   @Test
+   public void testChangedTouchedPersistenceContextFlushMode()
+   {
+      try
+      {
+         em.setFlushMode(javax.persistence.FlushModeType.AUTO);
+         pc.changeFlushMode(FlushModeType.MANUAL);
+         Assert.assertEquals(FlushMode.MANUAL, ((Session) em.getDelegate()).getFlushMode());
+      }
+      finally
+      {
+         em.setFlushMode(javax.persistence.FlushModeType.AUTO);
+      }
+   }
 }



More information about the seam-commits mailing list