Skip to content
Permalink
Browse files

Implemented: Providing utilities for integration tests

(OFBIZ-11247)

First step to simply using "userLogin" in tests

Thanks: Mathieu for the idea on dev ML

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868436 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
JacquesLeRoux committed Oct 14, 2019
1 parent 1207374 commit e27022b5cdd8879eaeb0b658d0c5d9ae2047c804
@@ -32,7 +32,7 @@ class AutoAcctgAdminTests extends OFBizTestCase {
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)
@@ -47,7 +47,7 @@ class AutoAcctgLedgerTests extends OFBizTestCase {
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()
@@ -71,7 +71,7 @@ class AutoAcctgPaymentTests extends OFBizTestCase {
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 OFBizTestCase {
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()
@@ -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 OFBizTestCase {
Map serviceCtx = [
orderId: 'TEST_DEMO10090',
sendTo: 'test_email@example.com',
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 OFBizTestCase {
Map serviceCtx = [
orderId: 'TEST_DEMO10090',
sendTo: 'test_email@example.com',
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 OFBizTestCase {
Map serviceCtx = [
orderId: 'TEST_DEMO10090',
sendTo: 'test_email@example.com',
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 OFBizTestCase {
Map serviceCtx = [
orderId: 'TEST_DEMO10090',
sendTo: 'test_email@example.com',
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 OFBizTestCase {
Map serviceCtx = [
orderId: 'TEST_DEMO10090',
sendTo: 'test_email@example.com',
userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
userLogin: userLogin
]
Map serviceResult = dispatcher.runSync('sendOrderCompleteNotification', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
@@ -31,7 +31,7 @@ class OrderRequirementTests extends OFBizTestCase {
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 OFBizTestCase {
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 OFBizTestCase {
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,15 +59,15 @@ class OrderRequirementTests extends OFBizTestCase {
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)
}
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 OFBizTestCase {
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 OFBizTestCase {
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)
@@ -31,7 +31,7 @@ class OrderReturnTests extends OFBizTestCase {
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,23 +40,23 @@ class OrderReturnTests extends OFBizTestCase {
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)
}
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)
}
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,23 +101,23 @@ class OrderReturnTests extends OFBizTestCase {
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)
}
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)
}
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 OFBizTestCase {
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 OFBizTestCase {
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 OFBizTestCase {
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 OFBizTestCase {
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 OFBizTestCase {
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,15 +184,15 @@ class OrderReturnTests extends OFBizTestCase {
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)
}
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,15 +210,15 @@ class OrderReturnTests extends OFBizTestCase {
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)
}
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)

0 comments on commit e27022b

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