@@ -8,7 +8,28 @@ import org.springframework.webflow.engine.FlowInputMappingException
88class FlowBuilderSubFlowExecutionWithInputOuputTests extends AbstractGrailsTagAwareFlowExecutionTests {
99
1010 def searchMoreAction = { [moreResults : [" one" , " two" , " three" ]] }
11+ def subber = {
12+ input {
13+ shortHand()
14+ constantDefault1(' constantDefault1Value' )
15+ constantDefault2(required : false , value : ' constantDefault2Value' )
16+ dynamicDefault1 {conversation. get(' conversationAttribute1' )}
17+ dynamicDefault2(value : {conversation. get(' conversationAttribute2' )})
18+ }
1119
20+ subberStart {
21+ on(" next" ). to " subberEnd"
22+ }
23+
24+ subberEnd {
25+ output {
26+ constantOut1(' constantOut1Value' )
27+ constantOut2(value : ' constantOut2Value' )
28+ dynamicOut1 {conversation. get(' conversationAttribute1' )}
29+ dynamicOut2(value : {conversation. get(' conversationAttribute2' )})
30+ }
31+ }
32+ }
1233
1334 def requiredInputSubber = {
1435 input {
@@ -24,28 +45,6 @@ class FlowBuilderSubFlowExecutionWithInputOuputTests extends AbstractGrailsTagAw
2445
2546
2647 Closure getFlowClosure () {
27- def subber = {
28- input {
29- shortHand()
30- constantDefault1(' constantDefault1Value' )
31- constantDefault2(required : false , value : ' constantDefault2Value' )
32- dynamicDefault1 {conversation. get(' conversationAttribute1' )}
33- dynamicDefault2(value : {conversation. get(' conversationAttribute2' )})
34- }
35-
36- subberStart {
37- on(" next" ). to " subberEnd"
38- }
39-
40- subberEnd {
41- output {
42- constantOut1(' constantOut1Value' )
43- constantOut2(value : ' constantOut2Value' )
44- dynamicOut1 {conversation. get(' conversationAttribute1' )}
45- dynamicOut2(value : {conversation. get(' conversationAttribute2' )})
46- }
47- }
48- }
4948 return {
5049 start {
5150 on(" next" ) {
@@ -56,17 +55,18 @@ class FlowBuilderSubFlowExecutionWithInputOuputTests extends AbstractGrailsTagAw
5655 }
5756
5857 defaultInputs {
59- subflow(subber)
58+ subflow(controller : ' subber' , action : ' subber ' )
6059 on(' subberEnd' ). to(' providedInputs' )
6160 }
6261
6362 providedInputs {
64- subflow(input : [
63+ subflow(controller : ' subber' , action : ' subber' ,
64+ input : [
6565 shortHand : ' shortHandInValue' ,
6666 constantDefault1 : ' constantDefault1InValue' ,
6767 constantDefault2 : ' constantDefault2InValue' ,
6868 dynamicDefault1 : {flow. get(' dynamicDefaultIn' )},
69- ], subber )
69+ ])
7070 on(' subberEnd' ) {
7171 flow. put(' constantOut1' , currentEvent. attributes. constantOut1)
7272 flow. put(' constantOut2' , currentEvent. attributes. constantOut2)
@@ -85,6 +85,7 @@ class FlowBuilderSubFlowExecutionWithInputOuputTests extends AbstractGrailsTagAw
8585
8686
8787 void testSubFlowInputOutput () {
88+ registerFlow(' subber/subber' , subber)
8889 GrailsWebRequest webrequest = grails.util.GrailsWebUtil . bindMockWebRequest()
8990 startFlow()
9091
@@ -112,4 +113,14 @@ class FlowBuilderSubFlowExecutionWithInputOuputTests extends AbstractGrailsTagAw
112113
113114 }
114115
116+ void testFailOnRequiredInput () {
117+ registerFlow(' subber/subber' , requiredInputSubber)
118+ grails.util.GrailsWebUtil . bindMockWebRequest()
119+ startFlow()
120+ try {
121+ signalEvent(' next' )
122+ fail (' expected FlowInputMappingException' )
123+ }
124+ catch (FlowInputMappingException e) {}
125+ }
115126}
0 commit comments