Hi Hage

The code you are trying to write is correct, adding something more you need to add a additional tag <check-errors/> see (CheckErrors.java code) which returns the fail-property errors for you .

S.Hage wrote:
Hi all,

  I'm writing a couple of tests to create a simple service. The service is
called from java code. When I call 'fail-property ' inside a
'call-map-processor ' I get 'Locate cannot be null' but if I use it inside
an 'if-compare' every thing is ok.  I would like to notice that i'm using
the latest trunk.

Any help is appreciated.

Here's the methods code called by the service:

test 1 (inside if-compare):
====================
<?xml version="1.0" encoding="UTF-8" ?>

<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="test1" short-description="test1"
login-required="false">

        <!-- TEST  1 -->
        <set field="require_login" value="true"/>
        <if-compare field="require_login" operator="equals" value="true">
            <add-error>
              <fail-property resource="PartyUiLabels"
property="PartyUserNameMissing"/>
            </add-error>
        </if-compare>

    </simple-method>
</simple-methods>


this test is correct;

test 2 inside call-map-processor:
=========================
<?xml version="1.0" encoding="UTF-8" ?>

<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="test2" short-description="test2"
login-required="false">
<!-- TEST 2 -->
        <call-map-processor in-map-name="parameters"
out-map-name="personContext">
            <simple-map-processor name="newPerson">
                <process field="USER_FIRST_NAME"><copy
to-field="firstName"/>
<not-empty> <fail-property resource="PartyUiLabels"
property="PartyFirstNameMissing"/>
                  </not-empty>
                </process>
            </simple-map-processor>
        </call-map-processor>

this test logged the error 'locate cannot be null' in ofbiz.log


thanks in advance

Saad.

--
Thanks & Regards
Shubham Dubey
Jr. Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/

Reply via email to