diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2009-11-24 13:26:46 -0400 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2009-11-24 13:26:46 -0400 |
commit | 1b4a97f23cee693d465a04737ed3913194476ffb (patch) | |
tree | 2126a5cf1cc67d0098b5f75328215dcd155d8c82 /proxy/code/src/org/fedoraproject/candlepin/model/test/ProductTest.java | |
parent | 110e92e9df170964779d148eb9ac075ca4239a08 (diff) | |
download | candlepin-1b4a97f23cee693d465a04737ed3913194476ffb.tar.gz candlepin-1b4a97f23cee693d465a04737ed3913194476ffb.tar.xz candlepin-1b4a97f23cee693d465a04737ed3913194476ffb.zip |
Cleanup test transaction management.
Diffstat (limited to 'proxy/code/src/org/fedoraproject/candlepin/model/test/ProductTest.java')
-rw-r--r-- | proxy/code/src/org/fedoraproject/candlepin/model/test/ProductTest.java | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/test/ProductTest.java b/proxy/code/src/org/fedoraproject/candlepin/model/test/ProductTest.java index 42bfc79..a492741 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/test/ProductTest.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/test/ProductTest.java @@ -4,29 +4,19 @@ import static org.junit.Assert.assertEquals; import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.EntityTransaction; import javax.persistence.PersistenceException; import org.fedoraproject.candlepin.model.Product; -import org.fedoraproject.candlepin.util.EntityManagerUtil; -import org.junit.Before; import org.junit.Test; -public class ProductTest { +public class ProductTest extends ModelTestFixture { - private EntityManager em; - - @Before - public void setUp() { - em = EntityManagerUtil.createEntityManager(); - } @Test public void normalCreate() { Product prod = new Product("myproductlabel", "My Product"); - storeObject(prod); + persistAndCommit(prod); List<Product> results = em.createQuery("select p from Product as p") .getResultList(); @@ -38,7 +28,7 @@ public class ProductTest { Product prod = new Product(); prod.setLabel("someproductlabel"); - storeObject(prod); + persistAndCommit(prod); } @@ -47,17 +37,8 @@ public class ProductTest { Product prod = new Product(); prod.setName("My Product Name"); - storeObject(prod); + persistAndCommit(prod); } - public void storeObject(Object storeMe) { - EntityTransaction tx = null; - tx = em.getTransaction(); - tx.begin(); - - em.persist(storeMe); - tx.commit(); - } - } |