You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2019/05/25 16:28:28 UTC
svn commit: r1860003 -
/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/test/OrderTests.groovy
Author: surajk
Date: Sat May 25 16:28:28 2019
New Revision: 1860003
URL: http://svn.apache.org/viewvc?rev=1860003&view=rev
Log:
Improved: Used more declarative style for the context map, preferring map literals over imperative map.
(OFBIZ-8853)
Thanks Mathieu Lirzin for your suggestion.
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/test/OrderTests.groovy
Modified: ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/test/OrderTests.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/test/OrderTests.groovy?rev=1860003&r1=1860002&r2=1860003&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/test/OrderTests.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/test/OrderTests.groovy Sat May 25 16:28:28 2019
@@ -4,57 +4,59 @@ import org.apache.ofbiz.testtools.Groovy
class OrderTests extends GroovyScriptTestCase {
void testAddRequirementTask() {
- Map serviceCtx = [:]
- serviceCtx.requirementId = "1000"
- serviceCtx.workEffortId = "9000"
- serviceCtx.userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne()
+ Map serviceCtx = [
+ requirementId: '1000',
+ workEffortId: '9000',
+ userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ ]
Map serviceResult = dispatcher.runSync("addRequirementTask", serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
}
void testCreateReturnAdjustment() {
- Map serviceCtx = [:]
- serviceCtx.amount = '2.0000'
- serviceCtx.returnId = '1009'
- serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ Map serviceCtx = [
+ amount: '2.0000',
+ returnId: '1009',
+ userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ ]
Map serviceResult = dispatcher.runSync('createReturnAdjustment', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
assert serviceResult.returnAdjustmentId != null
}
-
void testQuickReturnOrder() {
- Map serviceCtx = [:]
- serviceCtx.orderId = 'TEST_DEMO10090'
- serviceCtx.returnHeaderTypeId = 'CUSTOMER_RETURN'
- serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ Map serviceCtx = [
+ orderId: 'TEST_DEMO10090',
+ returnHeaderTypeId: 'CUSTOMER_RETURN',
+ userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ ]
Map serviceResult = dispatcher.runSync('quickReturnOrder', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
assert serviceResult.returnId != null
}
-
void testCreateReturnAndItemOrAdjustment() {
- Map serviceCtx = [:]
- serviceCtx.orderId = 'DEMO10090'
- serviceCtx.returnId = '1009'
- serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ Map serviceCtx = [
+ orderId: 'DEMO10090',
+ returnId: '1009',
+ userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ ]
Map serviceResult = dispatcher.runSync('createReturnAndItemOrAdjustment', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
assert serviceResult.returnAdjustmentId != null
}
-
void testCheckReturnComplete() {
- Map serviceCtx = [:]
- serviceCtx.amount = '2.0000'
- serviceCtx.returnId = '1009'
- serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ Map serviceCtx = [
+ amount: '2.0000',
+ returnId: '1009',
+ userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ ]
Map serviceResult = dispatcher.runSync('checkReturnComplete', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
assert serviceResult.statusId != null
}
-
void testCheckPaymentAmountForRefund() {
- Map serviceCtx = [:]
- serviceCtx.returnId = '1009'
- serviceCtx.userLogin = EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ Map serviceCtx = [
+ returnId: '1009',
+ userLogin: EntityQuery.use(delegator).from('UserLogin').where('userLoginId', 'system').cache().queryOne()
+ ]
Map serviceResult = dispatcher.runSync('checkPaymentAmountForRefund', serviceCtx)
assert ServiceUtil.isSuccess(serviceResult)
}