Skip to content
Permalink
Browse files

Improved: Use utilitary ‘OFBizTestCase#getLogin’ in ‘ServicePermissio…

…nTests’

(OFBIZ-11262)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869009 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Oct 26, 2019
1 parent 129ef1e commit 43c098c648052c7d1f822c2d40a2ec9603f40c55
@@ -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 ServicePermissionTests(String name) {
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);
@@ -40,17 +40,17 @@ public OFBizTestCase(String name) {
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");
}
}
}

0 comments on commit 43c098c

Please sign in to comment.
You can’t perform that action at this time.