Skip to content

Commit

Permalink
Improved: Use utilitary ‘OFBizTestCase#getLogin’ in ‘ServicePermissio…
Browse files Browse the repository at this point in the history
…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 43c098c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.