Author: rahul Date: Fri Nov 21 08:40:01 2008 New Revision: 719633 URL: http://svn.apache.org/viewvc?rev=719633&view=rev Log: Porting r719632 from trunk. event attribute of <send> is not evaluated SCXML-90
Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/Send.java commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-03.xml commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-04.xml commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/wizard-02.xml commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/invoke/invoked-02.xml commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/send-02.xml Modified: commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/Send.java URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/Send.java?rev=719633&r1=719632&r2=719633&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/Send.java (original) +++ commons/proper/scxml/branches/J6/src/main/java/org/apache/commons/scxml/model/Send.java Fri Nov 21 08:40:01 2008 @@ -326,6 +326,15 @@ wait = parseDelay(delayString, appLog); } } + String eventValue = event; + if (!SCXMLHelper.isStringEmpty(event)) { + eventValue = (String) eval.eval(ctx, event); + if (SCXMLHelper.isStringEmpty(eventValue) + && appLog.isWarnEnabled()) { + appLog.warn("<send>: event expression \"" + event + + "\" evaluated to null or empty String"); + } + } // Lets see if we should handle it ourselves if (targettypeValue != null && targettypeValue.trim().equalsIgnoreCase(TARGETTYPE_SCXML)) { @@ -333,10 +342,10 @@ // TODO: Remove both short-circuit passes in v1.0 if (wait == 0L) { if (appLog.isDebugEnabled()) { - appLog.debug("<send>: Enqueued event '" + event + appLog.debug("<send>: Enqueued event '" + eventValue + "' with no delay"); } - derivedEvents.add(new TriggerEvent(event, + derivedEvents.add(new TriggerEvent(eventValue, TriggerEvent.SIGNAL_EVENT, params)); return; } @@ -355,13 +364,13 @@ } ctx.setLocal(getNamespacesKey(), null); if (appLog.isDebugEnabled()) { - appLog.debug("<send>: Dispatching event '" + event + appLog.debug("<send>: Dispatching event '" + eventValue + "' to target '" + targetValue + "' of target type '" + targettypeValue + "' with suggested delay of " + wait + "ms"); } // Else, let the EventDispatcher take care of it - evtDispatcher.send(sendid, targetValue, targettypeValue, event, + evtDispatcher.send(sendid, targetValue, targettypeValue, eventValue, params, hintsValue, wait, externalNodes); } Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-03.xml URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-03.xml?rev=719633&r1=719632&r2=719633&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-03.xml (original) +++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-03.xml Fri Nov 21 08:40:01 2008 @@ -37,7 +37,7 @@ <onentry> <cs:var name="one" expr="Data(rootdata,'root/one')"/> <cs:var name="two" expr="Data(rootdata,'root/two')"/> - <send event="event.bar" namelist="one two"/> + <send event="'event.bar'" namelist="one two"/> </onentry> <transition event="event.bar" cond="_eventdatamap['event.bar'].one + _eventdatamap['event.bar'].two eq 3" Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-04.xml URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-04.xml?rev=719633&r1=719632&r2=719633&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-04.xml (original) +++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-04.xml Fri Nov 21 08:40:01 2008 @@ -28,7 +28,7 @@ </datamodel> <onentry> - <send event="event.bar" namelist="one two" delay="'100ms'"/> + <send event="'event.bar'" namelist="one two" delay="'100ms'"/> </onentry> <transition event="event.bar"> <log label="'simulatedUser'" expr="_eventdatamap['event.bar'].one + ', ' + _eventdatamap['event.bar'].two"/> Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/wizard-02.xml URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/wizard-02.xml?rev=719633&r1=719632&r2=719633&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/wizard-02.xml (original) +++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/env/jexl/wizard-02.xml Fri Nov 21 08:40:01 2008 @@ -25,7 +25,7 @@ default to be chosen as "scxml". This will cause the first transition to state2 to be immediately followed. --> - <send event="event2" /> + <send event="'event2'" /> </onentry> <transition event="event2" target="state2"/> <transition event="event3" target="state3"/> Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/invoke/invoked-02.xml URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/invoke/invoked-02.xml?rev=719633&r1=719632&r2=719633&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/invoke/invoked-02.xml (original) +++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/invoke/invoked-02.xml Fri Nov 21 08:40:01 2008 @@ -21,7 +21,7 @@ <state id="state1"> <onentry> - <send event="invoked.next" /> + <send event="'invoked.next'" /> </onentry> <transition event="invoked.next" target="state2" /> </state> Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/send-02.xml URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/send-02.xml?rev=719633&r1=719632&r2=719633&view=diff ============================================================================== --- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/send-02.xml (original) +++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/send-02.xml Fri Nov 21 08:40:01 2008 @@ -25,49 +25,49 @@ the state "seventy", then hop over and end up in "ninety" --> <state id="ten"> <onentry> - <send event="ten.done" /> + <send event="'ten.' + 'done'" /> </onentry> <transition event="ten.done" target="twenty" /> </state> <state id="twenty"> <onentry> - <send event="twenty.done" targettype="'scxml'" /> + <send event="'twenty.done'" targettype="'scxml'" /> </onentry> <transition event="twenty.done" target="thirty" /> </state> <state id="thirty"> <onentry> - <send event="thirty.done" targettype="' sCxML '" /> + <send event="'thirty.done'" targettype="' sCxML '" /> </onentry> <transition event="thirty.done" target="forty" /> </state> <state id="forty"> <onentry> - <send event="forty.done" targettype=" " target=" " /> + <send event="'forty.done'" targettype=" " target=" " /> </onentry> <transition event="forty.done" target="fifty" /> </state> <state id="fifty"> <onentry> - <send event="fifty.done" target="' '" /> + <send event="'fifty.done'" target="' '" /> </onentry> <transition event="fifty.done" target="sixty" /> </state> <state id="sixty"> <onentry> - <send event="sixty.done" targettype="'scxml'" target=" " /> + <send event="'sixty.done'" targettype="'scxml'" target=" " /> </onentry> <transition event="sixty.done" target="seventy" /> </state> <state id="seventy"> <onentry> - <send event="seventy.done" targettype="'scxml'" target="'foo'" /> + <send event="'seventy.done'" targettype="'scxml'" target="'foo'" /> </onentry> <!-- This transition should not be followed since