1 17 18 package org.apache.geronimo.transaction.mockjpa; 19 20 import java.util.Map ; 21 22 import javax.persistence.EntityManagerFactory; 23 import javax.persistence.EntityManager; 24 25 28 public class MockEntityManagerFactory implements EntityManagerFactory { 29 30 private boolean open = true; 31 32 public EntityManager createEntityManager() { 33 if (!open) { 34 throw new IllegalStateException ("closed"); 35 } 36 return new MockEntityManager(); 37 } 38 39 public EntityManager createEntityManager(Map map) { 40 if (!open) { 41 throw new IllegalStateException ("closed"); 42 } 43 return new MockEntityManager(map); 44 } 45 46 public void close() { 47 open = false; 48 } 49 50 public boolean isOpen() { 51 return open; 52 } 53 } 54 | Popular Tags |