Author: mor
Date: Sat Feb 6 11:49:07 2010
New Revision: 907202
URL: http://svn.apache.org/viewvc?rev=907202&view=rev
Log:
Added a bunch of test case related to product price.
Added:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml
(with props)
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml
(with props)
ofbiz/trunk/applications/product/testdef/CatalogTests.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=907202&r1=907201&r2=907202&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/product/ofbiz-component.xml Sat Feb 6 11:49:07
2010
@@ -67,6 +67,7 @@
<service-resource type="model" loader="main"
location="servicedef/services_upgrade.xml"/>
<!-- test suite -->
+ <test-suite loader="main" location="testdef/CatalogTests.xml"/>
<test-suite loader="main" location="testdef/FacilityTest.xml"/>
<webapp name="catalog" title="Catalog" server="default-server"
location="webapp/catalog"
Added:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml?rev=907202&view=auto
==============================================================================
---
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml
(added)
+++
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml
Sat Feb 6 11:49:07 2010
@@ -0,0 +1,35 @@
+<?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>
+ <Product productId="DemoProduct" productTypeId="FINISHED_GOOD"
productName="Demo Product" internalName="Test Product" isVirtual="Y"
isVariant="N" createdDate="2006-03-23 23:05:32.915" />
+
+ <Product productId="DemoProduct-1" productTypeId="FINISHED_GOOD"
productName="Demo Product 1" isVirtual="N" isVariant="Y"
createdDate="2006-03-23 23:05:32.915" />
+ <Product productId="DemoProduct-2" productTypeId="FINISHED_GOOD"
productName="Demo Product 2" isVirtual="N" isVariant="Y"
createdDate="2006-03-23 23:05:32.915" salesDiscontinuationDate="2007-03-23
23:05:32.915"/>
+ <Product productId="DemoProduct-3" productTypeId="FINISHED_GOOD"
productName="Demo Product 3" isVirtual="N" isVariant="Y"
createdDate="2006-03-23 23:05:32.915" />
+
+ <ProductAssoc fromDate="2006-05-13 12:00:00.0"
productAssocTypeId="PRODUCT_VARIANT" productId="DemoProduct"
productIdTo="DemoProduct-2" quantity="1.0" reason=""/>
+ <ProductAssoc fromDate="2006-05-13 12:00:00.0"
productAssocTypeId="PRODUCT_VARIANT" productId="DemoProduct"
productIdTo="DemoProduct-2" quantity="1.0" reason=""/>
+ <ProductAssoc fromDate="2006-05-13 12:00:00.0"
productAssocTypeId="PRODUCT_VARIANT" productId="DemoProduct"
productIdTo="DemoProduct-3" quantity="1.0" reason=""/>
+
+ <ProductPrice productId="DemoProduct-1" productPricePurposeId="PURCHASE"
productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD"
productStoreGroupId="_NA_" fromDate="2006-05-13 12:00:00.0" price="15.00"
createdDate="2006-05-13 12:00:00.0" lastModifiedDate="2006-05-13 12:00:00.0"/>
+ <ProductPrice productId="DemoProduct-2" productPricePurposeId="PURCHASE"
productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD"
productStoreGroupId="_NA_" fromDate="2006-05-13 12:00:00.0" price="5.00"
createdDate="2006-05-13 12:00:00.0" lastModifiedDate="2006-05-13 12:00:00.0"/>
+ <ProductPrice productId="DemoProduct-3" productPricePurposeId="PURCHASE"
productPriceTypeId="DEFAULT_PRICE" currencyUomId="USD"
productStoreGroupId="_NA_" fromDate="2006-05-13 12:00:00.0" price="10.00"
createdDate="2006-05-13 12:00:00.0" lastModifiedDate="2006-05-13 12:00:00.0"/>
+</entity-engine-xml>
\ No newline at end of file
Propchange:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTestData.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml?rev=907202&view=auto
==============================================================================
---
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml
(added)
+++
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml
Sat Feb 6 11:49:07 2010
@@ -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"
+
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
+
+ <simple-method method-name="testCalculateProductPrice"
short-description="Test case for service calculateProductPrice"
login-required="false">
+ <set field="productId" value="GZ-2002"/>
+ <entity-one entity-name="Product" value-field="product"/>
+ <set field="serviceCtx.product" from-field="product"/>
+ <call-service service-name="calculateProductPrice"
in-map-name="serviceCtx">
+ <results-to-map map-name="resultMap"/>
+ </call-service>
+ <assert>
+ <if-compare field="resultMap.defaultPrice" operator="equals"
value="47.99" type="BigDecimal"/>
+ <if-compare field="resultMap.listPrice" operator="equals"
value="48" type="BigDecimal"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+ <simple-method method-name="testCalculateProductPriceOfVariantProduct"
short-description="Test case for service calculateProductPrice, when product is
a variant and does not have product price" login-required="false">
+ <!-- If product is a variant and no price is set, then default price
of virtual product will be set -->
+ <set field="productId" value="GZ-1006-3"/>
+ <entity-one entity-name="Product" value-field="product"/>
+ <set field="serviceCtx.product" from-field="product"/>
+ <call-service service-name="calculateProductPrice"
in-map-name="serviceCtx">
+ <results-to-map map-name="resultMap"/>
+ </call-service>
+ <assert>
+ <if-compare field="resultMap.defaultPrice" operator="equals"
value="1.99" type="BigDecimal"/>
+ <if-compare field="resultMap.listPrice" operator="equals"
value="5.99" type="BigDecimal"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+ <simple-method method-name="testCalculateProductPriceOfVirtualProduct"
short-description="Test case for service calculateProductPrice, when product is
virtual and does not have product price set" login-required="false">
+ <!-- If product is a virtual and no price is set then then the
service return price of a variant product which have lowest DEFAULT_PRICE. It
is also considered whether the product is discontinued for sale before using
the lowest price against a variant for a virtual product -->
+ <set field="productId" value="DemoProduct"/>
+ <entity-one entity-name="Product" value-field="product"/>
+ <set field="serviceCtx.product" from-field="product"/>
+ <call-service service-name="calculateProductPrice"
in-map-name="serviceCtx">
+ <results-to-map map-name="resultMap"/>
+ </call-service>
+ <assert>
+ <if-compare field="resultMap.defaultPrice" operator="equals"
value="10" type="BigDecimal"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+</simple-methods>
\ No newline at end of file
Propchange:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange:
ofbiz/trunk/applications/product/script/org/ofbiz/product/test/ProductPriceTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: ofbiz/trunk/applications/product/testdef/CatalogTests.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/testdef/CatalogTests.xml?rev=907202&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/testdef/CatalogTests.xml (added)
+++ ofbiz/trunk/applications/product/testdef/CatalogTests.xml Sat Feb 6
11:49:07 2010
@@ -0,0 +1,32 @@
+<?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="catalogtests"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+
+ <test-case case-name="loadProductPriceTestData">
+ <entity-xml action="load"
entity-xml-url="component://product/script/org/ofbiz/product/test/ProductPriceTestData.xml"/>
+ </test-case>
+
+ <test-case case-name="productPrice-tests">
+ <simple-method-test
location="component://product/script/org/ofbiz/product/test/ProductPriceTests.xml"/>
+ </test-case>
+</test-suite>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/product/testdef/CatalogTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/product/testdef/CatalogTests.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/product/testdef/CatalogTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml