Hello MiniLang Experts,

I am migrating the checkStatusCustRequest service to Groovy (OFBIZ-11692 
<https://issues.apache.org/jira/browse/OFBIZ-11692>), part of our May 
CommunityDays scope and sprint.
In the finalization I now notice that the original Minilang service 
„checkStatusCustRequest“ is called by two other services as an inline 
call-simple-method statement:

Source is /applications/order/minilang/request/CustRequestServices.xml:

#121
Was:
<simple-method method-name="updateCustRequest" short-description="Update 
Customer Request">
    <call-simple-method method-name="checkStatusCustRequest"/>
    <set field="oldStatusId" from-field="custRequest.statusId“/>

Changed to:
<simple-method method-name="updateCustRequest" short-description="Update 
Customer Request">
    <set field="crqCheck.custRequestId" from-field="parameters.custRequestId"/>
    <set field="crqCheck.locale" from-field="parameters.locale"/>
    <set field="crqCheck.userLogin" from-field="parameters.userLogin"/>
    <call-service service-name="checkStatusCustRequest" in-map-name="crqCheck">
        <results-to-map map-name="crqCheckResult"/>
    </call-service>
    <set field="oldStatusId" from-field="custRequest.statusId"/>

And the second service in the same minilang file

#237
Was:
<simple-method method-name="createCustRequestItemNote" 
short-description="Create Customer RequestItem Note">
    <call-simple-method method-name="checkStatusCustRequest"/>        
    <make-value entity-name="CustRequestItemNote" value-field="newEntity"/>

Changed to:
<simple-method method-name="createCustRequestItemNote" 
short-description="Create Customer RequestItem Note">
    <set from-field="parameters.custRequestId" field="crqCheck.custRequestId"/>
    <set from-field="parameters.locale" field="crqCheck.locale"/>
    <set from-field="parameters.userLogin" field="crqCheck.userLogin"/>
    <call-service service-name="checkStatusCustRequest" in-map-name="crqCheck"/>
    <make-value entity-name="CustRequestItemNote" value-field="newEntity"/>

While the latter passes testing now, the first does not, complaining that:

      <testcase classname="org.apache.ofbiz.testtools.SimpleMethodTest" 
name="custrequest-tests.testCreateNewRequest" time="0.101">
          <failure message="ERROR: Could not complete the update a request 
[file:/Users/carsten/github/ofbiz-framework/applications/order/minilang/test/CustRequestTests.xml#inlineUpdateRequest]
 process [problem invoking the [updateCustRequest] service with the map named 
[updateRequestMap] containing 
[{userLogin=[GenericEntity:UserLogin][createdStamp,2020-05-25 
09:59:39.293(java.sql.Timestamp)][createdTxStamp,2020-05-25 
09:59:39.167(java.sql.Timestamp)][currentPassword,null()][disabledBy,null()][disabledDateTime,null()][enabled,N(java.lang.String)][externalAuthId,null()][hasLoggedOut,null()][isSystem,Y(java.lang.String)][lastCurrencyUom,null()][lastLocale,null()][lastTimeZone,null()][lastUpdatedStamp,2020-05-25
 09:59:41.161(java.sql.Timestamp)][lastUpdatedTxStamp,2020-05-25 
09:59:41.121(java.sql.Timestamp)][partyId,system(java.lang.String)][passwordHint,null()][requirePasswordChange,null()][successiveFailedLogins,null()][userLdapDn,null()][userLoginId,system(java.lang.String)],
 custRequestName=New Test Customer request, fromPartyId=admin, 
statusId=CRQ_ACCEPTED, custRequestId=10530, custRequestTypeId=RF_INFO, 
priority=2, locale=en}]: Outgoing result (in runSync : updateCustRequest) does 
not match expected requirements (The following required parameter is missing: 
[OUT] [updateCustRequest.oldStatusId])]" 
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
 ERROR: Could not complete the update a request 
[file:/Users/carsten/github/ofbiz-framework/applications/order/minilang/test/CustRequestTests.xml#inlineUpdateRequest]
 process [problem invoking the [updateCustRequest] service with the map named 
[updateRequestMap] containing 
[{userLogin=[GenericEntity:UserLogin][createdStamp,2020-05-25 
09:59:39.293(java.sql.Timestamp)][createdTxStamp,2020-05-25 
09:59:39.167(java.sql.Timestamp)][currentPassword,null()][disabledBy,null()][disabledDateTime,null()][enabled,N(java.lang.String)][externalAuthId,null()][hasLoggedOut,null()][isSystem,Y(java.lang.String)][lastCurrencyUom,null()][lastLocale,null()][lastTimeZone,null()][lastUpdatedStamp,2020-05-25
 09:59:41.161(java.sql.Timestamp)][lastUpdatedTxStamp,2020-05-25 
09:59:41.121(java.sql.Timestamp)][partyId,system(java.lang.String)][passwordHint,null()][requirePasswordChange,null()][successiveFailedLogins,null()][userLdapDn,null()][userLoginId,system(java.lang.String)],
 custRequestName=New Test Customer request, fromPartyId=admin, 
statusId=CRQ_ACCEPTED, custRequestId=10530, custRequestTypeId=RF_INFO, 
priority=2, locale=en}]: Outgoing result (in runSync : updateCustRequest) does 
not match expected requirements (The following required parameter is missing: 
[OUT] [updateCustRequest.oldStatusId])]
   at org.apache.ofbiz.testtools.SimpleMethodTest.run(SimpleMethodTest.java:91)
   at 
org.apache.ofbiz.testtools.TestRunContainer.start(TestRunContainer.java:90)
   at 
org.apache.ofbiz.base.container.ContainerLoader.startLoadedContainers(ContainerLoader.java:156)
   at 
org.apache.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:78)
   at 
org.apache.ofbiz.base.start.StartupControlPanel.loadContainers(StartupControlPanel.java:151)
   at 
org.apache.ofbiz.base.start.StartupControlPanel.start(StartupControlPanel.java:71)
   at org.apache.ofbiz.base.start.Start.main(Start.java:90)
          </failure>
So something in my checkStatusCustRequest call is not digesting the response 
from the sub-service properly I suspect as the test complains that the 
subsequent line originally in line #123 which maps the oldStatusId is not 
executed as that field is missing in the response.

Now I am not an expert at all with these cross-service calls, what would you 
suggest here?

Also, a tactical option could be to extend the story to port all three to 
Groovy knowing that the other two are not called as nested call-simple-method 
statements by other services, but always as call-service statements which 
assumedly makes it fairly easy to port (but will cause scope slippage).

Thanks for any views and hints.
Warm regards


Carsten



Reply via email to