svn commit: r1768162 - in /ofbiz/trunk/applications/accounting: minilang/test/RateTests.xml ofbiz-component.xml testdef/data/RateTestsData.xml testdef/ratetests.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1768162 - in /ofbiz/trunk/applications/accounting: minilang/test/RateTests.xml ofbiz-component.xml testdef/data/RateTestsData.xml testdef/ratetests.xml

Deepak Dixit-5
Author: deepak
Date: Sat Nov  5 08:38:51 2016
New Revision: 1768162

URL: http://svn.apache.org/viewvc?rev=1768162&view=rev
Log:
Improved: Added test cases for following rate related servicse.
- getRateAmount
- deleteRateAmount
- updateRateAmount
- getRatesAmountsFromWorkEffortId
- getRatesAmountsFromPartyId
- getRatesAmountsFromEmplPositionTypeId
- updatePartyRate
- deletePartyRate
- filterRateAmountList

(OFBIZ-8747)(OFBIZ-8753)(OFBIZ-8754)(OFBIZ-8755)(OFBIZ-8756)(OFBIZ-8757)(OFBIZ-8758)(OFBIZ-8759)(OFBIZ-8760)(OFBIZ-8761)

Thanks Akash Jain and Pawan Verma for your contribution

Added:
    ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml   (with props)
    ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml   (with props)
    ofbiz/trunk/applications/accounting/testdef/ratetests.xml   (with props)
Modified:
    ofbiz/trunk/applications/accounting/ofbiz-component.xml

Added: ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml?rev=1768162&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml (added)
+++ ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml Sat Nov  5 08:38:51 2016
@@ -0,0 +1,212 @@
+<?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="testUpdateRateAmount" short-description="test to update RateAmount" login-required="false">
+        <set field="serviceCtx.rateTypeId" value="OVERTIME"/>
+        <set field="serviceCtx.periodTypeId" value="RATE_HOUR"/>
+        <set field="serviceCtx.rateCurrencyUomId" value="USD"/>
+        <set field="serviceCtx.rateAmount" type="BigDecimal" value="25"/>
+        <set field="serviceCtx.emplPositionTypeId" value="TEST_EMPLOYEE"/>
+        <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 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="updateRateAmount" in-map-name="serviceCtx"/>
+        <entity-one entity-name="RateAmount" value-field="rateAmount">
+            <field-map field-name="rateTypeId" value="OVERTIME"/>
+            <field-map field-name="workEffortId" value="_NA_"/>
+            <field-map field-name="rateCurrencyUomId" value="USD"/>
+            <field-map field-name="emplPositionTypeId" value="TEST_EMPLOYEE"/>
+            <field-map field-name="partyId" value="_NA_"/>
+            <field-map field-name="periodTypeId" value="RATE_HOUR"/>
+            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="rateAmount"/></not>
+            <if-compare field="rateAmount.rateAmount" operator="equals" value="25"/>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testDeleteRateAmount" short-description="test to delete RateAmount" login-required="false">
+        <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/>
+        <set field="serviceCtx.emplPositionTypeId" value="TEST_EMPLOYEE"/>
+        <set field="serviceCtx.periodTypeId" value="RATE_MONTH"/>
+        <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 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="deleteRateAmount" in-map-name="serviceCtx"/>
+        <entity-one entity-name="RateAmount" value-field="rateAmount">
+            <field-map field-name="rateTypeId" value="AVERAGE_PAY_RATE"/>
+            <field-map field-name="workEffortId" value="_NA_"/>
+            <field-map field-name="rateCurrencyUomId" value="USD"/>
+            <field-map field-name="emplPositionTypeId" value="TEST_EMPLOYEE"/>
+            <field-map field-name="partyId" value="_NA_"/>
+            <field-map field-name="periodTypeId" value="RATE_MONTH"/>
+            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="rateAmount"/></not>
+            <not><if-empty field="rateAmount.thruDate"/></not>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testGetRateAmount" short-description="test to get Rates Amounts" login-required="false">
+        <set field="serviceCtx.workEffortId" value="Test_effort"/>
+        <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/>
+        <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="getRateAmount" in-map-name="serviceCtx">
+            <result-to-field result-name="rateAmount"/>
+        </call-service>
+        <assert>
+            <if-compare field="rateAmount" operator="equals" value="75"/>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testGetRatesAmountsFromWorkEffortId" short-description="test to get Rates Amounts From WorkEffortId" login-required="false">
+        <set field="serviceCtx.periodTypeId" value="RATE_HOUR"/>
+        <set field="serviceCtx.rateCurrencyUomId" value="USD"/>
+        <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/>
+        <set field="serviceCtx.workEffortId" value="Test_effort"/>
+        <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="getRatesAmountsFromWorkEffortId" in-map-name="serviceCtx">
+            <result-to-field result-name="ratesList"/>
+        </call-service>
+        <assert>
+            <not><if-empty field="ratesList"/></not>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testGetRatesAmountsFromPartyId" short-description="test to get Rates Amounts From partyId" login-required="false">
+        <set field="serviceCtx.periodTypeId" value="RATE_HOUR"/>
+        <set field="serviceCtx.rateCurrencyUomId" value="USD"/>
+        <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/>
+        <set field="serviceCtx.partyId" value="TEST_PARTY"/>
+        <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="getRatesAmountsFromPartyId" in-map-name="serviceCtx">
+            <result-to-field result-name="ratesList"/>
+        </call-service>
+        <assert>
+            <not><if-empty field="ratesList"/></not>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testGetRatesAmountsFromEmplPositionTypeId" short-description="test to get Rates Amounts From EmplPositionTypeId" login-required="false">
+        <set field="serviceCtx.periodTypeId" value="RATE_HOUR"/>
+        <set field="serviceCtx.rateCurrencyUomId" value="USD"/>
+        <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/>
+        <set field="serviceCtx.emplPositionTypeId" value="TEST_EMPLOYEE"/>
+        <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="getRatesAmountsFromEmplPositionTypeId" in-map-name="serviceCtx">
+            <result-to-field result-name="ratesList"/>
+        </call-service>
+        <assert>
+            <not><if-empty field="ratesList"/></not>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testUpdatePartyRate" short-description="test to update PartyRate" login-required="false">
+        <set field="serviceCtx.partyId" value="TEST_PARTY"/>
+        <set field="serviceCtx.periodTypeId" value="RATE_MONTH"/>
+        <set field="serviceCtx.rateTypeId" value="DISCOUNTED"/>
+        <set field="serviceCtx.rateAmount" type="BigDecimal" value="75"/>
+        <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 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="updatePartyRate" in-map-name="serviceCtx"/>
+        <entity-one entity-name="RateAmount" value-field="rateAmount">
+            <field-map field-name="rateTypeId" value="DISCOUNTED"/>
+            <field-map field-name="workEffortId" value="_NA_"/>
+            <field-map field-name="rateCurrencyUomId" value="USD"/>
+            <field-map field-name="emplPositionTypeId" value="_NA_"/>
+            <field-map field-name="partyId" value="TEST_PARTY"/>
+            <field-map field-name="periodTypeId" value="RATE_MONTH"/>
+            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
+        </entity-one>
+        <entity-one entity-name="PartyRate" value-field="partyRate">
+            <field-map field-name="rateTypeId" value="DISCOUNTED"/>
+            <field-map field-name="partyId" value="TEST_PARTY"/>
+            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="rateAmount"/></not>
+            <not><if-empty field="partyRate"/></not>
+            <if-compare field="rateAmount.rateAmount" operator="equals" value="75"/>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testDeletePartyRate" short-description="test to delete PartyRate" login-required="false">
+        <set field="serviceCtx.partyId" value="TEST_PARTY"/>
+        <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/>
+        <set field="serviceCtx.fromDate" type="Timestamp" value="2013-07-04 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="deletePartyRate" in-map-name="serviceCtx"/>
+         <entity-one entity-name="PartyRate" value-field="partyRate">
+            <field-map field-name="rateTypeId" value="AVERAGE_PAY_RATE"/>
+            <field-map field-name="partyId" value="TEST_PARTY"/>
+            <field-map field-name="fromDate" value="2013-07-04 00:00:00"/>
+        </entity-one>
+        <assert>
+            <not><if-empty field="partyRate"/></not>
+            <not><if-empty field="partyRate.thruDate"/></not>
+        </assert>
+        <check-errors/>
+    </simple-method>
+    <simple-method method-name="testFilterRateAmountList" short-description="test the service filterRateAmountList" login-required="false">
+        <entity-and entity-name="RateAmount" list="amountList">
+            <field-map field-name="rateTypeId" value="AVERAGE_PAY_RATE"/>
+            <field-map field-name="rateCurrencyUomId" value="USD"/>
+        </entity-and>
+        <set field="serviceCtx.ratesList" from-field="amountList" type="List"/>
+        <set field="serviceCtx.rateTypeId" value="AVERAGE_PAY_RATE"/>
+        <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="filterRateAmountList" in-map-name="serviceCtx">
+            <result-to-field result-name="filteredRatesList"/>
+        </call-service>
+        <assert>
+            <not><if-empty field="filteredRatesList"/></not>
+        </assert>
+        <check-errors/>
+    </simple-method>
+</simple-methods>

Propchange: ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/minilang/test/RateTests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/accounting/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/ofbiz-component.xml?rev=1768162&r1=1768161&r2=1768162&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/accounting/ofbiz-component.xml Sat Nov  5 08:38:51 2016
@@ -92,6 +92,7 @@ under the License.
     <test-suite loader="main" location="testdef/paymentappltests.xml"/>
     <test-suite loader="main" location="testdef/invoicetests.xml"/>
     <test-suite loader="main" location="testdef/fixedassettests.xml"/>
+    <test-suite loader="main" location="testdef/ratetests.xml"/>
 
     <webapp name="accounting"
         title="Accounting"

Added: ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml?rev=1768162&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml (added)
+++ ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml Sat Nov  5 08:38:51 2016
@@ -0,0 +1,30 @@
+<?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.
+-->
+
+<entity-engine-xml>
+    <WorkEffort workEffortId="Test_effort" workEffortName="Test workeffort"/>
+    <EmplPositionType emplPositionTypeId="TEST_EMPLOYEE" hasTable="N" description="Test employee"/>
+    <RateAmount rateTypeId="AVERAGE_PAY_RATE" rateCurrencyUomId="USD" periodTypeId="RATE_MONTH" workEffortId="_NA_" partyId="_NA_" emplPositionTypeId="TEST_EMPLOYEE" fromDate="2013-07-04 00:00:00"/>
+    <RateAmount rateTypeId="AVERAGE_PAY_RATE" rateCurrencyUomId="USD" periodTypeId="RATE_HOUR" workEffortId="Test_effort" partyId="_NA_" rateAmount="75" emplPositionTypeId="_NA_" fromDate="2013-07-04 00:00:00"/>
+    <Party partyId="TEST_PARTY"/>
+    <RateAmount rateTypeId="AVERAGE_PAY_RATE" rateCurrencyUomId="USD" periodTypeId="RATE_HOUR" workEffortId="_NA_" partyId="TEST_PARTY" emplPositionTypeId="_NA_" fromDate="2013-07-04 00:00:00"/>
+    <RateAmount rateTypeId="AVERAGE_PAY_RATE" rateCurrencyUomId="USD" periodTypeId="RATE_HOUR" workEffortId="_NA_" partyId="_NA_" emplPositionTypeId="TEST_EMPLOYEE" fromDate="2013-07-04 00:00:00"/>
+    <PartyRate partyId="TEST_PARTY" rateTypeId="AVERAGE_PAY_RATE" periodTypeId="RATE_MONTH" fromDate="2013-07-04 00:00:00"/>
+</entity-engine-xml>

Propchange: ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/testdef/data/RateTestsData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/applications/accounting/testdef/ratetests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/testdef/ratetests.xml?rev=1768162&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/testdef/ratetests.xml (added)
+++ ofbiz/trunk/applications/accounting/testdef/ratetests.xml Sat Nov  5 08:38:51 2016
@@ -0,0 +1,31 @@
+<?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.
+  -->
+
+<test-suite suite-name="ratetests"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+    <test-case case-name="rate-tests-data-load">
+        <entity-xml action="load" entity-xml-url="component://accounting/testdef/data/RateTestsData.xml"/>
+    </test-case>
+    
+    <test-case case-name="rate-tests">
+        <simple-method-test location="component://accounting/minilang/test/RateTests.xml"/>
+    </test-case>
+</test-suite>

Propchange: ofbiz/trunk/applications/accounting/testdef/ratetests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/testdef/ratetests.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/testdef/ratetests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml