I am confused... are you saying that the syntax:

<field-to-result field="val" result-name="${key}"/>

is not supported?

Jacopo



On Sep 26, 2014, at 9:02 AM, Adrian Crum <[email protected]> 
wrote:

> The element is behaving as specified in the schema:
> 
> <xs:documentation>
>                        The name of the result field to set. The target of the 
> assignment.
>                        Defaults to the value of the field attribute.
> 
>                        Optional. Attribute type: expression.
>                    </xs:documentation>
> 
> 
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
> 
> On 9/26/2014 7:56 AM, [email protected] wrote:
>> Author: jacopoc
>> Date: Fri Sep 26 06:56:27 2014
>> New Revision: 1627718
>> 
>> URL: http://svn.apache.org/r1627718
>> Log:
>> JUnit test to prove that field-to-result doesn't work properly when 
>> result-name contains the a ${} field.
>> 
>> Modified:
>>     
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java
>> 
>> Modified: 
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java?rev=1627718&r1=1627717&r2=1627718&view=diff
>> ==============================================================================
>> --- 
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java
>>  (original)
>> +++ 
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java
>>  Fri Sep 26 06:56:27 2014
>> @@ -91,4 +91,18 @@ public class MiniLangTests extends OFBiz
>>          assertTrue("<assert> error message text", 
>> errorMessage.startsWith("Assertion failed:"));
>>      }
>> 
>> +    public void testFieldToResultOperation() throws Exception {
>> +        String simpleMethodXml = "<simple-method 
>> name=\"testFieldToResult\">" +
>> +                                 "  <set field=\"resultValue\" 
>> value=\"someResultValue\"/>" +
>> +                                 "  <set field=\"result1\" 
>> value=\"dynamicResultName\"/>" +
>> +                                 "  <field-to-result field=\"resultValue\" 
>> result-name=\"constantResultName\"/>" +
>> +                                 "  <field-to-result field=\"resultValue\" 
>> result-name=\"${result1}\"/>" +
>> +                                 "</simple-method>";
>> +        SimpleMethod methodToTest = createSimpleMethod(simpleMethodXml);
>> +        MethodContext context = createServiceMethodContext();
>> +        String result = methodToTest.exec(context);
>> +        assertEquals("testFieldToResult success result", 
>> methodToTest.getDefaultSuccessCode(), result);
>> +        assertEquals("Constant result name set", "someResultValue", 
>> context.getResult("constantResultName"));
>> +        //assertEquals("Dynamic result name set", "someResultValue", 
>> context.getResult("dynamicResultName")); This one fails!
>> +    }
>>  }
>> 
>> 

Reply via email to