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 10:51:57 UTC
svn commit: r906422 - in /ofbiz/trunk/applications/party:
ofbiz-component.xml script/org/ofbiz/party/test/PartyContactMechTests.xml
script/org/ofbiz/party/test/PartyTests.xml testdef/PartyContactMechTests.xml
Author: mor
Date: Thu Feb 4 09:51:56 2010
New Revision: 906422
URL: http://svn.apache.org/viewvc?rev=906422&view=rev
Log:
Moved various test case related to party contact mechanism to a separate file.
Added:
ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml (with props)
ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml (with props)
Modified:
ofbiz/trunk/applications/party/ofbiz-component.xml
ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyTests.xml
Modified: ofbiz/trunk/applications/party/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/ofbiz-component.xml?rev=906422&r1=906421&r2=906422&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/party/ofbiz-component.xml Thu Feb 4 09:51:56 2010
@@ -39,6 +39,7 @@
<service-resource type="mca" loader="main" location="servicedef/mcas.xml"/>
<test-suite loader="main" location="testdef/PartyTests.xml"/>
+ <test-suite loader="main" location="testdef/PartyContactMechTests.xml"/>
<webapp name="party"
title="Party"
Added: ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml?rev=906422&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml (added)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml Thu Feb 4 09:51:56 2010
@@ -0,0 +1,292 @@
+<?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="testUpdatePartyEmailAddress" short-description="Test updatePartyEmailAddress service" login-required="false">
+ <!-- Precondition:
+ 1. Go to Party Manager
+ 2. Click on Lookup Party
+ 3. Select one party (DemoCustomer in this case)
+ 4. Update email address
+ -->
+ <!-- Process tested by test case:
+ 1. This test the process of update email address
+ -->
+ <!-- Post condition:
+ 1. If email address is changed, a new record is created in ContactMech entity else there is no change.
+ -->
+ <set field="partyId" value="DemoCustomer"/>
+ <set field="contactMechTypeId" value="EMAIL_ADDRESS"/>
+ <!-- first try with just updating without changing the email address -->
+ <set field="serviceCtx.partyId" from-field="partyId"/>
+ <set field="serviceCtx.emailAddress" value="ofbiztest@yahoo.com"/>
+ <set field="serviceCtx.contactMechId" value="9026"/>
+ <entity-one entity-name="UserLogin" value-field="userLogin">
+ <field-map field-name="userLoginId" value="system"/>
+ </entity-one>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+
+ <call-service service-name="updatePartyEmailAddress" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId"/>
+ </call-service>
+ <log level="info" message="====== contactMechId [${contactMechId}] ======"/>
+ <entity-one entity-name="ContactMech" value-field="contactMech"/>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <if-compare-field field="contactMechId" to-field="serviceCtx.contactMechId" operator="equals"/>
+ <if-compare-field field="contactMech.infoString" to-field="serviceCtx.emailAddress" operator="equals"/>
+ </assert>
+ <check-errors/>
+
+ <clear-field field="contactMech"/>
+ <!-- now update with changing the email address, a new record will be created in ContactMech entity this time -->
+ <set field="serviceCtx.emailAddress" value="ofbiz-test@yahoo.com"/>
+ <call-service service-name="updatePartyEmailAddress" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId" field="newContactMechId"/>
+ </call-service>
+ <log level="info" message="====== New contactMechId [${newContactMechId}] for email address is created for party [${partyId}] ======"/>
+ <entity-one entity-name="ContactMech" value-field="contactMech">
+ <field-map field-name="contactMechId" from-field="newContactMechId"/>
+ </entity-one>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <if-compare-field field="newContactMechId" to-field="serviceCtx.contactMechId" operator="not-equals"/>
+ <if-compare-field field="contactMech.infoString" to-field="serviceCtx.emailAddress" operator="equals"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+ <simple-method method-name="testUpdatePartyTelecomNumber" short-description="Test updatePartyTelecomNumber service" login-required="false">
+ <!-- Precondition:
+ 1. Go to the Party Manager
+ 2. Click on Lookup Party
+ 3. Select any party (DemoCustomer in this case)
+ 4. update telecom number fields
+ -->
+ <!-- Process tested by test case:
+ 1. This test the process of update telecom number.
+ -->
+ <!-- Post condition:
+ 1. If telecom number is changed then a new record is created in ContactMech and TelecomNumber entity else no change.
+ -->
+ <set field="partyId" value="DemoCustomer"/>
+ <set field="serviceCtx.partyId" from-field="partyId"/>
+ <set field="serviceCtx.contactMechId" value="9025"/>
+ <set field="serviceCtx.countryCode" value="1"/>
+ <set field="serviceCtx.areaCode" value="801"/>
+ <set field="serviceCtx.contactNumber" value="555-5555"/>
+
+ <entity-one entity-name="UserLogin" value-field="userLogin">
+ <field-map field-name="userLoginId" value="system"/>
+ </entity-one>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+
+ <call-service service-name="updatePartyTelecomNumber" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId"/>
+ </call-service>
+ <log level="info" message="====== contactMechId [${contactMechId}] ======"/>
+ <entity-one entity-name="ContactMech" value-field="contactMech"/>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <if-compare-field field="contactMechId" to-field="serviceCtx.contactMechId" operator="equals"/>
+ </assert>
+ <clear-field field="telecomNumber"/>
+ <get-related-one value-field="contactMech" relation-name="TelecomNumber" to-value-field="telecomNumber"/>
+ <assert>
+ <not><if-empty field="telecomNumber"/></not>
+ <if-compare-field field="telecomNumber.areaCode" to-field="serviceCtx.areaCode" operator="equals"/>
+ <if-compare-field field="telecomNumber.contactNumber" to-field="serviceCtx.contactNumber" operator="equals"/>
+ </assert>
+ <check-errors/>
+
+ <clear-field field="contactMech"/>
+ <clear-field field="telecomNumber"/>
+
+ <!-- try now with changing the telecom number, a new record will be created in ContactMech, TelecomNumber entity this time -->
+ <set field="serviceCtx.contactNumber" value="555-6666"/>
+ <call-service service-name="updatePartyTelecomNumber" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId" field="newContactMechId"/>
+ </call-service>
+ <log level="info" message="====== New contactMechId [${newContactMechId}] for TelecomNumber is created for party [${partyId}] ======"/>
+ <entity-one entity-name="ContactMech" value-field="contactMech">
+ <field-map field-name="contactMechId" from-field="newContactMechId"/>
+ </entity-one>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <if-compare-field field="newContactMechId" to-field="serviceCtx.contactMechId" operator="not-equals"/>
+ </assert>
+ <get-related-one value-field="contactMech" relation-name="TelecomNumber" to-value-field="telecomNumber"/>
+ <assert>
+ <not><if-empty field="telecomNumber"/></not>
+ <if-compare-field field="telecomNumber.contactNumber" to-field="serviceCtx.contactNumber" operator="equals"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+ <simple-method method-name="testUpdatePartyPostalAddress" short-description="Test updatePartyPostalAddress service" login-required="false">
+ <!-- Precondition:
+ 1. Go to the Party Manager
+ 2. Click on Lookup Party
+ 3. Select any party (DemoCustomer in this case)
+ 4. Edit address fields, click Save
+ -->
+ <!-- Process tested by test case:
+ 1. This test the process of update postal address
+ -->
+ <!-- Post condition:
+ 1. If postal address is changed then a new record is created in ContactMech and PostalAddress entity else no change.
+ -->
+ <set field="partyId" value="DemoCustomer"/>
+ <call-class-method method-name="findPartyLatestPostalAddress" class-name="org.ofbiz.party.party.PartyWorker" ret-field="postalAddress">
+ <field field="partyId" type="java.lang.String"/>
+ <field field="delegator" type="org.ofbiz.entity.Delegator"/>
+ </call-class-method>
+ <!-- first try with just updating without changing the postal address -->
+ <set-service-fields service-name="updatePartyPostalAddress" map="postalAddress" to-map="serviceCtx"/>
+ <set field="serviceCtx.partyId" from-field="partyId"/>
+
+ <entity-one entity-name="UserLogin" value-field="userLogin">
+ <field-map field-name="userLoginId" value="system"/>
+ </entity-one>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+
+ <call-service service-name="updatePartyPostalAddress" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId"/>
+ </call-service>
+ <log level="info" message="====== contactMechId [${contactMechId}] ======"/>
+ <entity-one entity-name="ContactMech" value-field="contactMech"/>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <if-compare-field field="contactMechId" to-field="serviceCtx.contactMechId" operator="equals"/>
+ </assert>
+ <clear-field field="postalAddress"/>
+ <get-related-one value-field="contactMech" relation-name="PostalAddress" to-value-field="postalAddress"/>
+ <assert>
+ <not><if-empty field="postalAddress"/></not>
+ <if-compare-field field="postalAddress.address1" to-field="serviceCtx.address1" operator="equals"/>
+ <if-compare-field field="postalAddress.stateProvinceGeoId" to-field="serviceCtx.stateProvinceGeoId" operator="equals"/>
+ <if-compare-field field="postalAddress.postalCode" to-field="serviceCtx.postalCode" operator="equals"/>
+ </assert>
+ <check-errors/>
+
+ <clear-field field="contactMech"/>
+ <clear-field field="postalAddress"/>
+
+ <!-- try now with changing the postal address fields, a new record will be created in ContactMech, PostalAddress entity this time -->
+ <set field="serviceCtx.stateProvinceGeoId" value="VA"/>
+ <set field="serviceCtx.postalCode" value="20147"/>
+ <call-service service-name="updatePartyPostalAddress" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId" field="newContactMechId"/>
+ </call-service>
+ <log level="info" message="====== New contactMechId [${newContactMechId}] for PostalAddress is created for party [${partyId}] ======"/>
+ <entity-one entity-name="ContactMech" value-field="contactMech">
+ <field-map field-name="contactMechId" from-field="newContactMechId"/>
+ </entity-one>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <if-compare-field field="newContactMechId" to-field="serviceCtx.contactMechId" operator="not-equals"/>
+ </assert>
+ <get-related-one value-field="contactMech" relation-name="PostalAddress" to-value-field="postalAddress"/>
+ <assert>
+ <not><if-empty field="postalAddress"/></not>
+ <if-compare-field field="postalAddress.stateProvinceGeoId" to-field="serviceCtx.stateProvinceGeoId" operator="equals"/>
+ <if-compare-field field="postalAddress.postalCode" to-field="serviceCtx.postalCode" operator="equals"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+
+ <simple-method method-name="testCreatePartyEmailAddress" short-description="Test case for service createPartyEmailAddress" login-required="false">
+ <set field="partyId" value="DemoEmployee"/>
+ <set field="emailAddress" value="demo.employee@gmail.com"/>
+ <set field="contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
+ <entity-one entity-name="UserLogin" value-field="userLogin">
+ <field-map field-name="userLoginId" value="system"/>
+ </entity-one>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+ <set field="serviceCtx.partyId" from-field="partyId"/>
+ <set field="serviceCtx.emailAddress" from-field="emailAddress"/>
+ <set field="serviceCtx.contactMechPurposeTypeId" from-field="contactMechPurposeTypeId"/>
+ <call-service service-name="createPartyEmailAddress" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId"/>
+ </call-service>
+ <entity-one entity-name="ContactMech" value-field="contactMech"/>
+ <entity-condition entity-name="PartyContactMech" list="pcmList" filter-by-date="true">
+ <condition-expr field-name="contactMechId" from-field="contactMechId"/>
+ <order-by field-name="fromDate"/>
+ </entity-condition>
+ <first-from-list list="pcmList" entry="pcm"/>
+ <entity-condition entity-name="PartyContactMechPurpose" list="pcmpList" filter-by-date="true">
+ <condition-expr field-name="contactMechId" from-field="contactMechId"/>
+ <order-by field-name="fromDate"/>
+ </entity-condition>
+ <first-from-list list="pcmpList" entry="pcmp"/>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <if-compare-field field="contactMech.infoString" operator="equals" to-field="emailAddress"/>
+ <not><if-empty field="pcmList"/></not>
+ <if-compare-field field="pcm.partyId" operator="equals" to-field="partyId"/>
+ <not><if-empty field="pcmpList"/></not>
+ <if-compare-field field="pcmp.partyId" operator="equals" to-field="partyId"/>
+ <if-compare-field field="pcmp.contactMechPurposeTypeId" operator="equals" to-field="contactMechPurposeTypeId"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+ <simple-method method-name="testCreatePartyTelecomNumber" short-description="Test case for service createPartyTelecomNumber" login-required="false">
+ <set field="serviceCtx.partyId" value="DemoEmployee"/>
+ <set field="serviceCtx.areaCode" value="801"/>
+ <set field="serviceCtx.contactNumber" value="888-8899"/>
+ <set field="serviceCtx.contactMechPurposeTypeId" value="PRIMARY_PHONE"/>
+ <entity-one entity-name="UserLogin" value-field="userLogin">
+ <field-map field-name="userLoginId" value="system"/>
+ </entity-one>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+ <call-service service-name="createPartyTelecomNumber" in-map-name="serviceCtx">
+ <result-to-field result-name="contactMechId"/>
+ </call-service>
+ <entity-one entity-name="ContactMech" value-field="contactMech"/>
+ <entity-one entity-name="TelecomNumber" value-field="telecomNumber"/>
+ <entity-and entity-name="PartyContactMech" list="pcmList" filter-by-date="true">
+ <field-map field-name="contactMechId"/>
+ </entity-and>
+ <first-from-list list="pcmList" entry="pcm"/>
+ <first-from-list list="partyContactMechList" entry="partyContactMech"/>
+ <entity-and entity-name="PartyContactMechPurpose" list="pcmpList" filter-by-date="true">
+ <field-map field-name="contactMechId"/>
+ </entity-and>
+ <first-from-list list="pcmpList" entry="pcmp"/>
+ <assert>
+ <not><if-empty field="contactMech"/></not>
+ <not><if-empty field="telecomNumber"/></not>
+ <if-compare field="telecomNumber.areaCode" operator="equals" value="801"/>
+ <if-compare field="telecomNumber.contactNumber" operator="equals" value="888-8899"/>
+ <not><if-empty field="pcmList"/></not>
+ <if-compare field="pcm.partyId" operator="equals" value="DemoEmployee"/>
+ <not><if-empty field="pcmpList"/></not>
+ <if-compare field="pcmp.partyId" operator="equals" value="DemoEmployee"/>
+ <if-compare field="pcmp.contactMechPurposeTypeId" operator="equals" value="PRIMARY_PHONE"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
+</simple-methods>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyTests.xml?rev=906422&r1=906421&r2=906422&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyTests.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyTests.xml Thu Feb 4 09:51:56 2010
@@ -70,199 +70,6 @@
<check-errors/>
</simple-method>
- <simple-method method-name="testUpdatePartyEmailAddress" short-description="Test updatePartyEmailAddress service" login-required="false">
- <!-- Precondition:
- 1. Go to Party Manager
- 2. Click on Lookup Party
- 3. Select one party (DemoCustomer in this case)
- 4. Update email address
- -->
- <!-- Process tested by test case:
- 1. This test the process of update email address
- -->
- <!-- Post condition:
- 1. If email address is changed, a new record is created in ContactMech entity else there is no change.
- -->
- <set field="partyId" value="DemoCustomer"/>
- <set field="contactMechTypeId" value="EMAIL_ADDRESS"/>
- <!-- first try with just updating without changing the email address -->
- <set field="serviceCtx.partyId" from-field="partyId"/>
- <set field="serviceCtx.emailAddress" value="ofbiztest@yahoo.com"/>
- <set field="serviceCtx.contactMechId" value="9026"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
-
- <call-service service-name="updatePartyEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <log level="info" message="====== contactMechId [${contactMechId}] ======"/>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare-field field="contactMechId" to-field="serviceCtx.contactMechId" operator="equals"/>
- <if-compare-field field="contactMech.infoString" to-field="serviceCtx.emailAddress" operator="equals"/>
- </assert>
- <check-errors/>
-
- <clear-field field="contactMech"/>
- <!-- now update with changing the email address, a new record will be created in ContactMech entity this time -->
- <set field="serviceCtx.emailAddress" value="ofbiz-test@yahoo.com"/>
- <call-service service-name="updatePartyEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId" field="newContactMechId"/>
- </call-service>
- <log level="info" message="====== New contactMechId [${newContactMechId}] for email address is created for party [${partyId}] ======"/>
- <entity-one entity-name="ContactMech" value-field="contactMech">
- <field-map field-name="contactMechId" from-field="newContactMechId"/>
- </entity-one>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare-field field="newContactMechId" to-field="serviceCtx.contactMechId" operator="not-equals"/>
- <if-compare-field field="contactMech.infoString" to-field="serviceCtx.emailAddress" operator="equals"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyTelecomNumber" short-description="Test updatePartyTelecomNumber service" login-required="false">
- <!-- Precondition:
- 1. Go to the Party Manager
- 2. Click on Lookup Party
- 3. Select any party (DemoCustomer in this case)
- 4. update telecom number fields
- -->
- <!-- Process tested by test case:
- 1. This test the process of update telecom number.
- -->
- <!-- Post condition:
- 1. If telecom number is changed then a new record is created in ContactMech and TelecomNumber entity else no change.
- -->
- <set field="partyId" value="DemoCustomer"/>
- <set field="serviceCtx.partyId" from-field="partyId"/>
- <set field="serviceCtx.contactMechId" value="9025"/>
- <set field="serviceCtx.countryCode" value="1"/>
- <set field="serviceCtx.areaCode" value="801"/>
- <set field="serviceCtx.contactNumber" value="555-5555"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
-
- <call-service service-name="updatePartyTelecomNumber" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <log level="info" message="====== contactMechId [${contactMechId}] ======"/>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare-field field="contactMechId" to-field="serviceCtx.contactMechId" operator="equals"/>
- </assert>
- <clear-field field="telecomNumber"/>
- <get-related-one value-field="contactMech" relation-name="TelecomNumber" to-value-field="telecomNumber"/>
- <assert>
- <not><if-empty field="telecomNumber"/></not>
- <if-compare-field field="telecomNumber.areaCode" to-field="serviceCtx.areaCode" operator="equals"/>
- <if-compare-field field="telecomNumber.contactNumber" to-field="serviceCtx.contactNumber" operator="equals"/>
- </assert>
- <check-errors/>
-
- <clear-field field="contactMech"/>
- <clear-field field="telecomNumber"/>
-
- <!-- try now with changing the telecom number, a new record will be created in ContactMech, TelecomNumber entity this time -->
- <set field="serviceCtx.contactNumber" value="555-6666"/>
- <call-service service-name="updatePartyTelecomNumber" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId" field="newContactMechId"/>
- </call-service>
- <log level="info" message="====== New contactMechId [${newContactMechId}] for TelecomNumber is created for party [${partyId}] ======"/>
- <entity-one entity-name="ContactMech" value-field="contactMech">
- <field-map field-name="contactMechId" from-field="newContactMechId"/>
- </entity-one>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare-field field="newContactMechId" to-field="serviceCtx.contactMechId" operator="not-equals"/>
- </assert>
- <get-related-one value-field="contactMech" relation-name="TelecomNumber" to-value-field="telecomNumber"/>
- <assert>
- <not><if-empty field="telecomNumber"/></not>
- <if-compare-field field="telecomNumber.contactNumber" to-field="serviceCtx.contactNumber" operator="equals"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testUpdatePartyPostalAddress" short-description="Test updatePartyPostalAddress service" login-required="false">
- <!-- Precondition:
- 1. Go to the Party Manager
- 2. Click on Lookup Party
- 3. Select any party (DemoCustomer in this case)
- 4. Edit address fields, click Save
- -->
- <!-- Process tested by test case:
- 1. This test the process of update postal address
- -->
- <!-- Post condition:
- 1. If postal address is changed then a new record is created in ContactMech and PostalAddress entity else no change.
- -->
- <set field="partyId" value="DemoCustomer"/>
- <call-class-method method-name="findPartyLatestPostalAddress" class-name="org.ofbiz.party.party.PartyWorker" ret-field="postalAddress">
- <field field="partyId" type="java.lang.String"/>
- <field field="delegator" type="org.ofbiz.entity.Delegator"/>
- </call-class-method>
- <!-- first try with just updating without changing the postal address -->
- <set-service-fields service-name="updatePartyPostalAddress" map="postalAddress" to-map="serviceCtx"/>
- <set field="serviceCtx.partyId" from-field="partyId"/>
-
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
-
- <call-service service-name="updatePartyPostalAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <log level="info" message="====== contactMechId [${contactMechId}] ======"/>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare-field field="contactMechId" to-field="serviceCtx.contactMechId" operator="equals"/>
- </assert>
- <clear-field field="postalAddress"/>
- <get-related-one value-field="contactMech" relation-name="PostalAddress" to-value-field="postalAddress"/>
- <assert>
- <not><if-empty field="postalAddress"/></not>
- <if-compare-field field="postalAddress.address1" to-field="serviceCtx.address1" operator="equals"/>
- <if-compare-field field="postalAddress.stateProvinceGeoId" to-field="serviceCtx.stateProvinceGeoId" operator="equals"/>
- <if-compare-field field="postalAddress.postalCode" to-field="serviceCtx.postalCode" operator="equals"/>
- </assert>
- <check-errors/>
-
- <clear-field field="contactMech"/>
- <clear-field field="postalAddress"/>
-
- <!-- try now with changing the postal address fields, a new record will be created in ContactMech, PostalAddress entity this time -->
- <set field="serviceCtx.stateProvinceGeoId" value="VA"/>
- <set field="serviceCtx.postalCode" value="20147"/>
- <call-service service-name="updatePartyPostalAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId" field="newContactMechId"/>
- </call-service>
- <log level="info" message="====== New contactMechId [${newContactMechId}] for PostalAddress is created for party [${partyId}] ======"/>
- <entity-one entity-name="ContactMech" value-field="contactMech">
- <field-map field-name="contactMechId" from-field="newContactMechId"/>
- </entity-one>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare-field field="newContactMechId" to-field="serviceCtx.contactMechId" operator="not-equals"/>
- </assert>
- <get-related-one value-field="contactMech" relation-name="PostalAddress" to-value-field="postalAddress"/>
- <assert>
- <not><if-empty field="postalAddress"/></not>
- <if-compare-field field="postalAddress.stateProvinceGeoId" to-field="serviceCtx.stateProvinceGeoId" operator="equals"/>
- <if-compare-field field="postalAddress.postalCode" to-field="serviceCtx.postalCode" operator="equals"/>
- </assert>
- <check-errors/>
- </simple-method>
-
<simple-method method-name="testUpdatePartyCreditCard" short-description="Test updateCreditCard service" login-required="false">
<!-- Precondition:
1. Go to the Party Manager
@@ -538,80 +345,6 @@
<check-errors/>
</simple-method>
- <simple-method method-name="testCreatePartyEmailAddress" short-description="Test case for service createPartyEmailAddress" login-required="false">
- <set field="partyId" value="DemoEmployee"/>
- <set field="emailAddress" value="demo.employee@gmail.com"/>
- <set field="contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <set field="serviceCtx.partyId" from-field="partyId"/>
- <set field="serviceCtx.emailAddress" from-field="emailAddress"/>
- <set field="serviceCtx.contactMechPurposeTypeId" from-field="contactMechPurposeTypeId"/>
- <call-service service-name="createPartyEmailAddress" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <entity-condition entity-name="PartyContactMech" list="pcmList" filter-by-date="true">
- <condition-expr field-name="contactMechId" from-field="contactMechId"/>
- <order-by field-name="fromDate"/>
- </entity-condition>
- <first-from-list list="pcmList" entry="pcm"/>
- <entity-condition entity-name="PartyContactMechPurpose" list="pcmpList" filter-by-date="true">
- <condition-expr field-name="contactMechId" from-field="contactMechId"/>
- <order-by field-name="fromDate"/>
- </entity-condition>
- <first-from-list list="pcmpList" entry="pcmp"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <if-compare-field field="contactMech.infoString" operator="equals" to-field="emailAddress"/>
- <not><if-empty field="pcmList"/></not>
- <if-compare-field field="pcm.partyId" operator="equals" to-field="partyId"/>
- <not><if-empty field="pcmpList"/></not>
- <if-compare-field field="pcmp.partyId" operator="equals" to-field="partyId"/>
- <if-compare-field field="pcmp.contactMechPurposeTypeId" operator="equals" to-field="contactMechPurposeTypeId"/>
- </assert>
- <check-errors/>
- </simple-method>
-
- <simple-method method-name="testCreatePartyTelecomNumber" short-description="Test case for service createPartyTelecomNumber" login-required="false">
- <set field="serviceCtx.partyId" value="DemoEmployee"/>
- <set field="serviceCtx.areaCode" value="801"/>
- <set field="serviceCtx.contactNumber" value="888-8899"/>
- <set field="serviceCtx.contactMechPurposeTypeId" value="PRIMARY_PHONE"/>
- <entity-one entity-name="UserLogin" value-field="userLogin">
- <field-map field-name="userLoginId" value="system"/>
- </entity-one>
- <set field="serviceCtx.userLogin" from-field="userLogin"/>
- <call-service service-name="createPartyTelecomNumber" in-map-name="serviceCtx">
- <result-to-field result-name="contactMechId"/>
- </call-service>
- <entity-one entity-name="ContactMech" value-field="contactMech"/>
- <entity-one entity-name="TelecomNumber" value-field="telecomNumber"/>
- <entity-and entity-name="PartyContactMech" list="pcmList" filter-by-date="true">
- <field-map field-name="contactMechId"/>
- </entity-and>
- <first-from-list list="pcmList" entry="pcm"/>
- <first-from-list list="partyContactMechList" entry="partyContactMech"/>
- <entity-and entity-name="PartyContactMechPurpose" list="pcmpList" filter-by-date="true">
- <field-map field-name="contactMechId"/>
- </entity-and>
- <first-from-list list="pcmpList" entry="pcmp"/>
- <assert>
- <not><if-empty field="contactMech"/></not>
- <not><if-empty field="telecomNumber"/></not>
- <if-compare field="telecomNumber.areaCode" operator="equals" value="801"/>
- <if-compare field="telecomNumber.contactNumber" operator="equals" value="888-8899"/>
- <not><if-empty field="pcmList"/></not>
- <if-compare field="pcm.partyId" operator="equals" value="DemoEmployee"/>
- <not><if-empty field="pcmpList"/></not>
- <if-compare field="pcmp.partyId" operator="equals" value="DemoEmployee"/>
- <if-compare field="pcmp.contactMechPurposeTypeId" operator="equals" value="PRIMARY_PHONE"/>
- </assert>
- <check-errors/>
- </simple-method>
-
<simple-method method-name="testCreateUpdatePersonWithCreate" short-description="Test the service to create a person" login-required="false">
<set field="serviceCtx.partyId" value="DemoPerson1"/>
<set field="serviceCtx.firstName" value="Demo"/>
Added: ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml?rev=906422&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml (added)
+++ ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml Thu Feb 4 09:51:56 2010
@@ -0,0 +1,28 @@
+<?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="partycontactmechtests"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+
+ <test-case case-name="partyContactMech-tests">
+ <simple-method-test location="component://party/script/org/ofbiz/party/test/PartyContactMechTests.xml"/>
+ </test-case>
+
+</test-suite>
\ No newline at end of file
Propchange: ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/party/testdef/PartyContactMechTests.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml