mirror of https://github.com/apache/openjpa.git
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:
parent
3c8b756ce5
commit
bc11397912
|
@ -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.RuntimeTest1;
|
||||||
import org.apache.openjpa.persistence.kernel.common.apps.RuntimeTest2;
|
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;
|
import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
|
||||||
|
|
||||||
public class TestEJBEntityManager extends AbstractTestCase {
|
public class TestEJBEntityManager extends AbstractTestCase {
|
||||||
|
|
||||||
private Object _id = null;
|
private Object _id = null;
|
||||||
|
|
||||||
private Object _id2 = null;
|
|
||||||
|
|
||||||
public TestEJBEntityManager(String name) {
|
public TestEJBEntityManager(String name) {
|
||||||
super(name, "kernelcactusapp");
|
super(name, "kernelcactusapp");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
deleteAll(RuntimeTest1.class);
|
super.setUp(RuntimeTest1.class, RuntimeTest2.class, RuntimeTest3.class);
|
||||||
|
|
||||||
EntityManager em = currentEntityManager();
|
EntityManager em = currentEntityManager();
|
||||||
startTx(em);
|
startTx(em);
|
||||||
|
@ -48,7 +47,7 @@ public class TestEJBEntityManager extends AbstractTestCase {
|
||||||
em.persist(a);
|
em.persist(a);
|
||||||
em.persist(b);
|
em.persist(b);
|
||||||
_id = a.getIntField();
|
_id = a.getIntField();
|
||||||
_id2 = b.getIntField();
|
b.getIntField();
|
||||||
|
|
||||||
endTx(em);
|
endTx(em);
|
||||||
endEm(em);
|
endEm(em);
|
||||||
|
@ -110,7 +109,7 @@ public class TestEJBEntityManager extends AbstractTestCase {
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
while (result.size() == 0)
|
while (result.size() == 0)
|
||||||
Thread.currentThread().yield(); // wait for results
|
Thread.yield(); // wait for results
|
||||||
Object ret = result.get(0);
|
Object ret = result.get(0);
|
||||||
|
|
||||||
if (ret instanceof Exception)
|
if (ret instanceof Exception)
|
||||||
|
@ -128,7 +127,7 @@ public class TestEJBEntityManager extends AbstractTestCase {
|
||||||
EntityManager em = currentEntityManager();
|
EntityManager em = currentEntityManager();
|
||||||
|
|
||||||
RuntimeTest1 a = new RuntimeTest1("foo", 10);
|
RuntimeTest1 a = new RuntimeTest1("foo", 10);
|
||||||
RuntimeTest1 a2 = (RuntimeTest1) em.find(RuntimeTest1.class, _id);
|
em.find(RuntimeTest1.class, _id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
em.persist(a);
|
em.persist(a);
|
||||||
|
|
|
@ -38,8 +38,7 @@ public class TestEJBLobs extends AbstractTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
deleteAll(Inner.class);
|
super.setUp(Inner.class, Inner2.class);
|
||||||
deleteAll(Inner2.class);
|
|
||||||
|
|
||||||
EntityManager em = currentEntityManager();
|
EntityManager em = currentEntityManager();
|
||||||
startTx(em);
|
startTx(em);
|
||||||
|
@ -70,7 +69,7 @@ public class TestEJBLobs extends AbstractTestCase {
|
||||||
endEm(_pm);
|
endEm(_pm);
|
||||||
|
|
||||||
_pm = currentEntityManager();
|
_pm = currentEntityManager();
|
||||||
_inner = (Inner) _pm.find(Inner.class, "string");
|
_inner = _pm.find(Inner.class, "string");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOtherFields() {
|
public void testOtherFields() {
|
||||||
|
|
|
@ -31,9 +31,8 @@ public class TestEJBManagedInverses extends AbstractTestCase {
|
||||||
super(name, "kernelcactusapp");
|
super(name, "kernelcactusapp");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUp() {
|
public void setUp() throws Exception {
|
||||||
deleteAll(InverseA.class);
|
super.setUp(InverseA.class, InverseB.class);
|
||||||
deleteAll(InverseB.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOneOne() {
|
public void testOneOne() {
|
||||||
|
|
|
@ -32,8 +32,8 @@ public class TestEJBQueryInterface extends BaseQueryTest {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUp() {
|
public void setUp() throws Exception {
|
||||||
deleteAll(Entity1.class);
|
super.setUp(Entity1.class, Entity2.class);
|
||||||
|
|
||||||
int instNum = 10;
|
int instNum = 10;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue