Author: nmalin
Date: Fri Dec 26 20:42:33 2014
New Revision: 1648017
URL: http://svn.apache.org/r1648017
Log:
add test on server ensurePartyRole, related to the issue OFBIZ-5853
Modified:
ofbiz/trunk/applications/party/script/org/ofbiz/party/test/PartyTests.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=1648017&r1=1648016&r2=1648017&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
Fri Dec 26 20:42:33 2014
@@ -149,6 +149,47 @@ under the License.
<check-errors/>
</simple-method>
+ <simple-method method-name="testEnsurePartyRole" short-description="A test
to ensure the association between a party and a role" login-required="false">
+ <set field="partyId" value="DemoCustomer"/>
+ <set field="roleTypeId" value="SUPPLIER"/>
+ <set field="serviceCtx.partyId" from-field="partyId"/>
+ <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/>
+ <entity-one entity-name="UserLogin" value-field="userLogin">
+ <field-map field-name="userLoginId" value="system"/>
+ </entity-one>
+ <entity-one entity-name="PartyRole" value-field="partyRole"/>
+ <assert>
+ <not><if-empty field="partyRole"/></not>
+ <if-compare-field field="partyRole.partyId" operator="equals"
to-field="partyId"/>
+ <if-compare-field field="partyRole.roleTypeId" operator="equals"
to-field="roleTypeId"/>
+ </assert>
+ <check-errors/>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+ <call-service service-name="ensurePartyRole" in-map-name="serviceCtx"/>
+ <entity-one entity-name="PartyRole" value-field="partyRole"/>
+ <assert>
+ <not><if-empty field="partyRole"/></not>
+ <if-compare-field field="partyRole.partyId" operator="equals"
to-field="partyId"/>
+ <if-compare-field field="partyRole.roleTypeId" operator="equals"
to-field="roleTypeId"/>
+ </assert>
+ <check-errors/>
+ <set field="roleTypeId" value="EMPLOYEE"/>
+ <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/>
+ <entity-one entity-name="PartyRole" value-field="partyRole"/>
+ <assert>
+ <if-empty field="partyRole"/>
+ </assert>
+ <check-errors/>
+ <call-service service-name="ensurePartyRole" in-map-name="serviceCtx"/>
+ <entity-one entity-name="PartyRole" value-field="partyRole"/>
+ <assert>
+ <not><if-empty field="partyRole"/></not>
+ <if-compare-field field="partyRole.partyId" operator="equals"
to-field="partyId"/>
+ <if-compare-field field="partyRole.roleTypeId" operator="equals"
to-field="roleTypeId"/>
+ </assert>
+ <check-errors/>
+ </simple-method>
+
<simple-method method-name="testCreateNewCommEvent"
short-description="test to create a new communication event"
login-required="false">
<set field="createNewCommEventMap.communicationEventTypeId"
value="EMAIL_COMMUNICATION"/>
<set field="createNewCommEventMap.statusId" value="COM_ENTERED"/>