Improved: Added support for EntityQuery methods in OFBiz integration tests.
Thanks: Jacques for the review.
@@ -21,10 +21,13 @@ package org.apache.ofbiz.service.testtools;
import org.apache.ofbiz.entity.GenericEntityException;
import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.entity.model.DynamicViewEntity;
import org.apache.ofbiz.entity.testtools.EntityTestCase;
import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.service.LocalDispatcher;
+import java.util.Set;
+
public class OFBizTestCase extends EntityTestCase {
protected LocalDispatcher dispatcher = null;
@@ -53,4 +56,20 @@ public class OFBizTestCase extends EntityTestCase {
protected GenericValue getUserLogin() throws GenericEntityException {
return getUserLogin("system");
}
+
+ protected EntityQuery from(String entityName) {
+ return EntityQuery.use(delegator).from(entityName);
+ }
+
+ protected EntityQuery from(DynamicViewEntity dynamicViewEntity) {
+ return EntityQuery.use(delegator).from(dynamicViewEntity);
+ }
+
+ protected EntityQuery select(String... fields) {
+ return EntityQuery.use(delegator).select(fields);
+ }
+
+ protected EntityQuery select(Set<String> fields) {
+ return EntityQuery.use(delegator).select(fields);
+ }
}
