File tree 4 files changed +20
-1
lines changed
main/resources/schema/produce
java/io/serverlessworkflow/api/test
4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 10
10
"data" : {
11
11
"type" : " string" ,
12
12
"description" : " Workflow expression which selects parts of the states data output to become the data of the produced event"
13
+ },
14
+ "contextAttributes" : {
15
+ "type" : " object" ,
16
+ "description" : " Add additional event extension context attributes" ,
17
+ "existingJavaType" : " java.util.Map<String, String>"
13
18
}
14
19
},
15
20
"required" : [
Original file line number Diff line number Diff line change 40
40
import io .serverlessworkflow .api .timeouts .WorkflowExecTimeout ;
41
41
import io .serverlessworkflow .api .workflow .*;
42
42
import java .util .List ;
43
+ import java .util .Map ;
44
+
43
45
import org .junit .jupiter .params .ParameterizedTest ;
44
46
import org .junit .jupiter .params .provider .ValueSource ;
45
47
@@ -260,6 +262,11 @@ public void testTransitions(String workflowLocation) {
260
262
assertEquals ("RejectApplication" , cond2 .getTransition ().getNextState ());
261
263
assertNotNull (cond2 .getTransition ().getProduceEvents ());
262
264
assertEquals (1 , cond2 .getTransition ().getProduceEvents ().size ());
265
+ assertNotNull (cond2 .getTransition ().getProduceEvents ().get (0 ).getContextAttributes ());
266
+ Map <String , String > contextAttributes = cond2 .getTransition ().getProduceEvents ().get (0 ).getContextAttributes ();
267
+ assertEquals (2 , contextAttributes .size ());
268
+ assertEquals ("IN" , contextAttributes .get ("order_location" ));
269
+ assertEquals ("online" , contextAttributes .get ("order_type" ));
263
270
assertFalse (cond2 .getTransition ().isCompensate ());
264
271
265
272
assertNotNull (switchState .getDefaultCondition ());
Original file line number Diff line number Diff line change 23
23
"produceEvents" : [
24
24
{
25
25
"eventRef" : " provisioningCompleteEvent" ,
26
- "data" : " ${ .provisionedOrders }"
26
+ "data" : " ${ .provisionedOrders }" ,
27
+ "contextAttributes" : {
28
+ "order_location" : " IN" ,
29
+ "order_type" : " online"
30
+ }
27
31
}
28
32
]
29
33
}
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ states:
18
18
produceEvents :
19
19
- eventRef : provisioningCompleteEvent
20
20
data : " ${ .provisionedOrders }"
21
+ contextAttributes :
22
+ " order_location " : " IN"
23
+ " order_type " : " online"
21
24
defaultCondition :
22
25
transition :
23
26
nextState : RejectApplication
You can’t perform that action at this time.
0 commit comments