You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2016/10/26 19:10:15 UTC

svn commit: r1766723 - in /ofbiz/trunk/applications/order: minilang/test/OrderTests.xml testdef/OrderTest.xml testdef/data/OrderTestData.xml

Author: deepak
Date: Wed Oct 26 19:10:14 2016
New Revision: 1766723

URL: http://svn.apache.org/viewvc?rev=1766723&view=rev
Log:
Improved: Unit test case for service - sendOrderConfirmation 
(OFBIZ-8507)

Added:
    ofbiz/trunk/applications/order/minilang/test/OrderTests.xml   (with props)
    ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml   (with props)
Modified:
    ofbiz/trunk/applications/order/testdef/OrderTest.xml

Added: ofbiz/trunk/applications/order/minilang/test/OrderTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/minilang/test/OrderTests.xml?rev=1766723&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/minilang/test/OrderTests.xml (added)
+++ ofbiz/trunk/applications/order/minilang/test/OrderTests.xml Wed Oct 26 19:10:14 2016
@@ -0,0 +1,42 @@
+<?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"
+                xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd">
+
+    <simple-method method-name="testSendOrderConfirmation" short-description="Sends order confirmation mail" login-required="false">
+        <entity-one entity-name="UserLogin" value-field="userLogin">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        <set-current-user-login value-field="userLogin"/>
+        <set field="serviceCtx.orderId" value="TEST_DEMO10090"/>
+        <set field="serviceCtx.note" value="Test Note"/>
+        <set field="serviceCtx.comments" value="Test comments"/>
+        <set field="serviceCtx.sendTo" value="newtest_email@email.com"/>
+        <call-service service-name="sendOrderConfirmation" in-map-name="serviceCtx">
+            <results-to-map map-name="serviceResult"/>
+        </call-service>
+        <assert>
+            <not><if-empty field="serviceResult"/></not>
+            <if-compare operator="equals" field="serviceResult.emailType" value="PRDS_ODR_CONFIRM" />
+        </assert>
+        <check-errors/>
+    </simple-method>
+</simple-methods>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/order/minilang/test/OrderTests.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/minilang/test/OrderTests.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/order/minilang/test/OrderTests.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/order/testdef/OrderTest.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/testdef/OrderTest.xml?rev=1766723&r1=1766722&r2=1766723&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/testdef/OrderTest.xml (original)
+++ ofbiz/trunk/applications/order/testdef/OrderTest.xml Wed Oct 26 19:10:14 2016
@@ -21,10 +21,16 @@ under the License.
 <test-suite suite-name="ordertests"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+    <test-case case-name="order-tests-data-load">
+        <entity-xml action="load" entity-xml-url="component://order/testdef/data/OrderTestData.xml"/>
+    </test-case>
     <test-case case-name="purchaseOrder-test">
         <junit-test-suite class-name="org.apache.ofbiz.order.test.PurchaseOrderTest"/>
     </test-case>
     <test-case case-name="salesOrder-test">
         <junit-test-suite class-name="org.apache.ofbiz.order.test.SalesOrderTest"/>
     </test-case>
+    <test-case case-name="order-test">
+        <simple-method-test location="component://order/minilang/test/OrderTests.xml"/>
+    </test-case>
 </test-suite>

Added: ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml?rev=1766723&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml (added)
+++ ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml Wed Oct 26 19:10:14 2016
@@ -0,0 +1,56 @@
+<?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>
+    <!--Demo Product Data-->
+    <Product productId="GZ-2644" productTypeId="FINISHED_GOOD"  internalName="Round Gizmo" longDescription="A small round gizmo with multi-colored lights. Works great in the dark. Small and compact." isVirtual="N" isVariant="N" quantityIncluded="100.0" productWeight="7.0"/>
+    <ProductPrice productId="GZ-2644" productPricePurposeId="PURCHASE" productPriceTypeId="SPECIAL_PROMO_PRICE" currencyUomId="USD" productStoreGroupId="_NA_" fromDate="2001-05-13 12:00:00.0" price="31.99" createdDate="2001-05-13 12:00:00.0"/>
+    <ProdCatalog prodCatalogId="DemoCatalog" catalogName="Demo Catalog" useQuickAdd="Y"/>
+    <ProductCategory productCategoryId="CATALOG1_BEST_SELL" productCategoryTypeId="BEST_SELL_CATEGORY" categoryName="Demo Best Selling"/>
+    <ProdCatalogCategory prodCatalogId="DemoCatalog" productCategoryId="CATALOG1_BEST_SELL" fromDate="2010-01-01 12:00:00.0" sequenceNum="1" prodCatalogCategoryTypeId="PCCT_BEST_SELL"/>
+
+    <ProductStore productStoreId="9000" storeName="OFBiz Ebay Store1-AU" companyName="Apache Ofbiz" title="Test OFBiz store1"/>
+    <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_ODR_CONFIRM" bodyScreenLocation="component://ecommerce/widget/EmailOrderScreens.xml#OrderConfirmNotice" xslfoAttachScreenLocation="component://ecommerce/widget/EmailOrderScreens.xml#OrderConfirmNoticePdf" subject="OFBiz Demo - Order Confirmation #${orderId}" bccAddress="ofbiztest@example.com" fromAddress="ofbiztest@example.com"/>
+
+    <!--Demo data for a sales order -->
+    <OrderHeader orderId="TEST_DEMO10090" orderTypeId="SALES_ORDER" orderName="" salesChannelEnumId="WEB_SALES_CHANNEL" orderDate="2008-04-23 16:49:27.392" entryDate="2008-04-23 16:49:27.392" priority="2" visitId="10002" statusId="ORDER_APPROVED" currencyUom="USD" webSiteId="OrderEntry" productStoreId="9000" remainingSubTotal="38.40" grandTotal="50.85"  invoicePerShipment="Y"/>
+    <OrderItem orderId="TEST_DEMO10090" orderItemSeqId="00001" orderItemTypeId="PRODUCT_ORDER_ITEM" productId="GZ-2644" prodCatalogId="DemoCatalog" isPromo="N" quantity="2.0" selectedAmount="0.0" unitPrice="38.4" unitListPrice="48.0" isModifiedPrice="N" itemDescription="Round Gizmo" correspondingPoId="" statusId="ITEM_APPROVED"/>
+
+    <Party partyId="TestDemoCustomer" partyTypeId="PERSON" statusId="PARTY_ENABLED"/>
+    <Person partyId="TestDemoCustomer" firstName="Test" lastName="Customer"/>
+    <PartyRole partyId="TestDemoCustomer" roleTypeId="CUSTOMER"/>
+    <PartyRole partyId="TestDemoCustomer" roleTypeId="CONTACT"/>
+    <PartyRole partyId="TestDemoCustomer" roleTypeId="ACCOUNTANT"/>
+    <PartyStatus partyId="TestDemoCustomer" statusId="PARTY_ENABLED" statusDate="2001-01-01 12:00:00.0"/>
+    <ContactMech contactMechId="TestContactMech" contactMechTypeId="EMAIL_ADDRESS" infoString="newtest_email@example.com"/>
+    <PartyContactMech partyId="TestDemoCustomer" contactMechId="TestContactMech" fromDate="2001-05-13 00:00:00.000"/>
+    <PartyContactMechPurpose partyId="TestDemoCustomer" contactMechId="TestContactMech" contactMechPurposeTypeId="PRIMARY_EMAIL" fromDate="2000-01-01 00:00:00"/>
+
+    <PartyRole partyId="TestDemoCustomer" roleTypeId="END_USER_CUSTOMER"/>
+    <PartyRole partyId="TestDemoCustomer" roleTypeId="SHIP_TO_CUSTOMER"/>
+    <PartyRole partyId="TestDemoCustomer" roleTypeId="PLACING_CUSTOMER"/>
+    <PartyRole partyId="TestDemoCustomer" roleTypeId="BILL_TO_CUSTOMER"/>
+
+    <OrderRole orderId="TEST_DEMO10090" partyId="TestDemoCustomer" roleTypeId="BILL_TO_CUSTOMER"/>
+    <OrderRole orderId="TEST_DEMO10090" partyId="TestDemoCustomer" roleTypeId="END_USER_CUSTOMER"/>
+    <OrderRole orderId="TEST_DEMO10090" partyId="TestDemoCustomer" roleTypeId="PLACING_CUSTOMER"/>
+    <OrderRole orderId="TEST_DEMO10090" partyId="TestDemoCustomer" roleTypeId="SHIP_TO_CUSTOMER"/>
+    <OrderContactMech orderId="TEST_DEMO10090" contactMechPurposeTypeId="ORDER_EMAIL" contactMechId="TestContactMech"/>
+</entity-engine-xml>

Propchange: ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/order/testdef/data/OrderTestData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml