details: https://code.openbravo.com/erp/devel/pi/rev/d4dc31fc531b
changeset: 24080:d4dc31fc531b
user: Martin Taal <martin.taal <at> openbravo.com>
date: Sat Jul 19 19:59:28 2014 +0200
summary: Fixes issue 27113: junit test HiddenUpdateTest is quite slow (2.5
minutes)
diffstat:
src-test/org/openbravo/test/dal/HiddenUpdateTest.java | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (31 lines):
diff -r 78049352f9eb -r d4dc31fc531b
src-test/org/openbravo/test/dal/HiddenUpdateTest.java
--- a/src-test/org/openbravo/test/dal/HiddenUpdateTest.java Fri Jul 18
10:37:19 2014 +0200
+++ b/src-test/org/openbravo/test/dal/HiddenUpdateTest.java Sat Jul 19
19:59:28 2014 +0200
@@ -33,6 +33,7 @@
import org.openbravo.base.structure.BaseOBObject;
import org.openbravo.dal.core.DalSessionFactoryController;
import org.openbravo.dal.core.SessionHandler;
+import org.openbravo.dal.service.OBCriteria;
import org.openbravo.dal.service.OBDal;
import org.openbravo.dal.xml.EntityXMLConverter;
import org.openbravo.test.base.BaseTest;
@@ -73,10 +74,17 @@
final String entityName = pc.getEntityName();
Entity entity = ModelProvider.getInstance().getEntity(entityName);
- if (entity.isHQLBased() || entity.isDataSourceBased()) {
+ // can also ignore views as they will result in errors anyway and they
are
+ // mapped as not updateable
+ if (entity.isHQLBased() || entity.isDataSourceBased() ||
entity.isView()) {
continue;
}
- for (final Object o :
OBDal.getInstance().createCriteria(entityName).list()) {
+
+ // read max 5 records from each type, should be enough to limit
runtime of the test
+ // and still give good results.
+ final OBCriteria<BaseOBObject> criteria =
OBDal.getInstance().createCriteria(entityName);
+ criteria.setMaxResults(5);
+ for (final Object o : criteria.list()) {
if (o == null) {
// can occur when reading views which have nullable
// columns in a
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits