[ofbiz-framework] branch trunk updated: Improved: Use userLogin available in context instead of fetching from DB in Groovy test cases (OFBIZ-11618)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Use userLogin available in context instead of fetching from DB in Groovy test cases (OFBIZ-11618)

Pawan Verma-2
This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b613256  Improved: Use userLogin available in context instead of fetching from DB in Groovy test cases (OFBIZ-11618)
b613256 is described below

commit b613256823163780ad1475fe43b8890b57b06a07
Author: Pawan Verma <[hidden email]>
AuthorDate: Wed Apr 29 16:26:58 2020 +0530

    Improved: Use userLogin available in context instead of fetching from DB in Groovy test cases
    (OFBIZ-11618)
   
    Thanks: Jacques for the review.
---
 .../ofbiz/accounting/AutoAcctgAdminTests.groovy    | 26 +++++++++++-----------
 .../ofbiz/accounting/AutoAcctgBudgetTests.groovy   |  4 ++--
 .../ofbiz/accounting/AutoAcctgCostTests.groovy     |  2 +-
 .../ofbiz/accounting/AutoAcctgInvoiceTests.groovy  | 10 ---------
 .../ofbiz/accounting/AutoAcctgLedgerTests.groovy   |  2 +-
 .../accounting/AutoAcctgPaymentGatewayTests.groovy |  2 +-
 .../ofbiz/accounting/AutoAcctgPaymentTests.groovy  |  6 ++---
 .../org/apache/ofbiz/content/ContentTests.groovy   |  2 +-
 .../org/apache/ofbiz/order/OrderReturnTests.groovy | 12 +++++-----
 .../org/apache/ofbiz/order/QuoteTests.groovy       |  2 +-
 .../order/TestCustRequestPermissionCheck.groovy    |  2 +-
 .../ofbiz/product/ProductFeatureTypeTests.groovy   |  2 +-
 .../org/apache/ofbiz/product/ProductTests.groovy   |  2 +-
 13 files changed, 32 insertions(+), 42 deletions(-)

diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy
index d5d2e4e..b7bce03 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy
@@ -43,7 +43,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
             paymentMethodTypeId: 'GIFT_CARD',
             organizationPartyId: 'DEMO_COMPANY1',
             glAccountId: '999999',
-            userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+            userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('addPaymentMethodTypeGlAssignment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -60,7 +60,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
         Map serviceCtx = [
                 paymentTypeId: 'COMMISSION_PAYMENT',
                 organizationPartyId: 'DEMO_COMPANY1',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('removePaymentTypeGlAssignment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -76,7 +76,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
         Map serviceCtx = [
                 partyId: 'DEMO_COMPANY',
                 refundPaymentMethodId: '9020',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('createPartyAcctgPreference', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -93,7 +93,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
         Map serviceCtx = [
                 partyId: 'DEMO_COMPANY1',
                 refundPaymentMethodId: '9020',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('updatePartyAcctgPreference', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -108,7 +108,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
     void testGetPartyAccountingPreferences() {
         Map serviceCtx = [
                 organizationPartyId: 'DEMO_COMPANY1',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('getPartyAccountingPreferences', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -118,7 +118,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
     void testSetAcctgCompany() {
         Map serviceCtx = [
                 organizationPartyId: 'DEMO_COMPANY1',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('setAcctgCompany', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -136,7 +136,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
                 uomId: 'INR',
                 uomIdTo: 'USD',
                 conversionFactor: 2.0,
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('updateFXConversion', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -153,7 +153,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
                 glAccountTypeId: 'BALANCE_ACCOUNT',
                 organizationPartyId: 'DEMO_COMPANY1',
                 glAccountId: '999999',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('createGlAccountTypeDefault', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -170,7 +170,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
                 glAccountTypeId: 'ACCOUNTS_PAYABLE',
                 organizationPartyId: 'DEMO_COMPANY1',
                 glAccountId: '999999',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('removeGlAccountTypeDefault', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -187,7 +187,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
                 invoiceItemTypeId: 'PINV_FPROD_ITEM',
                 organizationPartyId: 'DEMO_COMPANY1',
                 glAccountId: '999999',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('addInvoiceItemTypeGlAssignment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -204,7 +204,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
         Map serviceCtx = [
                 invoiceItemTypeId: 'PINV_SALES_TAX',
                 organizationPartyId: 'DEMO_COMPANY1',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('removeInvoiceItemTypeGlAssignment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -221,7 +221,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
                 paymentTypeId: 'TAX_PAYMENT',
                 organizationPartyId: 'DEMO_COMPANY1',
                 glAccountTypeId: 'TAX_ACCOUNT',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('addPaymentTypeGlAssignment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -238,7 +238,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
         Map serviceCtx = [
                 paymentMethodTypeId: 'CASH',
                 organizationPartyId: 'DEMO_COMPANY1',
-                userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+                userLogin: userLogin
         ]
         Map serviceResult = dispatcher.runSync('removePaymentMethodTypeGlAssignment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgBudgetTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgBudgetTests.groovy
index fb7f701..f1e10dd 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgBudgetTests.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgBudgetTests.groovy
@@ -32,7 +32,7 @@ class AutoAcctgBudgetTests extends OFBizTestCase {
         Map serviceCtx = [:]
         serviceCtx.budgetTypeId = 'CAPITAL_BUDGET'
         serviceCtx.comments = 'Capital Budget'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+        serviceCtx.userLogin = userLogin
         Map result = dispatcher.runSync('createBudget', serviceCtx)
         assert ServiceUtil.isSuccess(result)
 
@@ -46,7 +46,7 @@ class AutoAcctgBudgetTests extends OFBizTestCase {
         Map serviceCtx = [:]
         serviceCtx.budgetId = '9999'
         serviceCtx.statusId = 'BG_APPROVED'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+        serviceCtx.userLogin = userLogin
         Map result = dispatcher.runSync('updateBudgetStatus', serviceCtx)
 
         List<GenericValue> budgetStatuses = EntityQuery.use(delegator).from('BudgetStatus').where('budgetId', '9999').orderBy('-statusDate').queryList()
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgCostTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgCostTests.groovy
index d188f79..e6573a6 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgCostTests.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgCostTests.groovy
@@ -34,7 +34,7 @@ class AutoAcctgCostTests extends OFBizTestCase {
         serviceCtx.quantityAccepted = new BigDecimal('10')
         serviceCtx.productId = 'TestProduct3'
         serviceCtx.inventoryItemId = '9999'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').queryOne()
+        serviceCtx.userLogin = userLogin
         Map result = dispatcher.runSync('updateProductAverageCostOnReceiveInventory', serviceCtx)
         assert ServiceUtil.isSuccess(result)
 
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy
index e391449..c67ac75 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgInvoiceTests.groovy
@@ -32,11 +32,6 @@ class AutoAcctgInvoiceTests extends OFBizTestCase {
     }
 
     void testCreateInvoiceContent() {
-        def userLogin = EntityQuery.use(delegator).from('UserLogin')
-            .where('userLoginId', 'system')
-            .cache()
-            .queryOne()
-
         Map serviceCtx = [
             invoiceId: '1008',
             contentId: '1000',
@@ -56,11 +51,6 @@ class AutoAcctgInvoiceTests extends OFBizTestCase {
         assert invoiceContent.contentId == serviceResult.contentId
     }
     void testCreateSimpleTextContentForInvoice() {
-        def userLogin = EntityQuery.use(delegator).from('UserLogin')
-                .where('userLoginId', 'system')
-                .cache()
-                .queryOne()
-
         Map serviceCtx = [
                 invoiceId: '1009',
                 contentId: '1001',
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy
index e228163..b0fd6bb 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy
@@ -34,7 +34,7 @@ class AutoAcctgLedgerTests extends OFBizTestCase {
         serviceCtx.description = 'Test Credit Memo Transaction'
         serviceCtx.transactionDate = UtilDateTime.nowTimestamp()
         serviceCtx.glFiscalTypeId = 'BUDGET'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map serviceResult = dispatcher.runSync('createAcctgTrans', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
 
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentGatewayTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentGatewayTests.groovy
index 4c31991..004908e 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentGatewayTests.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentGatewayTests.groovy
@@ -32,7 +32,7 @@ class AutoAcctgPaymentGatewayTests extends OFBizTestCase {
         Map serviceCtx = [:]
         serviceCtx.paymentGatewayConfigId = 'SAGEPAY_CONFIG'
         serviceCtx.description = 'Test Payment Gateway Config Id'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map serviceResult = dispatcher.runSync('updatePaymentGatewayConfig', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
 
diff --git a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy
index 421a80e..8fc97ee 100644
--- a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy
+++ b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy
@@ -37,7 +37,7 @@ class AutoAcctgPaymentTests extends OFBizTestCase {
         serviceCtx.partyIdTo = 'DemoCustCompany'
         serviceCtx.amount = new BigDecimal('100.00')
         serviceCtx.paymentMethodTypeId = 'COMPANY_CHECK'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map serviceResult = dispatcher.runSync('createPayment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
 
@@ -49,7 +49,7 @@ class AutoAcctgPaymentTests extends OFBizTestCase {
         Map serviceCtx = [:]
         serviceCtx.paymentId = '1000'
         serviceCtx.statusId = 'PAYMENT_AUTHORIZED'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map serviceResult = dispatcher.runSync('setPaymentStatus', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
 
@@ -60,7 +60,7 @@ class AutoAcctgPaymentTests extends OFBizTestCase {
     void testQuickSendPayment() {
         Map serviceCtx = [:]
         serviceCtx.paymentId = '1001'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map serviceResult = dispatcher.runSync('quickSendPayment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
 
diff --git a/applications/content/src/main/groovy/org/apache/ofbiz/content/ContentTests.groovy b/applications/content/src/main/groovy/org/apache/ofbiz/content/ContentTests.groovy
index aaa5ef6..4099898 100644
--- a/applications/content/src/main/groovy/org/apache/ofbiz/content/ContentTests.groovy
+++ b/applications/content/src/main/groovy/org/apache/ofbiz/content/ContentTests.groovy
@@ -32,7 +32,7 @@ class ContentTests extends OFBizTestCase {
     void testGetDataResource() {
         Map serviceCtx = [:]
         serviceCtx.dataResourceId = 'TEST_RESOURCE'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map serviceResult = dispatcher.runSync('getDataResource', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
         assert serviceResult.resultData.dataResource.dataResourceId == 'TEST_RESOURCE'
diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy
index c7ed6a7..5b7e3df 100644
--- a/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy
+++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy
@@ -65,7 +65,7 @@ class OrderReturnTests extends OFBizTestCase {
         Map serviceCtx = [
             returnId       : '1009',
             returnItemSeqId: '00001',
-            userLogin      : EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+            userLogin      : userLogin
         ]
         Map serviceResult = dispatcher.runSync('getReturnItemInitialCost', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -75,7 +75,7 @@ class OrderReturnTests extends OFBizTestCase {
         Map serviceCtx = [
             returnId    : '1009',
             returnTypeId: 'RTN_REFUND',
-            userLogin   : EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+            userLogin   : userLogin
         ]
         Map serviceResult = dispatcher.runSync('processRefundReturn', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -84,7 +84,7 @@ class OrderReturnTests extends OFBizTestCase {
         Map serviceCtx = [
             returnId    : '1009',
             returnTypeId: 'RTN_REFUND',
-            userLogin   : EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+            userLogin   : userLogin
         ]
         Map serviceResult = dispatcher.runSync('processReplacementReturn', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -93,7 +93,7 @@ class OrderReturnTests extends OFBizTestCase {
         Map serviceCtx = [
             returnId      : '1009',
             orderItemSeqId: '00001',
-            userLogin     : EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+            userLogin     : userLogin
         ]
         Map serviceResult = dispatcher.runSync('processReplaceImmediatelyReturn', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -176,7 +176,7 @@ class OrderReturnTests extends OFBizTestCase {
             returnId         : '1009',
             returnItemSeqId  : '00001',
             quantity         : new BigDecimal('2.0000'),
-            userLogin        : EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+            userLogin        : userLogin
         ]
         Map serviceResult = dispatcher.runSync('createReturnItemShipment', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
@@ -201,7 +201,7 @@ class OrderReturnTests extends OFBizTestCase {
         Map serviceCtx = [
             toPartyId         : 'Company',
             returnHeaderTypeId: 'CUSTOMER_RETURN',
-            userLogin         : EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+            userLogin         : userLogin
         ]
         Map serviceResult = dispatcher.runSync('createReturnHeader', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)
diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy
index 59791cc..ba71824 100644
--- a/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy
+++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy
@@ -104,7 +104,7 @@ class QuoteTests extends OFBizTestCase {
     // Test case for calling createQuoteWorkEffort without a workEffortId which
     // triggers an ECA to create the WorkEffort first.
     void testCreateWorkEffortAndQuoteWorkEffort() {
-        GenericValue userLogin = getUserLogin('flexadmin')
+        GenericValue userLogin = getUserLogin('system')
 
         // Use the bare minimum inputs necessary to create the work effort as we
         // aren't testing that service, only that it plays well as an ECA.
diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/TestCustRequestPermissionCheck.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/TestCustRequestPermissionCheck.groovy
index 0a6c0bf..78538b4 100644
--- a/applications/order/src/main/groovy/org/apache/ofbiz/order/TestCustRequestPermissionCheck.groovy
+++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/TestCustRequestPermissionCheck.groovy
@@ -32,7 +32,7 @@ class TestCustRequestPermissionCheck extends OFBizTestCase {
         Map serviceCtx = [:]
         serviceCtx.fromPartyId = 'Company'
         serviceCtx.mainAction = 'TEST'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map result = dispatcher.runSync('custRequestPermissionCheck', serviceCtx)
         assert ServiceUtil.isSuccess(result)
     }
diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductFeatureTypeTests.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductFeatureTypeTests.groovy
index ad3c061..f7b3272 100644
--- a/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductFeatureTypeTests.groovy
+++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductFeatureTypeTests.groovy
@@ -33,7 +33,7 @@ class ProductFeatureTypeTests extends OFBizTestCase {
         serviceCtx.productFeatureTypeId = 'testProdFeat'
         serviceCtx.description = 'Test Description'
         serviceCtx.hasTable = 'N'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map result = dispatcher.runSync('createProductFeatureType', serviceCtx)
         assert ServiceUtil.isSuccess(result)
 
diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductTests.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductTests.groovy
index 6931b43..0fb786c 100644
--- a/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductTests.groovy
+++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/ProductTests.groovy
@@ -35,7 +35,7 @@ class ProductTests extends OFBizTestCase {
         serviceCtx.longDescription = 'Updated Long Test Product Category Description'
         serviceCtx.productCategoryId = 'CATALOG1_BEST_SELL'
         serviceCtx.productCategoryTypeId = 'BEST_SELL_CATEGORY'
-        serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+        serviceCtx.userLogin = userLogin
         Map serviceResult = dispatcher.runSync('updateProductCategory', serviceCtx)
         assert ServiceUtil.isSuccess(serviceResult)