Author: jleroux
Date: Mon Oct 14 09:59:31 2019 New Revision: 1868436 URL: http://svn.apache.org/viewvc?rev=1868436&view=rev Log: Implemented: Providing utilities for integration tests (OFBIZ-11247) First step to simply using "userLogin" in tests Thanks: Mathieu for the idea on dev ML Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderNotificationTests.groovy ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderRequirementTests.groovy ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/testtools/OFBizTestCase.java Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy?rev=1868436&r1=1868435&r2=1868436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgAdminTests.groovy Mon Oct 14 09:59:31 2019 @@ -32,7 +32,7 @@ class AutoAcctgAdminTests extends OFBizT Map serviceCtx = [ uomId: 'EUR', uomIdTo: 'USD', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync("getFXConversion", serviceCtx) assert ServiceUtil.isSuccess(serviceResult) Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy?rev=1868436&r1=1868435&r2=1868436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgLedgerTests.groovy Mon Oct 14 09:59:31 2019 @@ -47,7 +47,7 @@ class AutoAcctgLedgerTests extends OFBiz acctgTransId: '1000', organizationPartyId: 'DEMO_COMPANY', debitCreditFlag: 'C', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('createAcctgTransEntry', serviceCtx) GenericValue acctgTransEntry = EntityQuery.use(delegator).from('AcctgTransEntry').where('acctgTransId', '1000', 'acctgTransEntrySeqId', serviceResult.acctgTransEntrySeqId).queryOne() Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy?rev=1868436&r1=1868435&r2=1868436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/AutoAcctgPaymentTests.groovy Mon Oct 14 09:59:31 2019 @@ -71,7 +71,7 @@ class AutoAcctgPaymentTests extends OFBi void testGetPayments() { Map serviceCtx = [ finAccountTransId: '1001', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('getPayments', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -84,7 +84,7 @@ class AutoAcctgPaymentTests extends OFBi paymentContentTypeId: 'COMMENTS', contentId: '1006', fromDate: nowTimestamp, - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('createPaymentContent', serviceCtx) GenericValue paymentContent = EntityQuery.use(delegator).from('PaymentContent').where(paymentId: '1006', paymentContentTypeId: 'COMMENTS', contentId: '1006').filterByDate().queryFirst() Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderNotificationTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderNotificationTests.groovy?rev=1868436&r1=1868435&r2=1868436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderNotificationTests.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderNotificationTests.groovy Mon Oct 14 09:59:31 2019 @@ -18,7 +18,6 @@ */ package org.apache.ofbiz.order -import org.apache.ofbiz.entity.util.EntityQuery import org.apache.ofbiz.service.ServiceUtil import org.apache.ofbiz.service.testtools.OFBizTestCase @@ -32,7 +31,7 @@ class OrderNotificationTests extends OFB Map serviceCtx = [ orderId: 'TEST_DEMO10090', sendTo: '[hidden email]', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('sendOrderConfirmation', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -42,7 +41,7 @@ class OrderNotificationTests extends OFB Map serviceCtx = [ orderId: 'TEST_DEMO10090', sendTo: '[hidden email]', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('sendOrderChangeNotification', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -52,7 +51,7 @@ class OrderNotificationTests extends OFB Map serviceCtx = [ orderId: 'TEST_DEMO10090', sendTo: '[hidden email]', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('sendOrderBackorderNotification', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -62,7 +61,7 @@ class OrderNotificationTests extends OFB Map serviceCtx = [ orderId: 'TEST_DEMO10090', sendTo: '[hidden email]', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('sendOrderPayRetryNotification', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -72,7 +71,7 @@ class OrderNotificationTests extends OFB Map serviceCtx = [ orderId: 'TEST_DEMO10090', sendTo: '[hidden email]', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('sendOrderCompleteNotification', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderRequirementTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderRequirementTests.groovy?rev=1868436&r1=1868435&r2=1868436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderRequirementTests.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderRequirementTests.groovy Mon Oct 14 09:59:31 2019 @@ -31,7 +31,7 @@ class OrderRequirementTests extends OFBi Map serviceCtx = [ facilityId: 'WebStoreWarehouse', orderItemSeqId: '00001', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('checkCreateProductRequirementForFacility', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -40,7 +40,7 @@ class OrderRequirementTests extends OFBi Map serviceCtx = [ orderId: 'TEST_DEMO10090', orderItemSeqId: '00001', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('checkCreateStockRequirementQoh', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -50,7 +50,7 @@ class OrderRequirementTests extends OFBi orderId: 'TEST_DEMO10090', orderItemSeqId: '00001', shipGroupSeqId: '00001', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('checkCreateStockRequirementAtp', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -59,7 +59,7 @@ class OrderRequirementTests extends OFBi Map serviceCtx = [ orderId: 'TEST_DEMO10090', orderItemSeqId: '00001', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('checkCreateOrderRequirement', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -67,7 +67,7 @@ class OrderRequirementTests extends OFBi void testAutoAssignRequirementToSupplier() { Map serviceCtx = [ requirementId: '1000', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('autoAssignRequirementToSupplier', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -77,7 +77,7 @@ class OrderRequirementTests extends OFBi requirementId: '1000', custRequestId: '9000', custRequestItemSeqId: '00001', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('associatedRequirementWithRequestItem', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -86,7 +86,7 @@ class OrderRequirementTests extends OFBi Map serviceCtx = [ requirementId: '1000', workEffortId: '9000', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync("addRequirementTask", serviceCtx) assert ServiceUtil.isSuccess(serviceResult) Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy?rev=1868436&r1=1868435&r2=1868436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/OrderReturnTests.groovy Mon Oct 14 09:59:31 2019 @@ -31,7 +31,7 @@ class OrderReturnTests extends OFBizTest Map serviceCtx = [ orderId: 'TEST_DEMO10090', returnHeaderTypeId: 'CUSTOMER_RETURN', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('quickReturnOrder', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -40,7 +40,7 @@ class OrderReturnTests extends OFBizTest void testProcessCreditReturn() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processCreditReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -48,7 +48,7 @@ class OrderReturnTests extends OFBizTest void testProcessCrossShipReplacementReturn() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processCrossShipReplacementReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -56,7 +56,7 @@ class OrderReturnTests extends OFBizTest void testProcessRefundImmediatelyReturn() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processRefundImmediatelyReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -101,7 +101,7 @@ class OrderReturnTests extends OFBizTest void testProcessRefundOnlyReturn() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processRefundOnlyReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -109,7 +109,7 @@ class OrderReturnTests extends OFBizTest void testProcessWaitReplacementReturn() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processWaitReplacementReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -117,7 +117,7 @@ class OrderReturnTests extends OFBizTest void testProcessWaitReplacementReservedReturn() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processWaitReplacementReservedReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -126,7 +126,7 @@ class OrderReturnTests extends OFBizTest void testProcessSubscriptionReturn() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processSubscriptionReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -135,7 +135,7 @@ class OrderReturnTests extends OFBizTest Map serviceCtx = [ orderId : 'DEMO10090', returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('createReturnAndItemOrAdjustment', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -145,7 +145,7 @@ class OrderReturnTests extends OFBizTest Map serviceCtx = [ amount : '2.0000', returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('createReturnAdjustment', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -155,7 +155,7 @@ class OrderReturnTests extends OFBizTest Map serviceCtx = [ amount : '2.0000', returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('checkReturnComplete', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -164,7 +164,7 @@ class OrderReturnTests extends OFBizTest void testCheckPaymentAmountForRefund() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('checkPaymentAmountForRefund', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -184,7 +184,7 @@ class OrderReturnTests extends OFBizTest void testCreateReturnStatus() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('createReturnStatus', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -192,7 +192,7 @@ class OrderReturnTests extends OFBizTest void testGetReturnAmountByOrder() { Map serviceCtx = [ returnId : '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('getReturnAmountByOrder', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -210,7 +210,7 @@ class OrderReturnTests extends OFBizTest void testProcessRefundReturnForReplacement() { Map serviceCtx = [ orderId: 'TEST_DEMO10090', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processRefundReturnForReplacement', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) @@ -218,7 +218,7 @@ class OrderReturnTests extends OFBizTest void testProcessRepairReplacementReturn() { Map serviceCtx = [ returnId: '1009', - userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne() + userLogin: userLogin ] Map serviceResult = dispatcher.runSync('processRepairReplacementReturn', serviceCtx) assert ServiceUtil.isSuccess(serviceResult) Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy?rev=1868436&r1=1868435&r2=1868436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/groovy/org/apache/ofbiz/order/QuoteTests.groovy Mon Oct 14 09:59:31 2019 @@ -18,32 +18,23 @@ */ package org.apache.ofbiz.order -import org.apache.ofbiz.service.testtools.OFBizTestCase -import org.apache.ofbiz.order.shoppingcart.ShoppingCart -import org.apache.ofbiz.entity.util.EntityQuery -import org.apache.ofbiz.entity.GenericValue -import org.apache.ofbiz.service.ServiceUtil -import org.apache.ofbiz.base.util.Debug +import static org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp +import static org.apache.ofbiz.entity.condition.EntityComparisonOperator.GREATER_THAN_EQUAL_TO +import static org.apache.ofbiz.entity.condition.EntityCondition.makeCondition import java.sql.Timestamp -import static org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp -import static org.apache.ofbiz.entity.condition.EntityCondition.makeCondition -import static org.apache.ofbiz.entity.condition.EntityComparisonOperator.GREATER_THAN_EQUAL_TO +import org.apache.ofbiz.entity.GenericValue +import org.apache.ofbiz.entity.util.EntityQuery +import org.apache.ofbiz.order.shoppingcart.ShoppingCart +import org.apache.ofbiz.service.ServiceUtil +import org.apache.ofbiz.service.testtools.OFBizTestCase class QuoteTests extends OFBizTestCase { public QuoteTests(String name) { super(name) } - // Retrieves a particular login record. - private GenericValue getUserLogin(String userLoginId) { - GenericValue userLogin = EntityQuery.use(delegator) - .from('UserLogin').where(userLoginId: userLoginId).queryOne() - assert userLogin - return userLogin - } - // Test case for successfully creating a QuoteWorkEffort record. void testCreateQuoteWorkEffort() { GenericValue userLogin = getUserLogin('DemoRepStore') @@ -99,7 +90,6 @@ class QuoteTests extends OFBizTestCase { // Test case for CheckUpdateQuotestatus void testCheckUpdateQuotestatus() { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, quoteId: '9001', @@ -149,7 +139,6 @@ class QuoteTests extends OFBizTestCase { // Test createQuote service void testCreateQuote () { - GenericValue userLogin = getUserLogin('system') Map input = [ userLogin: userLogin, partyId: 'Company' @@ -163,7 +152,6 @@ class QuoteTests extends OFBizTestCase { // Test updateQuote service void testUpdateQuote() { - GenericValue userLogin = getUserLogin('system') Map input = [ userLogin: userLogin, quoteId: '9000', @@ -181,7 +169,6 @@ class QuoteTests extends OFBizTestCase { // Test copyQuote service void testCopyQuote() { - GenericValue userLogin = getUserLogin('system') Map input = [ userLogin: userLogin, quoteId: '9000' @@ -193,7 +180,6 @@ class QuoteTests extends OFBizTestCase { // Test createQuoteItem service void testCreateQuoteItem() { - GenericValue userLogin = getUserLogin('system') Map input = [ userLogin: userLogin, quoteId: '9000', @@ -208,7 +194,6 @@ class QuoteTests extends OFBizTestCase { // Test updateQuoteItem service void testUpdateQuoteItem() { - GenericValue userLogin = getUserLogin('system') Map input = [ userLogin: userLogin, @@ -224,7 +209,6 @@ class QuoteTests extends OFBizTestCase { // Test removeQuoteItem service void testRemoveQuoteItem() { - GenericValue userLogin = getUserLogin('system') Map input = [ userLogin: userLogin, @@ -241,7 +225,6 @@ class QuoteTests extends OFBizTestCase { // test create a Term void testCreateQuoteTerm () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, termTypeId: 'FIN_PAYMENT_DISC', @@ -269,7 +252,6 @@ class QuoteTests extends OFBizTestCase { // Update a term. void testUpdateQuoteTerm() { - GenericValue userLogin = getUserLogin('system') def input = [ termTypeId: 'FIN_PAYMENT_DISC', quoteId: '9000', @@ -302,7 +284,6 @@ class QuoteTests extends OFBizTestCase { // delete a term void testDeleteQuoteTerm () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, termTypeId: 'FIN_PAYMENT_DISC', @@ -318,7 +299,6 @@ class QuoteTests extends OFBizTestCase { // Create Quote Attribute void testCreateQuoteAttribute () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, quoteId: '9001', @@ -331,7 +311,6 @@ class QuoteTests extends OFBizTestCase { // Create Quote Coefficient void testCreateQuoteCoefficient () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, quoteId: '9001', @@ -344,7 +323,6 @@ class QuoteTests extends OFBizTestCase { // Get Next Quote Id void testGetNextQuoteId () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, partyId: 'DemoCustomer-1' @@ -357,7 +335,6 @@ class QuoteTests extends OFBizTestCase { // Test Quote Sequence Enforced void testQuoteSequenceEnforced() { - GenericValue userLogin = getUserLogin('system') GenericValue partyAcctgPreference = EntityQuery.use(delegator) .from('PartyAcctgPreference').where('partyId', 'DemoCustomer').queryOne() Long lastQuoteNumber = partyAcctgPreference.lastQuoteNumber @@ -378,7 +355,6 @@ class QuoteTests extends OFBizTestCase { // Copy Quote Item void testCopyQuoteItem () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, quoteId: '9001', @@ -396,7 +372,6 @@ class QuoteTests extends OFBizTestCase { // Test createQuoteAndQuoteItemForRequest void testCreateQuoteAndQuoteItemForRequest () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, custRequestId: '9000', @@ -410,7 +385,6 @@ class QuoteTests extends OFBizTestCase { // Test createQuoteFromCart void testCreateQuoteFromCart() { - GenericValue userLogin = getUserLogin('system') String productId = 'SV-1001' String partyId = 'DemoCustomer' @@ -442,7 +416,6 @@ class QuoteTests extends OFBizTestCase { // Test createQuoteFromShoppingList void testCreateQuoteFromShoppingList() { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, shoppingListId: '9000', @@ -458,7 +431,6 @@ class QuoteTests extends OFBizTestCase { // Test autoUpdateQuotePrice void testAutoUpdateQuotePrice() { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, quoteId: '9000', @@ -473,7 +445,6 @@ class QuoteTests extends OFBizTestCase { // Test createQuoteFromCustRequest void testCreateQuoteFromCustRequest () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, custRequestId: '9000' @@ -504,7 +475,6 @@ class QuoteTests extends OFBizTestCase { // Create Quote Note void testCreateQuoteNote () { - GenericValue userLogin = getUserLogin('system') def input = [ userLogin: userLogin, quoteId: '9001', 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=1868436&r1=1868435&r2=1868436&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 Mon Oct 14 09:59:31 2019 @@ -19,7 +19,10 @@ package org.apache.ofbiz.service.testtools; +import org.apache.ofbiz.entity.GenericEntityException; +import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.testtools.EntityTestCase; +import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.service.LocalDispatcher; public class OFBizTestCase extends EntityTestCase { @@ -37,4 +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) + .from("UserLogin") + .where("userLoginId", userLoginId) + .queryOne(); + } + + // Retrieves the default login record. + GenericValue getUserLogin() throws GenericEntityException { + return getUserLogin("system"); + } } |
Free forum by Nabble | Edit this page |