From 1b3d3bdf4e4ebcf3597a2bb97b22c41cbe20cf6c Mon Sep 17 00:00:00 2001 From: Pawan Verma Date: Wed, 29 Apr 2020 15:28:42 +0530 Subject: [PATCH] Improved: Added support for EntityQuery methods in OFBiz integration tests. (OFBIZ-11247) Thanks: Jacques for the review. --- .../service/testtools/OFBizTestCase.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java b/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java index 4ba848802a..257ae473f1 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java @@ -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 fields) { + return EntityQuery.use(delegator).select(fields); + } }