summaryrefslogtreecommitdiffstats
path: root/proxy/code/src/org/fedoraproject/candlepin/test/DatabaseTestFixture.java
diff options
context:
space:
mode:
Diffstat (limited to 'proxy/code/src/org/fedoraproject/candlepin/test/DatabaseTestFixture.java')
-rw-r--r--proxy/code/src/org/fedoraproject/candlepin/test/DatabaseTestFixture.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/test/DatabaseTestFixture.java b/proxy/code/src/org/fedoraproject/candlepin/test/DatabaseTestFixture.java
index 485b982..286e07b 100644
--- a/proxy/code/src/org/fedoraproject/candlepin/test/DatabaseTestFixture.java
+++ b/proxy/code/src/org/fedoraproject/candlepin/test/DatabaseTestFixture.java
@@ -8,6 +8,7 @@ import javax.persistence.EntityTransaction;
import org.fedoraproject.candlepin.model.Consumer;
import org.fedoraproject.candlepin.model.ConsumerInfo;
import org.fedoraproject.candlepin.model.ConsumerType;
+import org.fedoraproject.candlepin.model.Entitlement;
import org.fedoraproject.candlepin.model.EntitlementPool;
import org.fedoraproject.candlepin.model.Owner;
import org.fedoraproject.candlepin.model.Product;
@@ -46,6 +47,18 @@ public class DatabaseTestFixture {
beginTransaction();
}
+ List<Entitlement> ents = em.createQuery("from Entitlement e").
+ getResultList();
+ for (Entitlement e : ents) {
+ em.remove(e);
+ }
+
+ List<EntitlementPool> pools = em.createQuery("from EntitlementPool p").
+ getResultList();
+ for (EntitlementPool p : pools) {
+ em.remove(p);
+ }
+
// TODO: Would rather be doing this, but such a bulk delete does not seem to respect
// the cascade to child products and thus fails.
// em.createQuery("delete from Product").executeUpdate();
@@ -77,12 +90,6 @@ public class DatabaseTestFixture {
em.remove(c);
}
- List<EntitlementPool> pools = em.createQuery("from EntitlementPool p").
- getResultList();
- for (EntitlementPool p : pools) {
- em.remove(p);
- }
-
commitTransaction();
em.close();
}