You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mo...@apache.org on 2010/02/04 08:25:11 UTC
svn commit: r906384 - in /ofbiz/trunk/applications/order:
ofbiz-component.xml script/org/ofbiz/order/test/ShoppingListTests.xml
testdef/ShoppingListTests.xml testdef/data/ShoppingListTestData.xml
Author: mor
Date: Thu Feb 4 07:25:11 2010
New Revision: 906384
URL: http://svn.apache.org/viewvc?rev=906384&view=rev
Log:
Added a new test suite containing basic test case on Shopping List.
Added:
ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml (with props)
ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml (with props)
ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml (with props)
Modified:
ofbiz/trunk/applications/order/ofbiz-component.xml
Modified: ofbiz/trunk/applications/order/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/ofbiz-component.xml?rev=906384&r1=906383&r2=906384&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/order/ofbiz-component.xml Thu Feb 4 07:25:11 2010
@@ -52,6 +52,7 @@
<test-suite loader="main" location="testdef/OrderTest.xml"/>
<test-suite loader="main" location="testdef/quotetests.xml"/>
+ <test-suite loader="main" location="testdef/ShoppingListTests.xml"/>
<webapp name="order"
title="Order"
Added: ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml?rev=906384&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml (added)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml Thu Feb 4 07:25:11 2010
@@ -0,0 +1,165 @@
+<?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="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>
+ <if-empty field="shoppingListItem"/>
+ </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>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/order/script/org/ofbiz/order/test/ShoppingListTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml?rev=906384&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml (added)
+++ ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml Thu Feb 4 07:25:11 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="shopinglisttests"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+
+ <test-case case-name="loadShoppingListData">
+ <entity-xml action="load" entity-xml-url="component://order/testdef/data/ShoppingListTestData.xml"/>
+ </test-case>
+
+ <test-case case-name="shoppingList-test">
+ <simple-method-test location="component://order/script/org/ofbiz/order/test/ShoppingListTests.xml"/>
+ </test-case>
+</test-suite>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/order/testdef/ShoppingListTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml?rev=906384&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml (added)
+++ ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml Thu Feb 4 07:25:11 2010
@@ -0,0 +1,26 @@
+<?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>
+ <ShoppingList shoppingListId="DemoWishList" listName="Demo Wish List" partyId="DemoCustomer" shoppingListTypeId="SLT_WISH_LIST" productStoreId="9000" isActive="Y" currencyUom="USD" isPublic="N"/>
+ <ShoppingListItem shoppingListId="DemoWishList" shoppingListItemSeqId="00001" productId="GZ-2644" quantity="5" productStoreId="9000"/>
+ <ShoppingListItem shoppingListId="DemoWishList" shoppingListItemSeqId="00002" productId="WG-1111" quantity="2" productStoreId="9000"/>
+ <ShoppingListItem shoppingListId="DemoWishList" shoppingListItemSeqId="00003" productId="WG-5569" quantity="10" productStoreId="9000"/>
+</entity-engine-xml>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/order/testdef/data/ShoppingListTestData.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml