blob: d5d8a9d8fd6ee2678113c8a9886c62c6989e65b3 [file] [log] [blame]
<?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-v2.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>