| <?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="testCreateShoppingList" short-description="Test create shopping list" login-required="false"> |
| <set field="serviceCtx.partyId" value="DemoCustomer"/> |
| <set field="serviceCtx.shoppingListTypeId" value="SLT_WISH_LIST"/> |
| <set field="serviceCtx.productStoreId" value="9000"/> |
| <set field="serviceCtx.listName" value="Demo Wish List 1"/> |
| <set field="serviceCtx.isActive" value="Y"/> |
| <set field="serviceCtx.currencyUom" value="USD"/> |
| |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="DemoCustomer"/> |
| </entity-one> |
| <set field="serviceCtx.userLogin" from-field="userLogin"/> |
| <call-service service-name="createShoppingList" in-map-name="serviceCtx"> |
| <result-to-field result-name="shoppingListId"/> |
| </call-service> |
| <entity-one entity-name="ShoppingList" value-field="shoppingList"/> |
| <assert> |
| <not><if-empty field="shoppingList"/></not> |
| <if-compare field="shoppingList.partyId" operator="equals" value="DemoCustomer"/> |
| <if-compare field="shoppingList.listName" operator="equals" value="Demo Wish List 1"/> |
| </assert> |
| <check-errors/> |
| </simple-method> |
| |
| <simple-method method-name="testCreateShoppingListItem" short-description="Test create shopping list item" login-required="false"> |
| <set field="shoppingListId" value="DemoWishList"/> |
| <set field="serviceCtx.shoppingListId" from-field="shoppingListId"/> |
| <set field="serviceCtx.productId" value="GZ-8544"/> |
| <set field="serviceCtx.quantity" value="3" type="BigDecimal"/> |
| <set field="serviceCtx.productStoreId" value="9000"/> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="DemoCustomer"/> |
| </entity-one> |
| <set field="serviceCtx.userLogin" from-field="userLogin"/> |
| <call-service service-name="createShoppingListItem" in-map-name="serviceCtx"> |
| <result-to-field result-name="shoppingListItemSeqId"/> |
| </call-service> |
| <entity-one entity-name="ShoppingListItem" value-field="shoppingListItem"/> |
| <assert> |
| <not><if-empty field="shoppingListItem"/></not> |
| <if-compare field="shoppingListItem.productId" operator="equals" value="GZ-8544"/> |
| <if-compare field="shoppingListItem.quantity" operator="equals" value="3" type="BigDecimal"/> |
| </assert> |
| <check-errors/> |
| </simple-method> |
| |
| <simple-method method-name="testCreateShoppingListItemWithSameProduct" short-description="Test create shopping list item by adding a product that already exist in shopping list." login-required="false"> |
| <set field="shoppingListId" value="DemoWishList"/> |
| <set field="serviceCtx.shoppingListId" from-field="shoppingListId"/> |
| <set field="serviceCtx.productId" value="GZ-2644"/> |
| <set field="serviceCtx.quantity" value="2" type="BigDecimal"/> |
| <set field="serviceCtx.productStoreId" value="9000"/> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="DemoCustomer"/> |
| </entity-one> |
| <set field="serviceCtx.userLogin" from-field="userLogin"/> |
| <call-service service-name="createShoppingListItem" in-map-name="serviceCtx"> |
| <result-to-field result-name="shoppingListItemSeqId"/> |
| </call-service> |
| <entity-one entity-name="ShoppingListItem" value-field="shoppingListItem"/> |
| <assert> |
| <not><if-empty field="shoppingListItem"/></not> |
| <if-compare field="shoppingListItem.quantity" operator="equals" value="7" type="BigDecimal"/> |
| </assert> |
| <check-errors/> |
| </simple-method> |
| |
| <simple-method method-name="testUpdateShoppingList" short-description="Test update shopping list by updating the listName" login-required="false"> |
| <set field="serviceCtx.shoppingListId" value="DemoWishList"/> |
| <set field="serviceCtx.listName" value="New Demo Wish List"/> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="DemoCustomer"/> |
| </entity-one> |
| <set field="serviceCtx.userLogin" from-field="userLogin"/> |
| <call-service service-name="updateShoppingList" in-map-name="serviceCtx"/> |
| <entity-one entity-name="ShoppingList" value-field="shoppingList"> |
| <field-map field-name="shoppingListId" from-field="serviceCtx.shoppingListId"/> |
| </entity-one> |
| <assert> |
| <not><if-empty field="shoppingList"/></not> |
| <if-compare field="shoppingList.listName" operator="equals" value="New Demo Wish List"/> |
| </assert> |
| <check-errors/> |
| </simple-method> |
| |
| <simple-method method-name="testUpdateShoppingListItem" short-description="Test update shopping list item by updating quantity of item" login-required="false"> |
| <set field="serviceCtx.shoppingListId" value="DemoWishList"/> |
| <set field="serviceCtx.shoppingListItemSeqId" value="00002"/> |
| <set field="serviceCtx.quantity" value="4" type="BigDecimal"/> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="DemoCustomer"/> |
| </entity-one> |
| <set field="serviceCtx.userLogin" from-field="userLogin"/> |
| <call-service service-name="updateShoppingListItem" in-map-name="serviceCtx"/> |
| <entity-one entity-name="ShoppingListItem" value-field="shoppingListItem"> |
| <field-map field-name="shoppingListId" from-field="serviceCtx.shoppingListId"/> |
| <field-map field-name="shoppingListItemSeqId" value="00002"/> |
| </entity-one> |
| <assert> |
| <not><if-empty field="shoppingListItem"/></not> |
| <if-compare field="shoppingListItem.quantity" operator="equals" value="4" type="BigDecimal"/> |
| </assert> |
| <check-errors/> |
| </simple-method> |
| |
| <simple-method method-name="testUpdateShoppingListItemWithZeroQty" short-description="Test update shopping list item for a product with zero quantity" login-required="false"> |
| <set field="serviceCtx.shoppingListId" value="DemoWishList"/> |
| <set field="serviceCtx.shoppingListItemSeqId" value="00003"/> |
| <set field="serviceCtx.quantity" value="0" type="BigDecimal"/> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="DemoCustomer"/> |
| </entity-one> |
| <set field="serviceCtx.userLogin" from-field="userLogin"/> |
| <call-service service-name="updateShoppingListItem" in-map-name="serviceCtx"/> |
| <entity-one entity-name="ShoppingListItem" value-field="shoppingListItem"> |
| <field-map field-name="shoppingListId" from-field="serviceCtx.shoppingListId"/> |
| <field-map field-name="shoppingListItemSeqId" value="00003"/> |
| </entity-one> |
| <assert> |
| <not><if-empty field="shoppingListItem"/></not> |
| </assert> |
| <check-errors/> |
| </simple-method> |
| |
| <simple-method method-name="testRemoveShoppingListItem" short-description="Test remove shopping list item" login-required="false"> |
| <set field="serviceCtx.shoppingListId" value="DemoWishList"/> |
| <set field="serviceCtx.shoppingListItemSeqId" value="00002"/> |
| <entity-one entity-name="UserLogin" value-field="userLogin"> |
| <field-map field-name="userLoginId" value="DemoCustomer"/> |
| </entity-one> |
| <set field="serviceCtx.userLogin" from-field="userLogin"/> |
| <call-service service-name="removeShoppingListItem" in-map-name="serviceCtx"/> |
| <entity-one entity-name="ShoppingListItem" value-field="shoppingListItem"> |
| <field-map field-name="shoppingListId" from-field="serviceCtx.shoppingListId"/> |
| <field-map field-name="shoppingListItemSeqId" value="00002"/> |
| </entity-one> |
| <assert> |
| <if-empty field="shoppingListItem"/> |
| </assert> |
| <check-errors/> |
| </simple-method> |
| </simple-methods> |