Author: mthl Date: Sat Oct 26 16:22:07 2019 New Revision: 1869009 URL: http://svn.apache.org/viewvc?rev=1869009&view=rev Log: Improved: Use utilitary ‘OFBizTestCase#getLogin’ in ‘ServicePermissionTests’ (OFBIZ-11262)
Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServicePermissionTests.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServicePermissionTests.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServicePermissionTests.java?rev=1869009&r1=1869008&r2=1869009&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServicePermissionTests.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServicePermissionTests.java Sat Oct 26 16:22:07 2019 @@ -19,8 +19,6 @@ package org.apache.ofbiz.service.test; import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.entity.GenericValue; -import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.service.ServiceAuthException; import org.apache.ofbiz.service.ServiceUtil; import org.apache.ofbiz.service.testtools.OFBizTestCase; @@ -33,11 +31,6 @@ public class ServicePermissionTests exte super(name); } - - private GenericValue getUserLogin(String userLoginId) throws Exception { - return EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); - } - public void testPermissionSuccess() throws Exception { Map<String, Object> testingPermMap = UtilMisc.toMap("userLogin", getUserLogin("permUser1")); Map<String, Object> results = dispatcher.runSync("testSimplePermission", testingPermMap); Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java?rev=1869009&r1=1869008&r2=1869009&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java Sat Oct 26 16:22:07 2019 @@ -40,17 +40,17 @@ public class OFBizTestCase extends Entit public void setDispatcher(LocalDispatcher dispatcher) { this.dispatcher = dispatcher; } - + // Retrieves a particular login record. - GenericValue getUserLogin(String userLoginId) throws GenericEntityException { - return EntityQuery.use(delegator) + protected GenericValue getUserLogin(String userLoginId) throws GenericEntityException { + return EntityQuery.use(delegator) .from("UserLogin") .where("userLoginId", userLoginId) .queryOne(); } - + // Retrieves the default login record. - GenericValue getUserLogin() throws GenericEntityException { + protected GenericValue getUserLogin() throws GenericEntityException { return getUserLogin("system"); - } + } }