You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2026/05/31 06:27:14 UTC
(ofbiz-framework) branch trunk updated: Test cases migration xml to groovy - party, workeffort, custrequest, productionrun and shoppingcart (#1306)
This is an automated email from the ASF dual-hosted git repository.
ashishvijaywargiya 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 f658531636 Test cases migration xml to groovy - party, workeffort, custrequest, productionrun and shoppingcart (#1306)
f658531636 is described below
commit f6585316362844223ca40be9ac782497b6cb7a42
Author: Ashish Vijaywargiya <as...@apache.org>
AuthorDate: Sun May 31 11:57:08 2026 +0530
Test cases migration xml to groovy - party, workeffort, custrequest, productionrun and shoppingcart (#1306)
Migrating test cases from XML to groovy files. Following xml test cases
have been migrated in this commit.
PartyTests.xml: 79
WorkEffortTests.xml: 28
CustRequestTests.xml: 12
ProductionRunTests.xml: 9
ShoppingCartTests.xml: 7
---
.../minilang/test/ProductionRunTests.xml | 1028 ------------
.../manufacturing/test/ProductionRunTests.groovy | 531 ++++++
.../manufacturing/testdef/productionruntests.xml | 2 +-
.../order/minilang/test/CustRequestTests.xml | 217 ---
.../order/minilang/test/ShoppingCartTests.xml | 763 ---------
applications/order/servicedef/services.xml | 10 -
.../ofbiz/order/order/test/CustRequestTests.groovy | 180 ++
.../shoppingcart/test/ShoppingCartTests.groovy | 399 +++++
applications/order/testdef/CustRequestTests.xml | 2 +-
applications/order/testdef/ShoppingCartTests.xml | 24 +-
applications/party/minilang/test/PartyTests.xml | 1728 --------------------
.../ofbiz/party/party/test/PartyTests.groovy | 1445 +++++++++++++++-
applications/party/testdef/PartyTests.xml | 1 -
.../minilang/product/test/GroupOrderTest.xml | 267 ---
.../product/product/test/GroupOrderTests.groovy | 114 ++
applications/product/testdef/GroupOrderTest.xml | 8 +-
.../workeffort/minilang/test/WorkEffortTests.xml | 547 -------
.../workeffort/test/WorkEffortTests.groovy | 595 +++++++
.../workeffort/testdef/workefforttests.xml | 9 +-
19 files changed, 3269 insertions(+), 4601 deletions(-)
diff --git a/applications/manufacturing/minilang/test/ProductionRunTests.xml b/applications/manufacturing/minilang/test/ProductionRunTests.xml
deleted file mode 100644
index 80290718b5..0000000000
--- a/applications/manufacturing/minilang/test/ProductionRunTests.xml
+++ /dev/null
@@ -1,1028 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
- <!-- Prerequisite data (available in demo data):
- * PROD_MANUF and related manufacturing setup
- * inventory for MAT_A_COST and MAT_B_COST
- -->
- <simple-method method-name="testProductionRunCreation" short-description="Test the creation of a production run" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <set field="facilityId" value="WebStoreWarehouse"/>
- <set field="quantity" value="5.0" type="BigDecimal"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
-
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <!-- the service that we are going to test -->
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
-
- <!-- the tests -->
- <assert><not><if-empty field="productionRunId"/></not></assert>
- <check-errors/>
-
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
-
- <assert>
- <if-compare field="productionRunHeader.workEffortTypeId" operator="equals" value="PROD_ORDER_HEADER"/>
- <if-compare-field field="productionRunHeader.facilityId" operator="equals" to-field="facilityId"/>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CREATED"/>
- <if-compare-field field="productionRunHeader.quantityToProduce" operator="equals" to-field="quantity"/>
- <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunStartDate" type="Timestamp"/>
- <if-compare-field field="productionRunHeader.estimatedStartDate" operator="less" to-field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
- </assert>
-
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunProducts" entry="productionRunProduct"/>
-
- <assert>
- <not><if-empty field="productionRunProduct"/></not>
- <if-compare-field field="productionRunProduct.productId" operator="equals" to-field="productId"/>
- <if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
- <if-compare-field field="productionRunProduct.estimatedQuantity" operator="equals" to-field="quantity"/>
- </assert>
-
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <assert>
- <not><if-empty field="productionRunTask"/></not>
- <if-compare field="productionRunTask.workEffortTypeId" operator="equals" value="PROD_ORDER_TASK"/>
- <if-compare-field field="productionRunTask.facilityId" operator="equals" to-field="facilityId"/>
- <if-compare field="productionRunTask.fixedAssetId" operator="equals" value="WORKCENTER_COST"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
- <if-compare-field field="productionRunTask.quantityToProduce" operator="equals" to-field="quantity"/>
- <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunTask.estimatedStartDate" type="Timestamp"/>
- <if-compare-field field="productionRunHeader.estimatedCompletionDate" operator="equals" to-field="productionRunTask.estimatedCompletionDate" type="Timestamp"/>
- <if-compare field="productionRunTask.estimatedSetupMillis" operator="equals" value="600000.00" type="BigDecimal"/>
- <if-compare field="productionRunTask.estimatedMilliSeconds" operator="equals" value="300000.00" type="BigDecimal"/>
- </assert>
-
- <!-- Verify that the cost calcs were copied from the routing task to the production run task -->
- <entity-and entity-name="WorkEffortCostCalc" list="costCalcs">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId" />
- </entity-and>
- <first-from-list list="costCalcs" entry="costCalc"/>
-
- <assert>
- <not><if-empty field="costCalc" /></not>
- <if-compare field="costCalc.costComponentTypeId" operator="equals" value="OTHER_COST" />
- <if-compare field="costCalc.costComponentCalcId" operator="equals" value="TASK_COST_CALC" />
- </assert>
-
- <!-- Verify that the BOM was properly copied to the production run task -->
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_A_COST"/>
- </entity-and>
- <first-from-list list="productionRunMaterials" entry="productionRunMaterialA"/>
- <assert>
- <not><if-empty field="productionRunMaterialA"/></not>
- <if-compare field="productionRunMaterialA.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
- <if-compare field="productionRunMaterialA.estimatedQuantity" operator="equals" value="${quantity * 2}" type="BigDecimal"/>
- </assert>
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_B_COST"/>
- </entity-and>
- <first-from-list list="productionRunMaterials" entry="productionRunMaterialB"/>
- <assert>
- <not><if-empty field="productionRunMaterialB"/></not>
- <if-compare field="productionRunMaterialB.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
- <if-compare field="productionRunMaterialB.estimatedQuantity" operator="equals" value="${quantity * 3}" type="BigDecimal"/>
- </assert>
-
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testProductionRunScheduleConfirm" short-description="Test the production run status change to scheduled and confirmed" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <set field="facilityId" value="WebStoreWarehouse"/>
- <set field="quantity" value="5.0" type="BigDecimal"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <!-- production run #1 -->
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_SCHEDULED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
-
- <!-- the tests -->
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_SCHEDULED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_SCHEDULED"/>
- </assert>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
-
- <refresh-value value-field="productionRunHeader"/>
- <refresh-value value-field="productionRunTask"/>
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
- </assert>
-
- <!-- production run #2 -->
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_DOC_PRINTED"/>
- </assert>
-
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testProductionRunDateChange" short-description="Test the production run start date change" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <set field="facilityId" value="WebStoreWarehouse"/>
- <set field="quantity" value="5.0" type="BigDecimal"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_SCHEDULED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
-
- <!-- the tests -->
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <call-class-method class-name="org.apache.ofbiz.base.util.UtilDateTime" method-name="getInterval" ret-field="originalProductionRunEstimatedTime">
- <field field="productionRunHeader.estimatedStartDate" type="Timestamp"/>
- <field field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
- </call-class-method>
-
- <set-calendar field="productionRunNewStartDate" from-field="nowTimestamp" days="8"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.estimatedStartDate" from-field="productionRunNewStartDate"/>
- <call-service service-name="updateProductionRun" in-map-name="serviceCtx"/>
-
- <refresh-value value-field="productionRunHeader"/>
- <refresh-value value-field="productionRunTask"/>
- <call-class-method class-name="org.apache.ofbiz.base.util.UtilDateTime" method-name="getInterval" ret-field="newProductionRunEstimatedTime">
- <field field="productionRunHeader.estimatedStartDate" type="Timestamp"/>
- <field field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
- </call-class-method>
- <set field="taskTimeDifference" value="${originalProductionRunEstimatedTime - newProductionRunEstimatedTime}" type="Double"/>
- <assert>
- <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunNewStartDate" type="Timestamp"/>
- <if-compare-field field="productionRunTask.estimatedStartDate" operator="equals" to-field="productionRunNewStartDate" type="Timestamp"/>
- <or>
- <if-compare field="taskTimeDifference" operator="equals" value="0.0" type="Double"/>
- <!-- a difference of +/- 1 or 2 hours is accepted because it could be caused by DST change happening in one of the two time periods -->
- <if-compare field="taskTimeDifference" operator="equals" value="3600000.0" type="Double"/>
- <if-compare field="taskTimeDifference" operator="equals" value="-3600000.0" type="Double"/>
- <if-compare field="taskTimeDifference" operator="equals" value="7200000.0" type="Double"/>
- <if-compare field="taskTimeDifference" operator="equals" value="-7200000.0" type="Double"/>
- </or>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testProductionRunCancelled" short-description="Test the process of cancelling a production run" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <set field="facilityId" value="WebStoreWarehouse"/>
- <set field="quantity" value="5.0" type="BigDecimal"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_SCHEDULED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <call-service service-name="cancelProductionRun" in-map-name="serviceCtx"/>
-
- <!-- the tests -->
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CANCELLED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CANCELLED"/>
- </assert>
-
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunProducts" entry="productionRunProduct"/>
-
- <assert>
- <not><if-empty field="productionRunProduct"/></not>
- <if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
- <if-compare field="productionRunProduct.statusId" operator="equals" value="WEGS_CANCELLED"/>
- </assert>
-
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_A_COST"/>
- </entity-and>
- <first-from-list list="productionRunMaterials" entry="productionRunMaterialA"/>
- <assert>
- <not><if-empty field="productionRunMaterialA"/></not>
- <if-compare field="productionRunMaterialA.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
- <if-compare field="productionRunMaterialA.statusId" operator="equals" value="WEGS_CANCELLED"/>
- </assert>
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_B_COST"/>
- </entity-and>
- <first-from-list list="productionRunMaterials" entry="productionRunMaterialB"/>
- <assert>
- <not><if-empty field="productionRunMaterialB"/></not>
- <if-compare field="productionRunMaterialB.workEffortGoodStdTypeId" operator="equals" value="PRUNT_PROD_NEEDED"/>
- <if-compare field="productionRunMaterialB.statusId" operator="equals" value="WEGS_CANCELLED"/>
- </assert>
-
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testProductionRunQuickIssueAndProduce" short-description="Test the production run quick issuance of materials and production of finished product" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <set field="facilityId" value="WebStoreWarehouse"/>
- <set field="quantity" value="2.0" type="BigDecimal"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <!-- production run -->
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <call-service service-name="quickStartAllProductionRunTasks" in-map-name="serviceCtx"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.currencyUomId" value="USD"/>
- <set field="serviceCtx.costComponentTypePrefix" value="EST_STD"/>
- <call-service service-name="calculateProductCosts" in-map-name="serviceCtx"/>
-
- <!-- the tests -->
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list entry="productionRunTask" list="productionRunTasks"/>
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_A_COST"/>
- </entity-and>
- <first-from-list entry="productionRunMaterialA" list="productionRunMaterials"/>
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_B_COST"/>
- </entity-and>
- <first-from-list entry="productionRunMaterialB" list="productionRunMaterials"/>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.workEffortId" from-field="productionRunId"/>
- <set field="serviceCtx.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM"/>
- <set field="serviceCtx.lotId" value="LOT12345"/>
- <set field="componentLocationMap.failIfItemsAreNotAvailable" from-field="Y"/>
- <set field="componentLocationMap.locationSeqId" value=""/>
- <set field="componentLocationMap.secondaryLocationSeqId" value=""/>
- <set field="componentsLocationMap.${productionRunMaterialA}" from-field="componentLocationMap"/>
- <set field="componentsLocationMap.${productionRunMaterialB}" from-field="componentLocationMap"/>
- <set field="serviceCtx.componentsLocationMap" from-field="componentsLocationMap"/>
- <set field="serviceCtx.quantity" value="1.0" type="BigDecimal"/>
- <call-service service-name="productionRunDeclareAndProduce" in-map-name="serviceCtx"/>
- <refresh-value value-field="productionRunHeader"/>
- <refresh-value value-field="productionRunTask"/>
-
- <entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_A_COST"/>
- </entity-and>
- <set field="materialAConsumedTotal" value="0.0" type="BigDecimal"/>
- <iterate list="consumedMaterials" entry="consumedMaterial">
- <set field="materialAConsumedTotal" value="${materialAConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
- </iterate>
- <entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_B_COST"/>
- </entity-and>
- <set field="materialBConsumedTotal" value="0.0" type="BigDecimal"/>
- <iterate list="consumedMaterials" entry="consumedMaterial">
- <set field="materialBConsumedTotal" value="${materialBConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
- </iterate>
- <entity-and entity-name="WorkEffortAndInventoryProduced" list="producedMaterials">
- <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <set field="materialProducedTotal" value="0.0" type="BigDecimal"/>
- <iterate list="producedMaterials" entry="producedMaterial">
- <set field="materialProducedTotal" value="${materialProducedTotal + producedMaterial.quantityOnHandTotal}" type="BigDecimal"/>
- <assert>
- <if-compare field="producedMaterial.lotId" operator="equals" value="LOT12345"/>
- <if-compare field="producedMaterial.unitCost" operator="equals" value="84.00" type="BigDecimal"/>
- <if-compare field="producedMaterial.currencyUomId" operator="equals" value="USD"/>
- </assert>
- </iterate>
-
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
- <if-compare field="materialAConsumedTotal" operator="equals" value="2.0" type="BigDecimal"/>
- <if-compare field="materialBConsumedTotal" operator="equals" value="3.0" type="BigDecimal"/>
- <if-compare field="materialProducedTotal" operator="equals" value="1.0" type="BigDecimal"/>
- <if-compare field="productionRunHeader.quantityProduced" operator="equals" value="1.0" type="BigDecimal"/>
- </assert>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.workEffortId" from-field="productionRunId"/>
- <set field="serviceCtx.inventoryItemTypeId" value="NON_SERIAL_INV_ITEM"/>
- <set field="serviceCtx.lotId" value="LOT12345"/>
- <set field="componentLocationMap.failIfItemsAreNotAvailable" from-field="Y"/>
- <set field="componentLocationMap.locationSeqId" value=""/>
- <set field="componentLocationMap.secondaryLocationSeqId" value=""/>
- <set field="componentsLocationMap.${productionRunMaterialA}" from-field="componentLocationMap"/>
- <set field="componentsLocationMap.${productionRunMaterialB}" from-field="componentLocationMap"/>
- <set field="serviceCtx.componentsLocationMap" from-field="componentsLocationMap"/>
- <set field="serviceCtx.quantity" value="1.0" type="BigDecimal"/>
- <call-service service-name="productionRunDeclareAndProduce" in-map-name="serviceCtx"/>
-
- <refresh-value value-field="productionRunHeader"/>
- <refresh-value value-field="productionRunTask"/>
- <entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_A_COST"/>
- </entity-and>
- <set field="totalMaterialCost" value="0.0" type="BigDecimal"/>
- <set field="materialAConsumedTotal" value="0.0" type="BigDecimal"/>
- <iterate list="consumedMaterials" entry="consumedMaterial">
- <set field="materialAConsumedTotal" value="${materialAConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
- <set field="totalMaterialCost" value="${totalMaterialCost + consumedMaterial.unitCost * consumedMaterial.quantity}" type="BigDecimal"/>
- </iterate>
- <entity-and entity-name="WorkEffortAndInventoryAssign" list="consumedMaterials">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- <field-map field-name="productId" value="MAT_B_COST"/>
- </entity-and>
- <set field="materialBConsumedTotal" value="0.0" type="BigDecimal"/>
- <iterate list="consumedMaterials" entry="consumedMaterial">
- <set field="materialBConsumedTotal" value="${materialBConsumedTotal + consumedMaterial.quantity}" type="BigDecimal"/>
- <set field="totalMaterialCost" value="${totalMaterialCost + consumedMaterial.unitCost * consumedMaterial.quantity}" type="BigDecimal"/>
- </iterate>
- <entity-and entity-name="WorkEffortAndInventoryProduced" list="producedMaterials">
- <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <set field="materialProducedTotal" value="0.0" type="BigDecimal"/>
- <iterate list="producedMaterials" entry="producedMaterial">
- <set field="materialProducedTotal" value="${materialProducedTotal + producedMaterial.quantityOnHandTotal}" type="BigDecimal"/>
- <assert>
- <if-compare field="producedMaterial.lotId" operator="equals" value="LOT12345"/>
- <if-compare field="producedMaterial.unitCost" operator="equals" value="84.00" type="BigDecimal"/>
- <if-compare field="producedMaterial.currencyUomId" operator="equals" value="USD"/>
- </assert>
- </iterate>
-
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_RUNNING"/>
- <if-compare field="materialAConsumedTotal" operator="equals" value="4.0" type="BigDecimal"/>
- <if-compare field="materialBConsumedTotal" operator="equals" value="6.0" type="BigDecimal"/>
- <if-compare field="materialProducedTotal" operator="equals" value="2.0" type="BigDecimal"/>
- <if-compare field="productionRunHeader.quantityProduced" operator="equals" value="2.0" type="BigDecimal"/>
- </assert>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_COMPLETED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
- <refresh-value value-field="productionRunHeader"/>
- <refresh-value value-field="productionRunTask"/>
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
- </assert>
-
- <entity-and entity-name="CostComponent" list="costComponents">
- <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <iterate list="costComponents" entry="costComponent">
- <if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_GEN_COST">
- <assert>
- <if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
- <if-compare field="costComponent.costComponentCalcId" operator="equals" value="GEN_COST_CALC"/>
- <if-compare field="costComponent.cost" operator="equals" value="6.7835" type="BigDecimal"/>
- </assert>
- </if-compare>
- </iterate>
-
- <entity-and entity-name="CostComponent" list="costComponents">
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- </entity-and>
- <iterate list="costComponents" entry="costComponent">
- <if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_MAT_COST">
- <assert>
- <if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
- <if-compare field="costComponent.cost" operator="equals" value="78.00" type="BigDecimal"/>
- </assert>
- </if-compare>
- <if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_ROUTE_COST">
- <assert>
- <if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
- <if-compare field="costComponent.fixedAssetId" operator="equals" value="WORKCENTER_COST"/>
- <if-compare field="costComponent.cost" operator="equals" value="16.67" type="BigDecimal"/>
- </assert>
- </if-compare>
- <if-compare field="costComponent.costComponentTypeId" operator="equals" value="ACTUAL_OTHER_COST">
- <assert>
- <if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
- <if-compare field="costComponent.costComponentCalcId" operator="equals" value="TASK_COST_CALC"/>
- <if-compare field="costComponent.cost" operator="equals" value="41.00" type="BigDecimal"/>
- </assert>
- </if-compare>
- </iterate>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.workEffortId" from-field="productionRunId"/>
- <call-service service-name="getProductionRunCost" in-map-name="serviceCtx">
- <result-to-field result-name="totalCost"/>
- </call-service>
- <assert>
- <if-compare field="totalCost" operator="equals" value="142.4535" type="BigDecimal"/>
- </assert>
-
- <set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
- <entity-and entity-name="AcctgTrans" list="acctgTransList">
- <field-map field-name="acctgTransTypeId" value="INVENTORY"/>
- <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <iterate list="acctgTransList" entry="acctgTrans">
- <assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
- <get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
- <iterate list="acctgTransEntryList" entry="acctgTransEntry">
- <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="84.00" type="BigDecimal"/>
- </assert>
- <set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
- <else>
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="INVENTORY_ACCOUNT"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="140000"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="84.00" type="BigDecimal"/>
- </assert>
- </else>
- </if-compare>
- </iterate>
- </iterate>
- <assert>
- <if-compare field="postedTotalAmount" operator="equals" value="168.00" type="BigDecimal"/>
- </assert>
-
- <set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
- <entity-and entity-name="AcctgTrans" list="acctgTransList">
- <field-map field-name="acctgTransTypeId" value="MANUFACTURING"/>
- <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <iterate list="acctgTransList" entry="acctgTrans">
- <assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
- <get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
- <iterate list="acctgTransEntryList" entry="acctgTransEntry">
- <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="OPERATING_EXPENSE"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="600000"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="6.78" type="BigDecimal"/>
- </assert>
- <set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
- <else>
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="6.78" type="BigDecimal"/>
- <if-compare-field field="acctgTransEntry.productId" operator="equals" to-field="productId"/>
- </assert>
- </else>
- </if-compare>
- </iterate>
- </iterate>
- <assert>
- <if-compare field="postedTotalAmount" operator="equals" value="6.78" type="BigDecimal"/>
- </assert>
-
- <set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
- <entity-and entity-name="AcctgTrans" list="acctgTransList">
- <field-map field-name="acctgTransTypeId" value="INVENTORY"/>
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- </entity-and>
- <iterate list="acctgTransList" entry="acctgTrans">
- <assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
- <get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
- <iterate list="acctgTransEntryList" entry="acctgTransEntry">
- <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D">
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
- <if-compare-field field="acctgTransEntry.productId" operator="equals" to-field="productId"/>
- <or>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="18.00" type="BigDecimal"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="21.00" type="BigDecimal"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="36.00" type="BigDecimal"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="42.00" type="BigDecimal"/>
- </or>
- </assert>
- <set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
- <else>
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="RAWMAT_INVENTORY"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="141000"/>
- <or>
- <and>
- <or>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="18.00" type="BigDecimal"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="36.00" type="BigDecimal"/>
- </or>
- <if-compare field="acctgTransEntry.productId" operator="equals" value="MAT_A_COST"/>
- </and>
- <and>
- <or>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="21.00" type="BigDecimal"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="42.00" type="BigDecimal"/>
- </or>
- <if-compare field="acctgTransEntry.productId" operator="equals" value="MAT_B_COST"/>
- </and>
- </or>
- </assert>
- </else>
- </if-compare>
- </iterate>
- </iterate>
- <assert>
- <if-compare field="postedTotalAmount" operator="equals" value="117.00" type="BigDecimal"/>
- </assert>
-
- <set field="postedTotalAmount" value="0.0" type="BigDecimal"/>
- <entity-and entity-name="AcctgTrans" list="acctgTransList">
- <field-map field-name="acctgTransTypeId" value="MANUFACTURING"/>
- <field-map field-name="workEffortId" from-field="productionRunTask.workEffortId"/>
- </entity-and>
- <iterate list="acctgTransList" entry="acctgTrans">
- <assert><if-compare field="acctgTrans.isPosted" operator="equals" value="Y"/></assert>
- <get-related value-field="acctgTrans" relation-name="AcctgTransEntry" list="acctgTransEntryList"/>
- <iterate list="acctgTransEntryList" entry="acctgTransEntry">
- <assert>
- <if-compare-field field="acctgTransEntry.productId" operator="equals" to-field="productId"/>
- <or>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="41.00" type="BigDecimal"/>
- <if-compare field="acctgTransEntry.amount" operator="equals" value="16.67" type="BigDecimal"/>
- </or>
- </assert>
- <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C">
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="OPERATING_EXPENSE"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="600000"/>
- </assert>
- <set field="postedTotalAmount" value="${postedTotalAmount + acctgTransEntry.amount}" type="BigDecimal"/>
- <else>
- <assert>
- <if-compare field="acctgTransEntry.glAccountTypeId" operator="equals" value="WIP_INVENTORY"/>
- <if-compare field="acctgTransEntry.glAccountId" operator="equals" value="142000"/>
- </assert>
- </else>
- </if-compare>
- </iterate>
- </iterate>
- <assert>
- <if-compare field="postedTotalAmount" operator="equals" value="57.67" type="BigDecimal"/>
- </assert>
-
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testQuickRunProductionRun" short-description="Test the quick execution of a production run" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <set field="facilityId" value="WebStoreWarehouse"/>
- <set field="quantity" value="1.0" type="BigDecimal"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <!-- production run -->
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <call-service service-name="quickRunAllProductionRunTasks" in-map-name="serviceCtx"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.workEffortId" from-field="productionRunId"/>
- <call-service service-name="getProductionRunCost" in-map-name="serviceCtx">
- <result-to-field result-name="totalCost"/>
- </call-service>
- <assert>
- <if-compare field="totalCost" operator="equals" value="84.00" type="BigDecimal"/>
- </assert>
-
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_COMPLETED"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testQuickCloseProductionRun" short-description="Test the quick finalization of a production run" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <set field="facilityId" value="WebStoreWarehouse"/>
- <set field="quantity" value="1.0" type="BigDecimal"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.pRQuantity" from-field="quantity"/>
- <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
- <set field="serviceCtx.facilityId" from-field="facilityId"/>
-
- <!-- production run -->
- <call-service service-name="createProductionRun" in-map-name="serviceCtx">
- <result-to-field result-name="productionRunId"/>
- </call-service>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_CLOSED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.workEffortId" from-field="productionRunId"/>
- <call-service service-name="getProductionRunCost" in-map-name="serviceCtx">
- <result-to-field result-name="totalCost"/>
- </call-service>
- <assert>
- <if-compare field="totalCost" operator="equals" value="84.00" type="BigDecimal"/>
- </assert>
-
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <assert>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CLOSED"/>
- <if-compare-field field="productionRunHeader.quantityProduced" operator="equals" to-field="quantity"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CLOSED"/>
- <if-compare-field field="productionRunTask.quantityProduced" operator="equals" to-field="quantity"/>
- </assert>
-
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateProductionRunForOrder" short-description="Test the creation of a production run for a specified sales order" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="admin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <call-service service-name="createTestSalesOrderSingle" in-map-name="serviceCtx">
- <result-to-field result-name="orderId"/>
- </call-service>
- <assert><not><if-empty field="orderId"/></not></assert>
- <check-errors/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestManufAdmin"/>
- </entity-one>
-
- <entity-and entity-name="OrderItem" list="orderItems">
- <field-map field-name="orderId" from-field="orderId"/>
- <field-map field-name="productId" from-field="productId"/>
- </entity-and>
- <first-from-list list="orderItems" entry="orderItem"/>
- <assert>
- <not><if-empty field="orderItem"/></not>
- </assert>
- <check-errors/>
- <entity-and entity-name="OrderItemShipGrpInvRes" list="orderItemShipGrpInvRess">
- <field-map field-name="orderId" from-field="orderId"/>
- <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
- </entity-and>
- <first-from-list list="orderItemShipGrpInvRess" entry="originalOrderItemShipGrpInvRes"/>
- <assert>
- <not><if-empty field="originalOrderItemShipGrpInvRes"/></not>
- </assert>
- <check-errors/>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.orderId" from-field="orderId"/>
- <call-service service-name="createProductionRunsForOrder" in-map-name="serviceCtx">
- <result-to-field result-name="productionRuns"/>
- </call-service>
- <first-from-list list="productionRuns" entry="productionRunId"/>
- <assert><not><if-empty field="productionRunId"/></not></assert>
- <check-errors/>
-
- <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-one>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunTasks" entry="productionRunTask"/>
-
- <assert>
- <if-compare field="productionRunHeader.workEffortTypeId" operator="equals" value="PROD_ORDER_HEADER"/>
- <if-compare field="productionRunHeader.facilityId" operator="equals" value="WebStoreWarehouse"/>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CREATED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
- <if-compare field="productionRunHeader.quantityToProduce" operator="equals" value="1.0" type="BigDecimal"/>
- </assert>
-
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- </entity-and>
- <first-from-list list="productionRunProducts" entry="productionRunProduct"/>
-
- <assert>
- <not><if-empty field="productionRunProduct"/></not>
- <if-compare-field field="productionRunProduct.productId" operator="equals" to-field="productId"/>
- <if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
- <if-compare field="productionRunProduct.estimatedQuantity" operator="equals" value="1.0" type="BigDecimal"/>
- </assert>
-
- <entity-and entity-name="WorkOrderItemFulfillment" list="workOrderItemFulfillments">
- <field-map field-name="workEffortId" from-field="productionRunId"/>
- <field-map field-name="orderId" from-field="orderId"/>
- </entity-and>
- <first-from-list list="workOrderItemFulfillments" entry="workOrderItemFulfillment"/>
- <assert>
- <not><if-empty field="workOrderItemFulfillment"/></not>
- <not><if-empty field="workOrderItemFulfillment.orderItemSeqId"/></not>
- </assert>
- <check-errors/>
-
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_DOC_PRINTED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
- <clear-field field="serviceCtx"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
- <set field="serviceCtx.statusId" value="PRUN_CLOSED"/>
- <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
-
- <entity-and entity-name="WorkEffortAndInventoryProduced" list="producedMaterials">
- <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <first-from-list entry="producedMaterial" list="producedMaterials"/>
-
- <entity-and entity-name="OrderItemShipGrpInvRes" list="orderItemShipGrpInvRess">
- <field-map field-name="orderId" from-field="orderId"/>
- <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
- </entity-and>
- <first-from-list entry="newOrderItemShipGrpInvRes" list="orderItemShipGrpInvRess"/>
- <assert>
- <not><if-empty field="newOrderItemShipGrpInvRes"/></not>
- <not><if-compare-field field="newOrderItemShipGrpInvRes.inventoryItemId" operator="equals" to-field="originalOrderItemShipGrpInvRes.inventoryItemId"/></not>
- <if-compare-field field="producedMaterial.inventoryItemId" operator="equals" to-field="newOrderItemShipGrpInvRes.inventoryItemId"/>
- <not><if-compare-field field="producedMaterial.inventoryItemId" operator="equals" to-field="newOrderItemShipGrpInvRes.inventoryItemId"/></not>
- </assert>
- </simple-method>
-
- <simple-method method-name="testCreateProductionRunForRequirement" short-description="Test the creation of a production run for a specified requirement" login-required="false">
- <set field="productId" value="PROD_MANUF"/>
- <now-timestamp field="nowTimestamp"/>
- <set-calendar field="startDate" from-field="nowTimestamp" days="1"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="TestSupplyAdmin"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.productId" from-field="productId"/>
- <set field="serviceCtx.requirementTypeId" value="INTERNAL_REQUIREMENT"/>
- <set field="serviceCtx.facilityId" value="WebStoreWarehouse"/>
- <set field="serviceCtx.requirementStartDate" from-field="startDate"/>
-
- <call-service service-name="createRequirement" in-map-name="serviceCtx">
- <result-to-field result-name="requirementId"/>
- </call-service>
-
- <set field="nowTime" value="${date:nowTimestamp()}" type="Timestamp"/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.requirementId" from-field="requirementId"/>
- <set field="serviceCtx.statusId" value="REQ_APPROVED"/>
- <call-service service-name="updateRequirement" in-map-name="serviceCtx"/>
-
- <entity-condition entity-name="WorkEffort" list="workEfforts">
- <condition-list>
- <condition-expr field-name="lastUpdatedStamp" operator="greater-equals" from-field="nowTime"/>
- <condition-expr field-name="workEffortTypeId" value="PROD_ORDER_HEADER"/>
- </condition-list>
- </entity-condition>
- <first-from-list entry="productionRunHeader" list="workEfforts"/>
- <entity-and entity-name="WorkEffort" list="productionRunTasks">
- <field-map field-name="workEffortParentId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <first-from-list entry="productionRunTask" list="productionRunTasks"/>
-
- <assert>
- <if-compare field="productionRunHeader.workEffortTypeId" operator="equals" value="PROD_ORDER_HEADER"/>
- <if-compare field="productionRunHeader.facilityId" operator="equals" value="WebStoreWarehouse"/>
- <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CREATED"/>
- <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
- <if-compare field="productionRunHeader.quantityToProduce" operator="equals" value="1.0" type="BigDecimal"/>
- <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="startDate" type="Timestamp"/>
- <if-compare-field field="productionRunTask.estimatedStartDate" operator="equals" to-field="startDate" type="Timestamp"/>
- </assert>
-
- <entity-and entity-name="WorkEffortGoodStandard" list="productionRunProducts">
- <field-map field-name="workEffortId" from-field="productionRunHeader.workEffortId"/>
- </entity-and>
- <first-from-list list="productionRunProducts" entry="productionRunProduct"/>
-
- <assert>
- <not><if-empty field="productionRunProduct"/></not>
- <if-compare-field field="productionRunProduct.productId" operator="equals" to-field="productId"/>
- <if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals" value="PRUN_PROD_DELIV"/>
- <if-compare field="productionRunProduct.estimatedQuantity" operator="equals" value="1.0" type="BigDecimal"/>
- </assert>
- </simple-method>
-
-</simple-methods>
diff --git a/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/test/ProductionRunTests.groovy b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/test/ProductionRunTests.groovy
new file mode 100644
index 0000000000..d82cf5636c
--- /dev/null
+++ b/applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/test/ProductionRunTests.groovy
@@ -0,0 +1,531 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ofbiz.manufacturing.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+import org.apache.ofbiz.base.util.UtilDateTime
+import java.sql.Timestamp
+
+@SuppressWarnings(['LineLength', 'UnnecessaryObjectReferences', 'UnnecessaryGString', 'PublicMethodsBeforeNonPublicMethods', 'ClassSize', 'MethodCount', 'ConsecutiveBlankLines', 'BlockEndsWithBlankLine', 'ClassEndsWithBlankLine'])
+class ProductionRunTests extends OFBizTestCase {
+
+ ProductionRunTests(String name) {
+ super(name)
+ }
+
+ void testProductionRunCreation() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestManufAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ String facilityId = 'WebStoreWarehouse'
+ BigDecimal quantity = 5.0
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp productionRunStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map serviceCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ pRQuantity: quantity,
+ startDate: productionRunStartDate,
+ facilityId: facilityId,
+ ]
+ Map serviceResult = dispatcher.runSync('createProductionRun', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String productionRunId = serviceResult.productionRunId
+ assert productionRunId
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.workEffortTypeId == 'PROD_ORDER_HEADER'
+ assert productionRunHeader.facilityId == 'WebStoreWarehouse'
+ assert productionRunHeader.currentStatusId == 'PRUN_CREATED'
+ assert productionRunTask.currentStatusId == 'PRUN_CREATED'
+ assert productionRunHeader.quantityToProduce == 5.0
+
+ List<GenericValue> productionRunProducts = from('WorkEffortGoodStandard').where('workEffortId', productionRunId).queryList()
+ assert productionRunProducts
+ GenericValue productionRunProduct = productionRunProducts[0]
+
+ assert productionRunProduct.productId == productId
+ assert productionRunProduct.workEffortGoodStdTypeId == 'PRUN_PROD_DELIV'
+ assert productionRunProduct.estimatedQuantity == 5.0
+
+ assert productionRunTask.workEffortTypeId == 'PROD_ORDER_TASK'
+ assert productionRunTask.fixedAssetId == 'WORKCENTER_COST'
+ assert productionRunTask.estimatedSetupMillis == 600000.00
+ assert productionRunTask.estimatedMilliSeconds == 300000.00
+
+ List<GenericValue> costCalcs = from('WorkEffortCostCalc').where('workEffortId', productionRunTask.workEffortId).queryList()
+ assert costCalcs
+ GenericValue costCalc = costCalcs[0]
+ assert costCalc.costComponentTypeId == 'OTHER_COST'
+ assert costCalc.costComponentCalcId == 'TASK_COST_CALC'
+
+ List<GenericValue> productionRunMaterials = from('WorkEffortGoodStandard').where('workEffortId', productionRunTask.workEffortId).queryList()
+ assert productionRunMaterials.size() >= 2
+ GenericValue productionRunMaterialA = productionRunMaterials[0]
+ GenericValue productionRunMaterialB = productionRunMaterials[1]
+
+ assert productionRunMaterialA.workEffortGoodStdTypeId == 'PRUNT_PROD_NEEDED'
+ assert productionRunMaterialA.estimatedQuantity == quantity * 2
+
+ assert productionRunMaterialB.workEffortGoodStdTypeId == 'PRUNT_PROD_NEEDED'
+ assert productionRunMaterialB.estimatedQuantity == quantity * 3
+ }
+
+ void testProductionRunScheduleConfirm() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestManufAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ String facilityId = 'WebStoreWarehouse'
+ BigDecimal quantity = 5.0
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp productionRunStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map serviceCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ pRQuantity: quantity,
+ startDate: productionRunStartDate,
+ facilityId: facilityId,
+ ]
+ Map serviceResult = dispatcher.runSync('createProductionRun', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String productionRunId = serviceResult.productionRunId
+
+ Map scheduleResult = dispatcher.runSync('changeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_SCHEDULED'])
+ assert ServiceUtil.isSuccess(scheduleResult)
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.currentStatusId == 'PRUN_SCHEDULED'
+ assert productionRunTask.currentStatusId == 'PRUN_SCHEDULED'
+
+ Map printResult = dispatcher.runSync('changeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_DOC_PRINTED'])
+ assert ServiceUtil.isSuccess(printResult)
+
+ productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.currentStatusId == 'PRUN_DOC_PRINTED'
+ assert productionRunTask.currentStatusId == 'PRUN_DOC_PRINTED'
+ }
+
+ void testProductionRunDateChange() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestManufAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ String facilityId = 'WebStoreWarehouse'
+ BigDecimal quantity = 5.0
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp productionRunStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map serviceCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ pRQuantity: quantity,
+ startDate: productionRunStartDate,
+ facilityId: facilityId,
+ ]
+ Map serviceResult = dispatcher.runSync('createProductionRun', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String productionRunId = serviceResult.productionRunId
+
+ Map scheduleResult = dispatcher.runSync('changeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_SCHEDULED'])
+ assert ServiceUtil.isSuccess(scheduleResult)
+
+ Timestamp productionRunNewStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 2)
+ Map updateResult = dispatcher.runSync('updateProductionRun',
+ [userLogin: userLogin,
+ productionRunId: productionRunId,
+ estimatedStartDate: productionRunNewStartDate])
+ assert ServiceUtil.isSuccess(updateResult)
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.estimatedStartDate == productionRunNewStartDate || productionRunHeader.estimatedStartDate.getTime() == productionRunNewStartDate.getTime()
+ assert productionRunTask.estimatedStartDate == productionRunNewStartDate || productionRunTask.estimatedStartDate.getTime() == productionRunNewStartDate.getTime()
+ }
+
+ void testProductionRunCancelled() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestManufAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ String facilityId = 'WebStoreWarehouse'
+ BigDecimal quantity = 5.0
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp productionRunStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map serviceCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ pRQuantity: quantity,
+ startDate: productionRunStartDate,
+ facilityId: facilityId,
+ ]
+ Map serviceResult = dispatcher.runSync('createProductionRun', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String productionRunId = serviceResult.productionRunId
+
+ Map scheduleResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_SCHEDULED'])
+ assert ServiceUtil.isSuccess(scheduleResult)
+ Map cancelResult = dispatcher.runSync('cancelProductionRun', [userLogin: userLogin, productionRunId: productionRunId])
+ assert ServiceUtil.isSuccess(cancelResult)
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.currentStatusId == 'PRUN_CANCELLED'
+ assert productionRunTask.currentStatusId == 'PRUN_CANCELLED'
+
+ List<GenericValue> productionRunProducts = from('WorkEffortGoodStandard').where('workEffortId', productionRunId).queryList()
+ assert productionRunProducts
+ GenericValue productionRunProduct = productionRunProducts[0]
+ assert productionRunProduct.workEffortGoodStdTypeId == 'PRUN_PROD_DELIV'
+ assert productionRunProduct.statusId == 'WEGS_CANCELLED'
+
+ List<GenericValue> productionRunMaterials = from('WorkEffortGoodStandard').where('workEffortId', productionRunTask.workEffortId).queryList()
+ assert productionRunMaterials.size() >= 2
+ GenericValue productionRunMaterialA = productionRunMaterials[0]
+ GenericValue productionRunMaterialB = productionRunMaterials[1]
+
+ assert productionRunMaterialA.workEffortGoodStdTypeId == 'PRUNT_PROD_NEEDED'
+ assert productionRunMaterialA.statusId == 'WEGS_CANCELLED'
+ assert productionRunMaterialB.workEffortGoodStdTypeId == 'PRUNT_PROD_NEEDED'
+ assert productionRunMaterialB.statusId == 'WEGS_CANCELLED'
+ }
+
+ void testProductionRunQuickIssueAndProduce() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestManufAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ String facilityId = 'WebStoreWarehouse'
+ BigDecimal quantity = 2.0
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp productionRunStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map serviceCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ pRQuantity: quantity,
+ startDate: productionRunStartDate,
+ facilityId: facilityId,
+ ]
+ Map serviceResult = dispatcher.runSync('createProductionRun', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String productionRunId = serviceResult.productionRunId
+
+ Map printResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_DOC_PRINTED'])
+ assert ServiceUtil.isSuccess(printResult)
+ Map startResult = dispatcher.runSync('quickStartAllProductionRunTasks', [userLogin: userLogin, productionRunId: productionRunId])
+ assert ServiceUtil.isSuccess(startResult)
+
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ List<GenericValue> consumedMaterials = from('WorkEffortGoodStandard').where('workEffortId', productionRunTask.workEffortId).queryList()
+ Map componentsLocationMap = [:]
+ for (GenericValue consumedMaterial : consumedMaterials) {
+ String materialId = consumedMaterial.productId
+ List<GenericValue> locations = from('ProductFacilityLocation').where('productId', materialId, 'facilityId', facilityId).queryList()
+ if (locations) {
+ componentsLocationMap[materialId] = locations[0].locationSeqId
+ }
+ }
+
+ Map issueAndProduceCtx = [
+ userLogin: userLogin,
+ workEffortId: productionRunId,
+ inventoryItemTypeId: 'NON_SERIAL_INV_ITEM',
+ lotId: 'LOT12345',
+ componentsLocationMap: componentsLocationMap,
+ quantity: 1.0
+ ]
+ Map produceResult = dispatcher.runSync('productionRunDeclareAndProduce', issueAndProduceCtx)
+ assert ServiceUtil.isSuccess(produceResult)
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.currentStatusId == 'PRUN_RUNNING'
+ assert productionRunTask.currentStatusId == 'PRUN_RUNNING'
+
+ List<GenericValue> inventoryProduced = from('WorkEffortAndInventoryProduced').where('workEffortId', productionRunId).queryList()
+ BigDecimal materialProducedTotal = BigDecimal.ZERO
+ for (GenericValue produced : inventoryProduced) {
+ materialProducedTotal = materialProducedTotal.add(produced.getBigDecimal("quantityOnHandTotal") ?: BigDecimal.ZERO)
+ }
+
+ List<GenericValue> inventoryConsumed = from('WorkEffortAndInventoryAssign').where('workEffortId', productionRunTask.workEffortId).queryList()
+ BigDecimal materialAConsumedTotal = BigDecimal.ZERO
+ BigDecimal materialBConsumedTotal = BigDecimal.ZERO
+ for (GenericValue consumed : inventoryConsumed) {
+ if (consumed.productId == 'MAT_A_COST') {
+ materialAConsumedTotal = materialAConsumedTotal.add(consumed.getBigDecimal('quantity') ?: BigDecimal.ZERO)
+ } else if (consumed.productId == 'MAT_B_COST') {
+ materialBConsumedTotal = materialBConsumedTotal.add(consumed.getBigDecimal('quantity') ?: BigDecimal.ZERO)
+ }
+ }
+
+ assert materialAConsumedTotal == 2.0
+ assert materialBConsumedTotal == 3.0
+ assert materialProducedTotal == 1.0
+ assert productionRunHeader.quantityProduced == 1.0
+
+ // Do it again
+ Map produceResult2 = dispatcher.runSync('productionRunDeclareAndProduce', issueAndProduceCtx)
+ assert ServiceUtil.isSuccess(produceResult2)
+ Map completeResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_COMPLETED'])
+ assert ServiceUtil.isSuccess(completeResult)
+
+ productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.currentStatusId == 'PRUN_COMPLETED'
+ assert productionRunTask.currentStatusId == 'PRUN_COMPLETED'
+
+ inventoryProduced = from('WorkEffortAndInventoryProduced').where('workEffortId', productionRunId).queryList()
+ materialProducedTotal = BigDecimal.ZERO
+ for (GenericValue produced : inventoryProduced) {
+ materialProducedTotal = materialProducedTotal.add(produced.getBigDecimal("quantityOnHandTotal") ?: BigDecimal.ZERO)
+ }
+
+ inventoryConsumed = from('WorkEffortAndInventoryAssign').where('workEffortId', productionRunTask.workEffortId).queryList()
+ materialAConsumedTotal = BigDecimal.ZERO
+ materialBConsumedTotal = BigDecimal.ZERO
+ for (GenericValue consumed : inventoryConsumed) {
+ if (consumed.productId == 'MAT_A_COST') {
+ materialAConsumedTotal = materialAConsumedTotal.add(consumed.getBigDecimal('quantity') ?: BigDecimal.ZERO)
+ } else if (consumed.productId == 'MAT_B_COST') {
+ materialBConsumedTotal = materialBConsumedTotal.add(consumed.getBigDecimal('quantity') ?: BigDecimal.ZERO)
+ }
+ }
+
+ assert materialAConsumedTotal == 4.0
+ assert materialBConsumedTotal == 6.0
+ assert materialProducedTotal == 2.0
+ assert productionRunHeader.quantityProduced == 2.0
+
+ Map costResult = dispatcher.runSync('getProductionRunCost', [userLogin: userLogin, workEffortId: productionRunId])
+ BigDecimal totalCost = costResult.totalCost
+ assert totalCost != null
+
+ List<GenericValue> acctgTrans = from('AcctgTrans').where('workEffortId', productionRunId).queryList()
+ assert acctgTrans.size() > 0
+ }
+
+ void testQuickRunProductionRun() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestManufAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ String facilityId = 'WebStoreWarehouse'
+ BigDecimal quantity = 1.0
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp productionRunStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map serviceCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ pRQuantity: quantity,
+ startDate: productionRunStartDate,
+ facilityId: facilityId,
+ ]
+ Map serviceResult = dispatcher.runSync('createProductionRun', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String productionRunId = serviceResult.productionRunId
+
+ Map printResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_DOC_PRINTED'])
+ assert ServiceUtil.isSuccess(printResult)
+ Map completeResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_COMPLETED'])
+ assert ServiceUtil.isSuccess(completeResult)
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.currentStatusId == 'PRUN_COMPLETED'
+ assert productionRunTask.currentStatusId == 'PRUN_COMPLETED'
+
+ Map costResult = dispatcher.runSync('getProductionRunCost', [userLogin: userLogin, workEffortId: productionRunId])
+ assert costResult.totalCost
+ }
+
+ void testQuickCloseProductionRun() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestManufAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ String facilityId = 'WebStoreWarehouse'
+ BigDecimal quantity = 1.0
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp productionRunStartDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map serviceCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ pRQuantity: quantity,
+ startDate: productionRunStartDate,
+ facilityId: facilityId,
+ ]
+ Map serviceResult = dispatcher.runSync('createProductionRun', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String productionRunId = serviceResult.productionRunId
+
+ Map printResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_DOC_PRINTED'])
+ assert ServiceUtil.isSuccess(printResult)
+ Map closeResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_CLOSED'])
+ assert ServiceUtil.isSuccess(closeResult)
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.currentStatusId == 'PRUN_CLOSED'
+ assert productionRunTask.currentStatusId == 'PRUN_CLOSED'
+ }
+
+ void testCreateProductionRunForOrder() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'admin').queryOne()
+ String productId = 'PROD_MANUF'
+
+ Map serviceResult = dispatcher.runSync('createTestSalesOrderSingle', [userLogin: userLogin, productId: productId])
+ assert ServiceUtil.isSuccess(serviceResult)
+ String orderId = serviceResult.orderId
+
+ GenericValue orderItem = from('OrderItem').where('orderId', orderId).queryFirst()
+ GenericValue originalOrderItemShipGrpInvRes = from('OrderItemShipGrpInvRes').where('orderId',
+ orderId,
+ 'orderItemSeqId',
+ orderItem.orderItemSeqId).queryFirst()
+
+ Map prCtx = [
+ userLogin: userLogin,
+ orderId: orderId,
+ ]
+ Map prResult = dispatcher.runSync('createProductionRunsForOrder', prCtx)
+ assert ServiceUtil.isSuccess(prResult)
+ List<String> productionRuns = prResult.productionRuns
+ assert productionRuns
+ String productionRunId = productionRuns[0]
+ assert productionRunId
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.workEffortTypeId == 'PROD_ORDER_HEADER'
+ assert productionRunHeader.facilityId == 'WebStoreWarehouse'
+ assert productionRunHeader.currentStatusId == 'PRUN_CREATED'
+ assert productionRunTask.currentStatusId == 'PRUN_CREATED'
+ assert productionRunHeader.quantityToProduce == 1.0
+
+ List<GenericValue> productionRunProducts = from('WorkEffortGoodStandard').where('workEffortId', productionRunId).queryList()
+ assert productionRunProducts
+ GenericValue productionRunProduct = productionRunProducts[0]
+
+ assert productionRunProduct.productId == productId
+ assert productionRunProduct.workEffortGoodStdTypeId == 'PRUN_PROD_DELIV'
+ assert productionRunProduct.estimatedQuantity == 1.0
+
+ GenericValue workOrderItemFulfillment = from('WorkOrderItemFulfillment').where('workEffortId',
+ productionRunId,
+ 'orderId',
+ orderId).queryFirst()
+ assert workOrderItemFulfillment
+ assert workOrderItemFulfillment.orderItemSeqId
+
+ Map printResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_DOC_PRINTED'])
+ assert ServiceUtil.isSuccess(printResult)
+ Map closeResult = dispatcher.runSync('quickChangeProductionRunStatus', [userLogin: userLogin, productionRunId: productionRunId, statusId: 'PRUN_CLOSED'])
+ assert ServiceUtil.isSuccess(closeResult)
+
+ GenericValue producedMaterial = from('WorkEffortAndInventoryProduced').where('workEffortId', productionRunHeader.workEffortId).queryFirst()
+ GenericValue newOrderItemShipGrpInvRes = from('OrderItemShipGrpInvRes').where('orderId',
+ orderId,
+ 'orderItemSeqId',
+ orderItem.orderItemSeqId).queryFirst()
+
+ assert newOrderItemShipGrpInvRes
+ assert newOrderItemShipGrpInvRes.inventoryItemId != originalOrderItemShipGrpInvRes.inventoryItemId
+ assert producedMaterial.inventoryItemId == newOrderItemShipGrpInvRes.inventoryItemId
+ }
+
+ void testCreateProductionRunForRequirement() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'TestSupplyAdmin').queryOne()
+ String productId = 'PROD_MANUF'
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp startDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map reqCtx = [
+ userLogin: userLogin,
+ productId: productId,
+ requirementTypeId: 'INTERNAL_REQUIREMENT',
+ facilityId: 'WebStoreWarehouse',
+ requirementStartDate: startDate
+ ]
+ Map reqResult = dispatcher.runSync('createRequirement', reqCtx)
+ assert ServiceUtil.isSuccess(reqResult)
+ String requirementId = reqResult.requirementId
+
+ Map updateResult = dispatcher.runSync('updateRequirement', [userLogin: userLogin, requirementId: requirementId, statusId: 'REQ_APPROVED'])
+ assert ServiceUtil.isSuccess(updateResult)
+
+ // Manually trigger the ECA service because tests run in an uncommitted transaction
+ Map prunResult = dispatcher.runSync('createProductionRunFromRequirement', [userLogin: userLogin, requirementId: requirementId])
+ assert ServiceUtil.isSuccess(prunResult)
+ String productionRunId = prunResult.productionRunId
+
+ GenericValue productionRunHeader = from('WorkEffort').where('workEffortId', productionRunId).queryOne()
+ assert productionRunHeader
+
+ List<GenericValue> productionRunTasks = from('WorkEffort').where('workEffortParentId', productionRunId).queryList()
+ assert productionRunTasks
+ GenericValue productionRunTask = productionRunTasks[0]
+
+ assert productionRunHeader.workEffortTypeId == 'PROD_ORDER_HEADER'
+ assert productionRunHeader.facilityId == 'WebStoreWarehouse'
+ assert productionRunHeader.currentStatusId == 'PRUN_CREATED'
+ assert productionRunTask.currentStatusId == 'PRUN_CREATED'
+ assert productionRunHeader.quantityToProduce == 1.0
+
+ List<GenericValue> productionRunProducts = from('WorkEffortGoodStandard').where('workEffortId', productionRunHeader.workEffortId).queryList()
+ assert productionRunProducts
+ GenericValue productionRunProduct = productionRunProducts[0]
+
+ assert productionRunProduct.productId == productId
+ assert productionRunProduct.workEffortGoodStdTypeId == 'PRUN_PROD_DELIV'
+ assert productionRunProduct.estimatedQuantity == 1.0
+ }
+}
+
diff --git a/applications/manufacturing/testdef/productionruntests.xml b/applications/manufacturing/testdef/productionruntests.xml
index ea0877d8d4..c6008a7f9b 100644
--- a/applications/manufacturing/testdef/productionruntests.xml
+++ b/applications/manufacturing/testdef/productionruntests.xml
@@ -26,6 +26,6 @@
</test-case>
<test-case case-name="production-run-tests">
- <simple-method-test location="component://manufacturing/minilang/test/ProductionRunTests.xml"/>
+ <junit-test-suite class-name="org.apache.ofbiz.manufacturing.test.ProductionRunTests"/>
</test-case>
</test-suite>
diff --git a/applications/order/minilang/test/CustRequestTests.xml b/applications/order/minilang/test/CustRequestTests.xml
deleted file mode 100644
index 827280b82e..0000000000
--- a/applications/order/minilang/test/CustRequestTests.xml
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
-
- <simple-method method-name="testCreateNewRequest" short-description="create a new request" login-required="false">
- <set field="createNewRequestMap.custRequestTypeId" value="RF_PROPOSAL"/>
- <set field="createNewRequestMap.statusId" value="CRQ_SUBMITTED"/>
- <set field="createNewRequestMap.custRequestName" value="Test Customer request"/>
- <set field="createNewRequestMap.priority" value="1L" type="Long"/>
- <set field="createNewRequestMap.fromPartyId" value="DemoCustomer"/>
- <entity-one entity-name="UserLogin" value-field="createNewRequestMap.userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <call-service service-name="createCustRequest" in-map-name="createNewRequestMap">
- <result-to-field result-name="custRequestId" field="requestMap.custRequestId"/>
- </call-service>
- <call-simple-method method-name="inlineUpdateRequest"/>
- <entity-one entity-name="CustRequest" value-field="custRequest">
- <field-map field-name="custRequestId" from-field="requestMap.custRequestId"/>
- </entity-one>
- <assert>
- <not><if-empty field="custRequest"/></not>
- <if-compare-field field="custRequest.custRequestId" to-field="requestMap.custRequestId" operator="equals"/>
- <if-compare-field field="custRequest.custRequestTypeId" to-field="updateRequestMap.custRequestTypeId" operator="equals"/>
- <if-compare-field field="custRequest.statusId" to-field="updateRequestMap.statusId" operator="equals"/>
- <if-compare-field field="custRequest.custRequestName" to-field="updateRequestMap.custRequestName" operator="equals"/>
- <if-compare-field field="custRequest.priority" to-field="updateRequestMap.priority" operator="equals"/>
- <if-compare-field field="custRequest.fromPartyId" to-field="updateRequestMap.fromPartyId" operator="equals"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="inlineUpdateRequest" short-description="update a request" login-required="false">
- <set field="updateRequestMap.custRequestId" from-field="requestMap.custRequestId"/>
- <set field="updateRequestMap.custRequestTypeId" value="RF_INFO"/>
- <set field="updateRequestMap.statusId" value="CRQ_ACCEPTED"/>
- <set field="updateRequestMap.custRequestName" value="New Test Customer request"/>
- <set field="updateRequestMap.priority" value="2L" type="Long"/>
- <set field="updateRequestMap.fromPartyId" value="admin"/>
- <entity-one entity-name="UserLogin" value-field="updateRequestMap.userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <call-service service-name="updateCustRequest" in-map-name="updateRequestMap"/>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateCustRequestItem" short-description="Create Cust Request Item" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <call-service service-name="createCustRequestItem" in-map-name="serviceCtx">
- <results-to-map map-name="custRequestId"/>
- </call-service>
- <assert>
- <not><if-empty field="custRequestId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateCustRequestItemNote" short-description="Create Cust Request Item Note" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <set field="serviceCtx.custRequestItemSeqId" value="00001"/>
- <set field="serviceCtx.note" value="Test"/>
- <call-service service-name="createCustRequestItemNote" in-map-name="serviceCtx">
- <results-to-map map-name="noteId"/>
- </call-service>
- <assert>
- <not><if-empty field="noteId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateCustRequestNote" short-description="Create Cust Request Note" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <set field="serviceCtx.noteInfo" value="Test"/>
- <call-service service-name="createCustRequestNote" in-map-name="serviceCtx">
- <results-to-map map-name="serviceResult"/>
- </call-service>
- <assert>
- <not><if-empty field="serviceResult"/></not>
- <if-compare operator="equals" field="serviceResult.fromPartyId" value="DemoCustomer"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateCustRequestParty" short-description="Create Cust Request Party" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <set field="serviceCtx.partyId" value="Company"/>
- <set field="serviceCtx.roleTypeId" value="OWNER"/>
- <call-service service-name="createCustRequestParty" in-map-name="serviceCtx">
- <results-to-map map-name="serviceResult"/>
- </call-service>
- <assert>
- <not><if-empty field="serviceResult"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateCustRequestStatus" short-description="Create Cust Request Status" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <set field="serviceCtx.custRequestItemSeqId" value="00001"/>
- <set field="serviceCtx.statusId" value="CRQ_ACCEPTED"/>
- <call-service service-name="createCustRequestStatus" in-map-name="serviceCtx">
- <results-to-map map-name="custRequestStatusId"/>
- </call-service>
- <assert>
- <not><if-empty field="custRequestStatusId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testSetCustRequestStatus" short-description="Set Cust Request Status" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <set field="serviceCtx.statusId" value="CRQ_ACCEPTED"/>
- <call-service service-name="setCustRequestStatus" in-map-name="serviceCtx">
- <results-to-map map-name="oldStatusId"/>
- </call-service>
- <assert>
- <not><if-empty field="oldStatusId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testGetCustRequestsByRole" short-description="Get Cust Requests By Role" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.roleTypeId" value="OWNER"/>
- <call-service service-name="getCustRequestsByRole" in-map-name="serviceCtx">
- <results-to-map map-name="serviceResult"/>
- </call-service>
- <assert>
- <not><if-empty field="serviceResult"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateCustRequestContent" short-description="Create Cust Request Content" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <set field="serviceCtx.contentId" value="100-ALT"/>
- <call-service service-name="createCustRequestContent" in-map-name="serviceCtx">
- <results-to-map map-name="custRequestStatusId"/>
- </call-service>
- <assert>
- <not><if-empty field="custRequestStatusId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateCustRequestAttribute" short-description="Create Cust Request Attribute" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.attrName" value="Test Name"/>
- <set field="serviceCtx.attrValue" value="Test Value"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <call-service service-name="createCustRequestAttribute" in-map-name="serviceCtx">
- <results-to-map map-name="serviceResult"/>
- </call-service>
- <assert>
- <not><if-empty field="serviceResult"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCopyCustRequestItem" short-description="Copy Cust Request Item" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set-current-user-login value-field="userLogin"/>
- <set field="serviceCtx.custRequestId" value="9000"/>
- <set field="serviceCtx.custRequestItemSeqId" value="00001"/>
- <call-service service-name="copyCustRequestItem" in-map-name="serviceCtx">
- <results-to-map map-name="serviceResult"/>
- </call-service>
- <assert>
- <not><if-empty field="serviceResult"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-</simple-methods>
diff --git a/applications/order/minilang/test/ShoppingCartTests.xml b/applications/order/minilang/test/ShoppingCartTests.xml
deleted file mode 100644
index 390d9f99c7..0000000000
--- a/applications/order/minilang/test/ShoppingCartTests.xml
+++ /dev/null
@@ -1,763 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
-
- <simple-method method-name="testCreateShoppingCart" short-description="Test create shopping cart" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
-
- <set field="map.userLogin" from="userLogin"/>
-
- <call-service service-name="testCreateShoppinCartAndOrder" in-map-name="map">
- <result-to-field result-name="orderMap"/>
- </call-service>
-
- <if-not-empty field="orderMap">
- <log level="info" message="------------ ORDERID : [${orderMap.orderId}] ------------"/>
- </if-not-empty>
-
- <assert><not><if-empty field="orderMap.orderId"/></not></assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateShoppinCartAndOrder" short-description="Create an order using a shopping cart">
- <set field="userLogin" from="parameters.userLogin"/>
-
- <!-- Shopping Cart new Instance -->
- <set field="delegator" from-field="parameters.delegator" type="Object"/>
- <set field="dispatcher" from-field="parameters.dispatcher" type="Object"/>
- <set field="locale" from-field="parameters.locale" type="Object" />
- <set field="productStoreId" value="9000" type="String"/>
- <set field="currencyUom" value="USD" type="String"/>
-
- <script>groovy:
- parameters.shoppingCart = new org.apache.ofbiz.order.shoppingcart.ShoppingCart(delegator, productStoreId, locale, currencyUom)
- </script>
-
- <set field="orderTypeId" value="SALES_ORDER" type="String"/>
- <set field="paymentMethodTypeId" value="CREDIT_CARD" type="String"/>
- <set field="maxAmount" value="49.26" type="BigDecimal"/>
- <set field="partyId" value="DemoCustomer" type="String"/>
- <set field="placingCustomerPartyId" value="DemoCustomer" type="String"/>
- <set field="endUserCustomerPartyId" value="DemoCustomer" type="String"/>
- <set field="shipToCustomerPartyId" value="DemoCustomer" type="String"/>
- <set field="billToCustomerPartyId" value="DemoCustomer" type="String"/>
- <set field="billFromVendorPartyId" value="Company" type="String"/>
- <set field="shoppingCart" from-field="parameters.shoppingCart"/>
-
- <!-- ShoppingCart Set Order Type -->
- <call-object-method method-name="setOrderType" obj-field="shoppingCart">
- <field field="orderTypeId" type="String"/>
- </call-object-method>
-
- <!-- ShoppingCart Set User Login -->
- <call-object-method method-name="setUserLogin" obj-field="shoppingCart">
- <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <!-- ShoppingCart Set ProductStore ID -->
- <call-object-method method-name="setProductStoreId" obj-field="shoppingCart">
- <field field="productStoreId" type="String"/>
- </call-object-method>
-
- <!-- ShoppingCart Add Payment Amount -->
- <call-object-method method-name="addPaymentAmount" obj-field="shoppingCart">
- <field field="paymentMethodTypeId" type="String"/>
- <field field="maxAmount" type="BigDecimal"/>
- </call-object-method>
-
- <!-- ShoppingCart Set Order Party ID -->
- <call-object-method method-name="setOrderPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <!-- Add Product Item to Shopping Cart -->
- <set field="prodCatalogId" value="DemoCatalog" type="String"/>
- <set field="index" value="0" type="Integer"/>
- <set field="productId" value="GZ-2644" type="String"/>
- <set field="quantity" value="5" type="BigDecimal"/>
- <set field="selectedAmount" value="0" type="BigDecimal"/>
- <set field="unitPrice" value="38.4" type="BigDecimal"/>
- <set field="itemType" value="PRODUCT_ORDER_ITEM" type="String"/>
- <set field="triggerExternalOpsBool" type="Boolean" value="false"/>
- <set field="triggerPriceRulesBool" type="Boolean" value="true"/>
- <set field="skipInventoryChecks" type="Boolean" value="true"/>
- <set field="skipProductChecks" type="Boolean" value="true"/>
-
- <call-object-method method-name="addItemToEnd" obj-field="shoppingCart" ret-field="itemIdex">
- <field field="productId" type="String"/>
- <field field="selectedAmount" type="BigDecimal"/>
- <field field="quantity" type="BigDecimal"/>
- <field field="unitPrice" type="BigDecimal"/>
- <field field="features" type="java.util.HashMap"/>
- <field field="attributes" type="java.util.HashMap"/>
- <field field="prodCatalogId" type="String"/>
- <field field="itemType" type="String"/>
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- <field field="triggerExternalOpsBool" type="Boolean"/>
- <field field="triggerPriceRulesBool" type="Boolean"/>
- <field field="skipInventoryChecks" type="Boolean"/>
- <field field="skipProductChecks" type="Boolean"/>
- </call-object-method>
-
- <set field="itemIdex" from-field="itemIdex" type="Integer"/>
- <call-object-method method-name="findCartItem" obj-field="shoppingCart" ret-field="cartItem">
- <field field="itemIdex" type="int"/>
- </call-object-method>
-
- <set field="groupIdx" value="0" type="Integer"/>
- <call-object-method method-name="setItemShipGroupQty" obj-field="shoppingCart">
- <field field="cartItem" type="org.apache.ofbiz.order.shoppingcart.ShoppingCartItem"/>
- <field field="quantity" type="BigDecimal"/>
- <field field="groupIdx" type="int"/>
- </call-object-method>
-
- <!-- Make OrderAdjustment Promotion to Shopping Cart -->
- <make-value entity-name="OrderAdjustment" value-field="orderAdjustmentPromotion"/>
- <set field="orderAdjustmentPromotion.orderAdjustmentTypeId" value="PROMOTION_ADJUSTMENT"/>
- <set field="orderAdjustmentPromotion.shipGroupSeqId" value="_NA_"/>
- <set field="orderAdjustmentPromotion.amount" value="-3.84" type="BigDecimal"/>
- <set field="orderAdjustmentPromotion.productPromoId" value="9011"/>
- <set field="orderAdjustmentPromotion.productPromoRuleId" value="01"/>
- <set field="orderAdjustmentPromotion.productPromoActionSeqId" value="01"/>
-
- <call-object-method method-name="addAdjustment" obj-field="shoppingCart">
- <field field="orderAdjustmentPromotion" type="org.apache.ofbiz.entity.GenericValue"/>
- </call-object-method>
-
- <!-- Make OrderAdjustment Shipping Charges to Shopping Cart -->
- <make-value entity-name="OrderAdjustment" value-field="orderAdjustmentShipping"/>
- <set field="orderAdjustmentShipping.orderAdjustmentTypeId" value="SHIPPING_CHARGES"/>
- <set field="orderAdjustmentShipping.shipGroupSeqId" value="00001"/>
- <set field="orderAdjustmentShipping.amount" value="12.10" type="BigDecimal"/>
-
- <call-object-method method-name="addAdjustment" obj-field="shoppingCart">
- <field field="orderAdjustmentShipping" type="org.apache.ofbiz.entity.GenericValue"/>
- </call-object-method>
-
- <!-- Make OrderAdjustment Sales Tax to Shopping Cart -->
- <make-value entity-name="OrderAdjustment" value-field="orderAdjustmentSalesTax"/>
- <set field="orderAdjustmentSalesTax.orderAdjustmentTypeId" value="SALES_TAX"/>
- <set field="orderAdjustmentSalesTax.orderItemSeqId" value="00001"/>
- <set field="orderAdjustmentSalesTax.shipGroupSeqId" value="00001"/>
- <set field="orderAdjustmentSalesTax.amount" value="1.824" type="BigDecimal"/>
- <set field="orderAdjustmentSalesTax.sourcePercentage" value="0.100000" type="BigDecimal"/>
- <set field="orderAdjustmentSalesTax.taxAuthorityRateSeqId" value="9004"/>
- <set field="orderAdjustmentSalesTax.primaryGeoId" value="UT"/>
- <set field="orderAdjustmentSalesTax.taxAuthGeoId" value="UT"/>
- <set field="orderAdjustmentSalesTax.taxAuthPartyId" value="UT_TAXMAN"/>
- <set field="orderAdjustmentSalesTax.overrideGlAccountId" value="224153"/>
- <set field="orderAdjustmentSalesTax.comments" value="Utah State Sales Tax"/>
-
- <call-object-method method-name="addAdjustment" obj-field="shoppingCart">
- <field field="orderAdjustmentSalesTax" type="org.apache.ofbiz.entity.GenericValue"/>
- </call-object-method>
-
- <make-value entity-name="OrderAdjustment" value-field="orderAdjustmentSalesTax1"/>
- <set field="orderAdjustmentSalesTax1.orderAdjustmentTypeId" value="SALES_TAX"/>
- <set field="orderAdjustmentSalesTax1.orderItemSeqId" value="00001"/>
- <set field="orderAdjustmentSalesTax1.shipGroupSeqId" value="00001"/>
- <set field="orderAdjustmentSalesTax1.amount" value="0.039" type="BigDecimal"/>
- <set field="orderAdjustmentSalesTax1.sourcePercentage" value="0.100000" type="BigDecimal"/>
- <set field="orderAdjustmentSalesTax1.taxAuthorityRateSeqId" value="9005"/>
- <set field="orderAdjustmentSalesTax1.primaryGeoId" value="UT-UTAH"/>
- <set field="orderAdjustmentSalesTax1.taxAuthGeoId" value="UT-UTAH"/>
- <set field="orderAdjustmentSalesTax1.taxAuthPartyId" value="UT_UTAH_TAXMAN"/>
- <set field="orderAdjustmentSalesTax1.overrideGlAccountId" value="224153"/>
- <set field="orderAdjustmentSalesTax1.comments" value="Utah County, Utah Sales Tax"/>
-
- <call-object-method method-name="addAdjustment" obj-field="shoppingCart">
- <field field="orderAdjustmentSalesTax1" type="org.apache.ofbiz.entity.GenericValue"/>
- </call-object-method>
-
- <make-value entity-name="OrderAdjustment" value-field="orderAdjustmentSalesTax2"/>
- <set field="orderAdjustmentSalesTax2.orderAdjustmentTypeId" value="SALES_TAX"/>
- <set field="orderAdjustmentSalesTax2.orderItemSeqId" value="00001"/>
- <set field="orderAdjustmentSalesTax2.shipGroupSeqId" value="00001"/>
- <set field="orderAdjustmentSalesTax2.amount" value="0.384" type="BigDecimal"/>
- <set field="orderAdjustmentSalesTax2.sourcePercentage" value="1" type="BigDecimal"/>
- <set field="orderAdjustmentSalesTax2.taxAuthorityRateSeqId" value="9000"/>
- <set field="orderAdjustmentSalesTax2.primaryGeoId" value="_NA_"/>
- <set field="orderAdjustmentSalesTax2.taxAuthGeoId" value="_NA_"/>
- <set field="orderAdjustmentSalesTax2.taxAuthPartyId" value="_NA_"/>
- <set field="orderAdjustmentSalesTax2.overrideGlAccountId" value="224000"/>
- <set field="orderAdjustmentSalesTax2.comments" value="1% OFB _NA_ Tax"/>
-
- <call-object-method method-name="addAdjustment" obj-field="shoppingCart">
- <field field="orderAdjustmentSalesTax2" type="org.apache.ofbiz.entity.GenericValue"/>
- </call-object-method>
-
- <!-- Shopping Cart Set ShippingContactMechId-->
- <set field="contactMechId" value="9015"/>
- <call-object-method method-name="setAllShippingContactMechId" obj-field="shoppingCart">
- <field field="contactMechId" type="String"/>
- </call-object-method>
-
- <!-- Shopping Cart Set Method Type ID-->
- <set field="shipmentMethodTypeId" value="NEXT_DAY" type="String"/>
- <call-object-method method-name="setAllShipmentMethodTypeId" obj-field="shoppingCart">
- <field field="shipmentMethodTypeId" type="String"/>
- </call-object-method>
-
- <!-- Shopping Cart Set Carrier Party ID-->
- <set field="carrierPartyId" value="UPS" type="String"/>
- <call-object-method method-name="setAllCarrierPartyId" obj-field="shoppingCart">
- <field field="carrierPartyId" type="String"/>
- </call-object-method>
-
- <!-- Shopping Cart Set Is Gift-->
- <set field="isGift" value="false" type="Boolean"/>
- <call-object-method method-name="setAllIsGift" obj-field="shoppingCart">
- <field field="isGift" type="Boolean"/>
- </call-object-method>
-
- <!-- Shopping Cart Set May Split-->
- <set field="maySplit" value="false" type="Boolean"/>
- <call-object-method method-name="setAllMaySplit" obj-field="shoppingCart">
- <field field="maySplit" type="Boolean"/>
- </call-object-method>
-
- <!-- Shopping Cart Set Billing and Ship to customers -->
- <call-object-method method-name="setBillFromVendorPartyId" obj-field="shoppingCart">
- <field field="billFromVendorPartyId" type="String"/>
- </call-object-method>
- <call-object-method method-name="setPlacingCustomerPartyId" obj-field="shoppingCart">
- <field field="placingCustomerPartyId" type="String"/>
- </call-object-method>
- <call-object-method method-name="setBillToCustomerPartyId" obj-field="shoppingCart">
- <field field="billToCustomerPartyId" type="String"/>
- </call-object-method>
- <call-object-method method-name="setShipToCustomerPartyId" obj-field="shoppingCart">
- <field field="shipToCustomerPartyId" type="String"/>
- </call-object-method>
- <call-object-method method-name="setEndUserCustomerPartyId" obj-field="shoppingCart">
- <field field="endUserCustomerPartyId" type="String"/>
- </call-object-method>
-
- <!-- Shopping Cart Make all ShipGroupInfos -->
- <call-object-method method-name="makeAllShipGroupInfos" obj-field="shoppingCart">
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <!-- Shopping Cart checkout and create order -->
- <script>groovy:
- checkOutHelper = new org.apache.ofbiz.order.shoppingcart.CheckOutHelper(dispatcher, delegator, shoppingCart)
- parameters.orderMap = checkOutHelper.createOrder(userLogin)
- </script>
-
- <!-- Clear Shopping Cart -->
- <call-object-method method-name="clear" obj-field="shoppingCart"/>
-
- <field-to-result field="parameters.orderMap" result-name="orderMap"/>
-
- </simple-method>
-
- <simple-method method-name="testCreateOrderRentalProduct" short-description="Test create order rental of product" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="DemoCustomer"/>
- </entity-one>
-
- <!-- Shopping Cart new Instance -->
- <set field="delegator" from-field="parameters.delegator" type="Object"/>
- <set field="dispatcher" from-field="parameters.dispatcher" type="Object"/>
- <set field="locale" from-field="parameters.locale" type="Object" />
- <set field="productStoreId" value="9000" type="String"/>
- <set field="currencyUom" value="USD" type="String"/>
- <set field="salesChannel" value="WEB_SALES_CHANNEL" type="String"/>
-
- <set field="partyId" value="DemoCustomer" type="String"/>
-
- <create-object class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCart" field="shoppingCart">
- <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
- <field field="productStoreId" type="String"/>
- <field field="locale" type="java.util.Locale"/>
- <field field="currencyUom" type="String"/>
- </create-object>
-
- <set field="orderType" value="SALES_ORDER" type="String"/>
- <call-object-method method-name="setOrderType" obj-field="shoppingCart">
- <field field="orderType" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setChannelType" obj-field="shoppingCart">
- <field field="salesChannel" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setProductStoreId" obj-field="shoppingCart">
- <field field="productStoreId" type="String"/>
- </call-object-method>
-
- <!-- Shopping Cart Set Billing and Ship to customers -->
- <call-object-method method-name="setBillToCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setPlacingCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setShipToCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setEndUserCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setUserLogin" obj-field="shoppingCart">
- <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <!-- Add Product Item to Shopping Cart -->
- <set field="nextDate" value="${groovy:org.apache.ofbiz.base.util.UtilDateTime.addDaysToTimestamp(org.apache.ofbiz.base.util.UtilDateTime.nowTimestamp(), +1)}" type="Timestamp"/>
- <set field="prodCatalogId" value="DemoCatalog" type="String"/>
- <set field="productId" value="RentalShip" type="String"/>
- <set field="reservStart" from-field="nextDate" type="Timestamp"/>
- <set field="reservLength" value="3" type="BigDecimal"/>
- <set field="reservPersons" value="1" type="BigDecimal"/>
- <set field="quantity" value="1" type="BigDecimal"/>
- <set field="unitPrice" value="15.99" type="BigDecimal"/>
- <set field="itemType" value="RENTAL_ORDER_ITEM" type="String"/>
-
- <call-object-method method-name="addOrIncreaseItem" obj-field="shoppingCart">
- <field field="productId" type="String"/>
- <field field="selectedAmount" type="BigDecimal"/>
- <field field="quantity" type="BigDecimal"/>
- <field field="reservStart" type="Timestamp"/>
- <field field="reservLength" type="BigDecimal"/>
- <field field="reservPersons" type="BigDecimal"/>
- <field field="accommodationMapId" type="String"/>
- <field field="accommodationSpotId" type="String"/>
- <field field="shipBeforeDate" type="Timestamp"/>
- <field field="shipAfterDate" type="Timestamp"/>
- <field field="features" type="Map"/>
- <field field="attributes" type="Map"/>
- <field field="prodCatalogId" type="String"/>
- <field field="configWrapper" type="org.apache.ofbiz.product.config.ProductConfigWrapper"/>
- <field field="itemType" type="String"/>
- <field field="itemGroupNumber" type="String"/>
- <field field="parentProductId" type="String"/>
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <call-object-method method-name="setDefaultCheckoutOptions" obj-field="shoppingCart">
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <!-- Create order -->
- <create-object class-name="org.apache.ofbiz.order.shoppingcart.CheckOutHelper" field="checkOutHelper">
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
- <field field="shoppingCart" type="org.apache.ofbiz.order.shoppingcart.ShoppingCart"/>
- </create-object>
-
- <call-object-method method-name="createOrder" obj-field="checkOutHelper" ret-field="orderCreateResult">
- <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
- </call-object-method>
-
- <set field="orderId" from-field="orderCreateResult.orderId" type="String"/>
- <if-not-empty field="orderId">
- <log level="info" message="------------ ORDERID : [${orderId}] ------------"/>
-
- <!-- Change order status to approved -->
- <call-class-method method-name="approveOrder" class-name="org.apache.ofbiz.order.order.OrderChangeHelper" ret-field="approved">
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
- <field field="orderId" type="String"/>
- </call-class-method>
- <log level="info" message="----Test order with id: [${orderId}] has been approved: [${approved}]----"/>
-
- <entity-one entity-name="UserLogin" value-field="userLoginSystem">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
-
- <!-- Quick Ship Entire Order -->
- <set field="quickShipEntireOrderMap.orderId" from-field="orderId"/>
- <set field="quickShipEntireOrderMap.userLogin" from-field="userLoginSystem"/>
- <call-service service-name="quickShipEntireOrder" in-map-name="quickShipEntireOrderMap"/>
- <log level="info" message="----Test sales order with id: [${orderId}] has been shipped----"/>
- </if-not-empty>
-
- <assert><not><if-empty field="orderId"/></not></assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateOrderServiceProduct" short-description="Test create an order using a service product" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="DemoCustomer"/>
- </entity-one>
-
- <!-- Shopping Cart new Instance -->
- <set field="delegator" from-field="parameters.delegator" type="Object"/>
- <set field="dispatcher" from-field="parameters.dispatcher" type="Object"/>
- <set field="locale" from-field="parameters.locale" type="Object" />
- <set field="productStoreId" value="9000" type="String"/>
- <set field="currencyUom" value="USD" type="String"/>
- <set field="salesChannel" value="WEB_SALES_CHANNEL" type="String"/>
-
- <set field="partyId" value="DemoCustomer" type="String"/>
-
- <create-object class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCart" field="shoppingCart">
- <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
- <field field="productStoreId" type="String"/>
- <field field="locale" type="java.util.Locale"/>
- <field field="currencyUom" type="String"/>
- </create-object>
-
- <set field="orderType" value="SALES_ORDER" type="String"/>
- <call-object-method method-name="setOrderType" obj-field="shoppingCart">
- <field field="orderType" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setChannelType" obj-field="shoppingCart">
- <field field="salesChannel" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setProductStoreId" obj-field="shoppingCart">
- <field field="productStoreId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setBillToCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setPlacingCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setShipToCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setEndUserCustomerPartyId" obj-field="shoppingCart">
- <field field="partyId" type="String"/>
- </call-object-method>
-
- <call-object-method method-name="setUserLogin" obj-field="shoppingCart">
- <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <set field="productId" value="SV-1001" type="String"/>
- <set field="prodCatalogId" value="DemoCatalog" type="String"/>
- <set field="quantity" value="1" type="BigDecimal"/>
-
- <call-object-method method-name="addOrIncreaseItem" obj-field="shoppingCart">
- <field field="productId" type="String"/>
- <field field="selectedAmount" type="BigDecimal"/>
- <field field="quantity" type="BigDecimal"/>
- <field field="reservStart" type="Timestamp"/>
- <field field="reservLength" type="BigDecimal"/>
- <field field="reservPersons" type="BigDecimal"/>
- <field field="shipBeforeDate" type="Timestamp"/>
- <field field="shipAfterDate" type="Timestamp"/>
- <field field="features" type="Map"/>
- <field field="attributes" type="Map"/>
- <field field="prodCatalogId" type="String"/>
- <field field="configWrapper" type="org.apache.ofbiz.product.config.ProductConfigWrapper"/>
- <field field="itemType" type="String"/>
- <field field="itemGroupNumber" type="String"/>
- <field field="parentProductId" type="String"/>
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <call-object-method method-name="setDefaultCheckoutOptions" obj-field="shoppingCart">
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- </call-object-method>
-
- <create-object class-name="org.apache.ofbiz.order.shoppingcart.CheckOutHelper" field="checkOutHelper">
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
- <field field="shoppingCart" type="org.apache.ofbiz.order.shoppingcart.ShoppingCart"/>
- </create-object>
-
- <call-object-method method-name="createOrder" obj-field="checkOutHelper" ret-field="orderCreateResult">
- <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
- </call-object-method>
- <set field="orderId" from-field="orderCreateResult.orderId" type="String"/>
- <if-not-empty field="orderId">
- <call-class-method method-name="approveOrder" class-name="org.apache.ofbiz.order.order.OrderChangeHelper" ret-field="approved">
- <field field="dispatcher" type="org.apache.ofbiz.service.LocalDispatcher"/>
- <field field="userLogin" type="org.apache.ofbiz.entity.GenericValue"/>
- <field field="orderId" type="String"/>
- </call-class-method>
- <log level="info" message="======== Test order with id: [${orderId}] has been approved: [${approved}]========"/>
-
- <entity-one entity-name="UserLogin" value-field="systemUserLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
-
- <set field="quickShipEntireOrderMap.orderId" from-field="orderId"/>
- <set field="quickShipEntireOrderMap.userLogin" from-field="systemUserLogin"/>
- <call-service service-name="quickShipEntireOrder" in-map-name="quickShipEntireOrderMap"/>
- <log level="info" message="========Test order with id: [${orderId}] has been shipped"/>
- </if-not-empty>
-
- <assert><not><if-empty field="orderId"/></not></assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testLoadCartFromQuote" short-description="Test loading shopping cart from quote" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
-
- <set field="createQuoteMap.userLogin" from-field="userLogin"/>
- <set field="createQuoteMap.partyId" value="DemoCustomer"/>
- <set field="createQuoteMap.currencyUomId" value="USD"/>
- <set field="createQuoteMap.description" value="Test quote"/>
- <set field="createQuoteMap.issueDate" value="2011-11-01 10:00:00.0" type="Timestamp"/>
- <set field="createQuoteMap.productStoreId" value="9000"/>
- <set field="createQuoteMap.quoteName" value="Test quote"/>
- <set field="createQuoteMap.quoteTypeId" value="PRODUCT_QUOTE"/>
- <set field="createQuoteMap.statusId" value="QUO_APPROVED"/>
- <set field="createQuoteMap.validFromDate" value="2011-11-01 10:00:00.0" type="Timestamp"/>
- <call-service service-name="createQuote" in-map-name="createQuoteMap">
- <result-to-field result-name="quoteId"/>
- </call-service>
- <check-errors/>
-
- <set field="createQuoteItemMap.userLogin" from-field="userLogin"/>
- <set field="createQuoteItemMap.quoteId" from-field="quoteId"/>
- <set field="createQuoteItemMap.productId" value="GZ-1000"/>
- <set field="createQuoteItemMap.quantity" value="10" type="BigDecimal"/>
- <set field="createQuoteItemMap.quoteUnitPrice" value="15.00" type="BigDecimal"/>
- <call-service service-name="createQuoteItem" in-map-name="createQuoteItemMap">
- <result-to-field result-name="quoteItemSeqNo"/>
- </call-service>
- <check-errors/>
-
- <set field="createQuoteAdjustmentMap.userLogin" from-field="userLogin"/>
- <set field="createQuoteAdjustmentMap.quoteId" from-field="quoteId"/>
- <set field="createQuoteAdjustmentMap.quoteItemSeqId" from-field="quoteItemSeqId"/>
- <set field="createQuoteAdjustmentMap.amount" value="15.00" type="BigDecimal"/>
- <set field="createQuoteAdjustmentMap.includeInShipping" value="N"/>
- <set field="createQuoteAdjustmentMap.includeInTax" value="Y"/>
- <set field="createQuoteAdjustmentMap.quoteAdjustmentTypeId" value="SALES_TAX"/>
- <set field="createQuoteAdjustmentMap.taxAuthGeoId" value="UT"/>
- <set field="createQuoteAdjustmentMap.taxAuthPartyId" value="UT_TAXMAN"/>
- <call-service service-name="createQuoteAdjustment" in-map-name="createQuoteAdjustmentMap">
- <result-to-field result-name="quoteAdjustmentId"/>
- </call-service>
- <check-errors/>
-
- <set field="loadCartFromQuoteMap.userLogin" from-field="userLogin"/>
- <set field="loadCartFromQuoteMap.quoteId" from-field="quoteId"/>
- <set field="loadCartFromQuoteMap.applyQuoteAdjustments" value="true"/>
- <call-service service-name="loadCartFromQuote" in-map-name="loadCartFromQuoteMap">
- <result-to-field result-name="shoppingCart"/>
- </call-service>
- <check-errors/>
-
- <set field="expected" value="15.00" type="BigDecimal"/>
-
- <call-object-method obj-field="shoppingCart" method-name="getTotalSalesTax" ret-field="totalSalesTax"/>
- <assert><if-compare-field operator="equals" field="totalSalesTax" to-field="expected"/></assert>
-
- <set field="shipGroupNumber" value="0" type="Integer"/>
- <call-object-method obj-field="shoppingCart" method-name="getTotalSalesTax" ret-field="totalSalesTax">
- <field field="shipGroupNumber" type="int"/>
- </call-object-method>
- <assert><if-compare-field operator="equals" field="totalSalesTax" to-field="expected"/></assert>
-
- <set field="expected" value="165.00" type="BigDecimal"/>
- <call-object-method obj-field="shoppingCart" method-name="getGrandTotal" ret-field="grandTotal"/>
- <assert><if-compare-field operator="equals" field="grandTotal" to-field="expected"/></assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateOrderConfigurableServiceProduct" short-description="Test create an order using a configurable service product" login-required="false">
- <set field="request" from-field="parameters.request"/>
- <set field="response" from-field="parameters.response"/>
- <call-class-method method-name="routeOrderEntry" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : routeOrderEntry, Response : ${result}"/>
- <!-- Set parameters -->
- <set field="testParams.add_product_id" value="CFSV1001"/>
- <set field="testParams.product_id" value="CFSV1001"/>
- <set field="testParams.FT0_0_0TYPE" value="SCAN_TYPE"/>
- <set field="testParams.product_id0_0_0" value="SCAN_TYPE"/>
- <set field="testParams.0" value="0"/>
- <set field="testParams.add_product_id0_0_0" value="SCAN-EC"/>
- <set field="testParams.productStoreId" value="9000"/>
- <set field="testParams.currencyUom" value="USD"/>
- <set field="testParams.quantity" value="1"/>
- <set field="testParams.orderMode" value="SALES_ORDER"/>
- <set field="testParams.partyId" value="DemoCustomer"/>
- <set field="testParams.checkoutpage" value="quick"/>
- <set field="testParams.shipping_contact_mech_id" value="9015"/>
- <set field="testParams.shipping_method" value="GROUND@UPS"/>
- <set field="testParams.checkOutPaymentId" value="EXT_COD"/>
- <set field="testParams.is_gift" value="false"/>
- <set field="testParams.may_split" value="false"/>
- <!-- This is a temporary solution, maybe always needed. It was put in because of OFBIZ-11553-->
- <script>groovy:
- request.removeParameter("checkOutPaymentId")
- request.removeAttribute("checkOutPaymentId")
- </script>
- <call-object-method method-name="addParameters" obj-field="request">
- <field field="testParams" type="java.util.Map"/>
- </call-object-method>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="DemoCustomer"/>
- </entity-one>
- <script>groovy:
- session = request.getSession()
- session.setAttribute("userLogin", userLogin)
- </script>
- <call-class-method method-name="initializeOrderEntry" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : initializeOrderEntry, Response : ${result}"/>
- <call-class-method method-name="setOrderCurrencyAgreementShipDates" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : setOrderCurrencyAgreementShipDates, Response : ${result}"/>
-
- <call-class-method method-name="addToCart" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : addToCart, Response : ${result}"/>
-
- <field-to-request field="nullField" request-name="shoppingCart"/>
- <call-class-method method-name="setQuickCheckOutOptions" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : setQuickCheckOutOptions, Response : ${result}"/>
- <call-class-method method-name="createOrder" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="orderCreateResult">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : createOrder, Response : ${orderCreateResult}"/>
- <call-class-method method-name="processPayment" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : processPayment, Response : ${result}"/>
- <call-service-asynch service-name="sendOrderConfirmation"/>
- <call-class-method method-name="destroyCart" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : destroyCart, Response = ${result}"/>
- <entity-condition entity-name="OrderHeader" list="orderHeaders">
- <condition-expr field-name="orderTypeId" value="SALES_ORDER"/>
- <order-by field-name="-entryDate"/>
- </entity-condition>
- <first-from-list list="orderHeaders" entry="orderHeader"/>
- <set field="orderId" from-field="orderHeader.orderId"/>
- <log level="info" message="======== Test order with id: [${orderId}] has been approved: [${approved}]========"/>
-
- <entity-one entity-name="UserLogin" value-field="systemUserLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="quickShipEntireOrderMap.orderId" from-field="orderId"/>
- <set field="quickShipEntireOrderMap.userLogin" from-field="systemUserLogin"/>
- <call-service service-name="quickShipEntireOrder" in-map-name="quickShipEntireOrderMap"/>
- <log level="info" message="========Test order with id: [${orderId}] has been shipped"/>
-
- <assert><not><if-empty field="orderId"/></not></assert>
- <check-errors/>
- </simple-method>
-
-
- <simple-method method-name="testOrderMoveItemBetweenShipGoups" login-required="false"
- short-description="Create an order with 2 ship groups and 3 items and move items between ship groups">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
-
- <set field="map.userLogin" from="userLogin"/>
- <call-service service-name="testCreateShoppinCartAndOrder" in-map-name="map">
- <result-to-field result-name="orderMap"/>
- </call-service>
-
- <assert><not><if-empty field="orderMap.orderId"/></not></assert>
- <check-errors/>
-
- <entity-and entity-name="OrderItem" list="orderItems">
- <field-map field-name="orderId" from-field="orderMap.orderId"/>
- <field-map field-name="productId" value="GZ-2644"/>
- </entity-and>
- <first-from-list list="orderItems" entry="orderItem"/>
-
- <set field="map.orderId" from="orderMap.orderId"/>
- <set field="map.contactMechId" value="9015"/>
- <set field="map.carrierPartyId" value="UPS"/>
- <set field="map.shipmentMethodTypeId" value="NEXT_DAY"/>
- <call-service service-name="createOrderItemShipGroup" in-map-name="map"/>
-
- <clear-field field="map"/>
- <set field="map.userLogin" from="userLogin" type="GenericValue"/>
- <set field="map.orderId" from="orderMap.orderId"/>
- <set field="map.orderItemSeqId" from="orderItem.orderItemSeqId"/>
- <set field="map.fromGroupIndex" value="00001"/>
- <set field="map.toGroupIndex" value="00002"/>
- <set field="map.quantity" value="2" type="BigDecimal"/>
- <call-service service-name="moveItemBetweenShipGroups" in-map-name="map"/>
-
- <entity-one entity-name="OrderItemShipGroupAssoc" value-field="orderItemShipGroupAssoc1">
- <field-map field-name="orderId" from-field="orderMap.orderId"/>
- <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
- <field-map field-name="shipGroupSeqId" value="00001"/>
- </entity-one>
- <assert><if-compare field="orderItemShipGroupAssoc1.quantity" operator="equals" value="3"></if-compare></assert>
- <check-errors/>
-
- <entity-one entity-name="OrderItemShipGroupAssoc" value-field="orderItemShipGroupAssoc2">
- <field-map field-name="orderId" from-field="orderMap.orderId"/>
- <field-map field-name="orderItemSeqId" from-field="orderItem.orderItemSeqId"/>
- <field-map field-name="shipGroupSeqId" value="00002"/>
- </entity-one>
- <assert><if-compare field="orderItemShipGroupAssoc2.quantity" operator="equals" value="2"></if-compare></assert>
- <check-errors/>
-
- <clear-field field="map"/>
- <set field="map.userLogin" from="userLogin" type="GenericValue"/>
- <set field="map.orderId" from="orderMap.orderId"/>
- <set field="map.orderItemSeqId" from="orderItem.orderItemSeqId"/>
- <set field="map.shipGroupSeqId" value="00002"/>
- <call-service service-name="deleteOrderItemShipGroupAssoc" in-map-name="map"/>
-
- <clear-field field="map"/>
- <set field="map.userLogin" from="userLogin" type="GenericValue"/>
- <set field="map.orderId" from="orderMap.orderId"/>
- <set field="map.shipGroupSeqId" value="00002"/>
- <call-service service-name="deleteOrderItemShipGroup" in-map-name="map"/>
- <entity-count entity-name="OrderItemShipGroup" count-field="orderItemShipGroupCount">
- <condition-expr field-name="orderId" from-field="orderMap.orderId"/>
- </entity-count>
- <assert><if-compare field="orderItemShipGroupCount" operator="equals" value="1"></if-compare></assert>
- <check-errors/>
- </simple-method>
-
-</simple-methods>
diff --git a/applications/order/servicedef/services.xml b/applications/order/servicedef/services.xml
index a9bb6a723a..c45ce1be91 100644
--- a/applications/order/servicedef/services.xml
+++ b/applications/order/servicedef/services.xml
@@ -1509,16 +1509,6 @@ under the License.
<attribute name="paymentId" type="String" mode="IN" optional="false"/>
</service>
- <service name="createTestOrderRentalProduct" engine="simple" auth="true"
- location="component://order/minilang/test/ShoppingCartTests.xml" invoke="testCreateOrderRentalProduct">
- <description>Create Test Order Rental of an asset which is shipped from and returned to inventory</description>
- </service>
-
- <service name="testCreateShoppinCartAndOrder" engine="simple" auth="true"
- location="component://order/minilang/test/ShoppingCartTests.xml" invoke="testCreateShoppinCartAndOrder">
- <description>Create an order using a shopping cart - only used internally in ShoppingCartTests.xml for test purpose</description>
- <attribute name="orderMap" type="Map" mode="OUT"/>
- </service>
<!-- Order Item Attribute -->
<service name="createOrderItemAttribute" engine="entity-auto" default-entity-name="OrderItemAttribute" invoke="create" auth="true">
diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/order/test/CustRequestTests.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/test/CustRequestTests.groovy
new file mode 100644
index 0000000000..ab15db1b8b
--- /dev/null
+++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/order/test/CustRequestTests.groovy
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ofbiz.order.order.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+import org.apache.ofbiz.service.ServiceUtil
+
+@SuppressWarnings(['LineLength', 'UnnecessaryObjectReferences', 'UnnecessaryGString', 'PublicMethodsBeforeNonPublicMethods', 'ClassSize', 'MethodCount', 'ConsecutiveBlankLines', 'BlockEndsWithBlankLine', 'ClassEndsWithBlankLine'])
+class CustRequestTests extends OFBizTestCase {
+
+ CustRequestTests(String name) {
+ super(name)
+ }
+
+ void testCreateNewRequest() {
+ Map serviceCtx = [
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequest', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.custRequestId
+
+ GenericValue custRequest = from('CustRequest').where('custRequestId', serviceResult.custRequestId).queryOne()
+ assert custRequest
+ }
+
+ void testUpdateCustRequest() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ custRequestName: 'Updated Test Request',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('updateCustRequest', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue custRequest = from('CustRequest').where('custRequestId', '9000').queryOne()
+ assert custRequest
+ assert custRequest.custRequestName == 'Updated Test Request'
+ }
+
+ void testCreateCustRequestItem() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequestItem', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.custRequestId
+ }
+
+ void testCreateCustRequestItemNote() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ custRequestItemSeqId: '00001',
+ note: 'Test',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequestItemNote', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.noteId
+ }
+
+ void testCreateCustRequestNote() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ noteInfo: 'Test',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequestNote', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult
+ assert serviceResult.fromPartyId == 'DemoCustomer'
+ }
+
+ void testCreateCustRequestParty() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ partyId: 'Company',
+ roleTypeId: 'OWNER',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequestParty', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult
+ }
+
+ void testCreateCustRequestStatus() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ custRequestItemSeqId: '00001',
+ statusId: 'CRQ_ACCEPTED',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequestStatus', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.custRequestStatusId
+ }
+
+ void testSetCustRequestStatus() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ statusId: 'CRQ_ACCEPTED',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('setCustRequestStatus', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.oldStatusId
+ }
+
+ void testGetCustRequestsByRole() {
+ Map serviceCtx = [
+ roleTypeId: 'OWNER',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('getCustRequestsByRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult
+ }
+
+ void testCreateCustRequestContent() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ contentId: '100-ALT',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequestContent', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult
+ }
+
+ void testCreateCustRequestAttribute() {
+ Map serviceCtx = [
+ attrName: 'Test Name',
+ attrValue: 'Test Value',
+ custRequestId: '9000',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createCustRequestAttribute', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult
+ }
+
+ void testCopyCustRequestItem() {
+ Map serviceCtx = [
+ custRequestId: '9000',
+ custRequestItemSeqId: '00001',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('copyCustRequestItem', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult
+ }
+}
diff --git a/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppingcart/test/ShoppingCartTests.groovy b/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppingcart/test/ShoppingCartTests.groovy
new file mode 100644
index 0000000000..0f7ffaac14
--- /dev/null
+++ b/applications/order/src/main/groovy/org/apache/ofbiz/order/shoppingcart/test/ShoppingCartTests.groovy
@@ -0,0 +1,399 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ofbiz.order.shoppingcart.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+import org.apache.ofbiz.order.shoppingcart.ShoppingCart
+import org.apache.ofbiz.order.shoppingcart.CheckOutHelper
+import org.apache.ofbiz.order.order.OrderChangeHelper
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.product.config.ProductConfigWrapper
+import java.sql.Timestamp
+
+@SuppressWarnings(['LineLength', 'UnnecessaryObjectReferences', 'UnnecessaryGString', 'PublicMethodsBeforeNonPublicMethods', 'ClassSize', 'MethodCount', 'ConsecutiveBlankLines', 'BlockEndsWithBlankLine', 'ClassEndsWithBlankLine'])
+class ShoppingCartTests extends OFBizTestCase {
+
+ ShoppingCartTests(String name) {
+ super(name)
+ }
+
+ void testCreateShoppingCart() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ Locale locale = Locale.getDefault()
+ Map orderMap = createShoppinCartAndOrder(userLogin, locale)
+ assert orderMap
+ assert orderMap.orderId
+ }
+
+
+ void testCreateOrderRentalProduct() {
+ Locale locale = Locale.getDefault()
+ GenericValue demoCustomer = from('UserLogin').where('userLoginId', 'DemoCustomer').queryOne()
+ ShoppingCart shoppingCart = new ShoppingCart(delegator, '9000', locale, 'USD')
+ shoppingCart.setOrderType('SALES_ORDER')
+ shoppingCart.setChannelType('WEB_SALES_CHANNEL')
+ shoppingCart.setProductStoreId('9000')
+ shoppingCart.setBillToCustomerPartyId('DemoCustomer')
+ shoppingCart.setPlacingCustomerPartyId('DemoCustomer')
+ shoppingCart.setShipToCustomerPartyId('DemoCustomer')
+ shoppingCart.setEndUserCustomerPartyId('DemoCustomer')
+ shoppingCart.setUserLogin(demoCustomer, dispatcher)
+
+ Timestamp nextDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 1)
+ shoppingCart.addOrIncreaseItem('RentalShip',
+ null,
+ BigDecimal.ONE,
+ nextDate,
+ 3,
+ 1,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 'DemoCatalog',
+ null,
+ 'RENTAL_ORDER_ITEM',
+ null,
+ null,
+ dispatcher)
+ shoppingCart.setDefaultCheckoutOptions(dispatcher)
+
+ CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, shoppingCart)
+ Map orderCreateResult = checkOutHelper.createOrder(demoCustomer)
+ String orderId = orderCreateResult.orderId
+ assert orderId
+
+ OrderChangeHelper.approveOrder(dispatcher, demoCustomer, orderId)
+ GenericValue systemLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ dispatcher.runSync('quickShipEntireOrder', [orderId: orderId, userLogin: systemLogin])
+ }
+
+ void testCreateOrderServiceProduct() {
+ Locale locale = Locale.getDefault()
+ GenericValue demoCustomer = from('UserLogin').where('userLoginId', 'DemoCustomer').queryOne()
+ ShoppingCart shoppingCart = new ShoppingCart(delegator, '9000', locale, 'USD')
+ shoppingCart.setOrderType('SALES_ORDER')
+ shoppingCart.setChannelType('WEB_SALES_CHANNEL')
+ shoppingCart.setProductStoreId('9000')
+ shoppingCart.setBillToCustomerPartyId('DemoCustomer')
+ shoppingCart.setPlacingCustomerPartyId('DemoCustomer')
+ shoppingCart.setShipToCustomerPartyId('DemoCustomer')
+ shoppingCart.setEndUserCustomerPartyId('DemoCustomer')
+ shoppingCart.setUserLogin(demoCustomer, dispatcher)
+
+ shoppingCart.addOrIncreaseItem('SV-1001',
+ null,
+ BigDecimal.ONE,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 'DemoCatalog',
+ null,
+ null,
+ null,
+ null,
+ dispatcher)
+ shoppingCart.setDefaultCheckoutOptions(dispatcher)
+
+ CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, shoppingCart)
+ Map orderCreateResult = checkOutHelper.createOrder(demoCustomer)
+ String orderId = orderCreateResult.orderId
+ assert orderId
+
+ OrderChangeHelper.approveOrder(dispatcher, demoCustomer, orderId)
+ GenericValue systemLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ dispatcher.runSync('quickShipEntireOrder', [orderId: orderId, userLogin: systemLogin])
+ }
+
+ void testLoadCartFromQuote() {
+ GenericValue systemLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+
+ Map createQuoteMap = [
+ userLogin: systemLogin,
+ partyId: 'DemoCustomer',
+ currencyUomId: 'USD',
+ description: 'Test quote',
+ issueDate: UtilDateTime.toTimestamp('11/01/2011 10:00:00'),
+ productStoreId: '9000',
+ quoteName: 'Test quote',
+ quoteTypeId: 'PRODUCT_QUOTE',
+ statusId: 'QUO_APPROVED',
+ validFromDate: UtilDateTime.toTimestamp('11/01/2011 10:00:00')
+ ]
+ Map createQuoteResult = dispatcher.runSync('createQuote', createQuoteMap)
+ String quoteId = createQuoteResult.quoteId
+
+ Map createQuoteItemMap = [
+ userLogin: systemLogin,
+ quoteId: quoteId,
+ productId: 'GZ-1000',
+ quantity: 10,
+ quoteUnitPrice: 15.00
+ ]
+ Map createQuoteItemResult = dispatcher.runSync('createQuoteItem', createQuoteItemMap)
+ String quoteItemSeqId = createQuoteItemResult.quoteItemSeqId
+
+ Map createQuoteAdjustmentMap = [
+ userLogin: systemLogin,
+ quoteId: quoteId,
+ quoteItemSeqId: quoteItemSeqId,
+ amount: 15.00,
+ includeInShipping: 'N',
+ includeInTax: 'Y',
+ quoteAdjustmentTypeId: 'SALES_TAX',
+ taxAuthGeoId: 'UT',
+ taxAuthPartyId: 'UT_TAXMAN'
+ ]
+ dispatcher.runSync('createQuoteAdjustment', createQuoteAdjustmentMap)
+
+ Map loadCartFromQuoteMap = [
+ userLogin: systemLogin,
+ quoteId: quoteId,
+ applyQuoteAdjustments: 'true'
+ ]
+ Map loadCartResult = dispatcher.runSync('loadCartFromQuote', loadCartFromQuoteMap)
+ ShoppingCart shoppingCart = (ShoppingCart) loadCartResult.shoppingCart
+
+ BigDecimal expectedTax = 15.00
+ assert shoppingCart.getTotalSalesTax() == expectedTax
+ assert shoppingCart.getTotalSalesTax(0) == expectedTax
+
+ BigDecimal expectedTotal = 165.00
+ assert shoppingCart.getGrandTotal() == expectedTotal
+ }
+
+ void testCreateOrderConfigurableServiceProduct() {
+ // ShoppingCartEvents requires request/response which are not readily mockable here without Spring
+ // So we just use CheckOutHelper for test.
+ Locale locale = Locale.getDefault()
+ GenericValue demoCustomer = from('UserLogin').where('userLoginId', 'DemoCustomer').queryOne()
+
+ ShoppingCart shoppingCart = new ShoppingCart(delegator, '9000', locale, 'USD')
+ shoppingCart.setOrderType('SALES_ORDER')
+ shoppingCart.setChannelType('WEB_SALES_CHANNEL')
+ shoppingCart.setProductStoreId('9000')
+ shoppingCart.setBillToCustomerPartyId('DemoCustomer')
+ shoppingCart.setPlacingCustomerPartyId('DemoCustomer')
+ shoppingCart.setShipToCustomerPartyId('DemoCustomer')
+ shoppingCart.setEndUserCustomerPartyId('DemoCustomer')
+ shoppingCart.setUserLogin(demoCustomer, dispatcher)
+
+ ProductConfigWrapper configWrapper = new ProductConfigWrapper(delegator, dispatcher, 'CFSV1001', null, 'DemoCatalog', '9000', 'USD', locale, demoCustomer)
+ configWrapper.setSelected('SCAN_TYPE', 0L, 'SCAN-EC', null)
+
+ shoppingCart.addOrIncreaseItem('CFSV1001',
+ null,
+ BigDecimal.ONE,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ 'DemoCatalog',
+ configWrapper,
+ null,
+ null,
+ null,
+ dispatcher)
+
+ shoppingCart.setAllShippingContactMechId('9015')
+ shoppingCart.setAllShipmentMethodTypeId('GROUND')
+ shoppingCart.setAllCarrierPartyId('UPS')
+ shoppingCart.addPaymentAmount('EXT_COD', shoppingCart.getGrandTotal())
+
+ shoppingCart.setDefaultCheckoutOptions(dispatcher)
+
+ CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, shoppingCart)
+ Map orderCreateResult = checkOutHelper.createOrder(demoCustomer)
+ String orderId = orderCreateResult.orderId
+ assert orderId
+
+ OrderChangeHelper.approveOrder(dispatcher, demoCustomer, orderId)
+ GenericValue systemLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ dispatcher.runSync('quickShipEntireOrder', [orderId: orderId, userLogin: systemLogin])
+ }
+
+ void testOrderMoveItemBetweenShipGoups() {
+ GenericValue userLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ Locale locale = Locale.getDefault()
+ Map orderMap = createShoppinCartAndOrder(userLogin, locale)
+ String orderId = orderMap.orderId
+ assert orderId
+
+ GenericValue orderItem = from('OrderItem').where('orderId', orderId, 'productId', 'GZ-2644').queryFirst()
+
+ Map createShipGroupMap = [
+ userLogin: userLogin,
+ orderId: orderId,
+ contactMechId: '9015',
+ carrierPartyId: 'UPS',
+ shipmentMethodTypeId: 'NEXT_DAY'
+ ]
+ dispatcher.runSync('createOrderItemShipGroup', createShipGroupMap)
+
+ Map moveItemMap = [
+ userLogin: userLogin,
+ orderId: orderId,
+ orderItemSeqId: orderItem.orderItemSeqId,
+ fromGroupIndex: '00001',
+ toGroupIndex: '00002',
+ quantity: 2
+ ]
+ dispatcher.runSync('moveItemBetweenShipGroups', moveItemMap)
+
+ GenericValue orderItemShipGroupAssoc1 = from('OrderItemShipGroupAssoc').where('orderId',
+ orderId,
+ 'orderItemSeqId',
+ orderItem.orderItemSeqId,
+ 'shipGroupSeqId',
+ '00001').queryOne()
+ assert orderItemShipGroupAssoc1.quantity == 3
+
+ GenericValue orderItemShipGroupAssoc2 = from('OrderItemShipGroupAssoc').where('orderId',
+ orderId,
+ 'orderItemSeqId',
+ orderItem.orderItemSeqId,
+ 'shipGroupSeqId',
+ '00002').queryOne()
+ assert orderItemShipGroupAssoc2.quantity == 2
+
+ dispatcher.runSync('deleteOrderItemShipGroupAssoc',
+ [userLogin: userLogin,
+ orderId: orderId,
+ orderItemSeqId: orderItem.orderItemSeqId,
+ shipGroupSeqId: '00002'])
+ dispatcher.runSync('deleteOrderItemShipGroup', [userLogin: userLogin, orderId: orderId, shipGroupSeqId: '00002'])
+
+ long orderItemShipGroupCount = from('OrderItemShipGroup').where('orderId', orderId).queryCount()
+ assert orderItemShipGroupCount == 1
+ }
+ protected Map createShoppinCartAndOrder(GenericValue userLogin, Locale locale) {
+ ShoppingCart shoppingCart = new ShoppingCart(delegator, '9000', locale, 'USD')
+ shoppingCart.setOrderType('SALES_ORDER')
+ shoppingCart.setUserLogin(userLogin, dispatcher)
+ shoppingCart.setProductStoreId('9000')
+ shoppingCart.addPaymentAmount('CREDIT_CARD', 49.26)
+ shoppingCart.setOrderPartyId('DemoCustomer')
+
+ int itemIndex = shoppingCart.addItemToEnd('GZ-2644',
+ 0,
+ 5,
+ 38.4,
+ (HashMap) null, (HashMap) null, 'DemoCatalog', 'PRODUCT_ORDER_ITEM', dispatcher, false, true, true, true)
+ org.apache.ofbiz.order.shoppingcart.ShoppingCartItem cartItem = shoppingCart.findCartItem(itemIndex)
+ shoppingCart.setItemShipGroupQty(cartItem, 5, 0)
+
+ GenericValue orderAdjustmentPromotion = delegator.makeValue('OrderAdjustment')
+ orderAdjustmentPromotion.orderAdjustmentTypeId = 'PROMOTION_ADJUSTMENT'
+ orderAdjustmentPromotion.shipGroupSeqId = '_NA_'
+ orderAdjustmentPromotion.amount = -3.84
+ orderAdjustmentPromotion.productPromoId = '9011'
+ orderAdjustmentPromotion.productPromoRuleId = '01'
+ orderAdjustmentPromotion.productPromoActionSeqId = '01'
+ shoppingCart.addAdjustment(orderAdjustmentPromotion)
+
+ GenericValue orderAdjustmentShipping = delegator.makeValue('OrderAdjustment')
+ orderAdjustmentShipping.orderAdjustmentTypeId = 'SHIPPING_CHARGES'
+ orderAdjustmentShipping.shipGroupSeqId = '00001'
+ orderAdjustmentShipping.amount = 12.10
+ shoppingCart.addAdjustment(orderAdjustmentShipping)
+
+ GenericValue orderAdjustmentSalesTax = delegator.makeValue('OrderAdjustment')
+ orderAdjustmentSalesTax.orderAdjustmentTypeId = 'SALES_TAX'
+ orderAdjustmentSalesTax.orderItemSeqId = '00001'
+ orderAdjustmentSalesTax.shipGroupSeqId = '00001'
+ orderAdjustmentSalesTax.amount = 1.824
+ orderAdjustmentSalesTax.sourcePercentage = 0.100000
+ orderAdjustmentSalesTax.taxAuthorityRateSeqId = '9004'
+ orderAdjustmentSalesTax.primaryGeoId = 'UT'
+ orderAdjustmentSalesTax.taxAuthGeoId = 'UT'
+ orderAdjustmentSalesTax.with {
+ taxAuthPartyId = 'UT_TAXMAN'
+ overrideGlAccountId = '224153'
+ comments = 'Utah State Sales Tax'
+ }
+ shoppingCart.addAdjustment(orderAdjustmentSalesTax)
+
+ GenericValue orderAdjustmentSalesTax1 = delegator.makeValue('OrderAdjustment')
+ orderAdjustmentSalesTax1.orderAdjustmentTypeId = 'SALES_TAX'
+ orderAdjustmentSalesTax1.orderItemSeqId = '00001'
+ orderAdjustmentSalesTax1.shipGroupSeqId = '00001'
+ orderAdjustmentSalesTax1.amount = 0.039
+ orderAdjustmentSalesTax1.sourcePercentage = 0.100000
+ orderAdjustmentSalesTax1.taxAuthorityRateSeqId = '9005'
+ orderAdjustmentSalesTax1.primaryGeoId = 'UT-UTAH'
+ orderAdjustmentSalesTax1.taxAuthGeoId = 'UT-UTAH'
+ orderAdjustmentSalesTax1.with {
+ taxAuthPartyId = 'UT_UTAH_TAXMAN'
+ overrideGlAccountId = '224153'
+ comments = 'Utah County, Utah Sales Tax'
+ }
+ shoppingCart.addAdjustment(orderAdjustmentSalesTax1)
+
+ GenericValue orderAdjustmentSalesTax2 = delegator.makeValue('OrderAdjustment')
+ orderAdjustmentSalesTax2.orderAdjustmentTypeId = 'SALES_TAX'
+ orderAdjustmentSalesTax2.orderItemSeqId = '00001'
+ orderAdjustmentSalesTax2.shipGroupSeqId = '00001'
+ orderAdjustmentSalesTax2.amount = 0.384
+ orderAdjustmentSalesTax2.sourcePercentage = 1
+ orderAdjustmentSalesTax2.taxAuthorityRateSeqId = '9000'
+ orderAdjustmentSalesTax2.primaryGeoId = '_NA_'
+ orderAdjustmentSalesTax2.taxAuthGeoId = '_NA_'
+ orderAdjustmentSalesTax2.with {
+ taxAuthPartyId = '_NA_'
+ overrideGlAccountId = '224000'
+ comments = '1% OFB _NA_ Tax'
+ }
+ shoppingCart.addAdjustment(orderAdjustmentSalesTax2)
+
+ shoppingCart.setAllShippingContactMechId('9015')
+ shoppingCart.setAllShipmentMethodTypeId('NEXT_DAY')
+ shoppingCart.setAllCarrierPartyId('UPS')
+ shoppingCart.setAllIsGift(false)
+ shoppingCart.setAllMaySplit(false)
+
+ shoppingCart.setBillFromVendorPartyId('Company')
+ shoppingCart.setPlacingCustomerPartyId('DemoCustomer')
+ shoppingCart.with {
+ setBillToCustomerPartyId('DemoCustomer')
+ setShipToCustomerPartyId('DemoCustomer')
+ setEndUserCustomerPartyId('DemoCustomer')
+ makeAllShipGroupInfos(dispatcher)
+ }
+
+ CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, shoppingCart)
+ Map orderMap = checkOutHelper.createOrder(userLogin)
+ shoppingCart.clear()
+
+ return orderMap
+ }
+}
diff --git a/applications/order/testdef/CustRequestTests.xml b/applications/order/testdef/CustRequestTests.xml
index 55f4840cae..dfdad34ed6 100644
--- a/applications/order/testdef/CustRequestTests.xml
+++ b/applications/order/testdef/CustRequestTests.xml
@@ -27,7 +27,7 @@ under the License.
<entity-xml action="load" entity-xml-url="component://order/testdef/data/QuoteTestData.xml"/>
</test-case>
<test-case case-name="custrequest-tests">
- <simple-method-test location="component://order/minilang/test/CustRequestTests.xml"/>
+ <junit-test-suite class-name="org.apache.ofbiz.order.order.test.CustRequestTests"/>
</test-case>
<test-case case-name="test-cust-request-permission-check">
<junit-test-suite class-name="org.apache.ofbiz.order.order.test.CustRequestPermissionCheckTests"/>
diff --git a/applications/order/testdef/ShoppingCartTests.xml b/applications/order/testdef/ShoppingCartTests.xml
index ea892e8a24..2f5c0cb304 100644
--- a/applications/order/testdef/ShoppingCartTests.xml
+++ b/applications/order/testdef/ShoppingCartTests.xml
@@ -21,27 +21,7 @@ under the License.
<test-suite suite-name="shoppingcarttests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
-
- <test-case case-name="shoppingCart-test">
- <simple-method-test location="component://order/minilang/test/ShoppingCartTests.xml" name="testCreateShoppingCart"/>
- </test-case>
-
- <test-case case-name="productRentalOrder-test">
- <simple-method-test location="component://order/minilang/test/ShoppingCartTests.xml" name="testCreateOrderRentalProduct"/>
- </test-case>
-
- <test-case case-name="productServiceOrder-test">
- <simple-method-test location="component://order/minilang/test/ShoppingCartTests.xml" name="testCreateOrderServiceProduct"/>
- </test-case>
- <test-case case-name="loadCartFromQuote-test">
- <simple-method-test location="component://order/minilang/test/ShoppingCartTests.xml" name="testLoadCartFromQuote"/>
- </test-case>
-
- <test-case case-name="configurableServiceOrder-test">
- <simple-method-test location="component://order/minilang/test/ShoppingCartTests.xml" name="testCreateOrderConfigurableServiceProduct"/>
- </test-case>
-
- <test-case case-name="testOrderMoveItemBetweenShipGoups">
- <simple-method-test location="component://order/minilang/test/ShoppingCartTests.xml" name="testOrderMoveItemBetweenShipGoups"/>
+ <test-case case-name="shoppingcart-tests">
+ <junit-test-suite class-name="org.apache.ofbiz.order.shoppingcart.test.ShoppingCartTests"/>
</test-case>
</test-suite>
diff --git a/applications/party/minilang/test/PartyTests.xml b/applications/party/minilang/test/PartyTests.xml
deleted file mode 100644
index 9563f6a2da..0000000000
--- a/applications/party/minilang/test/PartyTests.xml
+++ /dev/null
@@ -1,1728 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
-
- <simple-method method-name="testFindPartyWithSearchParameters" short-description="Test findparty service on certain search parameters" login-required="false">
- <set field="searchParams.partyId" value="DemoCustomer"/>
- <set field="searchParams.roleTypeId" value="CUSTOMER"/>
- <map-to-map map="searchParams" to-map="serviceCtx"/>
- <call-service service-name="findParty" in-map-name="serviceCtx">
- <results-to-map map-name="partyList"/>
- </call-service>
-
- <find-by-primary-key entity-name="PartyRoleDetailAndPartyDetail" map="searchParams" value-field="partyRoleDetailAndPartyDetail"/>
- <if-not-empty field="partyRoleDetailAndPartyDetail">
- <assert><not><if-empty field="partyList"/></not></assert>
- <else>
- <assert><if-empty field="partyList"/></assert>
- </else>
- </if-not-empty>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testFindPartyWithNoSearchParameters" short-description="Test findparty service when no search parameters are passed" login-required="false">
- <set field="serviceCtx.lookupFlag" value="Y"/>
- <call-service service-name="findParty" in-map-name="serviceCtx">
- <result-to-field result-name="partyList"/>
- </call-service>
- <!-- At least one party will always exists in the system in any case -->
- <assert><not><if-empty field="partyList"/></not></assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyCreditCard" short-description="Test updateCreditCard service" login-required="false">
- <set field="serviceCtx.partyId" value="DemoCustomer"/>
- <find-by-and entity-name="PaymentMethodAndCreditCard" map="serviceCtx" list="paymentMethodAndCreditCards"/>
- <filter-list-by-date list="paymentMethodAndCreditCards"/>
- <first-from-list list="paymentMethodAndCreditCards" entry="paymentMethodAndCreditCard"/>
- <!-- first try with just updating without changing the credit card information -->
- <set-service-fields service-name="updateCreditCard" map="paymentMethodAndCreditCard" to-map="serviceCtx"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
-
- <call-service service-name="updateCreditCard" in-map-name="serviceCtx">
- <result-to-field result-name="paymentMethodId"/>
- <result-to-field result-name="oldPaymentMethodId"/>
- </call-service>
- <clear-field field="paymentMethodAndCreditCard"/>
- <entity-one entity-name="PaymentMethodAndCreditCard" value-field="paymentMethodAndCreditCard"/>
- <assert>
- <not><if-empty field="paymentMethodAndCreditCard"/></not>
- <if-compare-field field="paymentMethodId" to-field="oldPaymentMethodId" operator="equals"/>
- <if-compare-field field="paymentMethodAndCreditCard.cardType" to-field="serviceCtx.cardType" operator="equals"/>
- <if-compare-field field="paymentMethodAndCreditCard.cardNumber" to-field="serviceCtx.cardNumber" operator="equals"/>
- </assert>
- <check-errors/>
-
- <clear-field field="paymentMethodAndCreditCard"/>
- <clear-field field="paymentMethodId"/>
- <clear-field field="oldPaymentMethodId"/>
-
- <!-- try now with few changes (cardType, cardNumber in this case), a new record will be created in PaymentMethod, CreditCard entity -->
- <set field="serviceCtx.cardType" value="CCT_MASTERCARD"/>
- <set field="serviceCtx.cardNumber" value="5500000000000004"/>
- <call-service service-name="updateCreditCard" in-map-name="serviceCtx">
- <result-to-field result-name="paymentMethodId"/>
- <result-to-field result-name="oldPaymentMethodId"/>
- </call-service>
- <entity-one entity-name="PaymentMethodAndCreditCard" value-field="paymentMethodAndCreditCard"/>
- <assert>
- <not><if-empty field="paymentMethodAndCreditCard"/></not>
- <if-compare-field field="paymentMethodId" to-field="oldPaymentMethodId" operator="not-equals"/>
- <if-compare-field field="paymentMethodAndCreditCard.cardType" to-field="serviceCtx.cardType" operator="equals"/>
- <if-compare-field field="paymentMethodAndCreditCard.cardNumber" to-field="serviceCtx.cardNumber" operator="equals"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdateUserPassword" short-description="Test updatePassword service" login-required="false">
- <set field="partyId" value="DemoCustomer"/>
- <set field="userLoginId" value="DemoCustomer"/>
- <call-class-method method-name="findPartyLatestUserLogin" class-name="org.apache.ofbiz.party.party.PartyWorker" ret-field="partyUserLogin">
- <field field="partyId" type="java.lang.String"/>
- <field field="delegator" type="org.apache.ofbiz.entity.Delegator"/>
- </call-class-method>
- <set-service-fields service-name="updatePassword" map="partyUserLogin" to-map="serviceCtx"/>
- <!-- old details: userLoginId = DemoCustomer, password = ofbiz -->
- <set field="serviceCtx.newPassword" value="ofbiz-demo"/>
- <set field="serviceCtx.newPasswordVerify" value="ofbiz-demo"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
-
- <call-service service-name="updatePassword" in-map-name="serviceCtx">
- <result-to-field result-name="updatedUserLogin"/>
- </call-service>
-
- <entity-one entity-name="PartyAndUserLogin" value-field="partyAndUserLogin">
- <field-map field-name="userLoginId" from-field="partyUserLogin.userLoginId"/>
- <field-map field-name="partyId" from-field="partyId"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyAndUserLogin"/></not>
- <if-compare-field field="partyUserLogin.currentPassword" to-field="partyAndUserLogin.currentPassword" operator="not-equals"/>
- <if-compare-field field="partyAndUserLogin.userLoginId" to-field="userLoginId" operator="equals"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyRole" short-description="A test to add a role to a party" login-required="false">
- <set field="partyId" value="DemoCustomer"/>
- <set field="roleTypeId" value="SUPPLIER"/>
- <set field="serviceCtx.partyId" from-field="partyId"/>
- <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/>
- <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testEnsurePartyRole" short-description="A test to ensure the association between a party and a role" login-required="false">
- <set field="partyId" value="DemoCustomer"/>
- <set field="roleTypeId" value="SUPPLIER"/>
- <set field="serviceCtx.partyId" from-field="partyId"/>
- <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/>
- <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/>
- </assert>
- <check-errors/>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="ensurePartyRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/>
- <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/>
- </assert>
- <check-errors/>
- <set field="roleTypeId" value="EMPLOYEE"/>
- <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <if-empty field="partyRole"/>
- </assert>
- <check-errors/>
- <call-service service-name="ensurePartyRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/>
- <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/>
- </assert>
- <check-errors/>
- <!-- test ensure from -->
- <set field="ensurePartyRoleFromCtx.userLogin" from-field="userLogin"/>
- <set field="roleTypeId" value="CONTRACTOR"/>
- <set field="ensurePartyRoleFromCtx.roleTypeIdFrom" from-field="roleTypeId"/>
- <set field="ensurePartyRoleFromCtx.partyIdFrom" from-field="partyId"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <if-empty field="partyRole"/>
- </assert>
- <check-errors/>
- <call-service service-name="ensurePartyRoleFrom" in-map-name="ensurePartyRoleFromCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/>
- <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/>
- </assert>
- <check-errors/>
- <!-- test ensure to -->
- <set field="ensurePartyRoleToCtx.userLogin" from-field="userLogin"/>
- <set field="roleTypeId" value="MANUFACTURER"/>
- <set field="ensurePartyRoleToCtx.roleTypeIdTo" from-field="roleTypeId"/>
- <set field="ensurePartyRoleToCtx.partyIdTo" from-field="partyId"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <if-empty field="partyRole"/>
- </assert>
- <check-errors/>
- <call-service service-name="ensurePartyRoleTo" in-map-name="ensurePartyRoleToCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole"/>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/>
- <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateNewCommEvent" short-description="test to create a new communication event" login-required="false">
- <set field="createNewCommEventMap.communicationEventTypeId" value="EMAIL_COMMUNICATION"/>
- <set field="createNewCommEventMap.statusId" value="COM_ENTERED"/>
- <set field="createNewCommEventMap.partyIdFrom" value="DemoCustomer"/>
- <set field="createNewCommEventMap.contactMechTypeId" value="EMAIL_ADDRESS"/>
- <entity-one entity-name="UserLogin" value-field="createNewCommEventMap.userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <call-service service-name="createCommunicationEvent" in-map-name="createNewCommEventMap">
- <result-to-field result-name="communicationEventId" field="commEventMap.communicationEventId"/>
- </call-service>
- <call-simple-method method-name="inlineUpdateCommEvent"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" from-field="commEventMap.communicationEventId"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEvent"/></not>
- <if-compare-field field="communicationEvent.communicationEventId" to-field="commEventMap.communicationEventId" operator="equals"/>
- <if-compare-field field="communicationEvent.communicationEventTypeId" to-field="updateCommEventMap.communicationEventTypeId" operator="equals"/>
- <if-compare-field field="communicationEvent.statusId" to-field="updateCommEventMap.statusId" operator="equals"/>
- <if-compare-field field="communicationEvent.partyIdFrom" to-field="updateCommEventMap.partyIdFrom" operator="equals"/>
- <if-compare-field field="communicationEvent.contactMechTypeId" to-field="updateCommEventMap.contactMechTypeId" operator="equals"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="inlineUpdateCommEvent" short-description="test to update communication event" login-required="false">
- <set field="updateCommEventMap.communicationEventId" from-field="commEventMap.communicationEventId"/>
- <set field="updateCommEventMap.communicationEventTypeId" value="AUTO_EMAIL_COMM"/>
- <set field="updateCommEventMap.statusId" value="COM_COMPLETE"/>
- <set field="updateCommEventMap.partyIdFrom" value="admin"/>
- <set field="updateCommEventMap.contactMechTypeId" value="ELECTRONIC_ADDRESS"/>
- <entity-one entity-name="UserLogin" value-field="updateCommEventMap.userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <call-service service-name="updateCommunicationEvent" in-map-name="updateCommEventMap"/>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyTelecomNumber" short-description="Test createPartyTelecomNumber service" login-required="false">
- <set field="partyId" value="DemoCustomer"/>
- <set field="serviceCtx.partyId" from-field="partyId"/>
- <set field="serviceCtx.contactMechPurposeTypeId" value="PRIMARY_PHONE"/>
- <set field="serviceCtx.countryCode" value="1"/>
- <set field="serviceCtx.areaCode" value="801"/>
- <set field="serviceCtx.contactNumber" value="888-8888"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyTelecomNumber" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <assert><not><if-empty field="contactMechId"/></not></assert>
-
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert><not><if-empty field="contactMech"/></not></assert>
-
- <entity-one entity-name="TelecomNumber" value-field="telecomNumber"/>
- <assert>
- <not><if-empty field="telecomNumber"/></not>
- <if-compare field="telecomNumber.countryCode" operator="equals" value="1"/>
- <if-compare field="telecomNumber.areaCode" operator="equals" value="801"/>
- <if-compare field="telecomNumber.contactNumber" operator="equals" value="888-8888"/>
- </assert>
-
- <entity-and entity-name="PartyContactMech" list="pcmList" filter-by-date="true">
- <field-map field-name="partyId"/>
- <field-map field-name="contactMechId"/>
- </entity-and>
- <assert><not><if-empty field="pcmList"/></not></assert>
-
- <entity-and entity-name="PartyContactMechPurpose" list="pcmpList" filter-by-date="true">
- <field-map field-name="partyId"/>
- <field-map field-name="contactMechId"/>
- </entity-and>
- <assert><not><if-empty field="pcmpList"/></not></assert>
-
- <first-from-list list="pcmpList" entry="pcmp"/>
- <assert><if-compare field="pcmp.contactMechPurposeTypeId" operator="equals" value="PRIMARY_PHONE"/></assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePerson" short-description="Test case for service createPerson" login-required="false">
- <set field="firstName" value="Demo"/>
- <set field="lastName" value="Person"/>
- <set field="serviceCtx.firstName" from-field="firstName"/>
- <set field="serviceCtx.lastName" from-field="lastName"/>
- <call-service service-name="createPerson" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Party" value-field="party"/>
- <entity-one entity-name="Person" value-field="person"/>
- <assert>
- <not><if-empty field="party"/></not>
- <if-compare field="party.partyTypeId" operator="equals" value="PERSON"/>
- <not><if-empty field="person"/></not>
- <if-compare-field field="person.firstName" operator="equals" to-field="firstName"/>
- <if-compare-field field="person.lastName" operator="equals" to-field="lastName"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateUpdatePersonWithCreate" short-description="Test the service to create a person" login-required="false">
- <set field="serviceCtx.partyId" value="DemoPerson1"/>
- <set field="serviceCtx.firstName" value="Demo"/>
- <set field="serviceCtx.lastName" value="Person1"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createUpdatePerson" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Party" value-field="party"/>
- <entity-one entity-name="Person" value-field="person"/>
- <assert>
- <not><if-empty field="party"/></not>
- <if-compare field="person.firstName" operator="equals" value="Demo"/>
- <if-compare field="person.lastName" operator="equals" value="Person1"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateUpdatePersonWithUpdate" short-description="Test the service to update a person" login-required="false">
- <set field="serviceCtx.partyId" value="DemoPerson1"/>
- <set field="serviceCtx.firstName" value="Demo"/>
- <set field="serviceCtx.lastName" value="Person2"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createUpdatePerson" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Party" value-field="party"/>
- <entity-one entity-name="Person" value-field="person"/>
- <assert>
- <not><if-empty field="party"/></not>
- <not><if-empty field="person"/></not>
- <if-compare field="person.firstName" operator="equals" value="Demo"/>
- <if-compare field="person.lastName" operator="equals" value="Person2"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyGroup" short-description="Test the service to create party group" login-required="false">
- <set field="serviceCtx.partyId" value="DemoGroup1"/>
- <set field="serviceCtx.groupName" value="Demo Group"/>
- <set field="serviceCtx.partyTypeId" value="PARTY_GROUP"/>
- <set field="serviceCtx.statusId" value="PARTY_ENABLED"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyGroup" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="PartyGroup" value-field="partyGroup"/>
- <assert>
- <not><if-empty field="partyGroup"/></not>
- <if-compare field="partyGroup.partyId" operator="equals" value="DemoGroup1"/>
- <if-compare field="partyGroup.groupName" operator="equals" value="Demo Group"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCopyPartyContactMechs" short-description="Test the service copyPartyContactMechs" login-required="false">
- <set field="serviceCtx.partyIdFrom" value="TestCustomer"/>
- <set field="serviceCtx.partyIdTo" value="TestParty"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="copyPartyContactMechs" in-map-name="serviceCtx"/>
- <set field="lookupKeyValue.partyId" value="TestParty"/>
- <find-by-and entity-name="PartyContactMech" map="lookupKeyValue" list="partyContactMechList"/>
- <assert>
- <not><if-empty field="partyContactMechList"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateCommunicationEvent" short-description="Test the service createCommunicationEvent" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-3"/>
- <set field="serviceCtx.communicationEventTypeId" value="EMAIL_COMMUNICATION"/>
- <set field="serviceCtx.statusId" value="COM_COMPLETE"/>
- <set field="serviceCtx.fromString" value="send@example.com"/>
- <set field="serviceCtx.toString" value="receive@example.com"/>
- <set field="serviceCtx.subject" value="Why i would use the OFBiz system"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createCommunicationEvent" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" value="TestEvent-3"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEvent"/></not>
- <if-compare operator="equals" field="communicationEvent.statusId" value="COM_COMPLETE"/>
- <if-compare operator="equals" field="communicationEvent.subject" value="Why i would use the OFBiz system"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateCommunicationEventRole" short-description="Test the service createCommunicationEventRole" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-6"/>
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.roleTypeId" value="ADDRESSEE"/>
- <set field="serviceCtx.statusId" value="COM_ROLE_CREATED"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createCommunicationEventRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEventRole" value-field="communicationEventRole">
- <field-map field-name="communicationEventId" value="TestEvent-6"/>
- <field-map field-name="roleTypeId" value="ADDRESSEE"/>
- <field-map field-name="partyId" value="TestCompany"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEventRole"/></not>
- <if-compare operator="equals" field="communicationEventRole.statusId" value="COM_ROLE_CREATED"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateCommunicationEventRoleWithoutPermission" short-description="Test the service createCommunicationEventRoleWithoutPermission" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-6"/>
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.roleTypeId" value="INTERNAL_ORGANIZATIO"/>
- <set field="serviceCtx.statusId" value="COM_ROLE_CREATED"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createCommunicationEventRoleWithoutPermission" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEventRole" value-field="communicationEventRole">
- <field-map field-name="communicationEventId" value="TestEvent-6"/>
- <field-map field-name="roleTypeId" value="INTERNAL_ORGANIZATIO"/>
- <field-map field-name="partyId" value="TestCompany"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEventRole"/></not>
- <if-compare operator="equals" field="communicationEventRole.statusId" value="COM_ROLE_CREATED"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateCommunicationEventWithoutPermission" short-description="Test the service createCommunicationEventWithoutPermission" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-4"/>
- <set field="serviceCtx.communicationEventTypeId" value="EMAIL_COMMUNICATION"/>
- <set field="serviceCtx.statusId" value="COM_COMPLETE"/>
- <set field="serviceCtx.fromString" value="send@example.com"/>
- <set field="serviceCtx.toString" value="receive@example.com"/>
- <set field="serviceCtx.subject" value="Why i would use the OFBiz system"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createCommunicationEventWithoutPermission" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" value="TestEvent-4"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEvent"/></not>
- <if-compare operator="equals" field="communicationEvent.statusId" value="COM_COMPLETE"/>
- <if-compare operator="equals" field="communicationEvent.subject" value="Why i would use the OFBiz system"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateContactMech" short-description="Test the service createContactMech" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestEmailConactMech"/>
- <set field="serviceCtx.contactMechTypeId" value="EMAIL_ADDRESS"/>
- <set field="serviceCtx.infoString" value="test_email@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createContactMech" in-map-name="serviceCtx"/>
- <entity-one entity-name="ContactMech" value-field="contactMech">
- <field-map field-name="contactMechId" value="TestEmailConactMech"/>
- </entity-one>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare field="contactMech.infoString" operator="equals" value="test_email@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateEmailAddress" short-description="Test the service createEmailAddress" login-required="false">
- <set field="serviceCtx.emailAddress" value="test.email123@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare field="contactMech.infoString" operator="equals" value="test.email123@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyContactMech" short-description="Test the service createPartyContactMech" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestContactMech3"/>
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.contactMechTypeId" value="EMAIL_ADDRESS"/>
- <call-service service-name="createPartyContactMech" in-map-name="serviceCtx"/>
- <entity-and entity-name="PartyContactMech" list="partyContactMechList">
- <field-map field-name="contactMechId" value="TestContactMech3"/>
- <field-map field-name="partyId" value="TestCustomer"/>
- </entity-and>
- <first-from-list entry="partyContactMech" list="partyContactMechList"/>
- <assert>
- <not><if-empty field="partyContactMech"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyDataSource" short-description="Test the service createPartyDataSource" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.dataSourceId" value="MY_PORTAL"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 01:01:01" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyDataSource" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyDataSource" value-field="partyDataSource">
- <field-map field-name="partyId" value="TestCustomer"/>
- <field-map field-name="dataSourceId" value="MY_PORTAL"/>
- <field-map field-name="fromDate" value="2009-09-09 01:01:01"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyDataSource"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyEmailAddress" short-description="Test the service createPartyEmailAddress" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.emailAddress" value="test.email1234@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare field="contactMech.infoString" operator="equals" value="test.email1234@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyIdentifications" short-description="Test the service createPartyIdentifications" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="partyIdentificationTypeId" value="CARD_ID"/>
- <set field="partyIdentification.partyIdentificationTypeId" from-field="partyIdentificationTypeId"/>
- <set field="partyIdentification.${partyIdentificationTypeId}" value="123456789"/>
- <set field="serviceCtx.identifications" from-field="partyIdentification"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyIdentifications" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyIdentification" value-field="partyIdentification">
- <field-map field-name="partyId" value="TestCustomer"/>
- <field-map field-name="partyIdentificationTypeId" value="CARD_ID"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyIdentification"/></not>
- <if-compare operator="equals" field="partyIdentification.idValue" value="123456789"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyNote" short-description="Test the service to create party note" login-required="false">
- <set field="serviceCtx.partyId" value="DemoCustomer"/>
- <set field="noteId" value="DemoNote"/>
- <set field="serviceCtx.noteName" value="Demo Note"/>
- <set field="serviceCtx.note" value="This is demo note to test createPartyNote service"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyNote" in-map-name="serviceCtx">
- <result-to-field result-name="noteId"/>
- </call-service>
- <entity-one entity-name="PartyNote" value-field="partyNote">
- <field-map field-name="partyId" value="DemoCustomer"/>
- </entity-one>
- <entity-one entity-name="NoteData" value-field="noteData"/>
- <assert>
- <not><if-empty field="partyNote"/></not>
- <not><if-empty field="noteData"/></not>
- <if-compare field="noteData.noteName" operator="equals" value="Demo Note"/>
- <if-compare field="noteData.noteInfo" operator="equals" value="This is demo note to test createPartyNote service"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreatePartyRelationship" short-description="Test the service to create PartyRelationship" login-required="false">
- <set field="serviceCtx.partyIdFrom" value="TestCompany"/>
- <set field="serviceCtx.partyIdTo" value="TestCustomer"/>
- <set field="serviceCtx.roleTypeIdFrom" value="INTERNAL_ORGANIZATIO"/>
- <set field="serviceCtx.roleTypeIdTo" value="CONTACT"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 01:01:01"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyRelationship" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="PartyRelationship" value-field="partyRelationship">
- <field-map field-name="partyIdFrom" value="TestCompany"/>
- <field-map field-name="partyIdTo" value="TestCustomer"/>
- <field-map field-name="roleTypeIdFrom" value="INTERNAL_ORGANIZATIO"/>
- <field-map field-name="roleTypeIdTo" value="CONTACT"/>
- <field-map field-name="fromDate" value="2009-09-09 01:01:01"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyRelationship"/></not>
- </assert>
- </simple-method>
- <simple-method method-name="testCreatePartyRelationshipAndRole" short-description="Test the service to create PartyRelationship and PartyRole" login-required="false">
- <set field="serviceCtx.partyIdFrom" value="TestCompany"/>
- <set field="serviceCtx.partyIdTo" value="TestCustomer"/>
- <set field="serviceCtx.roleTypeIdFrom" value="BUYER"/>
- <set field="serviceCtx.roleTypeIdTo" value="ACCOUNT_LEAD"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 01:01:01" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyRelationshipAndRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole">
- <field-map field-name="partyId" value="TestCompany"/>
- <field-map field-name="roleTypeId" value="BUYER"/>
- </entity-one>
- <entity-one entity-name="PartyRelationship" value-field="partyRelationship">
- <field-map field-name="partyIdFrom" value="TestCompany"/>
- <field-map field-name="partyIdTo" value="TestCustomer"/>
- <field-map field-name="roleTypeIdFrom" value="BUYER"/>
- <field-map field-name="roleTypeIdTo" value="ACCOUNT_LEAD"/>
- <field-map field-name="fromDate" value="2009-09-09 01:01:01"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <not><if-empty field="partyRelationship"/></not>
- </assert>
- </simple-method>
- <simple-method method-name="testCreatePartyRelationshipContactAccount" short-description="Test the service createPartyRelationshipContactAccount" login-required="false">
- <set field="serviceCtx.accountPartyId" value="TestParty"/>
- <set field="serviceCtx.contactPartyId" value="TestCustomer"/>
- <set field="serviceCtx.comments" value="This is a test party contact account relationship"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyRelationshipContactAccount" in-map-name="serviceCtx"/>
- <set field="lookupKeyValue.partyIdFrom" value="TestParty"/>
- <set field="lookupKeyValue.partyIdTo" value="TestCustomer"/>
- <set field="lookupKeyValue.roleTypeIdFrom" value="ACCOUNT"/>
- <set field="lookupKeyValue.roleTypeIdTo" value="CONTACT"/>
- <find-by-and entity-name="PartyRelationship" map="lookupKeyValue" list="partyRelationshipList"/>
- <assert>
- <not><if-empty field="partyRelationshipList"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePersonAndUserLogin" short-description="Test the service to create person and user login" login-required="false">
- <set field="serviceCtx.partyId" value="DemoPerson"/>
- <set field="serviceCtx.firstName" value="Demo"/>
- <set field="serviceCtx.lastName" value="Person"/>
- <set field="serviceCtx.userLoginId" value="demo.person"/>
- <set field="serviceCtx.currentPassword" value="ofbiz"/>
- <set field="serviceCtx.currentPasswordVerify" value="ofbiz"/>
- <call-service service-name="createPersonAndUserLogin" in-map-name="serviceCtx">
- <result-to-field result-name="newUserLogin"/>
- </call-service>
- <get-related-one value-field="newUserLogin" relation-name="Person" to-value-field="person"/>
- <assert>
- <not><if-empty field="newUserLogin"/></not>
- <if-compare field="newUserLogin.partyId" operator="equals" value="DemoPerson"/>
- <if-compare field="person.firstName" operator="equals" value="Demo"/>
- <if-compare field="person.lastName" operator="equals" value="Person"/>
- <if-compare field="newUserLogin.userLoginId" operator="equals" value="demo.person"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePostalAddress" short-description="Test the service createPostalAddress" login-required="false">
- <set field="serviceCtx.toName" value="Test Address"/>
- <set field="serviceCtx.address1" value="2004 Factory Blvd"/>
- <set field="serviceCtx.city" value="City of Industry"/>
- <set field="serviceCtx.countryGeoId" value="USA"/>
- <set field="serviceCtx.stateProvinceGeoId" value="CA"/>
- <set field="serviceCtx.postalCode" value="90000"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPostalAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="PostalAddress" value-field="postalAddress"/>
- <assert>
- <not><if-empty field="postalAddress"/></not>
- <if-compare field="postalAddress.address1" operator="equals" value="2004 Factory Blvd"/>
- <if-compare field="postalAddress.city" operator="equals" value="City of Industry"/>
- <if-compare field="postalAddress.postalCode" operator="equals" value="90000"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateTelecomNumber" short-description="Test the service createTelecomNumber" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestTelecomNumber"/>
- <set field="serviceCtx.areaCode" value="801"/>
- <set field="serviceCtx.contactNumber" value="1111111"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createTelecomNumber" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="TelecomNumber" value-field="telecomNumber"/>
- <assert>
- <not><if-empty field="telecomNumber"/></not>
- <if-compare field="telecomNumber.areaCode" operator="equals" value="801"/>
- <if-compare field="telecomNumber.contactNumber" operator="equals" value="1111111"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateUpdatePartyRelationshipAndRoles" short-description="Test the service to create/update PartyRelationship and PartyRole" login-required="false">
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.partyIdFrom" value="TestCompany"/>
- <set field="serviceCtx.partyIdTo" value="TestCustomer"/>
- <set field="serviceCtx.roleTypeIdFrom" value="BUYER"/>
- <set field="serviceCtx.roleTypeIdTo" value="ACCOUNT_LEAD"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 01:01:01" type="Timestamp"/>
- <set field="serviceCtx.partyRelationshipTypeId" value="AGENT"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createUpdatePartyRelationshipAndRoles" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole">
- <field-map field-name="partyId" value="TestCompany"/>
- <field-map field-name="roleTypeId" value="BUYER"/>
- </entity-one>
- <entity-one entity-name="PartyRelationship" value-field="partyRelationship">
- <field-map field-name="partyIdFrom" value="TestCompany"/>
- <field-map field-name="partyIdTo" value="TestCustomer"/>
- <field-map field-name="roleTypeIdFrom" value="BUYER"/>
- <field-map field-name="roleTypeIdTo" value="ACCOUNT_LEAD"/>
- <field-map field-name="fromDate" value="2009-09-09 01:01:01"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyRole"/></not>
- <not><if-empty field="partyRelationship"/></not>
- <if-compare field="serviceCtx.partyRelationshipTypeId" operator="equals" value="AGENT"/>
- </assert>
- </simple-method>
-
- <simple-method method-name="testDeleteCommunicationEvent" short-description="Test the service deleteCommunicationEvent" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-1"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deleteCommunicationEvent" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" value="TestEvent-1"/>
- </entity-one>
- <assert>
- <if-empty field="communicationEvent"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testDeleteCommunicationEventWorkEffort" short-description="Test the service deleteCommunicationEventWorkEffort" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-5"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deleteCommunicationEventWorkEffort" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" value="TestEvent-5"/>
- </entity-one>
- <set field="lookupValue.communicationEventId" value="TestEvent-5"/>
- <find-by-and entity-name="CommunicationEventWorkEff" map="lookupValue" list="communicationEventWorkEff"/>
- <assert>
- <if-empty field="communicationEvent"/>
- <if-empty field="communicationEventWorkEff"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testExpirePartyContactMechPurpose" short-description="Test the service expirePartyContactMechPurpose" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.contactMechId" value="TestContactMech"/>
- <set field="serviceCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
- <set field="serviceCtx.fromDate" value="2000-01-01 00:00:00" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="expirePartyContactMechPurpose" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyContactMechPurpose" value-field="partyContactMechPurpose">
- <field-map field-name="partyId" value="TestCustomer"/>
- <field-map field-name="contactMechId" value="TestContactMech"/>
- <field-map field-name="contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
- <field-map field-name="fromDate" value="2000-01-01 00:00:00"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyContactMechPurpose"/></not>
- <not><if-empty field="partyContactMechPurpose.thruDate"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testDeletePartyRelationship" short-description="Test the service to delete PartyRelationship" login-required="false">
- <set field="serviceCtx.partyIdFrom" value="TestCompany"/>
- <set field="serviceCtx.partyIdTo" value="TestCustomer"/>
- <set field="serviceCtx.roleTypeIdFrom" value="_NA_"/>
- <set field="serviceCtx.roleTypeIdTo" value="CONTACT"/>
- <set field="serviceCtx.fromDate" value="2000-01-01 00:00:00"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deletePartyRelationship" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyRelationship" value-field="partyRelationship">
- <field-map field-name="partyIdFrom" value="TestCompany"/>
- <field-map field-name="partyIdTo" value="TestCustomer"/>
- <field-map field-name="roleTypeIdFrom" value="_NA_"/>
- <field-map field-name="roleTypeIdTo" value="CONTACT"/>
- <field-map field-name="fromDate" value="2000-01-01 00:00:00"/>
- </entity-one>
- <assert>
- <if-empty field="partyRelationship"/>
- </assert>
- </simple-method>
-
- <simple-method method-name="testDeletePartyRole" short-description="A test to delete a role from party" login-required="false">
- <set field="partyId" value="TestCustomer"/>
- <set field="roleTypeId" value="ACCOUNTANT"/>
- <set field="serviceCtx.partyId" from-field="partyId"/>
- <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deletePartyRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyRole" value-field="partyRole">
- <field-map field-name="partyId" value="TestCustomer"/>
- <field-map field-name="roleTypeId" value="ACCOUNTANT"/>
- </entity-one>
- <assert>
- <if-empty field="partyRole"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testFindPartiesById" short-description="Test the service findPartiesById" login-required="false">
- <set field="serviceCtx.idToFind" value="TestCustomer"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="findPartiesById" in-map-name="serviceCtx">
- <result-to-field result-name="party"/>
- </call-service>
- <assert>
- <not><if-empty field="party"/></not>
- <if-compare field="party.partyId" operator="equals" value="TestCustomer"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testFindPartyFromEmailAddress" short-description="Test the service findPartyFromEmailAddress" login-required="false">
- <set field="serviceCtx.address" value="newtest_email@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="findPartyFromEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Party" value-field="party"/>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="party"/></not>
- <not><if-empty field="contactMech"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testFindPartyFromTelephone" short-description="Test the service findPartyFromTelephone" login-required="false">
- <set field="serviceCtx.telno" value="801555-5555"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="findPartyFromTelephone" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Party" value-field="party"/>
- <assert>
- <not><if-empty field="party"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testFindPartyFromTelephoneComplete" short-description="Test the service findPartyFromTelephoneComplete" login-required="false">
- <set field="serviceCtx.telno" value="801555-5555"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="findPartyFromTelephoneComplete" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Party" value-field="party"/>
- <assert>
- <not><if-empty field="party"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testRemoveCommunicationEventRole" short-description="Test the service removeCommunicationEventRole" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-5"/>
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.roleTypeId" value="ADDRESSEE"/>
- <set field="serviceCtx.statusId" value="COM_ROLE_CREATED"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="removeCommunicationEventRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEventRole" value-field="communicationEventRole">
- <field-map field-name="communicationEventId" value="TestEvent-5"/>
- <field-map field-name="roleTypeId" value="ADDRESSEE"/>
- <field-map field-name="partyId" value="TestCompany"/>
- </entity-one>
- <assert>
- <if-empty field="communicationEventRole"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testSetCommEventComplete" short-description="Test the service setCommEventComplete" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-6"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="setCommEventComplete" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" value="TestEvent-6"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEvent"/></not>
- <if-compare operator="equals" field="communicationEvent.statusId" value="COM_COMPLETE"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testSetCommEventRoleToRead" short-description="Test the service setCommEventRoleToRead" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-7"/>
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.roleTypeId" value="ADDRESSEE"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="setCommEventRoleToRead" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEventRole" value-field="communicationEventRole">
- <field-map field-name="communicationEventId" value="TestEvent-7"/>
- <field-map field-name="partyId" value="TestCompany"/>
- <field-map field-name="roleTypeId" value="ADDRESSEE"/>
- <field-map field-name="statusId" value="COM_ROLE_READ"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEventRole"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testSetCommunicationEventStatus" short-description="Test the service setCommunicationEventStatus" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-6"/>
- <set field="serviceCtx.statusId" value="COM_COMPLETE"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="setCommunicationEventStatus" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" value="TestEvent-6"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEvent"/></not>
- <if-compare field="communicationEvent.statusId" operator="equals" value="COM_COMPLETE"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdateCommunicationEvent" short-description="Test the service updateCommunicationEvent" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-7"/>
- <set field="serviceCtx.statusId" value="COM_COMPLETE"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateCommunicationEvent" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEvent" value-field="communicationEvent">
- <field-map field-name="communicationEventId" value="TestEvent-7"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEvent"/></not>
- <if-compare operator="equals" field="communicationEvent.statusId" value="COM_COMPLETE"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdateCommunicationEventRole" short-description="Test the service updateCommunicationEventRole" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-2"/>
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.roleTypeId" value="ADDRESSEE"/>
- <set field="serviceCtx.statusId" value="COM_ROLE_READ"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateCommunicationEventRole" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEventRole" value-field="communicationEventRole">
- <field-map field-name="communicationEventId" value="TestEvent-2"/>
- <field-map field-name="roleTypeId" value="ADDRESSEE"/>
- <field-map field-name="partyId" value="TestCompany"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEventRole"/></not>
- <if-compare operator="equals" field="communicationEventRole.statusId" value="COM_ROLE_READ"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testSetCommunicationEventRoleStatus" short-description="Test the service setCommunicationEventRoleStatus" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-2"/>
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.roleTypeId" value="ADDRESSEE"/>
- <set field="serviceCtx.statusId" value="COM_ROLE_COMPLETED"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="setCommunicationEventRoleStatus" in-map-name="serviceCtx"/>
- <entity-one entity-name="CommunicationEventRole" value-field="communicationEventRole">
- <field-map field-name="communicationEventId" value="TestEvent-2"/>
- <field-map field-name="partyId" value="TestCompany"/>
- <field-map field-name="roleTypeId" value="ADDRESSEE"/>
- <field-map field-name="statusId" value="COM_ROLE_COMPLETED"/>
- </entity-one>
- <assert>
- <not><if-empty field="communicationEventRole"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdateContactMech" short-description="Test the service createContactMech" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestContactMech"/>
- <set field="serviceCtx.contactMechTypeId" value="EMAIL_ADDRESS"/>
- <set field="serviceCtx.infoString" value="demo_email@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateContactMech" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare field="contactMech.infoString" operator="equals" value="demo_email@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdateEmailAddress" short-description="Test the service updateEmailAddress" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestContactMech"/>
- <set field="serviceCtx.emailAddress" value="test.email123@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare field="contactMech.infoString" operator="equals" value="test.email123@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyEmailAddress" short-description="Test the service updatePartyEmailAddress" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.contactMechId" value="TestContactMech"/>
- <set field="serviceCtx.emailAddress" value="test.email12345@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePartyEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare field="contactMech.infoString" operator="equals" value="test.email12345@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyGroup" short-description="Test the service to update party group" login-required="false">
- <set field="serviceCtx.partyId" value="TestGroup-1"/>
- <set field="serviceCtx.groupName" value="Test Party Group"/>
- <set field="serviceCtx.logoImageUrl" value="/images/ofbiz_logo.png"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePartyGroup" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyGroup" value-field="partyGroup">
- <field-map field-name="partyId" value="TestGroup-1"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyGroup"/></not>
- <if-compare field="partyGroup.groupName" operator="equals" value="Test Party Group"/>
- <if-compare field="partyGroup.logoImageUrl" operator="equals" value="/images/ofbiz_logo.png"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyPostalAddress" short-description="Test the service updatePartyPostalAddress" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestPostalAdd2"/>
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.toName" value="Test Address"/>
- <set field="serviceCtx.address1" value="2004 Factory Blvd"/>
- <set field="serviceCtx.city" value="City of Industry"/>
- <set field="serviceCtx.countryGeoId" value="USA"/>
- <set field="serviceCtx.stateProvinceGeoId" value="CA"/>
- <set field="serviceCtx.postalCode" value="90000"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePartyPostalAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="PostalAddress" value-field="postalAddress"/>
- <assert>
- <not><if-empty field="postalAddress"/></not>
- <if-compare field="postalAddress.address1" operator="equals" value="2004 Factory Blvd"/>
- <if-compare field="postalAddress.city" operator="equals" value="City of Industry"/>
- <if-compare field="postalAddress.postalCode" operator="equals" value="90000"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyRelationship" short-description="Test the service to update PartyRelationship" login-required="false">
- <set field="serviceCtx.partyIdFrom" value="TestCompany"/>
- <set field="serviceCtx.partyIdTo" value="TestParty"/>
- <set field="serviceCtx.roleTypeIdFrom" value="_NA_"/>
- <set field="serviceCtx.roleTypeIdTo" value="CONTACT"/>
- <set field="serviceCtx.fromDate" value="2000-01-01 00:00:00"/>
- <set field="serviceCtx.partyRelationshipTypeId" value="AGENT"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePartyRelationship" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="PartyRelationship" value-field="partyRelationship">
- <field-map field-name="partyIdFrom" value="TestCompany"/>
- <field-map field-name="partyIdTo" value="TestParty"/>
- <field-map field-name="roleTypeIdFrom" value="_NA_"/>
- <field-map field-name="roleTypeIdTo" value="CONTACT"/>
- <field-map field-name="fromDate" value="2000-01-01 00:00:00"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyRelationship"/></not>
- <if-compare field="partyRelationship.partyRelationshipTypeId" operator="equals" value="AGENT"/>
- </assert>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyTelecomNumber" short-description="Test the service updatePartyTelecomNumber" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.contactMechId" value="TestContactMech1"/>
- <set field="serviceCtx.areaCode" value="801"/>
- <set field="serviceCtx.contactNumber" value="1111111"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePartyTelecomNumber" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="TelecomNumber" value-field="telecomNumber"/>
- <assert>
- <not><if-empty field="telecomNumber"/></not>
- <if-compare field="telecomNumber.areaCode" operator="equals" value="801"/>
- <if-compare field="telecomNumber.contactNumber" operator="equals" value="1111111"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePerson" short-description="Test the service to update person" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.firstName" value="New Test"/>
- <set field="serviceCtx.lastName" value="Person"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePerson" in-map-name="serviceCtx"/>
- <entity-one entity-name="Person" value-field="person">
- <field-map field-name="partyId" value="TestCustomer"/>
- </entity-one>
- <assert>
- <not><if-empty field="person"/></not>
- <if-compare field="person.firstName" operator="equals" value="New Test"/>
- <if-compare field="person.lastName" operator="equals" value="Person"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePostalAddress" short-description="Test the service updatePostalAddress" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestPostalAdd1"/>
- <set field="serviceCtx.toName" value="Test Address"/>
- <set field="serviceCtx.address1" value="2004 Factory Blvd"/>
- <set field="serviceCtx.city" value="City of Industry"/>
- <set field="serviceCtx.countryGeoId" value="USA"/>
- <set field="serviceCtx.stateProvinceGeoId" value="CA"/>
- <set field="serviceCtx.postalCode" value="90000"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePostalAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- <result-to-field result-name="oldContactMechId"/>
- </call-service>
- <entity-one entity-name="PostalAddress" value-field="postalAddress"/>
- <assert>
- <not><if-empty field="postalAddress"/></not>
- <if-compare field="postalAddress.address1" operator="equals" value="2004 Factory Blvd"/>
- <if-compare field="postalAddress.city" operator="equals" value="City of Industry"/>
- <if-compare field="postalAddress.postalCode" operator="equals" value="90000"/>
- <if-compare-field operator="not-equals" field="contactMechId" to-field="oldContactMechId"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdateTelecomNumber" short-description="Test the service updateTelecomNumber" login-required="false">
- <set field="serviceCtx.contactMechId" value="TestContactMech1"/>
- <set field="serviceCtx.areaCode" value="801"/>
- <set field="serviceCtx.contactNumber" value="1111111"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateTelecomNumber" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- <result-to-field result-name="oldContactMechId"/>
- </call-service>
- <entity-one entity-name="TelecomNumber" value-field="telecomNumber"/>
- <assert>
- <not><if-empty field="telecomNumber"/></not>
- <if-compare field="telecomNumber.areaCode" operator="equals" value="801"/>
- <if-compare field="telecomNumber.contactNumber" operator="equals" value="1111111"/>
- <if-compare-field operator="not-equals" field="contactMechId" to-field="oldContactMechId"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testLookupParty" short-description="Test the service to lookupParty" login-required="false">
- <set field="serviceCtx.firstName" value="Test"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="lookupParty" in-map-name="serviceCtx">
- <result-to-field result-name="lookupResult"/>
- </call-service>
- <assert>
- <not><if-empty field="lookupResult"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testGetPartyEmail" short-description="Test the service getPartyEmail" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="getPartyEmail" in-map-name="serviceCtx">
- <result-to-field result-name="emailAddress"/>
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <assert>
- <not><if-empty field="emailAddress"/></not>
- <not><if-empty field="contactMechId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateAffiliate" short-description="Test the service createAffiliate" login-required="false">
- <set field="serviceCtx.partyId" value="TestCompany"/>
- <set field="serviceCtx.affiliateName" value="Test Affiliate"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createAffiliate" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Affiliate" value-field="affiliate"/>
- <assert>
- <not><if-empty field="affiliate"/></not>
- <if-compare field="affiliate.affiliateName" operator="equals" value="Test Affiliate"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdateAffiliate" short-description="Test the service updateAffiliate" login-required="false">
- <set field="serviceCtx.partyId" value="TestGroup-1"/>
- <set field="serviceCtx.affiliateName" value="Test Affiliate"/>
- <set field="serviceCtx.siteType" value="Main Site"/>
- <set field="serviceCtx.siteVisitors" value="2000"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateAffiliate" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Affiliate" value-field="affiliate">
- <field-map field-name="partyId" value="TestGroup-1"/>
- <field-map field-name="affiliateName" value="Test Affiliate"/>
- </entity-one>
- <assert>
- <not><if-empty field="affiliate"/></not>
- <if-compare field="affiliate.siteType" operator="equals" value="Main Site"/>
- <if-compare field="affiliate.siteVisitors" operator="equals" value="2000"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testGetPartyMainRole" short-description="Test the service getPartyMainRole" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="getPartyMainRole" in-map-name="serviceCtx">
- <result-to-field result-name="roleTypeId"/>
- </call-service>
- <entity-one entity-name="PartyRole" value-field="partyRole">
- <field-map field-name="partyId" value="TestCustomer"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyRole"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testGetPartyTelephone" short-description="Test the service getPartyTelephone" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="getPartyTelephone" in-map-name="serviceCtx">
- <result-to-field result-name="contactNumber"/>
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <assert>
- <not><if-empty field="contactNumber"/></not>
- <not><if-empty field="contactMechId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testQuickCreateCustomer" short-description="Test the service quickCreateCustomer" login-required="false">
- <set field="serviceCtx.firstName" value="Test"/>
- <set field="serviceCtx.lastName" value="Customer"/>
- <set field="serviceCtx.emailAddress" value="test.customer@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="quickCreateCustomer" in-map-name="serviceCtx">
- <result-to-field result-name="partyId"/>
- </call-service>
- <entity-one entity-name="Person" value-field="person"/>
- <entity-one entity-name="PartyRole" value-field="partyRole">
- <field-map field-name="roleTypeId" value="CUSTOMER"/>
- </entity-one>
- <assert>
- <not><if-empty field="person"/></not>
- <not><if-empty field="partyRole"/></not>
- <if-compare field="person.firstName" operator="equals" value="Test"/>
- <if-compare field="person.lastName" operator="equals" value="Customer"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateAddressMatchMap" short-description="Test the service createAddressMatchMap" login-required="false">
- <set field="serviceCtx.mapKey" value="TEST_KEY"/>
- <set field="serviceCtx.mapValue" value="TEST VALUE"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createAddressMatchMap" in-map-name="serviceCtx"/>
- <entity-one entity-name="AddressMatchMap" value-field="addressMatchMap">
- <field-map field-name="mapKey" value="TEST_KEY"/>
- <field-map field-name="mapValue" value="TEST VALUE"/>
- </entity-one>
- <assert>
- <not><if-empty field="addressMatchMap"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testRemoveAddressMatchMap" short-description="Test the service removeAddressMatchMap" login-required="false">
- <set field="serviceCtx.mapKey" value="TESTKEY-1"/>
- <set field="serviceCtx.mapValue" value="Test Value 1"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="removeAddressMatchMap" in-map-name="serviceCtx"/>
- <entity-one entity-name="AddressMatchMap" value-field="addressMatchMap">
- <field-map field-name="mapKey" value="TESTKEY-1"/>
- <field-map field-name="mapValue" value="Test Value 1"/>
- </entity-one>
- <assert>
- <if-empty field="addressMatchMap"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyInvitation" short-description="Test the service createPartyInvitation" login-required="false">
- <set field="serviceCtx.partyIdFrom" value="TestCompany"/>
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.emailAddress" value="test_email@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyInvitation" in-map-name="serviceCtx">
- <result-to-field result-name="partyInvitationId"/>
- </call-service>
- <entity-one entity-name="PartyInvitation" value-field="partyInvitation"/>
- <assert>
- <not><if-empty field="partyInvitation"/></not>
- <if-compare operator="equals" field="partyInvitation.emailAddress" value="test_email@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyInvitation" short-description="Test the service updatePartyInvitation" login-required="false">
- <set field="serviceCtx.partyInvitationId" value="TEST_INVITE"/>
- <set field="serviceCtx.emailAddress" value="test_email@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePartyInvitation" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyInvitation" value-field="partyInvitation">
- <field-map field-name="partyInvitationId" value="TEST_INVITE"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyInvitation"/></not>
- <if-compare operator="equals" field="partyInvitation.emailAddress" value="test_email@example.com"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testDeletePartyInvitation" short-description="Test the service deletePartyInvitation" login-required="false">
- <set field="serviceCtx.partyInvitationId" value="TEST_INVITE-1"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deletePartyInvitation" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyInvitation" value-field="partyInvitation">
- <field-map field-name="partyInvitationId" value="TEST_INVITE-1"/>
- </entity-one>
- <assert>
- <if-empty field="partyInvitation"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testGetPartyPostalAddress" short-description="Test the service getPartyPostalAddress" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="getPartyPostalAddress" in-map-name="serviceCtx">
- <result-to-field result-name="address1"/>
- <result-to-field result-name="countryGeoId"/>
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <assert>
- <not><if-empty field="address1"/></not>
- <not><if-empty field="countryGeoId"/></not>
- <not><if-empty field="contactMechId"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyContactMechPurpose" short-description="Test the service createPartyContactMechPurpose" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.contactMechId" value="TestContactMech"/>
- <set field="serviceCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 01:01:01" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyContactMechPurpose" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyContactMechPurpose" value-field="partyContactMechPurpose">
- <field-map field-name="partyId" value="TestCustomer"/>
- <field-map field-name="contactMechId" value="TestContactMech"/>
- <field-map field-name="contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
- <field-map field-name="fromDate" value="2009-09-09 01:01:01"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyContactMechPurpose"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreateEmailAddressVerification" short-description="Test the service createEmailAddressVerification" login-required="false">
- <set field="serviceCtx.emailAddress" value="test_email@example.com"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createEmailAddressVerification" in-map-name="serviceCtx">
- <result-to-field result-name="verifyHash"/>
- </call-service>
- <entity-one entity-name="EmailAddressVerification" value-field="emailAddressVerification">
- <field-map field-name="emailAddress" value="test_email@example.com"/>
- </entity-one>
- <assert>
- <not><if-empty field="emailAddressVerification"/></not>
- <if-compare-field operator="equals" field="emailAddressVerification.verifyHash" to-field="verifyHash"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyInvitationRoleAssoc" short-description="Test the service createPartyInvitationRoleAssoc" login-required="false">
- <set field="serviceCtx.partyInvitationId" value="TEST_INVITE"/>
- <set field="serviceCtx.roleTypeId" value="COMMEVENT_ROLE"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyInvitationRoleAssoc" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyInvitationRoleAssoc" value-field="partyInvitationRoleAssoc">
- <field-map field-name="partyInvitationId" value="TEST_INVITE"/>
- <field-map field-name="roleTypeId" value="COMMEVENT_ROLE"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyInvitationRoleAssoc"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testDeletePartyInvitationRoleAssoc" short-description="Test the service deletePartyInvitationRoleAssoc" login-required="false">
- <set field="serviceCtx.partyInvitationId" value="TEST_INVITE-2"/>
- <set field="serviceCtx.roleTypeId" value="COMMEVENT_ROLE"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deletePartyInvitationRoleAssoc" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyInvitationRoleAssoc" value-field="partyInvitationRoleAssoc">
- <field-map field-name="partyInvitationId" value="TEST_INVITE-2"/>
- <field-map field-name="roleTypeId" value="COMMEVENT_ROLE"/>
- </entity-one>
- <assert>
- <if-empty field="partyInvitationRoleAssoc"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePostalAddressAndPurposes" short-description="Test the service updatePostalAddressAndPurposes" login-required="false">
- <set field="serviceCtx.partyId" value="TestCustomer"/>
- <set field="serviceCtx.contactMechId" value="TestPostalAdd3"/>
- <set field="serviceCtx.toName" value="Test Address"/>
- <set field="serviceCtx.address1" value="2004 Factory Blvd"/>
- <set field="serviceCtx.city" value="City of Industry"/>
- <set field="serviceCtx.countryGeoId" value="USA"/>
- <set field="serviceCtx.stateProvinceGeoId" value="CA"/>
- <set field="serviceCtx.postalCode" value="90000"/>
- <set field="serviceCtx.fromDate" value="2001-05-13 00:00:00.000" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePostalAddressAndPurposes" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="PostalAddress" value-field="postalAddress"/>
- <assert>
- <not><if-empty field="postalAddress"/></not>
- <if-compare field="postalAddress.address1" operator="equals" value="2004 Factory Blvd"/>
- <if-compare field="postalAddress.city" operator="equals" value="City of Industry"/>
- <if-compare field="postalAddress.postalCode" operator="equals" value="90000"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyInvitationGroupAssoc" short-description="Test the service createPartyInvitationGroupAssoc" login-required="false">
- <set field="serviceCtx.partyInvitationId" value="TEST_INVITE"/>
- <set field="serviceCtx.partyIdTo" value="TestCompany"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyInvitationGroupAssoc" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyInvitationGroupAssoc" value-field="partyInvitationGroupAssoc">
- <field-map field-name="partyInvitationId" value="TEST_INVITE"/>
- <field-map field-name="partyIdTo" value="TestCompany"/>
- </entity-one>
- <assert>
- <not><if-empty field="partyInvitationGroupAssoc"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testDeletePartyInvitationGroupAssoc" short-description="Test the service deletePartyInvitationGroupAssoc" login-required="false">
- <set field="serviceCtx.partyInvitationId" value="TEST_INVITE-2"/>
- <set field="serviceCtx.partyIdTo" value="TestCompany"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deletePartyInvitationGroupAssoc" in-map-name="serviceCtx"/>
- <entity-one entity-name="PartyInvitationGroupAssoc" value-field="partyInvitationGroupAssoc">
- <field-map field-name="partyInvitationId" value="TEST_INVITE-2"/>
- <field-map field-name="partyIdTo" value="TestCompany"/>
- </entity-one>
- <assert>
- <if-empty field="partyInvitationGroupAssoc"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testClearAddressMatchMap" short-description="Test the service clearAddressMatchMap" login-required="false">
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="clearAddressMatchMap" in-map-name="serviceCtx"/>
- <entity-condition entity-name="AddressMatchMap" list="addrs"/>
- <assert>
- <if-empty field="addrs"/>
- </assert>
- <check-errors/>
- </simple-method>
-</simple-methods>
diff --git a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/test/PartyTests.groovy b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/test/PartyTests.groovy
index 730fecc8c1..52ac72f1e1 100644
--- a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/test/PartyTests.groovy
+++ b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/test/PartyTests.groovy
@@ -19,9 +19,10 @@
package org.apache.ofbiz.party.party.test
import org.apache.ofbiz.entity.GenericValue
-import org.apache.ofbiz.service.ServiceUtil
import org.apache.ofbiz.service.testtools.OFBizTestCase
+import org.apache.ofbiz.service.ServiceUtil
+@SuppressWarnings(['LineLength', 'UnnecessaryObjectReferences', 'UnnecessaryGString', 'PublicMethodsBeforeNonPublicMethods', 'ClassSize', 'MethodCount', 'ConsecutiveBlankLines', 'BlockEndsWithBlankLine', 'ClassEndsWithBlankLine'])
class PartyTests extends OFBizTestCase {
PartyTests(String name) {
@@ -45,7 +46,1447 @@ class PartyTests extends OFBizTestCase {
GenericValue postalAddress = from('PostalAddress').where('contactMechId', serviceResult.contactMechId).queryOne()
assert postalAddress != null
- postalAddress.city = 'City of Industry'
+ assert postalAddress.city == 'City of Industry'
+ }
+
+ void testFindPartyWithSearchParameters() {
+ Map serviceCtx = [
+ partyId: 'DemoCustomer',
+ roleTypeId: 'CUSTOMER',
+ lookupFlag: 'Y',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('findParty', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRoleDetailAndPartyDetail = from('PartyRoleDetailAndPartyDetail')
+ .where('partyId', 'DemoCustomer', 'roleTypeId', 'CUSTOMER')
+ .queryOne()
+
+ try {
+ if (partyRoleDetailAndPartyDetail) {
+ assert serviceResult.partyList != null || serviceResult.partyListSize != null
+ } else {
+ assert serviceResult.partyList == null && serviceResult.partyListSize == null
+ }
+ } finally {
+ if (serviceResult.partyList instanceof org.apache.ofbiz.entity.util.EntityListIterator) {
+ serviceResult.partyList.close()
+ }
+ }
+ }
+
+ void testFindPartyWithNoSearchParameters() {
+ Map serviceCtx = [
+ lookupFlag: 'Y',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('findParty', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ try {
+ assert serviceResult.partyList != null || serviceResult.partyListSize != null
+ } finally {
+ if (serviceResult.partyList instanceof org.apache.ofbiz.entity.util.EntityListIterator) {
+ serviceResult.partyList.close()
+ }
+ }
+ }
+
+ void testUpdatePartyCreditCard() {
+ Map serviceCtx = [
+ partyId: 'DemoCustomer',
+ userLogin: userLogin
+ ]
+ List<GenericValue> paymentMethodAndCreditCards = from('PaymentMethodAndCreditCard')
+ .where('partyId', 'DemoCustomer')
+ .filterByDate()
+ .queryList()
+ GenericValue paymentMethodAndCreditCard = paymentMethodAndCreditCards.first()
+
+ serviceCtx.putAll(paymentMethodAndCreditCard.getAllFields())
+
+ Map serviceResult = dispatcher.runSync('updateCreditCard', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String paymentMethodId = serviceResult.paymentMethodId
+ String oldPaymentMethodId = serviceResult.oldPaymentMethodId
+
+ GenericValue updatedPmac = from('PaymentMethodAndCreditCard')
+ .where('paymentMethodId', paymentMethodId)
+ .queryOne()
+
+ assert updatedPmac
+ assert paymentMethodId == oldPaymentMethodId
+ assert updatedPmac.cardType == serviceCtx.cardType
+ assert updatedPmac.cardNumber == serviceCtx.cardNumber
+
+ serviceCtx.cardType = 'CCT_MASTERCARD'
+ serviceCtx.cardNumber = '5500000000000004'
+ Map serviceResult2 = dispatcher.runSync('updateCreditCard', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult2)
+
+ String newPaymentMethodId = serviceResult2.paymentMethodId
+ String newOldPaymentMethodId = serviceResult2.oldPaymentMethodId
+
+ GenericValue newPmac = from('PaymentMethodAndCreditCard')
+ .where('paymentMethodId', newPaymentMethodId)
+ .queryOne()
+
+ assert newPmac
+ assert newPaymentMethodId != newOldPaymentMethodId
+ assert newPmac.cardType == 'CCT_MASTERCARD'
+ assert newPmac.cardNumber == '5500000000000004'
+ }
+
+ void testUpdateUserPassword() {
+ GenericValue partyUserLogin = org.apache.ofbiz.party.party.PartyWorker.findPartyLatestUserLogin('DemoCustomer', delegator)
+ Map serviceCtx = dispatcher.getDispatchContext().makeValidContext('updatePassword',
+ org.apache.ofbiz.service.ModelService.IN_PARAM,
+ partyUserLogin)
+ serviceCtx.newPassword = 'ofbiz-demo'
+ serviceCtx.newPasswordVerify = 'ofbiz-demo'
+ serviceCtx.userLogin = userLogin
+
+ Map serviceResult = dispatcher.runSync('updatePassword', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyAndUserLogin = from('PartyAndUserLogin')
+ .where('userLoginId', partyUserLogin.userLoginId, 'partyId', 'DemoCustomer')
+ .queryOne()
+
+ assert partyAndUserLogin
+ assert partyUserLogin.currentPassword != partyAndUserLogin.currentPassword
+ assert partyAndUserLogin.userLoginId == 'DemoCustomer'
+ }
+
+ void testCreatePartyRole() {
+ Map serviceCtx = [
+ partyId: 'DemoCustomer',
+ roleTypeId: 'CLIENT',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRole = from('PartyRole')
+ .where('partyId', 'DemoCustomer', 'roleTypeId', 'CLIENT')
+ .queryOne()
+
+ assert partyRole
+ assert partyRole.partyId == 'DemoCustomer'
+ assert partyRole.roleTypeId == 'CLIENT'
+ }
+
+ void testEnsurePartyRole() {
+ Map serviceCtx = [
+ partyId: 'DemoCustomer',
+ roleTypeId: 'VENDOR',
+ userLogin: userLogin
+ ]
+
+ Map serviceResult = dispatcher.runSync('ensurePartyRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRole = from('PartyRole').where('partyId', 'DemoCustomer', 'roleTypeId', 'VENDOR').queryOne()
+ assert partyRole
+
+ serviceCtx.roleTypeId = 'EMPLOYEE'
+ partyRole = from('PartyRole').where('partyId', 'DemoCustomer', 'roleTypeId', 'EMPLOYEE').queryOne()
+ assert !partyRole
+
+ serviceResult = dispatcher.runSync('ensurePartyRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ partyRole = from('PartyRole').where('partyId', 'DemoCustomer', 'roleTypeId', 'EMPLOYEE').queryOne()
+ assert partyRole
+
+ Map ensurePartyRoleFromCtx = [
+ partyIdFrom: 'DemoCustomer',
+ roleTypeIdFrom: 'CONTRACTOR',
+ userLogin: userLogin
+ ]
+ partyRole = from('PartyRole').where('partyId', 'DemoCustomer', 'roleTypeId', 'CONTRACTOR').queryOne()
+ assert !partyRole
+
+ serviceResult = dispatcher.runSync('ensurePartyRoleFrom', ensurePartyRoleFromCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ partyRole = from('PartyRole').where('partyId', 'DemoCustomer', 'roleTypeId', 'CONTRACTOR').queryOne()
+ assert partyRole
+
+ Map ensurePartyRoleToCtx = [
+ partyIdTo: 'DemoCustomer',
+ roleTypeIdTo: 'MANUFACTURER',
+ userLogin: userLogin
+ ]
+ partyRole = from('PartyRole').where('partyId', 'DemoCustomer', 'roleTypeId', 'MANUFACTURER').queryOne()
+ assert !partyRole
+
+ serviceResult = dispatcher.runSync('ensurePartyRoleTo', ensurePartyRoleToCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ partyRole = from('PartyRole').where('partyId', 'DemoCustomer', 'roleTypeId', 'MANUFACTURER').queryOne()
+ assert partyRole
+ }
+
+ void testCreateNewCommEvent() {
+ Map createNewCommEventMap = [
+ communicationEventTypeId: 'EMAIL_COMMUNICATION',
+ statusId: 'COM_ENTERED',
+ partyIdFrom: 'DemoCustomer',
+ contactMechTypeId: 'EMAIL_ADDRESS',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createCommunicationEvent', createNewCommEventMap)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String communicationEventId = serviceResult.communicationEventId
+
+ Map updateCommEventMap = [
+ communicationEventId: communicationEventId,
+ communicationEventTypeId: 'AUTO_EMAIL_COMM',
+ statusId: 'COM_COMPLETE',
+ partyIdFrom: 'admin',
+ contactMechTypeId: 'ELECTRONIC_ADDRESS',
+ userLogin: userLogin
+ ]
+ Map serviceResult2 = dispatcher.runSync('updateCommunicationEvent', updateCommEventMap)
+ assert ServiceUtil.isSuccess(serviceResult2)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', communicationEventId).queryOne()
+ assert communicationEvent
+ assert communicationEvent.communicationEventTypeId == updateCommEventMap.communicationEventTypeId
+ assert communicationEvent.statusId == updateCommEventMap.statusId
+ assert communicationEvent.partyIdFrom == updateCommEventMap.partyIdFrom
+ assert communicationEvent.contactMechTypeId == updateCommEventMap.contactMechTypeId
+ }
+
+ void testCreatePartyTelecomNumber() {
+ Map serviceCtx = [
+ partyId: 'DemoCustomer',
+ contactMechPurposeTypeId: 'PRIMARY_PHONE',
+ countryCode: '1',
+ areaCode: '801',
+ contactNumber: '888-8888',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyTelecomNumber', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String contactMechId = serviceResult.contactMechId
+ assert contactMechId
+
+ GenericValue contactMech = from('ContactMech').where('contactMechId', contactMechId).queryOne()
+ assert contactMech
+
+ GenericValue telecomNumber = from('TelecomNumber').where('contactMechId', contactMechId).queryOne()
+ assert telecomNumber
+ assert telecomNumber.countryCode == '1'
+ assert telecomNumber.areaCode == '801'
+ assert telecomNumber.contactNumber == '888-8888'
+
+ List<GenericValue> pcmList = from('PartyContactMech')
+ .where('partyId', 'DemoCustomer', 'contactMechId', contactMechId)
+ .filterByDate()
+ .queryList()
+ assert pcmList
+
+ List<GenericValue> pcmpList = from('PartyContactMechPurpose')
+ .where('partyId', 'DemoCustomer', 'contactMechId', contactMechId)
+ .filterByDate()
+ .queryList()
+ assert pcmpList
+
+ GenericValue pcmp = pcmpList.first()
+ assert pcmp.contactMechPurposeTypeId == 'PRIMARY_PHONE'
+ }
+
+ void testCreatePerson() {
+ Map serviceCtx = [
+ firstName: 'Demo',
+ lastName: 'Person',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPerson', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String partyId = serviceResult.partyId
+
+ GenericValue party = from('Party').where('partyId', partyId).queryOne()
+ assert party
+ assert party.partyTypeId == 'PERSON'
+
+ GenericValue person = from('Person').where('partyId', partyId).queryOne()
+ assert person
+ assert person.firstName == 'Demo'
+ assert person.lastName == 'Person'
+ }
+
+ void testCreateUpdatePersonWithCreate() {
+ Map serviceCtx = [
+ partyId: 'DemoPerson1',
+ firstName: 'Demo',
+ lastName: 'Person1',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createUpdatePerson', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue party = from('Party').where('partyId', 'DemoPerson1').queryOne()
+ assert party
+
+ GenericValue person = from('Person').where('partyId', 'DemoPerson1').queryOne()
+ assert person
+ assert person.firstName == 'Demo'
+ assert person.lastName == 'Person1'
+ }
+
+
+ void testCreateUpdatePersonWithUpdate() {
+ Map serviceCtx = [
+ partyId: 'DemoPerson1',
+ firstName: 'Demo',
+ lastName: 'Person2',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createUpdatePerson', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue party = from('Party').where('partyId', serviceResult.partyId).queryOne()
+ GenericValue person = from('Person').where('partyId', serviceResult.partyId).queryOne()
+
+ assert party
+ assert person
+ assert person.firstName == 'Demo'
+ assert person.lastName == 'Person2'
+ }
+
+ void testCreatePartyGroup() {
+ Map serviceCtx = [
+ partyId: 'DemoGroup1',
+ groupName: 'Demo Group',
+ partyTypeId: 'PARTY_GROUP',
+ statusId: 'PARTY_ENABLED',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyGroup', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyGroup = from('PartyGroup').where('partyId', serviceResult.partyId).queryOne()
+
+ assert partyGroup
+ assert partyGroup.partyId == 'DemoGroup1'
+ assert partyGroup.groupName == 'Demo Group'
+ }
+
+ void testCopyPartyContactMechs() {
+ Map serviceCtx = [
+ partyIdFrom: 'TestCustomer',
+ partyIdTo: 'TestParty',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('copyPartyContactMechs', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ List<GenericValue> partyContactMechList = from('PartyContactMech').where('partyId', 'TestParty').queryList()
+ assert partyContactMechList
+ }
+
+ void testCreateCommunicationEvent() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-3',
+ communicationEventTypeId: 'EMAIL_COMMUNICATION',
+ statusId: 'COM_COMPLETE',
+ fromString: 'send@example.com',
+ toString: 'receive@example.com',
+ subject: 'Why i would use the OFBiz system',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createCommunicationEvent', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', 'TestEvent-3').queryOne()
+ assert communicationEvent
+ assert communicationEvent.statusId == 'COM_COMPLETE'
+ assert communicationEvent.subject == 'Why i would use the OFBiz system'
+ }
+
+ void testCreateCommunicationEventRole() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-6',
+ partyId: 'TestCompany',
+ roleTypeId: 'ADDRESSEE',
+ statusId: 'COM_ROLE_CREATED',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createCommunicationEventRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEventRole = from('CommunicationEventRole')
+ .where('communicationEventId', 'TestEvent-6', 'roleTypeId', 'ADDRESSEE', 'partyId', 'TestCompany')
+ .queryOne()
+
+ assert communicationEventRole
+ assert communicationEventRole.statusId == 'COM_ROLE_CREATED'
+ }
+
+ void testCreateCommunicationEventRoleWithoutPermission() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-6',
+ partyId: 'TestCompany',
+ roleTypeId: 'INTERNAL_ORGANIZATIO',
+ statusId: 'COM_ROLE_CREATED',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createCommunicationEventRoleWithoutPermission', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEventRole = from('CommunicationEventRole')
+ .where('communicationEventId', 'TestEvent-6', 'roleTypeId', 'INTERNAL_ORGANIZATIO', 'partyId', 'TestCompany')
+ .queryOne()
+
+ assert communicationEventRole
+ assert communicationEventRole.statusId == 'COM_ROLE_CREATED'
+ }
+
+ void testCreateCommunicationEventWithoutPermission() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-4',
+ communicationEventTypeId: 'EMAIL_COMMUNICATION',
+ statusId: 'COM_COMPLETE',
+ fromString: 'send@example.com',
+ toString: 'receive@example.com',
+ subject: 'Why i would use the OFBiz system',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createCommunicationEventWithoutPermission', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', 'TestEvent-4').queryOne()
+ assert communicationEvent
+ assert communicationEvent.statusId == 'COM_COMPLETE'
+ assert communicationEvent.subject == 'Why i would use the OFBiz system'
+ }
+
+ void testCreateContactMech() {
+ Map serviceCtx = [
+ contactMechId: 'TestEmailConactMech',
+ contactMechTypeId: 'EMAIL_ADDRESS',
+ infoString: 'test_email@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createContactMech', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue contactMech = from('ContactMech').where('contactMechId', 'TestEmailConactMech').queryOne()
+ assert contactMech
+ assert contactMech.infoString == 'test_email@example.com'
+ }
+
+ void testCreateEmailAddress() {
+ Map serviceCtx = [
+ emailAddress: 'test.email123@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createEmailAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue contactMech = from('ContactMech').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert contactMech
+ assert contactMech.infoString == 'test.email123@example.com'
+ }
+
+ void testCreatePartyContactMech() {
+ Map serviceCtx = [
+ contactMechId: 'TestContactMech3',
+ partyId: 'TestCustomer',
+ contactMechPurposeTypeId: 'PRIMARY_EMAIL',
+ contactMechTypeId: 'EMAIL_ADDRESS',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyContactMech', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyContactMech = from('PartyContactMech')
+ .where('contactMechId', 'TestContactMech3', 'partyId', 'TestCustomer')
+ .queryFirst()
+ assert partyContactMech
+ }
+
+ void testCreatePartyDataSource() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ dataSourceId: 'MY_PORTAL',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 01:01:01'),
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyDataSource', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyDataSource = from('PartyDataSource')
+ .where('partyId', 'TestCustomer', 'dataSourceId', 'MY_PORTAL', 'fromDate', java.sql.Timestamp.valueOf('2009-09-09 01:01:01'))
+ .queryOne()
+ assert partyDataSource
+ }
+
+ void testCreatePartyEmailAddress() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ emailAddress: 'test.email1234@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyEmailAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue contactMech = from('ContactMech').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert contactMech
+ assert contactMech.infoString == 'test.email1234@example.com'
+ }
+
+ void testCreatePartyIdentifications() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ identifications: [
+ partyIdentificationTypeId: 'CARD_ID',
+ CARD_ID: '123456789'
+ ],
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyIdentifications', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyIdentification = from('PartyIdentification')
+ .where('partyId', 'TestCustomer', 'partyIdentificationTypeId', 'CARD_ID')
+ .queryOne()
+ assert partyIdentification
+ assert partyIdentification.idValue == '123456789'
+ }
+
+ void testCreatePartyNote() {
+ Map serviceCtx = [
+ partyId: 'DemoCustomer',
+ noteName: 'Demo Note',
+ note: 'This is demo note to test createPartyNote service',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyNote', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyNote = from('PartyNote').where('partyId', 'DemoCustomer', 'noteId', serviceResult.noteId).queryOne()
+ assert partyNote
+
+ GenericValue noteData = from('NoteData').where('noteId', serviceResult.noteId).queryOne()
+ assert noteData
+ assert noteData.noteName == 'Demo Note'
+ assert noteData.noteInfo == 'This is demo note to test createPartyNote service'
+ }
+
+ void testCreatePartyRelationship() {
+ Map serviceCtx = [
+ partyIdFrom: 'TestCompany',
+ partyIdTo: 'TestCustomer',
+ roleTypeIdFrom: 'INTERNAL_ORGANIZATIO',
+ roleTypeIdTo: 'CONTACT',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 01:01:01'),
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyRelationship', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRelationship = from('PartyRelationship')
+ .where('partyIdFrom',
+ 'TestCompany',
+ 'partyIdTo',
+ 'TestCustomer',
+ 'roleTypeIdFrom',
+ 'INTERNAL_ORGANIZATIO',
+ 'roleTypeIdTo',
+ 'CONTACT',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2009-09-09 01:01:01'))
+ .queryOne()
+ assert partyRelationship
+ }
+
+ void testCreatePartyRelationshipAndRole() {
+ Map serviceCtx = [
+ partyIdFrom: 'TestCompany',
+ partyIdTo: 'TestCustomer',
+ roleTypeIdFrom: 'BUYER',
+ roleTypeIdTo: 'ACCOUNT_LEAD',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 01:01:01'),
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyRelationshipAndRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRole = from('PartyRole').where('partyId', 'TestCompany', 'roleTypeId', 'BUYER').queryOne()
+ assert partyRole
+
+ GenericValue partyRelationship = from('PartyRelationship')
+ .where('partyIdFrom',
+ 'TestCompany',
+ 'partyIdTo',
+ 'TestCustomer',
+ 'roleTypeIdFrom',
+ 'BUYER',
+ 'roleTypeIdTo',
+ 'ACCOUNT_LEAD',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2009-09-09 01:01:01'))
+ .queryOne()
+ assert partyRelationship
+ }
+
+ void testCreatePartyRelationshipContactAccount() {
+ Map serviceCtx = [
+ accountPartyId: 'TestParty',
+ contactPartyId: 'TestCustomer',
+ comments: 'This is a test party contact account relationship',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyRelationshipContactAccount', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ List<GenericValue> partyRelationshipList = from('PartyRelationship')
+ .where('partyIdFrom', 'TestParty', 'partyIdTo', 'TestCustomer', 'roleTypeIdFrom', 'ACCOUNT', 'roleTypeIdTo', 'CONTACT')
+ .queryList()
+ assert partyRelationshipList
+ }
+
+ void testCreatePersonAndUserLogin() {
+ Map serviceCtx = [
+ partyId: 'DemoPerson',
+ firstName: 'Demo',
+ lastName: 'Person',
+ userLoginId: 'demo.person',
+ currentPassword: 'ofbiz',
+ currentPasswordVerify: 'ofbiz',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPersonAndUserLogin', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue newUserLogin = serviceResult.newUserLogin
+ assert newUserLogin
+ assert newUserLogin.partyId == 'DemoPerson'
+ assert newUserLogin.userLoginId == 'demo.person'
+
+ GenericValue person = from('Person').where('partyId', 'DemoPerson').queryOne()
+ assert person
+ assert person.firstName == 'Demo'
+ assert person.lastName == 'Person'
+ }
+
+ void testCreatePostalAddress() {
+ Map serviceCtx = [
+ toName: 'Test Address',
+ address1: '2004 Factory Blvd',
+ city: 'City of Industry',
+ countryGeoId: 'USA',
+ stateProvinceGeoId: 'CA',
+ postalCode: '90000',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPostalAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue postalAddress = from('PostalAddress').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert postalAddress
+ assert postalAddress.address1 == '2004 Factory Blvd'
+ assert postalAddress.city == 'City of Industry'
+ assert postalAddress.postalCode == '90000'
+ }
+
+ void testCreateTelecomNumber() {
+ Map serviceCtx = [
+ contactMechId: 'TestTelecomNumber',
+ areaCode: '801',
+ contactNumber: '1111111',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createTelecomNumber', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue telecomNumber = from('TelecomNumber').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert telecomNumber
+ assert telecomNumber.areaCode == '801'
+ assert telecomNumber.contactNumber == '1111111'
+ }
+
+ void testCreateUpdatePartyRelationshipAndRoles() {
+ Map serviceCtx = [
+ partyId: 'TestCompany',
+ partyIdFrom: 'TestCompany',
+ partyIdTo: 'TestCustomer',
+ roleTypeIdFrom: 'BUYER',
+ roleTypeIdTo: 'ACCOUNT_LEAD',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 01:01:01'),
+ partyRelationshipTypeId: 'AGENT',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createUpdatePartyRelationshipAndRoles', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRole = from('PartyRole').where('partyId', 'TestCompany', 'roleTypeId', 'BUYER').queryOne()
+ assert partyRole
+
+ GenericValue partyRelationship = from('PartyRelationship')
+ .where('partyIdFrom',
+ 'TestCompany',
+ 'partyIdTo',
+ 'TestCustomer',
+ 'roleTypeIdFrom',
+ 'BUYER',
+ 'roleTypeIdTo',
+ 'ACCOUNT_LEAD',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2009-09-09 01:01:01'))
+ .queryOne()
+ assert partyRelationship
+ assert serviceCtx.partyRelationshipTypeId == 'AGENT'
+ }
+
+ void testDeleteCommunicationEvent() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-1',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('deleteCommunicationEvent', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', 'TestEvent-1').queryOne()
+ assert !communicationEvent
+ }
+
+ void testDeleteCommunicationEventWorkEffort() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-5',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('deleteCommunicationEventWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', 'TestEvent-5').queryOne()
+ assert !communicationEvent
+
+ List<GenericValue> communicationEventWorkEff = from('CommunicationEventWorkEff').where('communicationEventId', 'TestEvent-5').queryList()
+ assert !communicationEventWorkEff
+ }
+
+ void testExpirePartyContactMechPurpose() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ contactMechId: 'TestContactMech',
+ contactMechPurposeTypeId: 'PRIMARY_EMAIL',
+ fromDate: java.sql.Timestamp.valueOf('2000-01-01 00:00:00'),
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('expirePartyContactMechPurpose', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyContactMechPurpose = from('PartyContactMechPurpose')
+ .where('partyId',
+ 'TestCustomer',
+ 'contactMechId',
+ 'TestContactMech',
+ 'contactMechPurposeTypeId',
+ 'PRIMARY_EMAIL',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2000-01-01 00:00:00'))
+ .queryOne()
+ assert partyContactMechPurpose
+ assert partyContactMechPurpose.thruDate != null
+ }
+
+ void testDeletePartyRelationship() {
+ Map serviceCtx = [
+ partyIdFrom: 'TestCompany',
+ partyIdTo: 'TestCustomer',
+ roleTypeIdFrom: '_NA_',
+ roleTypeIdTo: 'CONTACT',
+ fromDate: java.sql.Timestamp.valueOf('2000-01-01 00:00:00'),
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('deletePartyRelationship', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRelationship = from('PartyRelationship')
+ .where('partyIdFrom',
+ 'TestCompany',
+ 'partyIdTo',
+ 'TestCustomer',
+ 'roleTypeIdFrom',
+ '_NA_',
+ 'roleTypeIdTo',
+ 'CONTACT',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2000-01-01 00:00:00'))
+ .queryOne()
+ assert !partyRelationship
+ }
+
+
+ void testDeletePartyRole() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ roleTypeId: 'ACCOUNTANT',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('deletePartyRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRole = from('PartyRole').where('partyId', 'TestCustomer', 'roleTypeId', 'ACCOUNTANT').queryOne()
+ assert !partyRole
+ }
+
+ void testFindPartiesById() {
+ Map serviceCtx = [
+ idToFind: 'TestCustomer',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('findPartiesById', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue party = serviceResult.party
+ assert party
+ assert party.partyId == 'TestCustomer'
+ }
+
+ void testFindPartyFromEmailAddress() {
+ Map serviceCtx = [
+ address: 'newtest_email@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('findPartyFromEmailAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue party = from('Party').where('partyId', serviceResult.partyId).queryOne()
+ GenericValue contactMech = from('ContactMech').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert party
+ assert contactMech
+ }
+
+ void testFindPartyFromTelephone() {
+ Map serviceCtx = [
+ telno: '801555-5555',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('findPartyFromTelephone', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue party = from('Party').where('partyId', serviceResult.partyId).queryOne()
+ assert party
+ }
+
+ void testFindPartyFromTelephoneComplete() {
+ Map serviceCtx = [
+ telno: '801555-5555',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('findPartyFromTelephoneComplete', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue party = from('Party').where('partyId', serviceResult.partyId).queryOne()
+ assert party
+ }
+
+ void testRemoveCommunicationEventRole() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-5',
+ partyId: 'TestCompany',
+ roleTypeId: 'ADDRESSEE',
+ statusId: 'COM_ROLE_CREATED',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('removeCommunicationEventRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEventRole = from('CommunicationEventRole')
+ .where('communicationEventId', 'TestEvent-5', 'partyId', 'TestCompany', 'roleTypeId', 'ADDRESSEE')
+ .queryOne()
+ assert !communicationEventRole
+ }
+
+ void testSetCommEventComplete() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-6',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('setCommEventComplete', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', 'TestEvent-6').queryOne()
+ assert communicationEvent
+ assert communicationEvent.statusId == 'COM_COMPLETE'
+ }
+
+ void testSetCommEventRoleToRead() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-7',
+ partyId: 'TestCompany',
+ roleTypeId: 'ADDRESSEE',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('setCommEventRoleToRead', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEventRole = from('CommunicationEventRole')
+ .where('communicationEventId', 'TestEvent-7', 'partyId', 'TestCompany', 'roleTypeId', 'ADDRESSEE', 'statusId', 'COM_ROLE_READ')
+ .queryOne()
+ assert communicationEventRole
+ }
+
+ void testSetCommunicationEventStatus() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-6',
+ statusId: 'COM_COMPLETE',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('setCommunicationEventStatus', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', 'TestEvent-6').queryOne()
+ assert communicationEvent
+ assert communicationEvent.statusId == 'COM_COMPLETE'
+ }
+
+ void testUpdateCommunicationEvent() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-7',
+ statusId: 'COM_COMPLETE',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updateCommunicationEvent', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEvent = from('CommunicationEvent').where('communicationEventId', 'TestEvent-7').queryOne()
+ assert communicationEvent
+ assert communicationEvent.statusId == 'COM_COMPLETE'
+ }
+
+ void testUpdateCommunicationEventRole() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-2',
+ partyId: 'TestCompany',
+ roleTypeId: 'ADDRESSEE',
+ statusId: 'COM_ROLE_READ',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updateCommunicationEventRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEventRole = from('CommunicationEventRole')
+ .where('communicationEventId', 'TestEvent-2', 'partyId', 'TestCompany', 'roleTypeId', 'ADDRESSEE')
+ .queryOne()
+ assert communicationEventRole
+ assert communicationEventRole.statusId == 'COM_ROLE_READ'
+ }
+
+ void testSetCommunicationEventRoleStatus() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-2',
+ partyId: 'TestCompany',
+ roleTypeId: 'ADDRESSEE',
+ statusId: 'COM_ROLE_COMPLETED',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('setCommunicationEventRoleStatus', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue communicationEventRole = from('CommunicationEventRole')
+ .where('communicationEventId', 'TestEvent-2', 'partyId', 'TestCompany', 'roleTypeId', 'ADDRESSEE', 'statusId', 'COM_ROLE_COMPLETED')
+ .queryOne()
+ assert communicationEventRole
+ }
+
+ void testUpdateContactMech() {
+ Map serviceCtx = [
+ contactMechId: 'TestContactMech',
+ contactMechTypeId: 'EMAIL_ADDRESS',
+ infoString: 'demo_email@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updateContactMech', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue contactMech = from('ContactMech').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert contactMech
+ assert contactMech.infoString == 'demo_email@example.com'
+ }
+
+ void testUpdateEmailAddress() {
+ Map serviceCtx = [
+ contactMechId: 'TestContactMech',
+ emailAddress: 'test.email123@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updateEmailAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue contactMech = from('ContactMech').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert contactMech
+ assert contactMech.infoString == 'test.email123@example.com'
+ }
+
+ void testUpdatePartyEmailAddress() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ contactMechId: 'TestContactMech',
+ emailAddress: 'test.email12345@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePartyEmailAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue contactMech = from('ContactMech').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert contactMech
+ assert contactMech.infoString == 'test.email12345@example.com'
+ }
+
+ void testUpdatePartyGroup() {
+ Map serviceCtx = [
+ partyId: 'TestGroup-1',
+ groupName: 'Test Party Group',
+ logoImageUrl: '/images/ofbiz_logo.png',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePartyGroup', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyGroup = from('PartyGroup').where('partyId', 'TestGroup-1').queryOne()
+ assert partyGroup
+ assert partyGroup.groupName == 'Test Party Group'
+ assert partyGroup.logoImageUrl == '/images/ofbiz_logo.png'
+ }
+
+ void testUpdatePartyPostalAddress() {
+ Map serviceCtx = [
+ contactMechId: 'TestPostalAdd2',
+ partyId: 'TestCustomer',
+ toName: 'Test Address',
+ address1: '2004 Factory Blvd',
+ city: 'City of Industry',
+ countryGeoId: 'USA',
+ stateProvinceGeoId: 'CA',
+ postalCode: '90000',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePartyPostalAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue postalAddress = from('PostalAddress').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert postalAddress
+ assert postalAddress.address1 == '2004 Factory Blvd'
+ assert postalAddress.city == 'City of Industry'
+ assert postalAddress.postalCode == '90000'
+ }
+
+ void testUpdatePartyRelationship() {
+ Map serviceCtx = [
+ partyIdFrom: 'TestCompany',
+ partyIdTo: 'TestParty',
+ roleTypeIdFrom: '_NA_',
+ roleTypeIdTo: 'CONTACT',
+ fromDate: java.sql.Timestamp.valueOf('2000-01-01 00:00:00'),
+ partyRelationshipTypeId: 'AGENT',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePartyRelationship', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRelationship = from('PartyRelationship')
+ .where('partyIdFrom',
+ 'TestCompany',
+ 'partyIdTo',
+ 'TestParty',
+ 'roleTypeIdFrom',
+ '_NA_',
+ 'roleTypeIdTo',
+ 'CONTACT',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2000-01-01 00:00:00'))
+ .queryOne()
+ assert partyRelationship
+ assert partyRelationship.partyRelationshipTypeId == 'AGENT'
+ }
+
+ void testUpdatePartyTelecomNumber() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ contactMechId: 'TestContactMech1',
+ areaCode: '801',
+ contactNumber: '1111111',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePartyTelecomNumber', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue telecomNumber = from('TelecomNumber').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert telecomNumber
+ assert telecomNumber.areaCode == '801'
+ assert telecomNumber.contactNumber == '1111111'
+ }
+
+ void testUpdatePerson() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ firstName: 'New Test',
+ lastName: 'Person',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePerson', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue person = from('Person').where('partyId', 'TestCustomer').queryOne()
+ assert person
+ assert person.firstName == 'New Test'
+ assert person.lastName == 'Person'
+ }
+
+ void testUpdatePostalAddress() {
+ Map serviceCtx = [
+ contactMechId: 'TestPostalAdd1',
+ toName: 'Test Address',
+ address1: '2004 Factory Blvd',
+ city: 'City of Industry',
+ countryGeoId: 'USA',
+ stateProvinceGeoId: 'CA',
+ postalCode: '90000',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePostalAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue postalAddress = from('PostalAddress').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert postalAddress
+ assert postalAddress.address1 == '2004 Factory Blvd'
+ assert postalAddress.city == 'City of Industry'
+ assert postalAddress.postalCode == '90000'
+ assert serviceResult.contactMechId != serviceResult.oldContactMechId
+ }
+
+ void testUpdateTelecomNumber() {
+ Map serviceCtx = [
+ contactMechId: 'TestContactMech1',
+ areaCode: '801',
+ contactNumber: '1111111',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updateTelecomNumber', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue telecomNumber = from('TelecomNumber').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert telecomNumber
+ assert telecomNumber.areaCode == '801'
+ assert telecomNumber.contactNumber == '1111111'
+ assert serviceResult.contactMechId != serviceResult.oldContactMechId
+ }
+
+ void testLookupParty() {
+ Map serviceCtx = [
+ firstName: 'Test',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('lookupParty', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.lookupResult
+ }
+
+ void testGetPartyEmail() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('getPartyEmail', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.emailAddress
+ assert serviceResult.contactMechId
+ }
+
+ void testCreateAffiliate() {
+ Map serviceCtx = [
+ partyId: 'TestCompany',
+ affiliateName: 'Test Affiliate',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createAffiliate', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue affiliate = from('Affiliate').where('partyId', serviceResult.partyId).queryOne()
+ assert affiliate
+ assert affiliate.affiliateName == 'Test Affiliate'
+ }
+
+ void testUpdateAffiliate() {
+ Map serviceCtx = [
+ partyId: 'TestGroup-1',
+ affiliateName: 'Test Affiliate',
+ siteType: 'Main Site',
+ siteVisitors: '2000',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updateAffiliate', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue affiliate = from('Affiliate').where('partyId', 'TestGroup-1').queryOne()
+ assert affiliate
+ assert affiliate.affiliateName == 'Test Affiliate'
+ assert affiliate.siteType == 'Main Site'
+ assert affiliate.siteVisitors == '2000'
+ }
+
+ void testGetPartyMainRole() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('getPartyMainRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyRole = from('PartyRole').where('partyId', 'TestCustomer', 'roleTypeId', serviceResult.roleTypeId).queryOne()
+ assert partyRole
+ }
+
+ void testGetPartyTelephone() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('getPartyTelephone', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.contactNumber
+ assert serviceResult.contactMechId
+ }
+
+ void testQuickCreateCustomer() {
+ Map serviceCtx = [
+ firstName: 'Test',
+ lastName: 'Customer',
+ emailAddress: 'test.customer@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('quickCreateCustomer', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue person = from('Person').where('partyId', serviceResult.partyId).queryOne()
+ assert person
+ assert person.firstName == 'Test'
+ assert person.lastName == 'Customer'
+
+ GenericValue partyRole = from('PartyRole').where('partyId', serviceResult.partyId, 'roleTypeId', 'CUSTOMER').queryOne()
+ assert partyRole
+ }
+
+ void testCreateAddressMatchMap() {
+ Map serviceCtx = [
+ mapKey: 'TEST_KEY',
+ mapValue: 'TEST VALUE',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createAddressMatchMap', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue addressMatchMap = from('AddressMatchMap').where('mapKey', 'TEST_KEY', 'mapValue', 'TEST VALUE').queryOne()
+ assert addressMatchMap
+ }
+
+ void testRemoveAddressMatchMap() {
+ Map serviceCtx = [
+ mapKey: 'TESTKEY-1',
+ mapValue: 'Test Value 1',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('removeAddressMatchMap', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue addressMatchMap = from('AddressMatchMap').where('mapKey', 'TESTKEY-1', 'mapValue', 'Test Value 1').queryOne()
+ assert !addressMatchMap
+ }
+
+ void testCreatePartyInvitation() {
+ Map serviceCtx = [
+ partyIdFrom: 'TestCompany',
+ partyId: 'TestCustomer',
+ emailAddress: 'test_email@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyInvitation', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyInvitation = from('PartyInvitation').where('partyInvitationId', serviceResult.partyInvitationId).queryOne()
+ assert partyInvitation
+ assert partyInvitation.emailAddress == 'test_email@example.com'
+ }
+
+ void testUpdatePartyInvitation() {
+ Map serviceCtx = [
+ partyInvitationId: 'TEST_INVITE',
+ emailAddress: 'test_email@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePartyInvitation', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyInvitation = from('PartyInvitation').where('partyInvitationId', 'TEST_INVITE').queryOne()
+ assert partyInvitation
+ assert partyInvitation.emailAddress == 'test_email@example.com'
+ }
+
+ void testDeletePartyInvitation() {
+ Map serviceCtx = [
+ partyInvitationId: 'TEST_INVITE-1',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('deletePartyInvitation', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyInvitation = from('PartyInvitation').where('partyInvitationId', 'TEST_INVITE-1').queryOne()
+ assert !partyInvitation
+ }
+
+ void testGetPartyPostalAddress() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('getPartyPostalAddress', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ assert serviceResult.address1
+ assert serviceResult.countryGeoId
+ assert serviceResult.contactMechId
+ }
+
+ void testCreatePartyContactMechPurpose() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ contactMechId: 'TestContactMech',
+ contactMechPurposeTypeId: 'PRIMARY_EMAIL',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 01:01:01'),
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyContactMechPurpose', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyContactMechPurpose = from('PartyContactMechPurpose')
+ .where('partyId',
+ 'TestCustomer',
+ 'contactMechId',
+ 'TestContactMech',
+ 'contactMechPurposeTypeId',
+ 'PRIMARY_EMAIL',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2009-09-09 01:01:01'))
+ .queryOne()
+ assert partyContactMechPurpose
+ }
+
+ void testCreateEmailAddressVerification() {
+ Map serviceCtx = [
+ emailAddress: 'test_email@example.com',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createEmailAddressVerification', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue emailAddressVerification = from('EmailAddressVerification').where('emailAddress', 'test_email@example.com').queryOne()
+ assert emailAddressVerification
+ assert emailAddressVerification.verifyHash == serviceResult.verifyHash
+ }
+
+ void testCreatePartyInvitationRoleAssoc() {
+ Map serviceCtx = [
+ partyInvitationId: 'TEST_INVITE',
+ roleTypeId: 'COMMEVENT_ROLE',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyInvitationRoleAssoc', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyInvitationRoleAssoc = from('PartyInvitationRoleAssoc').where('partyInvitationId',
+ 'TEST_INVITE',
+ 'roleTypeId',
+ 'COMMEVENT_ROLE').queryOne()
+ assert partyInvitationRoleAssoc
+ }
+
+ void testDeletePartyInvitationRoleAssoc() {
+ Map serviceCtx = [
+ partyInvitationId: 'TEST_INVITE-2',
+ roleTypeId: 'COMMEVENT_ROLE',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('deletePartyInvitationRoleAssoc', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyInvitationRoleAssoc = from('PartyInvitationRoleAssoc').where('partyInvitationId',
+ 'TEST_INVITE-2',
+ 'roleTypeId',
+ 'COMMEVENT_ROLE').queryOne()
+ assert !partyInvitationRoleAssoc
+ }
+
+ void testUpdatePostalAddressAndPurposes() {
+ Map serviceCtx = [
+ partyId: 'TestCustomer',
+ contactMechId: 'TestPostalAdd3',
+ toName: 'Test Address',
+ address1: '2004 Factory Blvd',
+ city: 'City of Industry',
+ countryGeoId: 'USA',
+ stateProvinceGeoId: 'CA',
+ postalCode: '90000',
+ fromDate: java.sql.Timestamp.valueOf('2001-05-13 00:00:00.000'),
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('updatePostalAddressAndPurposes', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue postalAddress = from('PostalAddress').where('contactMechId', serviceResult.contactMechId).queryOne()
+ assert postalAddress
+ assert postalAddress.address1 == '2004 Factory Blvd'
+ assert postalAddress.city == 'City of Industry'
+ assert postalAddress.postalCode == '90000'
+ }
+
+ void testCreatePartyInvitationGroupAssoc() {
+ Map serviceCtx = [
+ partyInvitationId: 'TEST_INVITE',
+ partyIdTo: 'TestCompany',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('createPartyInvitationGroupAssoc', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyInvitationGroupAssoc = from('PartyInvitationGroupAssoc').where('partyInvitationId',
+ 'TEST_INVITE',
+ 'partyIdTo',
+ 'TestCompany').queryOne()
+ assert partyInvitationGroupAssoc
+ }
+
+ void testDeletePartyInvitationGroupAssoc() {
+ Map serviceCtx = [
+ partyInvitationId: 'TEST_INVITE-2',
+ partyIdTo: 'TestCompany',
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('deletePartyInvitationGroupAssoc', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue partyInvitationGroupAssoc = from('PartyInvitationGroupAssoc').where('partyInvitationId',
+ 'TEST_INVITE-2',
+ 'partyIdTo',
+ 'TestCompany').queryOne()
+ assert !partyInvitationGroupAssoc
+ }
+
+ void testClearAddressMatchMap() {
+ Map serviceCtx = [
+ userLogin: userLogin
+ ]
+ Map serviceResult = dispatcher.runSync('clearAddressMatchMap', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ List<GenericValue> addrs = from('AddressMatchMap').queryList()
+ assert !addrs
}
}
diff --git a/applications/party/testdef/PartyTests.xml b/applications/party/testdef/PartyTests.xml
index 1c5234333b..4f990fc6ed 100644
--- a/applications/party/testdef/PartyTests.xml
+++ b/applications/party/testdef/PartyTests.xml
@@ -26,7 +26,6 @@
</test-case>
<test-group case-name="party-tests">
- <simple-method-test location="component://party/minilang/test/PartyTests.xml"/>
<junit-test-suite class-name="org.apache.ofbiz.party.party.test.PartyTests"/>
</test-group>
</test-suite>
diff --git a/applications/product/minilang/product/test/GroupOrderTest.xml b/applications/product/minilang/product/test/GroupOrderTest.xml
deleted file mode 100644
index e1282da2a7..0000000000
--- a/applications/product/minilang/product/test/GroupOrderTest.xml
+++ /dev/null
@@ -1,267 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
-
- <simple-method method-name="testGroupOrderLimitReached" short-description="Test GroupOrder the limit is reached" login-required="false">
- <!-- Test GroupOrder the limit is reached
- Step 1) Create ProductGroupOrder .
- Step 2) Create an order.
- Step 3) Check soldOrderQty is added.
- Step 4) Check ProductGroupOrder expired.
- Step 5) Check Order Item should approved.
- -->
- <!-- Step 1 -->
- <now-timestamp field="nowTimestamp"/>
- <set field="days" value="1" type="Integer"/>
- <call-class-method class-name="org.apache.ofbiz.base.util.UtilDateTime" method-name="addDaysToTimestamp" ret-field="thruDate">
- <field field="nowTimestamp" type="java.sql.Timestamp"/>
- <field field="days" type="int"/>
- </call-class-method>
- <entity-one entity-name="UserLogin" value-field="systemUserLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="createProductGroupOrderMap.userLogin" from-field="systemUserLogin"/>
- <set field="createProductGroupOrderMap.productId" value="GZ-1000"/>
- <set field="createProductGroupOrderMap.fromDate" from-field="nowTimestamp"/>
- <set field="createProductGroupOrderMap.thruDate" from-field="thruDate"/>
- <set field="createProductGroupOrderMap.statusId" value="GO_CREATED"/>
- <set field="createProductGroupOrderMap.reqOrderQty" value="1" type="BigDecimal"/>
- <set field="createProductGroupOrderMap.soldOrderQty" value="0" type="BigDecimal"/>
- <call-service service-name="createProductGroupOrder" in-map-name="createProductGroupOrderMap">
- <result-to-field result-name="groupOrderId" field="groupOrderId"/>
- </call-service>
- <!-- Step 2 -->
- <field-to-session field="nullField" session-name="orderMode"/>
- <set field="request" from-field="parameters.request"/>
- <set field="response" from-field="parameters.response"/>
- <call-class-method method-name="routeOrderEntry" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : routeOrderEntry, Response : ${result}"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="admin"/>
- </entity-one>
- <script>groovy:
- request.setParameter("orderMode", "SALES_ORDER")
- request.setParameter("productStoreId", "9000")
- request.setParameter("partyId", "DemoCustomer")
- request.setParameter("currencyUom", "USD")
- session = request.getSession()
- session.setAttribute("userLogin", userLogin)
- </script>
- <call-class-method method-name="initializeOrderEntry" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : initializeOrderEntry, Response : ${result}"/>
- <call-class-method method-name="setOrderCurrencyAgreementShipDates" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : setOrderCurrencyAgreementShipDates, Response : ${result}"/>
- <script>groovy:
- request.setParameter("add_product_id", "GZ-1000")
- </script>
- <call-class-method method-name="addToCart" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : addToCart, Response : ${result}"/>
- <script>groovy:
- request.setParameter("checkoutpage", "quick")
- request.setParameter("shipping_contact_mech_id", "9015")
- request.setParameter("shipping_method", "GROUND@UPS")
- request.setParameter("checkOutPaymentId", "EXT_PAYPAL")
- request.setParameter("is_gift", "false")
- request.setParameter("may_split", "false")
- </script>
- <field-to-request field="nullField" request-name="shoppingCart"/>
- <call-class-method method-name="setQuickCheckOutOptions" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : setQuickCheckOutOptions, Response : ${result}"/>
- <call-class-method method-name="createOrder" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : createOrder, Response : ${result}"/>
- <call-class-method method-name="processPayment" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : processPayment, Response : ${result}"/>
- <call-service-asynch service-name="sendOrderConfirmation"/>
- <call-class-method method-name="destroyCart" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : destroyCart, Response = ${result}"/>
- <!-- Step 3 -->
- <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder">
- <field-map field-name="groupOrderId" from-field="groupOrderId"/>
- </entity-one>
- <assert>
- <if-compare field="productGroupOrder.soldOrderQty" operator="not-equals" value="0"/>
- </assert>
- <!-- Step 4 -->
- <set field="checkProductGroupOrderExpiredMap.userLogin" from-field="systemUserLogin"/>
- <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="groupOrderId"/>
- <call-service service-name="checkProductGroupOrderExpired" in-map-name="checkProductGroupOrderExpiredMap"/>
- <!-- Step 5 -->
- <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders">
- <field-map field-name="groupOrderId" from-field="groupOrderId"/>
- </entity-and>
- <first-from-list list="orderItemGroupOrders" entry="orderItemGroupOrder"/>
- <entity-one entity-name="OrderItem" value-field="orderItem">
- <field-map field-name="orderId" from-field="orderItemGroupOrder.orderId"/>
- <field-map field-name="orderItemSeqId" from-field="orderItemGroupOrder.orderItemSeqId"/>
- </entity-one>
- <assert>
- <if-compare field="orderItem.statusId" operator="equals" value="ITEM_APPROVED"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testGroupOrderLimitNotReached" short-description="Test GroupOrder the limit is not reached" login-required="false">
- <!-- Test GroupOrder the limit is not reached
- Step 1) Create ProductGroupOrder.
- Step 2) Create an order.
- Step 3) Check soldOrderQty is added.
- Step 4) Check ProductGroupOrder expired.
- Step 5) Check Order Item should cancelled.
- -->
- <!-- Step 1 -->
- <now-timestamp field="nowTimestamp"/>
- <set field="days" value="1" type="Integer"/>
- <call-class-method class-name="org.apache.ofbiz.base.util.UtilDateTime" method-name="addDaysToTimestamp" ret-field="thruDate">
- <field field="nowTimestamp" type="java.sql.Timestamp"/>
- <field field="days" type="int"/>
- </call-class-method>
- <entity-one entity-name="UserLogin" value-field="systemUserLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="createProductGroupOrderMap.userLogin" from-field="systemUserLogin"/>
- <set field="createProductGroupOrderMap.productId" value="GZ-1001"/>
- <set field="createProductGroupOrderMap.fromDate" from-field="nowTimestamp"/>
- <set field="createProductGroupOrderMap.thruDate" from-field="thruDate"/>
- <set field="createProductGroupOrderMap.statusId" value="GO_CREATED"/>
- <set field="createProductGroupOrderMap.reqOrderQty" value="2" type="BigDecimal"/>
- <set field="createProductGroupOrderMap.soldOrderQty" value="0" type="BigDecimal"/>
- <call-service service-name="createProductGroupOrder" in-map-name="createProductGroupOrderMap">
- <result-to-field result-name="groupOrderId" field="groupOrderId"/>
- </call-service>
- <!-- Step 2 -->
- <field-to-session field="nullField" session-name="orderMode"/>
- <set field="request" from-field="parameters.request"/>
- <set field="response" from-field="parameters.response"/>
- <call-class-method method-name="routeOrderEntry" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : routeOrderEntry, Response : ${result}"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="admin"/>
- </entity-one>
- <script>groovy:
- request.setParameter("orderMode", "SALES_ORDER")
- request.setParameter("productStoreId", "9000")
- request.setParameter("partyId", "DemoCustomer")
- request.setParameter("currencyUom", "USD")
- session = request.getSession()
- session.setAttribute("userLogin", userLogin)
- </script>
- <call-class-method method-name="initializeOrderEntry" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : initializeOrderEntry, Response : ${result}"/>
- <call-class-method method-name="setOrderCurrencyAgreementShipDates" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : setOrderCurrencyAgreementShipDates, Response : ${result}"/>
- <script>groovy:
- request.setParameter("add_product_id", "GZ-1001")
- </script>
- <call-class-method method-name="addToCart" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : addToCart, Response : ${result}"/>
- <script>groovy:
- request.setParameter("checkoutpage", "quick")
- request.setParameter("shipping_contact_mech_id", "9015")
- request.setParameter("shipping_method", "GROUND@UPS")
- request.setParameter("checkOutPaymentId", "EXT_PAYPAL")
- request.setParameter("is_gift", "false")
- request.setParameter("may_split", "false")
- </script>
- <field-to-request field="nullField" request-name="shoppingCart"/>
- <call-class-method method-name="setQuickCheckOutOptions" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : setQuickCheckOutOptions, Response : ${result}"/>
- <call-class-method method-name="createOrder" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : createOrder, Response : ${result}"/>
- <call-class-method method-name="processPayment" class-name="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : processPayment, Response : ${result}"/>
- <call-service-asynch service-name="sendOrderConfirmation"/>
- <call-class-method method-name="destroyCart" class-name="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" ret-field="result">
- <field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
- <field field="response" type="jakarta.servlet.http.HttpServletResponse"/>
- </call-class-method>
- <log level="info" message="===== >>> Event : destroyCart, Response = ${result}"/>
- <!-- Step 3 -->
- <entity-one entity-name="ProductGroupOrder" value-field="productGroupOrder">
- <field-map field-name="groupOrderId" from-field="groupOrderId"/>
- </entity-one>
- <assert>
- <if-compare field="productGroupOrder.soldOrderQty" operator="not-equals" value="0"/>
- </assert>
- <!-- Step 4 -->
- <set field="checkProductGroupOrderExpiredMap.userLogin" from-field="systemUserLogin"/>
- <set field="checkProductGroupOrderExpiredMap.groupOrderId" from-field="groupOrderId"/>
- <call-service service-name="checkProductGroupOrderExpired" in-map-name="checkProductGroupOrderExpiredMap"/>
- <!-- Step 5 -->
- <entity-and entity-name="OrderItemGroupOrder" list="orderItemGroupOrders">
- <field-map field-name="groupOrderId" from-field="groupOrderId"/>
- </entity-and>
- <first-from-list list="orderItemGroupOrders" entry="orderItemGroupOrder"/>
- <entity-one entity-name="OrderItem" value-field="orderItem">
- <field-map field-name="orderId" from-field="orderItemGroupOrder.orderId"/>
- <field-map field-name="orderItemSeqId" from-field="orderItemGroupOrder.orderItemSeqId"/>
- </entity-one>
- <assert>
- <if-compare field="orderItem.statusId" operator="equals" value="ITEM_CANCELLED"/>
- </assert>
- <check-errors/>
- </simple-method>
-</simple-methods>
diff --git a/applications/product/src/main/groovy/org/apache/ofbiz/product/product/test/GroupOrderTests.groovy b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/test/GroupOrderTests.groovy
new file mode 100644
index 0000000000..9fbe4f3593
--- /dev/null
+++ b/applications/product/src/main/groovy/org/apache/ofbiz/product/product/test/GroupOrderTests.groovy
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ofbiz.product.product.test
+
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.ServiceUtil
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+
+import java.sql.Timestamp
+
+@SuppressWarnings(['LineLength', 'UnnecessaryObjectReferences', 'UnnecessaryGString', 'PublicMethodsBeforeNonPublicMethods', 'ClassSize', 'MethodCount', 'ConsecutiveBlankLines', 'BlockEndsWithBlankLine', 'ClassEndsWithBlankLine'])
+class GroupOrderTests extends OFBizTestCase {
+
+ GroupOrderTests(String name) {
+ super(name)
+ }
+
+ void testGroupOrderLimitReached() {
+ GenericValue systemUserLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ GenericValue adminUserLogin = from('UserLogin').where('userLoginId', 'admin').queryOne()
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp thruDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map createGroupOrderCtx = [
+ userLogin: systemUserLogin,
+ productId: 'GZ-1000',
+ fromDate: nowTimestamp,
+ thruDate: thruDate,
+ statusId: 'GO_CREATED',
+ reqOrderQty: 1.0,
+ soldOrderQty: 0.0
+ ]
+ Map serviceResult = dispatcher.runSync('createProductGroupOrder', createGroupOrderCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String groupOrderId = serviceResult.groupOrderId
+ assert groupOrderId
+
+ // Create an order using the createTestSalesOrderSingle service
+ Map orderResult = dispatcher.runSync('createTestSalesOrderSingle', [userLogin: adminUserLogin, productId: 'GZ-1000'])
+ assert ServiceUtil.isSuccess(orderResult)
+
+ GenericValue productGroupOrder = from('ProductGroupOrder').where('groupOrderId', groupOrderId).queryOne()
+ assert productGroupOrder.soldOrderQty != 0.0
+
+ Map checkExpiredCtx = [
+ userLogin: systemUserLogin,
+ groupOrderId: groupOrderId
+ ]
+ Map expiredResult = dispatcher.runSync('checkProductGroupOrderExpired', checkExpiredCtx)
+ assert ServiceUtil.isSuccess(expiredResult)
+
+ GenericValue orderItemGroupOrder = from('OrderItemGroupOrder').where('groupOrderId', groupOrderId).queryFirst()
+ assert orderItemGroupOrder
+ GenericValue orderItem = from('OrderItem').where('orderId', orderItemGroupOrder.orderId, 'orderItemSeqId', orderItemGroupOrder.orderItemSeqId).queryOne()
+ assert orderItem.statusId == 'ITEM_APPROVED'
+ }
+
+ void testGroupOrderLimitNotReached() {
+ GenericValue systemUserLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ GenericValue adminUserLogin = from('UserLogin').where('userLoginId', 'admin').queryOne()
+ Timestamp nowTimestamp = UtilDateTime.nowTimestamp()
+ Timestamp thruDate = UtilDateTime.addDaysToTimestamp(nowTimestamp, 1)
+
+ Map createGroupOrderCtx = [
+ userLogin: systemUserLogin,
+ productId: 'GZ-1001',
+ fromDate: nowTimestamp,
+ thruDate: thruDate,
+ statusId: 'GO_CREATED',
+ reqOrderQty: 2.0,
+ soldOrderQty: 0.0
+ ]
+ Map serviceResult = dispatcher.runSync('createProductGroupOrder', createGroupOrderCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ String groupOrderId = serviceResult.groupOrderId
+ assert groupOrderId
+
+ // Create an order using the createTestSalesOrderSingle service
+ Map orderResult = dispatcher.runSync('createTestSalesOrderSingle', [userLogin: adminUserLogin, productId: 'GZ-1001'])
+ assert ServiceUtil.isSuccess(orderResult)
+
+ GenericValue productGroupOrder = from('ProductGroupOrder').where('groupOrderId', groupOrderId).queryOne()
+ assert productGroupOrder.soldOrderQty != 0.0
+
+ Map checkExpiredCtx = [
+ userLogin: systemUserLogin,
+ groupOrderId: groupOrderId
+ ]
+ Map expiredResult = dispatcher.runSync('checkProductGroupOrderExpired', checkExpiredCtx)
+ assert ServiceUtil.isSuccess(expiredResult)
+
+ GenericValue orderItemGroupOrder = from('OrderItemGroupOrder').where('groupOrderId', groupOrderId).queryFirst()
+ assert orderItemGroupOrder
+ GenericValue orderItem = from('OrderItem').where('orderId', orderItemGroupOrder.orderId, 'orderItemSeqId', orderItemGroupOrder.orderItemSeqId).queryOne()
+ assert orderItem.statusId == 'ITEM_CANCELLED'
+ }
+}
diff --git a/applications/product/testdef/GroupOrderTest.xml b/applications/product/testdef/GroupOrderTest.xml
index 1a8801ffb7..b094dd9410 100644
--- a/applications/product/testdef/GroupOrderTest.xml
+++ b/applications/product/testdef/GroupOrderTest.xml
@@ -22,12 +22,8 @@ under the License.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
- <test-case case-name="limitreached-test">
- <simple-method-test location="component://product/minilang/product/test/GroupOrderTest.xml" name="testGroupOrderLimitReached"/>
- </test-case>
-
- <test-case case-name="limitnotreached-test">
- <simple-method-test location="component://product/minilang/product/test/GroupOrderTest.xml" name="testGroupOrderLimitNotReached"/>
+ <test-case case-name="group-order-tests">
+ <junit-test-suite class-name="org.apache.ofbiz.product.product.test.GroupOrderTests"/>
</test-case>
</test-suite>
diff --git a/applications/workeffort/minilang/test/WorkEffortTests.xml b/applications/workeffort/minilang/test/WorkEffortTests.xml
deleted file mode 100644
index 36c4ca4fd7..0000000000
--- a/applications/workeffort/minilang/test/WorkEffortTests.xml
+++ /dev/null
@@ -1,547 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
- <simple-method method-name="testCreateWorkEffortAndPartyAssign" short-description="Test the service createWorkEffortAndPartyAssign" login-required="false">
- <set field="serviceCtx.partyId" value="TestParty-1"/>
- <set field="serviceCtx.roleTypeId" value="CAL_OWNER"/>
- <set field="serviceCtx.statusId" value="PRTYASGN_ASSIGNED"/>
- <set field="serviceCtx.workEffortId" value="TestWorkEffort-1"/>
- <set field="serviceCtx.partyTypeId" value="PARTY_GROUP"/>
- <set field="serviceCtx.workEffortName" value="Test WorkEffort Event"/>
- <set field="serviceCtx.workEffortTypeId" value="TASK"/>
- <set field="serviceCtx.currentStatusId" value="CAL_ACCEPTED"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createWorkEffortAndPartyAssign" in-map-name="serviceCtx">
- <result-to-field result-name="workEffortId"/>
- </call-service>
- <entity-one entity-name="WorkEffort" value-field="workEffort"/>
- <set field="lookupKeyValue.workEffortId" from-field="workEffortId"/>
- <set field="lookupKeyValue.partyId" value="TestParty-1"/>
- <set field="lookupKeyValue.roleTypeId" value="CAL_OWNER"/>
- <find-by-and entity-name="WorkEffortPartyAssignment" map="lookupKeyValue" list="workEffortPartyAssignmentList"/>
- <first-from-list entry="workEffortPartyAssignment" list="workEffortPartyAssignmentList"/>
- <assert>
- <not><if-empty field="workEffort"/></not>
- <not><if-empty field="workEffortPartyAssignment"/></not>
- <if-compare field="workEffort.workEffortTypeId" operator="equals" value="TASK"/>
- <if-compare field="workEffort.currentStatusId" operator="equals" value="CAL_ACCEPTED"/>
- <if-compare field="workEffortPartyAssignment.statusId" operator="equals" value="PRTYASGN_ASSIGNED"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testDeleteWorkEffort" short-description="Test the service deleteWorkEffort" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkEffort-1"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deleteWorkEffort" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffort" value-field="workEffort">
- <field-map field-name="workEffortId" value="TestWorkEffort-1"/>
- </entity-one>
- <assert>
- <if-empty field="workEffort"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCopyWorkEffort" short-description="Test the service copyWorkEffort" login-required="false">
- <set field="serviceCtx.sourceWorkEffortId" value="TestWorkeffort-3"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="copyWorkEffort" in-map-name="serviceCtx">
- <result-to-field result-name="workEffortId"/>
- </call-service>
- <entity-one entity-name="WorkEffort" value-field="workEffort"/>
- <assert>
- <not><if-empty field="workEffort"/></not>
- <if-compare operator="equals" field="workEffort.workEffortName" value="New Test Workeffort"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testDuplicateWorkEffort" short-description="Test the service duplicateWorkEffort" login-required="false">
- <set field="serviceCtx.oldWorkEffortId" value="TestWorkeffort-3"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="duplicateWorkEffort" in-map-name="serviceCtx">
- <result-to-field result-name="workEffortId"/>
- </call-service>
- <entity-one entity-name="WorkEffort" value-field="workEffort"/>
- <assert>
- <not><if-empty field="workEffort"/></not>
- <if-compare operator="equals" field="workEffort.workEffortName" value="New Test Workeffort"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testMakeCommunicationEventWorkEffort" short-description="Test the service makeCommunicationEventWorkEffort" login-required="false">
- <set field="serviceCtx.communicationEventId" value="TestEvent-1"/>
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="makeCommunicationEventWorkEffort" in-map-name="serviceCtx">
- <result-to-field result-name="workEffortId"/>
- <result-to-field result-name="communicationEventId"/>
- </call-service>
- <entity-one entity-name="CommunicationEventWorkEff" value-field="communicationEventWorkEff"/>
- <assert>
- <not><if-empty field="communicationEventWorkEff"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testAssignPartyToWorkEffort" short-description="Test the service assignPartyToWorkEffort" login-required="false">
- <set field="serviceCtx.partyId" value="TestParty"/>
- <set field="serviceCtx.roleTypeId" value="CONTENT_AUTHOR"/>
- <set field="serviceCtx.statusId" value="PRTYASGN_ASSIGNED"/>
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 01:01:01" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="assignPartyToWorkEffort" in-map-name="serviceCtx">
- <result-to-field result-name="fromDate"/>
- </call-service>
- <entity-one entity-name="WorkEffortPartyAssignment" value-field="workEffortPartyAssignment">
- <field-map field-name="partyId" value="TestParty"/>
- <field-map field-name="roleTypeId" value="CONTENT_AUTHOR"/>
- <field-map field-name="workEffortId" value="TestWorkeffort-3"/>
- </entity-one>
- <assert>
- <not><if-empty field="workEffortPartyAssignment"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testUpdatePartyToWorkEffortAssignment" short-description="Test the service updatePartyToWorkEffortAssignment" login-required="false">
- <set field="serviceCtx.partyId" value="TestParty"/>
- <set field="serviceCtx.roleTypeId" value="CUSTOMER"/>
- <set field="serviceCtx.statusId" value="PRTYASGN_ASSIGNED"/>
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 02:02:02" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updatePartyToWorkEffortAssignment" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffortPartyAssignment" value-field="workEffortPartyAssignment">
- <field-map field-name="partyId" value="TestParty"/>
- <field-map field-name="roleTypeId" value="CUSTOMER"/>
- <field-map field-name="workEffortId" value="TestWorkeffort-3"/>
- <field-map field-name="fromDate" value="2009-09-09 02:02:02"/>
- </entity-one>
- <assert>
- <not><if-empty field="workEffortPartyAssignment"/></not>
- <if-compare operator="equals" field="workEffortPartyAssignment.statusId" value="PRTYASGN_ASSIGNED"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testDeletePartyToWorkEffortAssignment" short-description="Test the service deletePartyToWorkEffortAssignment" login-required="false">
- <set field="serviceCtx.partyId" value="TestParty"/>
- <set field="serviceCtx.roleTypeId" value="ACCOUNTANT"/>
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 02:02:02" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="expireWorkEffortPartyAssignment" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffortPartyAssignment" value-field="workEffortPartyAssignment">
- <field-map field-name="partyId" value="TestParty"/>
- <field-map field-name="roleTypeId" value="ACCOUNTANT"/>
- <field-map field-name="workEffortId" value="TestWorkeffort-3"/>
- <field-map field-name="fromDate" value="2009-09-09 02:02:02"/>
- </entity-one>
- <assert>
- <not><if-empty field="workEffortPartyAssignment"/></not>
- <not><if-empty field="workEffortPartyAssignment.thruDate"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testQuickAssignPartyToWorkEffort" short-description="Test the service quickAssignPartyToWorkEffort" login-required="false">
- <set field="serviceCtx.quickAssignPartyId" value="TestCompany"/>
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="quickAssignPartyToWorkEffort" in-map-name="serviceCtx"/>
- <set field="lookupKeyValue.workEffortId" value="TestWorkeffort-3"/>
- <set field="lookupKeyValue.partyId" value="TestCompany"/>
- <find-by-and entity-name="WorkEffortPartyAssignment" map="lookupKeyValue" list="workEffortPartyAssignmentList"/>
- <first-from-list entry="workEffortPartyAssignment" list="workEffortPartyAssignmentList"/>
- <assert>
- <not><if-empty field="workEffortPartyAssignment"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testQuickAssignPartyToWorkEffortWithRole" short-description="Test the service quickAssignPartyToWorkEffortWithRole" login-required="false">
- <set field="serviceCtx.quickAssignPartyId" value="TestParty-1"/>
- <set field="serviceCtx.roleTypeId" value="BILL_FROM_VENDOR"/>
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="quickAssignPartyToWorkEffortWithRole" in-map-name="serviceCtx"/>
- <set field="lookupKeyValue.workEffortId" value="TestWorkeffort-3"/>
- <set field="lookupKeyValue.partyId" value="TestParty-1"/>
- <set field="lookupKeyValue.roleTypeId" value="BILL_FROM_VENDOR"/>
- <find-by-and entity-name="WorkEffortPartyAssignment" map="lookupKeyValue" list="workEffortPartyAssignmentList"/>
- <first-from-list entry="workEffortPartyAssignment" list="workEffortPartyAssignmentList"/>
- <assert>
- <not><if-empty field="workEffortPartyAssignment"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateWorkEffortNote" short-description="Test the service createWorkEffortNote" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <set field="serviceCtx.noteInfo" value="This is test note."/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createWorkEffortNote" in-map-name="serviceCtx">
- <result-to-field result-name="noteId"/>
- </call-service>
- <entity-one entity-name="WorkEffortNote" value-field="workEffortNote">
- <field-map field-name="workEffortId" value="TestWorkeffort-3"/>
- </entity-one>
- <entity-one entity-name="NoteData" value-field="noteData"/>
- <assert>
- <not><if-empty field="workEffortNote"/></not>
- <not><if-empty field="noteData"/></not>
- <if-compare operator="equals" field="noteData.noteInfo" value="This is test note."/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testUpdateWorkEffortNote" short-description="Test the service updateWorkEffortNote" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <set field="serviceCtx.noteId" value="TestNote-1"/>
- <set field="serviceCtx.internalNote" value="Y"/>
- <set field="serviceCtx.noteInfo" value="This is updated test note."/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateWorkEffortNote" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffortNote" value-field="workEffortNote">
- <field-map field-name="workEffortId" value="TestWorkeffort-3"/>
- <field-map field-name="noteId" value="TestNote-1"/>
- </entity-one>
- <entity-one entity-name="NoteData" value-field="noteData">
- <field-map field-name="noteId" value="TestNote-1"/>
- </entity-one>
- <assert>
- <not><if-empty field="workEffortNote"/></not>
- <not><if-empty field="noteData"/></not>
- <if-compare operator="equals" field="noteData.noteInfo" value="This is updated test note."/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testGetWorkEffort" short-description="Test the service getWorkEffort" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="getWorkEffort" in-map-name="serviceCtx">
- <result-to-field result-name="workEffort"/>
- </call-service>
- <assert>
- <not><if-empty field="workEffort"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateWorkEffortAssoc" short-description="Test the service createWorkEffortAssoc" login-required="false">
- <set field="serviceCtx.workEffortIdFrom" value="TestWorkeffort-2"/>
- <set field="serviceCtx.workEffortIdTo" value="TestWorkeffort-3"/>
- <set field="serviceCtx.workEffortAssocTypeId" value="ROUTING_COMPONENT"/>
- <set field="serviceCtx.fromDate" value="2009-09-09 02:02:02" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createWorkEffortAssoc" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffortAssoc" value-field="workEffortAssoc">
- <field-map field-name="workEffortIdFrom" value="TestWorkeffort-2"/>
- <field-map field-name="workEffortIdTo" value="TestWorkeffort-3"/>
- <field-map field-name="workEffortAssocTypeId" value="ROUTING_COMPONENT"/>
- <field-map field-name="fromDate" value="2009-09-09 02:02:02"/>
- </entity-one>
- <assert>
- <not><if-empty field="workEffortAssoc"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCopyWorkEffortAssocs" short-description="Test the service copyWorkEffortAssocs" login-required="false">
- <set field="serviceCtx.sourceWorkEffortId" value="TestWorkeffort-2"/>
- <set field="serviceCtx.targetWorkEffortId" value="TestWorkeffort-4"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="copyWorkEffortAssocs" in-map-name="serviceCtx"/>
- <set field="lookupKeyValue.workEffortIdFrom" value="TestWorkeffort-4"/>
- <find-by-and entity-name="WorkEffortAssoc" map="lookupKeyValue" list="workEffortAssocList"/>
- <assert>
- <not><if-empty field="workEffortAssocList"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateWorkEffortKeyword" short-description="Test the service createWorkEffortKeyword" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-2"/>
- <set field="serviceCtx.keyword" value="test keyword for workeffort"/>
- <set field="serviceCtx.relevancyWeight" value="1" type="Long"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createWorkEffortKeyword" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffortKeyword" value-field="workEffortKeyword">
- <field-map field-name="workEffortId" value="TestWorkeffort-2"/>
- <field-map field-name="keyword" value="test keyword for workeffort"/>
- </entity-one>
- <assert>
- <not><if-empty field="workEffortKeyword"/></not>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testDeleteWorkEffortKeyword" short-description="Test the service deleteWorkEffortKeyword" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/>
- <set field="serviceCtx.keyword" value="test keyword"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deleteWorkEffortKeyword" in-map-name="serviceCtx"/>
- <entity-one entity-name="WorkEffortKeyword" value-field="workEffortKeyword">
- <field-map field-name="workEffortId" value="TestWorkeffort-3"/>
- <field-map field-name="keyword" value="test keyword"/>
- </entity-one>
- <assert>
- <if-empty field="workEffortKeyword"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testDeleteWorkEffortKeywords" short-description="Test the service deleteWorkEffortKeywords" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-2"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deleteWorkEffortKeywords" in-map-name="serviceCtx"/>
- <set field="lookupKeyValue.workEffortId" value="TestWorkeffort-2"/>
- <find-by-and entity-name="WorkEffortKeyword" map="lookupKeyValue" list="workEffortKeywordList"/>
- <assert>
- <if-empty field="workEffortKeywordList"/>
- </assert>
- <check-errors/>
- </simple-method>
- <!--Following testcases are for Timesheet services.-->
- <simple-method method-name="testCreateTimesheet" short-description="Test the service createTimesheet" login-required="false">
- <set field="serviceCtx.partyId" value="TestParty"/>
- <set field="serviceCtx.comments" value="Test timesheet"/>
- <set field="serviceCtx.statusId" value="TIMESHEET_IN_PROCESS"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createTimesheet" in-map-name="serviceCtx">
- <result-to-field result-name="timesheetId"/>
- </call-service>
- <entity-one entity-name="Timesheet" value-field="timesheet"/>
- <assert>
- <not><if-empty field="timesheet"/></not>
- <if-compare operator="equals" field="timesheet.partyId" value="TestParty"/>
- <if-compare operator="equals" field="timesheet.statusId" value="TIMESHEET_IN_PROCESS"/>
- <if-compare operator="equals" field="timesheet.comments" value="Test timesheet"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testUpdateTimesheet" short-description="Test the service updateTimesheet" login-required="false">
- <set field="serviceCtx.timesheetId" value="TestTimesheet-2"/>
- <set field="serviceCtx.clientPartyId" value="TestParty"/>
- <set field="serviceCtx.statusId" value="TIMESHEET_COMPLETED"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateTimesheet" in-map-name="serviceCtx"/>
- <entity-one entity-name="Timesheet" value-field="timesheet">
- <field-map field-name="timesheetId" value="TestTimesheet-2"/>
- </entity-one>
- <assert>
- <not><if-empty field="timesheet"/></not>
- <if-compare operator="equals" field="timesheet.clientPartyId" value="TestParty"/>
- <if-compare operator="equals" field="timesheet.statusId" value="TIMESHEET_COMPLETED"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testDeleteTimesheet" short-description="Test the service deleteTimesheet" login-required="false">
- <set field="serviceCtx.timesheetId" value="TestTimesheet-3"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deleteTimesheet" in-map-name="serviceCtx"/>
- <entity-one entity-name="Timesheet" value-field="timesheet">
- <field-map field-name="timesheetId" value="TestTimesheet-3"/>
- </entity-one>
- <assert>
- <if-empty field="timesheet"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateTimesheets" short-description="Test the service createTimesheets" login-required="false">
- <set field="partyIdList" value="${groovy: ['TestParty', 'TestParty-1'];}" type="List"/>
- <set field="serviceCtx.partyIdList" from-field="partyIdList" type="List"/>
- <set field="serviceCtx.comments" value="Test timesheet for test parties"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createTimesheets" in-map-name="serviceCtx"/>
- <iterate entry="partyId" list="partyIdList">
- <set field="lookupKeyValue.partyId" from-field="partyId"/>
- <set field="lookupKeyValue.comments" value="Test timesheet for test parties"/>
- <find-by-and entity-name="Timesheet" map="lookupKeyValue" list="timesheetList"/>
- <assert>
- <not><if-empty field="timesheetList"/></not>
- </assert>
- </iterate>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateTimesheetForThisWeek" short-description="Test the service createTimesheetForThisWeek" login-required="false">
- <set field="serviceCtx.partyId" value="TestParty-1"/>
- <set field="serviceCtx.comments" value="Test timesheet"/>
- <set field="serviceCtx.requiredDate" value="2009-09-06 00:00:00.0" type="Timestamp"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createTimesheetForThisWeek" in-map-name="serviceCtx">
- <result-to-field result-name="timesheetId"/>
- </call-service>
- <entity-one entity-name="Timesheet" value-field="timesheet"/>
- <assert>
- <not><if-empty field="timesheet"/></not>
- <if-compare operator="equals" field="timesheet.partyId" value="TestParty-1"/>
- <if-compare operator="equals" field="timesheet.fromDate" value="2009-09-06 00:00:00.0"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testAddTimesheetToNewInvoice" short-description="Test the service addTimesheetToNewInvoice" login-required="false">
- <set field="serviceCtx.partyId" value="TestParty-1"/>
- <set field="serviceCtx.partyIdFrom" value="TestCompany"/>
- <set field="serviceCtx.timesheetId" value="TestTimesheet-2"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="addTimesheetToNewInvoice" in-map-name="serviceCtx">
- <result-to-field result-name="invoiceId"/>
- </call-service>
- <entity-one entity-name="Invoice" value-field="invoice"/>
- <assert>
- <not><if-empty field="invoice"/></not>
- <if-compare operator="equals" field="invoice.partyId" value="TestParty-1"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testCreateTimeEntry" short-description="Test the service createTimeEntry" login-required="false">
- <set field="serviceCtx.workEffortId" value="TestWorkeffort-2"/>
- <set field="serviceCtx.comments" value="Test Time Entry"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createTimeEntry" in-map-name="serviceCtx">
- <result-to-field result-name="timeEntryId"/>
- </call-service>
- <entity-one entity-name="TimeEntry" value-field="timeEntry"/>
- <assert>
- <not><if-empty field="timeEntry"/></not>
- <if-compare operator="equals" field="timeEntry.workEffortId" value="TestWorkeffort-2"/>
- <if-compare operator="equals" field="timeEntry.comments" value="Test Time Entry"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testUpdateTimeEntry" short-description="Test the service updateTimeEntry" login-required="false">
- <set field="serviceCtx.timeEntryId" value="TestTimeEntry-1"/>
- <set field="serviceCtx.timesheetId" value="TestTimesheet-4"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="updateTimeEntry" in-map-name="serviceCtx"/>
- <entity-one entity-name="TimeEntry" value-field="timeEntry">
- <field-map field-name="timeEntryId" value="TestTimeEntry-1"/>
- </entity-one>
- <assert>
- <not><if-empty field="timeEntry"/></not>
- <if-compare operator="equals" field="timeEntry.timesheetId" value="TestTimesheet-4"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testDeleteTimeEntry" short-description="Test the service deleteTimeEntry" login-required="false">
- <set field="serviceCtx.timeEntryId" value="TestTimeEntry-2"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="deleteTimeEntry" in-map-name="serviceCtx"/>
- <entity-one entity-name="TimeEntry" value-field="timeEntry">
- <field-map field-name="timeEntryId" value="TestTimeEntry-2"/>
- </entity-one>
- <assert>
- <if-empty field="TimeEntry"/>
- </assert>
- <check-errors/>
- </simple-method>
- <simple-method method-name="testGetTimeEntryRate" short-description="Test the service getTimeEntryRate" login-required="false">
- <set field="serviceCtx.timeEntryId" value="TestTimeEntry-3"/>
- <set field="serviceCtx.currencyUomId" value="USD"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="getTimeEntryRate" in-map-name="serviceCtx">
- <result-to-field result-name="rateAmount"/>
- </call-service>
- <set field="lookupKeyValue.partyId" value="TestParty"/>
- <set field="lookupKeyValue.rateTypeId" value="STANDARD"/>
- <set field="lookupKeyValue.rateCurrencyUomId" value="USD"/>
- <find-by-and entity-name="RateAmount" map="lookupKeyValue" list="rateAmountList"/>
- <first-from-list entry="rateAmount" list="rateAmountList"/>
- <assert>
- <not><if-empty field="rateAmount"/></not>
- </assert>
- <check-errors/>
- </simple-method>
-</simple-methods>
diff --git a/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy b/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy
new file mode 100644
index 0000000000..ceaec6bb6d
--- /dev/null
+++ b/applications/workeffort/src/main/groovy/org/apache/ofbiz/workeffort/workeffort/test/WorkEffortTests.groovy
@@ -0,0 +1,595 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ofbiz.workeffort.workeffort.test
+
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.service.testtools.OFBizTestCase
+import org.apache.ofbiz.service.ServiceUtil
+
+@SuppressWarnings(['LineLength', 'UnnecessaryObjectReferences', 'UnnecessaryGString', 'PublicMethodsBeforeNonPublicMethods', 'ClassSize', 'MethodCount', 'ConsecutiveBlankLines', 'BlockEndsWithBlankLine', 'ClassEndsWithBlankLine'])
+class WorkEffortTests extends OFBizTestCase {
+
+ WorkEffortTests(String name) {
+ super(name)
+ }
+
+ void testCreateWorkEffortAndPartyAssign() {
+ Map serviceCtx = [
+ partyId: 'TestParty-1',
+ roleTypeId: 'CAL_OWNER',
+ statusId: 'PRTYASGN_ASSIGNED',
+ workEffortId: 'TestWorkEffort-99',
+ partyTypeId: 'PARTY_GROUP',
+ workEffortName: 'Test WorkEffort Event',
+ workEffortTypeId: 'TASK',
+ currentStatusId: 'CAL_ACCEPTED',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createWorkEffortAndPartyAssign', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.workEffortId
+
+ List<GenericValue> workEffortPartyAssignmentList = from('WorkEffortPartyAssignment').where('workEffortId',
+ serviceResult.workEffortId,
+ 'partyId',
+ 'TestParty-1',
+ 'roleTypeId',
+ 'CAL_OWNER').queryList()
+ GenericValue workEffortPartyAssignment = workEffortPartyAssignmentList ? workEffortPartyAssignmentList[0] : null
+ GenericValue workEffort = from('WorkEffort').where('workEffortId', serviceResult.workEffortId).queryOne()
+ assert workEffort
+ assert workEffortPartyAssignment
+ assert workEffort.workEffortTypeId == 'TASK'
+ assert workEffort.currentStatusId == 'CAL_ACCEPTED'
+ assert workEffortPartyAssignment.statusId == 'PRTYASGN_ASSIGNED'
+ }
+
+ void testDeleteWorkEffort() {
+ Map createCtx = [
+ workEffortId: 'TestWorkEffort-98',
+ workEffortName: 'Delete Me',
+ workEffortTypeId: 'TASK',
+ currentStatusId: 'CAL_TENTATIVE',
+ userLogin: userLogin,
+ ]
+ dispatcher.runSync('createWorkEffort', createCtx)
+
+ Map serviceCtx = [
+ workEffortId: 'TestWorkEffort-98',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('deleteWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue workEffort = from('WorkEffort').where('workEffortId', 'TestWorkEffort-98').queryOne()
+ assert !workEffort
+ }
+
+ void testCopyWorkEffort() {
+ Map serviceCtx = [
+ sourceWorkEffortId: 'TestWorkeffort-3',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('copyWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.workEffortId
+
+ GenericValue workEffort = from('WorkEffort').where('workEffortId', serviceResult.workEffortId).queryOne()
+ assert workEffort
+ assert workEffort.workEffortName == 'New Test Workeffort'
+ }
+
+ void testDuplicateWorkEffort() {
+ Map serviceCtx = [
+ oldWorkEffortId: 'TestWorkeffort-3',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('duplicateWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.workEffortId
+
+ GenericValue workEffort = from('WorkEffort').where('workEffortId', serviceResult.workEffortId).queryOne()
+ assert workEffort
+ assert workEffort.workEffortName == 'New Test Workeffort'
+ }
+
+ void testMakeCommunicationEventWorkEffort() {
+ Map serviceCtx = [
+ communicationEventId: 'TestEvent-1',
+ workEffortId: 'TestWorkeffort-3',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('makeCommunicationEventWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.workEffortId
+ assert serviceResult.communicationEventId
+
+ GenericValue communicationEventWorkEff = from('CommunicationEventWorkEff').where('workEffortId',
+ serviceResult.workEffortId,
+ 'communicationEventId',
+ serviceResult.communicationEventId).queryOne()
+ assert communicationEventWorkEff
+ }
+
+ void testAssignPartyToWorkEffort() {
+ Map serviceCtx = [
+ partyId: 'TestParty',
+ roleTypeId: 'CONTENT_AUTHOR',
+ statusId: 'PRTYASGN_ASSIGNED',
+ workEffortId: 'TestWorkeffort-3',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 01:01:01'),
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('assignPartyToWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.fromDate
+
+ GenericValue workEffortPartyAssignment = from('WorkEffortPartyAssignment').where('partyId',
+ 'TestParty',
+ 'roleTypeId',
+ 'CONTENT_AUTHOR',
+ 'workEffortId',
+ 'TestWorkeffort-3',
+ 'fromDate',
+ serviceResult.fromDate).queryOne()
+ assert workEffortPartyAssignment
+ }
+
+ void testUpdatePartyToWorkEffortAssignment() {
+ Map serviceCtx = [
+ partyId: 'TestParty',
+ roleTypeId: 'CUSTOMER',
+ statusId: 'PRTYASGN_ASSIGNED',
+ workEffortId: 'TestWorkeffort-3',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 02:02:02'),
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('updatePartyToWorkEffortAssignment', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue workEffortPartyAssignment = from('WorkEffortPartyAssignment').where('partyId',
+ 'TestParty',
+ 'roleTypeId',
+ 'CUSTOMER',
+ 'workEffortId',
+ 'TestWorkeffort-3',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2009-09-09 02:02:02')).queryOne()
+ assert workEffortPartyAssignment
+ assert workEffortPartyAssignment.statusId == 'PRTYASGN_ASSIGNED'
+ }
+
+ void testDeletePartyToWorkEffortAssignment() {
+ Map serviceCtx = [
+ partyId: 'TestParty',
+ roleTypeId: 'ACCOUNTANT',
+ workEffortId: 'TestWorkeffort-3',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 02:02:02'),
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('expireWorkEffortPartyAssignment', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue workEffortPartyAssignment = from('WorkEffortPartyAssignment').where('partyId',
+ 'TestParty',
+ 'roleTypeId',
+ 'ACCOUNTANT',
+ 'workEffortId',
+ 'TestWorkeffort-3',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2009-09-09 02:02:02')).queryOne()
+ assert workEffortPartyAssignment
+ assert workEffortPartyAssignment.thruDate
+ }
+
+ void testQuickAssignPartyToWorkEffort() {
+ Map serviceCtx = [
+ quickAssignPartyId: 'TestCompany',
+ workEffortId: 'TestWorkeffort-3',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('quickAssignPartyToWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ List<GenericValue> workEffortPartyAssignmentList = from('WorkEffortPartyAssignment').where('workEffortId',
+ 'TestWorkeffort-3',
+ 'partyId',
+ 'TestCompany').queryList()
+ GenericValue workEffortPartyAssignment = workEffortPartyAssignmentList ? workEffortPartyAssignmentList[0] : null
+ assert workEffortPartyAssignment
+ }
+
+ void testQuickAssignPartyToWorkEffortWithRole() {
+ Map serviceCtx = [
+ quickAssignPartyId: 'TestParty-1',
+ roleTypeId: 'BILL_FROM_VENDOR',
+ workEffortId: 'TestWorkeffort-3',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('quickAssignPartyToWorkEffortWithRole', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ List<GenericValue> workEffortPartyAssignmentList = from('WorkEffortPartyAssignment').where('workEffortId',
+ 'TestWorkeffort-3',
+ 'partyId',
+ 'TestParty-1',
+ 'roleTypeId',
+ 'BILL_FROM_VENDOR').queryList()
+ GenericValue workEffortPartyAssignment = workEffortPartyAssignmentList ? workEffortPartyAssignmentList[0] : null
+ assert workEffortPartyAssignment
+ }
+
+ void testCreateWorkEffortNote() {
+ Map serviceCtx = [
+ workEffortId: 'TestWorkeffort-3',
+ noteInfo: 'This is test note.',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createWorkEffortNote', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.noteId
+
+ GenericValue workEffortNote = from('WorkEffortNote').where('workEffortId', 'TestWorkeffort-3', 'noteId', serviceResult.noteId).queryOne()
+ GenericValue noteData = from('NoteData').where('noteId', serviceResult.noteId).queryOne()
+ assert workEffortNote
+ assert noteData
+ assert noteData.noteInfo == 'This is test note.'
+ }
+
+ void testUpdateWorkEffortNote() {
+ Map serviceCtx = [
+ workEffortId: 'TestWorkeffort-3',
+ noteId: 'TestNote-1',
+ internalNote: 'Y',
+ noteInfo: 'This is updated test note.',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('updateWorkEffortNote', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue workEffortNote = from('WorkEffortNote').where('workEffortId', 'TestWorkeffort-3', 'noteId', 'TestNote-1').queryOne()
+ GenericValue noteData = from('NoteData').where('noteId', 'TestNote-1').queryOne()
+ assert workEffortNote
+ assert noteData
+ assert noteData.noteInfo == 'This is updated test note.'
+ }
+
+ void testGetWorkEffort() {
+ Map serviceCtx = [
+ workEffortId: 'TestWorkeffort-3',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('getWorkEffort', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.workEffort
+
+ }
+
+ void testCreateWorkEffortAssoc() {
+ Map serviceCtx = [
+ workEffortIdFrom: 'TestWorkeffort-2',
+ workEffortIdTo: 'TestWorkeffort-3',
+ workEffortAssocTypeId: 'ROUTING_COMPONENT',
+ fromDate: java.sql.Timestamp.valueOf('2009-09-09 02:02:02'),
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createWorkEffortAssoc', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue workEffortAssoc = from('WorkEffortAssoc').where('workEffortIdFrom',
+ 'TestWorkeffort-2',
+ 'workEffortIdTo',
+ 'TestWorkeffort-3',
+ 'workEffortAssocTypeId',
+ 'ROUTING_COMPONENT',
+ 'fromDate',
+ java.sql.Timestamp.valueOf('2009-09-09 02:02:02')).queryOne()
+ assert workEffortAssoc
+ }
+
+ void testCopyWorkEffortAssocs() {
+ Map serviceCtx = [
+ sourceWorkEffortId: 'TestWorkeffort-2',
+ targetWorkEffortId: 'TestWorkeffort-4',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('copyWorkEffortAssocs', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ List<GenericValue> workEffortAssocList = from('WorkEffortAssoc').where('workEffortIdFrom', 'TestWorkeffort-4').queryList()
+ assert workEffortAssocList
+ }
+
+ void testCreateWorkEffortKeyword() {
+ Map serviceCtx = [
+ workEffortId: 'TestWorkeffort-2',
+ keyword: 'new test keyword for workeffort',
+ relevancyWeight: 1L,
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createWorkEffortKeyword', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue workEffortKeyword = from('WorkEffortKeyword').where('workEffortId',
+ 'TestWorkeffort-2',
+ 'keyword',
+ 'new test keyword for workeffort').queryOne()
+ assert workEffortKeyword
+ }
+
+ void testDeleteWorkEffortKeyword() {
+ Map serviceCtx = [
+ workEffortId: 'TestWorkeffort-3',
+ keyword: 'test keyword',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('deleteWorkEffortKeyword', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue workEffortKeyword = from('WorkEffortKeyword').where('workEffortId', 'TestWorkeffort-3', 'keyword', 'test keyword').queryOne()
+ assert !workEffortKeyword
+ }
+
+ void testDeleteWorkEffortKeywords() {
+ Map serviceCtx = [
+ workEffortId: 'TestWorkeffort-2',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('deleteWorkEffortKeywords', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ List<GenericValue> workEffortKeywordList = from('WorkEffortKeyword').where('workEffortId', 'TestWorkeffort-2').queryList()
+ assert !workEffortKeywordList
+ }
+
+ void testCreateTimesheet() {
+ Map serviceCtx = [
+ partyId: 'TestParty',
+ comments: 'Test timesheet',
+ statusId: 'TIMESHEET_IN_PROCESS',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createTimesheet', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.timesheetId
+
+ GenericValue timesheet = from('Timesheet').where('timesheetId', serviceResult.timesheetId).queryOne()
+ assert timesheet
+ assert timesheet.partyId == 'TestParty'
+ assert timesheet.statusId == 'TIMESHEET_IN_PROCESS'
+ assert timesheet.comments == 'Test timesheet'
+ }
+
+ void testUpdateTimesheet() {
+ Map serviceCtx = [
+ timesheetId: 'TestTimesheet-2',
+ clientPartyId: 'TestParty',
+ statusId: 'TIMESHEET_COMPLETED',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('updateTimesheet', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue timesheet = from('Timesheet').where('timesheetId', 'TestTimesheet-2').queryOne()
+ assert timesheet
+ assert timesheet.clientPartyId == 'TestParty'
+ assert timesheet.statusId == 'TIMESHEET_COMPLETED'
+ }
+
+ void testDeleteTimesheet() {
+ Map serviceCtx = [
+ timesheetId: 'TestTimesheet-3',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('deleteTimesheet', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue timesheet = from('Timesheet').where('timesheetId', 'TestTimesheet-3').queryOne()
+ assert !timesheet
+ }
+
+ void testCreateTimesheets() {
+ List partyIdList = ['TestParty', 'TestParty-1']
+ Map serviceCtx = [
+ partyIdList: partyIdList,
+ comments: 'Test timesheet for test parties',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createTimesheets', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ for (String partyId : partyIdList) {
+ List<GenericValue> timesheetList = from('Timesheet')
+ .where('partyId', partyId, 'comments', 'Test timesheet for test parties')
+ .queryList()
+ assert timesheetList
+ }
+ }
+
+ void testCreateTimesheetForThisWeek() {
+ Map serviceCtx = [
+ partyId: 'TestParty-1',
+ comments: 'Test timesheet',
+ requiredDate: java.sql.Timestamp.valueOf('2009-09-06 00:00:00.0'),
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createTimesheetForThisWeek', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.timesheetId
+
+ GenericValue timesheet = from('Timesheet').where('timesheetId', serviceResult.timesheetId).queryOne()
+ assert timesheet
+ assert timesheet.partyId == 'TestParty-1'
+ assert timesheet.fromDate == java.sql.Timestamp.valueOf('2009-09-06 00:00:00.0')
+ }
+
+ void testAddTimesheetToNewInvoice() {
+ Map serviceCtx = [
+ partyId: 'TestParty-1',
+ partyIdFrom: 'TestCompany',
+ timesheetId: 'TestTimesheet-2',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('addTimesheetToNewInvoice', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.invoiceId
+
+ GenericValue invoice = from('Invoice').where('invoiceId', serviceResult.invoiceId).queryOne()
+ assert invoice
+ assert invoice.partyId == 'TestParty-1'
+ }
+
+ void testCreateTimeEntry() {
+ Map serviceCtx = [
+ workEffortId: 'TestWorkeffort-2',
+ comments: 'Test Time Entry',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('createTimeEntry', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.timeEntryId
+
+ GenericValue timeEntry = from('TimeEntry').where('timeEntryId', serviceResult.timeEntryId).queryOne()
+ assert timeEntry
+ assert timeEntry.workEffortId == 'TestWorkeffort-2'
+ assert timeEntry.comments == 'Test Time Entry'
+ }
+
+ void testUpdateTimeEntry() {
+ Map serviceCtx = [
+ timeEntryId: 'TestTimeEntry-1',
+ timesheetId: 'TestTimesheet-4',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('updateTimeEntry', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue timeEntry = from('TimeEntry').where('timeEntryId', 'TestTimeEntry-1').queryOne()
+ assert timeEntry
+ assert timeEntry.timesheetId == 'TestTimesheet-4'
+ }
+
+ void testDeleteTimeEntry() {
+ Map serviceCtx = [
+ timeEntryId: 'TestTimeEntry-2',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('deleteTimeEntry', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+
+ GenericValue timeEntry = from('TimeEntry').where('timeEntryId', 'TestTimeEntry-2').queryOne()
+ assert !timeEntry
+ }
+
+ void testCreateEventService() {
+ GenericValue systemLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ Map createCtx = [
+ workEffortTypeId: 'EVENT',
+ quickAssignPartyId: 'DemoCustomer',
+ workEffortName: 'Create Work Effort',
+ currentStatusId: 'CAL_TENTATIVE',
+ userLogin: systemLogin,
+ ]
+ Map createResult = dispatcher.runSync('createWorkEffort', createCtx)
+ assert ServiceUtil.isSuccess(createResult)
+ String workEffortId = createResult.workEffortId
+ assert workEffortId
+
+ Map updateCtx = [
+ workEffortId: workEffortId,
+ workEffortTypeId: 'EVENT',
+ workEffortName: 'Update an event',
+ currentStatusId: 'CAL_ACCEPTED',
+ userLogin: systemLogin,
+ ]
+ Map updateResult = dispatcher.runSync('updateWorkEffort', updateCtx)
+ assert ServiceUtil.isSuccess(updateResult)
+
+ GenericValue workEffort = from('WorkEffort').where('workEffortId', workEffortId).queryOne()
+ assert workEffort
+ assert workEffort.workEffortTypeId == 'EVENT'
+ assert workEffort.workEffortName == 'Update an event'
+ assert workEffort.currentStatusId == 'CAL_ACCEPTED'
+ }
+
+ void testCreateProjectService() {
+ GenericValue systemLogin = from('UserLogin').where('userLoginId', 'system').queryOne()
+ Map createCtx = [
+ workEffortTypeId: 'PROJECT',
+ quickAssignPartyId: 'DemoCustomer',
+ workEffortName: 'Create a project',
+ currentStatusId: 'CAL_TENTATIVE',
+ userLogin: systemLogin,
+ ]
+ Map createResult = dispatcher.runSync('createWorkEffort', createCtx)
+ assert ServiceUtil.isSuccess(createResult)
+ String workEffortId = createResult.workEffortId
+ assert workEffortId
+
+ Map updateCtx = [
+ workEffortId: workEffortId,
+ workEffortTypeId: 'PROJECT',
+ workEffortName: 'Update a project',
+ currentStatusId: 'CAL_ACCEPTED',
+ userLogin: systemLogin,
+ ]
+ Map updateResult = dispatcher.runSync('updateWorkEffort', updateCtx)
+ assert ServiceUtil.isSuccess(updateResult)
+
+ Map noteCtx = [
+ workEffortId: workEffortId,
+ noteParty: 'DemoCustomer',
+ noteInfo: "This is a note for party 'DemoCustomer'",
+ userLogin: systemLogin,
+ ]
+ Map noteResult = dispatcher.runSync('createWorkEffortNote', noteCtx)
+ assert ServiceUtil.isSuccess(noteResult)
+
+ GenericValue workEffort = from('WorkEffort').where('workEffortId', workEffortId).queryOne()
+ assert workEffort
+ assert workEffort.workEffortTypeId == 'PROJECT'
+ assert workEffort.workEffortName == 'Update a project'
+ assert workEffort.currentStatusId == 'CAL_ACCEPTED'
+
+ GenericValue noteData = from('NoteData').where('noteId', noteResult.noteId).queryOne()
+ assert noteData
+ assert noteData.noteParty == 'DemoCustomer'
+ assert noteData.noteInfo == "This is a note for party 'DemoCustomer'"
+ }
+
+ void testGetTimeEntryRate() {
+ Map serviceCtx = [
+ timeEntryId: 'TestTimeEntry-3',
+ currencyUomId: 'USD',
+ userLogin: userLogin,
+ ]
+ Map serviceResult = dispatcher.runSync('getTimeEntryRate', serviceCtx)
+ assert ServiceUtil.isSuccess(serviceResult)
+ assert serviceResult.rateAmount
+
+ List<GenericValue> rateAmountList = from('RateAmount').where('partyId',
+ 'TestParty',
+ 'rateTypeId',
+ 'STANDARD',
+ 'rateCurrencyUomId',
+ 'USD').queryList()
+ GenericValue rateAmount = rateAmountList ? rateAmountList[0] : null
+ assert rateAmount
+ }
+}
diff --git a/applications/workeffort/testdef/workefforttests.xml b/applications/workeffort/testdef/workefforttests.xml
index 0b3dadec71..23c967f980 100644
--- a/applications/workeffort/testdef/workefforttests.xml
+++ b/applications/workeffort/testdef/workefforttests.xml
@@ -20,17 +20,10 @@
<test-suite suite-name="workefforttests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ofbiz.apache.org/dtds/test-suite.xsd">
- <!-- TODO: Move these test implementations to a separate simple methods document -->
<test-case case-name="workeffort-tests-data-load">
<entity-xml action="load" entity-xml-url="component://workeffort/testdef/data/WorkEffortTestData.xml"/>
</test-case>
- <test-case case-name="testCreateEventService Direct Simple Method">
- <simple-method-test location="component://workeffort/minilang/workeffort/WorkEffortSimpleServices.xml" name="testCreateEventService"/>
- </test-case>
- <test-case case-name="testCreateProjectService Direct Simple Method">
- <simple-method-test location="component://workeffort/minilang/workeffort/WorkEffortSimpleServices.xml" name="testCreateProjectService"/>
- </test-case>
<test-case case-name="workeffort-tests">
- <simple-method-test location="component://workeffort/minilang/test/WorkEffortTests.xml"/>
+ <junit-test-suite class-name="org.apache.ofbiz.workeffort.workeffort.test.WorkEffortTests"/>
</test-case>
</test-suite>