initial add of EbeanORM server based on v2.8.1

This commit is contained in:
rbygrave
2012-09-14 00:40:39 +12:00
parent 2b74d0f9d9
commit 96ce4c0ddf
1188 changed files with 135034 additions and 0 deletions
@@ -0,0 +1,72 @@
package com.avaje.tests.query;
import junit.framework.TestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.Query;
import com.avaje.tests.model.basic.Customer;
public class TestConnectionCloseOnSqlerr extends TestCase {
static boolean runManuallyNow = true;
public void test() {
if (runManuallyNow) {
return;
}
try {
for (int i = 0; i < 100; i++) {
try {
Query<Customer> q0 = Ebean.find(Customer.class).where().icontains("namexxx", "Rob").query();
q0.findList();
} catch (Exception e) {
if (e.getMessage().contains("Unsuccessfully waited")) {
fail("No connections found while only one thread is running. (after " + i + " queries)");
} else {
e.printStackTrace();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void testTransactional() {
if (runManuallyNow) {
return;
}
try {
for (int i = 0; i < 100; i++) {
try {
Ebean.beginTransaction();
Query<Customer> q0 = Ebean.find(Customer.class).where().icontains("namexxx", "Rob").query();
q0.findList();
Ebean.commitTransaction();
} catch (Exception e) {
if (e.getMessage().contains("Unsuccessfully waited")) {
fail("No connections found while only one thread is running. (after " + i + " queries)");
} else {
e.printStackTrace();
}
} finally {
if (Ebean.currentTransaction().isActive()) {
Ebean.rollbackTransaction();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}