You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2016/11/02 20:07:38 UTC
svn commit: r1767773 - in /ofbiz/trunk/applications/accounting:
minilang/test/AutoAcctgAgreementTests.xml
minilang/test/AutoAcctgBudgetTests.xml minilang/test/AutoAcctgCostTests.xml
testdef/accountingtests.xml testdef/data/AccountingTestsData.xml
Author: deepak
Date: Wed Nov 2 20:07:37 2016
New Revision: 1767773
URL: http://svn.apache.org/viewvc?rev=1767773&view=rev
Log:
Improved: Added unit test case for following accounting related services
- cancelAgreement
- copyAgreement
- getCommissionForProduct
- createBudget
- updateBudgetStatus
- updateProductAverageCostOnReceiveInventory
- getProductAverageCost
(OFBIZ-8719)(OFBIZ-8720)(OFBIZ-8721)(OFBIZ-8749)(OFBIZ-8750)(OFBIZ-8751)(OFBIZ-8752)
Thanks Deepak Nigam for your contribution.
Added:
ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml (with props)
ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml (with props)
ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml (with props)
Modified:
ofbiz/trunk/applications/accounting/testdef/accountingtests.xml
ofbiz/trunk/applications/accounting/testdef/data/AccountingTestsData.xml
Added: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml?rev=1767773&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml (added)
+++ ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml Wed Nov 2 20:07:37 2016
@@ -0,0 +1,87 @@
+<?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="testCancelAgreement" short-description="Test case for service cancelAgreement" login-required="false">
+ <set field="serviceCtx.agreementId" value="1000"/>
+ <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="cancelAgreement" in-map-name="serviceCtx"/>
+ <now-timestamp field="nowTimestamp"/>
+
+ <entity-one entity-name="Agreement" value-field="agreement">
+ <field-map field-name="agreementId" value="1000"/>
+ </entity-one>
+ <assert>
+ <not><if-empty field="agreement"/></not>
+ <if-compare-field field="agreement.thruDate" operator="less-equals" to-field="nowTimestamp"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+ <simple-method method-name="testCopyAgreement" short-description="Test case for service copyAgreement" login-required="false">
+ <set field="serviceCtx.agreementId" value="1010"/>
+ <set field="serviceCtx.copyAgreementTerms" value="N"/>
+ <set field="serviceCtx.copyAgreementProducts" value="Y"/>
+ <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="copyAgreement" in-map-name="serviceCtx">
+ <results-to-map map-name="agreementResult"/>
+ </call-service>
+ <entity-one entity-name="Agreement" value-field="agreement">
+ <field-map field-name="agreementId" from-field="agreementResult.agreementId"/>
+ </entity-one>
+ <get-related value-field="agreement" relation-name="AgreementItem" list="agreementItems"/>
+ <get-related value-field="agreement" relation-name="AgreementTerm" list="agreementTerms"/>
+ <get-related value-field="agreement" relation-name="AgreementProductAppl" list="agreementProductAppls"/>
+ <assert>
+ <not><if-empty field="agreement"/></not>
+ <not><if-empty field="agreementItems"/></not>
+ <if-empty field="agreementTerms"/>
+ <not><if-empty field="agreementProductAppls"/></not>
+ </assert>
+ <check-errors/>
+ </simple-method>
+ <simple-method method-name="testGetCommissionForProduct" short-description="Test case for service getCommissionForProduct" login-required="false">
+ <set field="serviceCtx.productId" value="TestProduct2"/>
+ <set field="serviceCtx.invoiceItemSeqId" value="COMM_INV_ITEM"/>
+ <set field="serviceCtx.invoiceItemTypeId" value="COMM_INV_ITEM"/>
+ <set field="serviceCtx.amount" value="100" type="BigDecimal"/>
+ <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="getCommissionForProduct" in-map-name="serviceCtx">
+ <results-to-map map-name="productCommission"/>
+ </call-service>
+ <set field="commissions" from-field="productCommission.commissions"/>
+ <first-from-list entry="commission" list="commissions"/>
+ <assert>
+ <not><if-empty field="commissions"/></not>
+ <not><if-empty field="commission"/></not>
+ <if-compare operator="equals" value="10.00" field="commission.commission"></if-compare>
+ </assert>
+ <check-errors/>
+ </simple-method>
+</simple-methods>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgAgreementTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml?rev=1767773&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml (added)
+++ ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml Wed Nov 2 20:07:37 2016
@@ -0,0 +1,65 @@
+<?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="testCreateBudget" short-description="Test case for service createBudget" login-required="false">
+ <set field="serviceCtx.budgetTypeId" value="CAPITAL_BUDGET"/>
+ <set field="serviceCtx.comments" value="Capital Budget"/>
+ <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="createBudget" in-map-name="serviceCtx">
+ <results-to-map map-name="budgetResult"/>
+ </call-service>
+
+ <entity-one entity-name="Budget" value-field="budget">
+ <field-map field-name="budgetId" from-field="budgetResult.budgetId"/>
+ </entity-one>
+ <assert>
+ <not><if-empty field="budget"/></not>
+ <if-compare operator="equals" value="CAPITAL_BUDGET" field="budget.budgetTypeId"></if-compare>
+ <if-compare operator="equals" value="Capital Budget" field="budget.comments"></if-compare>
+ </assert>
+ <check-errors/>
+ </simple-method>
+ <simple-method method-name="testUpdateBudgetStatus" short-description="Test case for service updateBudgetStatus" login-required="false">
+ <set field="serviceCtx.budgetId" value="9999"/>
+ <set field="serviceCtx.statusId" value="BG_APPROVED"/>
+ <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="updateBudgetStatus" in-map-name="serviceCtx"/>
+
+ <entity-and list="budgetStatuses" entity-name="BudgetStatus">
+ <field-map field-name="budgetId" value="9999"/>
+ <order-by field-name="-statusDate"/>
+ </entity-and>
+ <first-from-list entry="budgetStatus" list="budgetStatuses"/>
+ <assert>
+ <not><if-empty field="budgetStatus"/></not>
+ <if-compare operator="equals" value="BG_APPROVED" field="budgetStatus.statusId"></if-compare>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+</simple-methods>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgBudgetTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml?rev=1767773&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml (added)
+++ ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml Wed Nov 2 20:07:37 2016
@@ -0,0 +1,66 @@
+<?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="testUpdateProductAverageCostOnReceiveInventory" short-description="Test case for service updateProductAverageCostOnReceiveInventory" login-required="false">
+ <set field="serviceCtx.facilityId" value="DemoFacility1"/>
+ <set field="serviceCtx.quantityAccepted" value="10" type="BigDecimal"/>
+ <set field="serviceCtx.productId" value="TestProduct3"/>
+ <set field="serviceCtx.inventoryItemId" value="9999"/>
+ <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="updateProductAverageCostOnReceiveInventory" in-map-name="serviceCtx"/>
+
+ <entity-and entity-name="ProductAverageCost" list="productAverageCostList" filter-by-date="true">
+ <field-map field-name="productId" value="TestProduct3"/>
+ <field-map field-name="facilityId" value="DemoFacility1"/>
+ <field-map field-name="organizationPartyId" value="DEMO_COMPANY2"/>
+ </entity-and>
+ <first-from-list entry="productAverageCost" list="productAverageCostList"/>
+ <assert>
+ <not><if-empty field="productAverageCost"/></not>
+ <if-compare operator="equals" value="SIMPLE_AVG_COST" field="productAverageCost.productAverageCostTypeId"></if-compare>
+ <if-compare operator="equals" value="9" field="productAverageCost.averageCost"></if-compare>
+ </assert>
+ <check-errors/>
+ </simple-method>
+ <simple-method method-name="testGetProductAverageCost" short-description="Test case for service getProductAverageCost" login-required="false">
+ <entity-one entity-name="InventoryItem" value-field="inventoryItem">
+ <field-map field-name="inventoryItemId" value="9999"/>
+ </entity-one>
+ <set field="serviceCtx.inventoryItem" from-field="inventoryItem"/>
+ <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="getProductAverageCost" in-map-name="serviceCtx">
+ <results-to-map map-name="productAverageCost"/>
+ </call-service>
+ <assert>
+ <not><if-empty field="productAverageCost"/></not>
+ <if-compare operator="equals" value="9" field="productAverageCost.unitCost"></if-compare>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+</simple-methods>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/trunk/applications/accounting/minilang/test/AutoAcctgCostTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: ofbiz/trunk/applications/accounting/testdef/accountingtests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/accountingtests.xml?rev=1767773&r1=1767772&r2=1767773&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/testdef/accountingtests.xml (original)
+++ ofbiz/trunk/applications/accounting/testdef/accountingtests.xml Wed Nov 2 20:07:37 2016
@@ -40,4 +40,13 @@
<test-case case-name="auto-accounting-admin-tests">
<simple-method-test location="component://accounting/minilang/test/AutoAcctgAdminTests.xml"/>
</test-case>
+ <test-case case-name="auto-accounting-agreement-tests">
+ <simple-method-test location="component://accounting/minilang/test/AutoAcctgAgreementTests.xml"/>
+ </test-case>
+ <test-case case-name="auto-accounting-budget-tests">
+ <simple-method-test location="component://accounting/minilang/test/AutoAcctgBudgetTests.xml"/>
+ </test-case>
+ <test-case case-name="auto-accounting-cost-tests">
+ <simple-method-test location="component://accounting/minilang/test/AutoAcctgCostTests.xml"/>
+ </test-case>
</test-suite>
Modified: ofbiz/trunk/applications/accounting/testdef/data/AccountingTestsData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/data/AccountingTestsData.xml?rev=1767773&r1=1767772&r2=1767773&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/testdef/data/AccountingTestsData.xml (original)
+++ ofbiz/trunk/applications/accounting/testdef/data/AccountingTestsData.xml Wed Nov 2 20:07:37 2016
@@ -47,4 +47,25 @@ under the License.
<PaymentGlAccountTypeMap paymentTypeId="COMMISSION_PAYMENT" glAccountTypeId="COMMISSIONS_PAYABLE" organizationPartyId="DEMO_COMPANY1"/>
<!-- For Testing service removePaymentMethodTypeGlAssignment-->
<PaymentMethodTypeGlAccount paymentMethodTypeId="CASH" glAccountId="999999" organizationPartyId="DEMO_COMPANY1"/>
+
+ <!-- For Testing service cancelAgreement -->
+ <PartyRole partyId="DEMO_COMPANY" roleTypeId="SUPPLIER"/>
+ <PartyRole partyId="DEMO_COMPANY1" roleTypeId="DISTRIBUTOR"/>
+ <Agreement agreementId="1000" agreementTypeId="COMMISSION_AGREEMENT" description="Commission Agreement" partyIdFrom="DEMO_COMPANY" partyIdTo="DEMO_COMPANY1" roleTypeIdFrom="SUPPLIER" roleTypeIdTo="DISTRIBUTOR" fromDate="2016-09-29 00:00:00"/>
+ <!-- For Testing service copyAgreement -->
+ <Product productId="TestProduct2" productName="Test Product 2" internalName="Test Product 2" description="Test Product For Testing getCommissionForProduct services"/>
+ <Agreement agreementId="1010" agreementTypeId="COMMISSION_AGREEMENT" description="Commission Agreement" partyIdFrom="DEMO_COMPANY" partyIdTo="DEMO_COMPANY1" roleTypeIdFrom="SUPPLIER" roleTypeIdTo="DISTRIBUTOR" fromDate="2016-09-29 00:00:00"/>
+ <AgreementItem agreementId="1010" agreementItemSeqId="0001" currencyUomId="USD" agreementItemTypeId="AGREEMENT_COMMISSION" agreementText="Commission in USD"/>
+ <AgreementProductAppl agreementId="1010" agreementItemSeqId="0001" productId="TestProduct2"/>
+ <AgreementTerm agreementTermId="1010" termTypeId="FIN_COMM_VARIABLE" agreementId="1010" agreementItemSeqId="0001" productId="TestProduct2" invoiceItemTypeId="COMM_INV_ITEM" fromDate="2016-09-29 00:00:00" thruDate="2017-09-29 00:00:00" termValue="10" termDays="30" minQuantity="1" maxQuantity="100" description="Agreement Term for Test Product 2 Commission"/>
+ <!-- For Testing service updateBudgetStatus -->
+ <Budget budgetId="9999" budgetTypeId="CAPITAL_BUDGET" comments="This is the capital budget"/>
+ <BudgetStatus budgetId="9999" statusId="BG_CREATED" statusDate="2016-09-29 00:00:00"/>
+ <!-- For Testing service updateProductAverageCostOnReceiveInventory -->
+ <Product productId="TestProduct3" productName="Test Product 3" internalName="Test Product 3" description="Test Product For Testing updateProductAverageCostOnReceiveInventory services"/>
+ <Facility facilityId="DemoFacility1" facilityTypeId="WAREHOUSE" facilityName="Demo Facility" />
+ <Party partyId="DEMO_COMPANY2" partyTypeId="PARTY_GROUP"/>
+ <PartyRole partyId="DEMO_COMPANY2" roleTypeId="INTERNAL_ORGANIZATIO"/>
+ <InventoryItem facilityId="DemoFacility1" inventoryItemId="9999" inventoryItemTypeId="NON_SERIAL_INV_ITEM" productId="TestProduct3" ownerPartyId="DEMO_COMPANY2" currencyUomId="USD" unitCost="9"/>
+ <PartyAcctgPreference partyId="DEMO_COMPANY2" cogsMethodId="COGS_LIFO"/>
</entity-engine-xml>