Remove unused ServerConfig debugSql options, Update Tests to use agentloader

This commit is contained in:
Robin Bygrave
2013-04-29 22:42:27 +12:00
parent bb2479c9e7
commit 2f97c5c36e
217 changed files with 6351 additions and 6740 deletions
@@ -2,8 +2,9 @@ package com.avaje.tests.text.json;
import java.util.List;
import junit.framework.TestCase;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.text.json.JsonContext;
@@ -13,44 +14,43 @@ import com.avaje.ebean.text.json.JsonWriter;
import com.avaje.tests.model.basic.Customer;
import com.avaje.tests.model.basic.ResetBasicData;
public class TestTextJsonSimple extends TestCase {
public class TestTextJsonSimple extends BaseTestCase {
public void test() {
ResetBasicData.reset();
List<Customer> list = Ebean.find(Customer.class)
.select("id, name, status, shippingAddress")
.fetch("billingAddress","line1, city")
.fetch("billingAddress.country","*")
.fetch("contacts", "firstName,email")//, new FetchConfig().queryFirst(2))
//.filterMany("contacts").ilike("firstName", "J%").query()
//.where().lt("id", 3)
.order().desc("id")
.findList();
EbeanServer server = Ebean.getServer(null);
@Test
public void test() {
JsonContext json = server.createJsonContext();
JsonWriteOptions options = new JsonWriteOptions();
options.setRootPathProperties("name, id");
options.setRootPathVisitor(new JsonWriteBeanVisitor<Customer>() {
ResetBasicData.reset();
public void visit(Customer bean, JsonWriter ctx) {
System.out.println("visiting "+bean);
ctx.appendRawValue("dummy", "34");
}
});
//String s = json.toJsonString(list, true);
String s = json.toJsonString(list, true, options);
System.out.println(s);
List<Customer> mList = json.toList(Customer.class, s);
System.out.println(mList);
}
List<Customer> list = Ebean.find(Customer.class).select("id, name, status, shippingAddress")
.fetch("billingAddress", "line1, city").fetch("billingAddress.country", "*")
.fetch("contacts", "firstName,email")// , new
// FetchConfig().queryFirst(2))
// .filterMany("contacts").ilike("firstName", "J%").query()
// .where().lt("id", 3)
.order().desc("id").findList();
EbeanServer server = Ebean.getServer(null);
JsonContext json = server.createJsonContext();
JsonWriteOptions options = new JsonWriteOptions();
options.setRootPathProperties("name, id");
options.setRootPathVisitor(new JsonWriteBeanVisitor<Customer>() {
public void visit(Customer bean, JsonWriter ctx) {
System.out.println("visiting " + bean);
ctx.appendRawValue("dummy", "34");
}
});
// String s = json.toJsonString(list, true);
String s = json.toJsonString(list, true, options);
System.out.println(s);
List<Customer> mList = json.toList(Customer.class, s);
System.out.println(mList);
}
}