OPENJPA-1153: Speed tests up by using only needed entities rather than all entities from persistence.xml

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@824071 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Milosz Tylenda 2009-10-11 13:35:43 +00:00
parent 3c8b756ce5
commit bc11397912
4 changed files with 11 additions and 14 deletions

View File

@ -25,20 +25,19 @@ import javax.persistence.EntityManager;
import org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest1;
import org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest2;
import org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest3;
import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
public class TestEJBEntityManager extends AbstractTestCase {
private Object _id = null;
private Object _id2 = null;
public TestEJBEntityManager(String name) {
super(name, "kernelcactusapp");
}
public void setUp() throws Exception {
deleteAll(RuntimeTest1.class);
super.setUp(RuntimeTest1.class, RuntimeTest2.class, RuntimeTest3.class);
EntityManager em = currentEntityManager();
startTx(em);
@ -48,7 +47,7 @@ public class TestEJBEntityManager extends AbstractTestCase {
em.persist(a);
em.persist(b);
_id = a.getIntField();
_id2 = b.getIntField();
b.getIntField();
endTx(em);
endEm(em);
@ -110,7 +109,7 @@ public class TestEJBEntityManager extends AbstractTestCase {
}.start();
while (result.size() == 0)
Thread.currentThread().yield(); // wait for results
Thread.yield(); // wait for results
Object ret = result.get(0);
if (ret instanceof Exception)
@ -128,7 +127,7 @@ public class TestEJBEntityManager extends AbstractTestCase {
EntityManager em = currentEntityManager();
RuntimeTest1 a = new RuntimeTest1("foo", 10);
RuntimeTest1 a2 = (RuntimeTest1) em.find(RuntimeTest1.class, _id);
em.find(RuntimeTest1.class, _id);
try {
em.persist(a);

View File

@ -38,8 +38,7 @@ public class TestEJBLobs extends AbstractTestCase {
}
public void setUp() throws Exception {
deleteAll(Inner.class);
deleteAll(Inner2.class);
super.setUp(Inner.class, Inner2.class);
EntityManager em = currentEntityManager();
startTx(em);
@ -70,7 +69,7 @@ public class TestEJBLobs extends AbstractTestCase {
endEm(_pm);
_pm = currentEntityManager();
_inner = (Inner) _pm.find(Inner.class, "string");
_inner = _pm.find(Inner.class, "string");
}
public void testOtherFields() {

View File

@ -31,9 +31,8 @@ public class TestEJBManagedInverses extends AbstractTestCase {
super(name, "kernelcactusapp");
}
public void setUp() {
deleteAll(InverseA.class);
deleteAll(InverseB.class);
public void setUp() throws Exception {
super.setUp(InverseA.class, InverseB.class);
}
public void testOneOne() {

View File

@ -32,8 +32,8 @@ public class TestEJBQueryInterface extends BaseQueryTest {
super(name);
}
public void setUp() {
deleteAll(Entity1.class);
public void setUp() throws Exception {
super.setUp(Entity1.class, Entity2.class);
int instNum = 10;