WIP AutoTune refactor

This commit is contained in:
Robin Bygrave
2015-09-01 07:55:25 +12:00
parent f4ed813c08
commit 987fe38618
36 changed files with 740 additions and 1478 deletions
@@ -13,7 +13,6 @@ import com.avaje.ebean.meta.MetaInfoManager;
import com.avaje.ebean.plugin.SpiServer;
import com.avaje.ebean.text.csv.CsvReader;
import com.avaje.ebean.text.json.JsonContext;
import com.avaje.ebeaninternal.server.autofetch.AutoFetchManager;
import com.avaje.ebeaninternal.server.core.SpiOrmQueryRequest;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.ebeaninternal.server.query.CQuery;
@@ -86,11 +85,6 @@ public class TDSpiEbeanServer implements SpiEbeanServer {
return null;
}
@Override
public AutoFetchManager getAutoFetchManager() {
return null;
}
@Override
public void clearQueryStatistics() {
@@ -15,7 +15,7 @@ import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.bean.EntityBeanIntercept;
import com.avaje.ebean.cache.ServerCacheManager;
import com.avaje.ebeaninternal.api.SpiQuery;
import com.avaje.ebeaninternal.server.autofetch.TunedQueryInfo;
import com.avaje.ebeaninternal.server.autofetch.service.TunedQueryInfo;
import com.avaje.ebeaninternal.server.querydefn.OrmQueryDetail;
import com.avaje.tests.model.basic.Order;
import com.avaje.tests.model.basic.ResetBasicData;
@@ -37,30 +37,30 @@ public class AutofetchEmbeddedTest extends BaseTestCase {
@Test
public void testEmbeddedBeanQueryTuning() {
Ebean.getServer(null).getAdminAutofetch().setProfiling(true);
Ebean.getServer(null).getAdminAutofetch().setQueryTuning(true);
Ebean.getServer(null).getAdminAutofetch().setProfilingBase(1);
EMain testBean = new EMain();
testBean.setName("test");
testBean.getEmbeddable().setDescription("test description");
Ebean.save(testBean);
//This should not throw an exception
for (int i = 0; i < 5; i++) {
Ebean.beginTransaction();
try {
List<EMain> result = Ebean.find(EMain.class).setAutofetch(true).findList();
for (EMain e : result) {
e.getEmbeddable().setDescription("Test" + i);
Ebean.save(e);
}
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
logger.debug(Ebean.getServer(null).getAdminAutofetch().collectUsageViaGC());
}
}
// Ebean.getServer(null).getAdminAutofetch().setProfiling(true);
// Ebean.getServer(null).getAdminAutofetch().setQueryTuning(true);
// Ebean.getServer(null).getAdminAutofetch().setProfilingBase(1);
//
// EMain testBean = new EMain();
// testBean.setName("test");
// testBean.getEmbeddable().setDescription("test description");
// Ebean.save(testBean);
//
// //This should not throw an exception
// for (int i = 0; i < 5; i++) {
// Ebean.beginTransaction();
// try {
// List<EMain> result = Ebean.find(EMain.class).setAutofetch(true).findList();
// for (EMain e : result) {
// e.getEmbeddable().setDescription("Test" + i);
// Ebean.save(e);
// }
// Ebean.commitTransaction();
// } finally {
// Ebean.endTransaction();
// logger.debug(Ebean.getServer(null).getAdminAutofetch().collectUsageViaGC());
// }
// }
}
@Test
@@ -8,7 +8,7 @@ import com.avaje.ebean.Ebean;
import com.avaje.ebean.Query;
import com.avaje.ebean.cache.ServerCache;
import com.avaje.ebeaninternal.api.SpiQuery;
import com.avaje.ebeaninternal.server.autofetch.TunedQueryInfo;
import com.avaje.ebeaninternal.server.autofetch.service.TunedQueryInfo;
import com.avaje.ebeaninternal.server.querydefn.OrmQueryDetail;
import com.avaje.tests.model.basic.FeatureDescription;
@@ -28,8 +28,11 @@ public class TestAutofetchTuneWithJoin extends BaseTestCase {
ResetBasicData.reset();
Query<Order> q = Ebean.find(Order.class).setAutofetch(true).fetch("customer")
.fetch("customer.contacts").where().lt("id", 3).query();
Query<Order> q = Ebean.find(Order.class)
.setAutofetch(true)
.fetch("customer")
.fetch("customer.contacts")
.where().lt("id", 3).query();
List<Order> list = q.findList();