svn commit: r909331 - in /ofbiz/trunk/applications/product: ofbiz-component.xml script/org/ofbiz/product/test/CostTests.xml testdef/CostTests.xml

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

svn commit: r909331 - in /ofbiz/trunk/applications/product: ofbiz-component.xml script/org/ofbiz/product/test/CostTests.xml testdef/CostTests.xml

jacopoc
Author: jacopoc
Date: Fri Feb 12 10:12:37 2010
New Revision: 909331

URL: http://svn.apache.org/viewvc?rev=909331&view=rev
Log:
Automated test for the product standard cost algorithm.

Added:
    ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml   (with props)
    ofbiz/trunk/applications/product/testdef/CostTests.xml   (with props)
Modified:
    ofbiz/trunk/applications/product/ofbiz-component.xml

Modified: ofbiz/trunk/applications/product/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/ofbiz-component.xml?rev=909331&r1=909330&r2=909331&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/product/ofbiz-component.xml Fri Feb 12 10:12:37 2010
@@ -69,6 +69,7 @@
     <!-- test suite -->
     <test-suite loader="main" location="testdef/CatalogTests.xml"/>
     <test-suite loader="main" location="testdef/FacilityTest.xml"/>
+    <test-suite loader="main" location="testdef/CostTests.xml"/>
 
     <webapp name="catalog" title="Catalog" server="default-server" location="webapp/catalog"
         base-permission="OFBTOOLS,CATALOG" mount-point="/catalog"/>

Added: ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml?rev=909331&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml (added)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml Fri Feb 12 10:12:37 2010
@@ -0,0 +1,71 @@
+<?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"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
+
+    <simple-method method-name="testCalculateProductStandardCosts" short-description="Test case for service calculateProductCosts" 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"/>
+        <set field="serviceCtx.currencyUomId" value="USD"/>
+        <set field="serviceCtx.costComponentTypePrefix" value="EST_STD"/>
+        <call-service service-name="calculateProductCosts" in-map-name="serviceCtx"/>
+
+        <entity-and list="costComponents" entity-name="CostComponent">
+            <field-map field-name="productId" from-field="productId"/>
+        </entity-and>
+        <filter-list-by-date list="costComponents"/>
+        <set field="costTotalAmount" value="0.0" type="BigDecimal"/>
+        <iterate list="costComponents" entry="costComponent">
+            <assert>
+                <if-compare field="costComponent.costUomId" operator="equals" value="USD"/>
+                <or>
+                    <and>
+                        <if-compare field="costComponent.costComponentTypeId" operator="equals" value="EST_STD_ROUTE_COST"/>
+                        <if-compare field="costComponent.cost" operator="equals" value="10.00" type="BigDecimal"/>
+                    </and>
+                    <and>
+                        <if-compare field="costComponent.costComponentTypeId" operator="equals" value="EST_STD_MAT_COST"/>
+                        <if-compare field="costComponent.cost" operator="equals" value="39.00" type="BigDecimal"/>
+                    </and>
+                    <and>
+                        <if-compare field="costComponent.costComponentTypeId" operator="equals" value="EST_STD_OTHER_COST"/>
+                        <if-compare field="costComponent.cost" operator="equals" value="31.00" type="BigDecimal"/>
+                    </and>
+                    <and>
+                        <!--<if-compare field="costComponent.costComponentCalcId" operator="equals" value="GEN_COST_CALC"/>-->
+                        <if-compare field="costComponent.costComponentTypeId" operator="equals" value="EST_STD_GEN_COST"/>
+                        <if-compare field="costComponent.cost" operator="equals" value="4.00" type="BigDecimal"/>
+                    </and>
+                </or>
+            </assert>
+            <set field="costTotalAmount" value="${costTotalAmount + costComponent.cost}" type="BigDecimal"/>
+        </iterate>
+        <assert>
+            <if-compare field="costTotalAmount" operator="equals" value="84.00" type="BigDecimal"/>
+        </assert>
+        <check-errors/>
+    </simple-method>
+</simple-methods>

Propchange: ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/product/script/org/ofbiz/product/test/CostTests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/applications/product/testdef/CostTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/testdef/CostTests.xml?rev=909331&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/testdef/CostTests.xml (added)
+++ ofbiz/trunk/applications/product/testdef/CostTests.xml Fri Feb 12 10:12:37 2010
@@ -0,0 +1,28 @@
+<?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="productcosttests"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+
+    <test-case case-name="cost-tests">
+        <simple-method-test location="component://product/script/org/ofbiz/product/test/CostTests.xml"/>
+    </test-case>
+</test-suite>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/product/testdef/CostTests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/product/testdef/CostTests.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/product/testdef/CostTests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml