File tree Expand file tree Collapse file tree 4 files changed +20
-1
lines changed
main/resources/schema/produce
java/io/serverlessworkflow/api/test Expand file tree Collapse file tree 4 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 1010 "data" : {
1111 "type" : " string" ,
1212 "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>"
1318 }
1419 },
1520 "required" : [
Original file line number Diff line number Diff line change 4040import io .serverlessworkflow .api .timeouts .WorkflowExecTimeout ;
4141import io .serverlessworkflow .api .workflow .*;
4242import java .util .List ;
43+ import java .util .Map ;
44+
4345import org .junit .jupiter .params .ParameterizedTest ;
4446import org .junit .jupiter .params .provider .ValueSource ;
4547
@@ -260,6 +262,11 @@ public void testTransitions(String workflowLocation) {
260262 assertEquals ("RejectApplication" , cond2 .getTransition ().getNextState ());
261263 assertNotNull (cond2 .getTransition ().getProduceEvents ());
262264 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" ));
263270 assertFalse (cond2 .getTransition ().isCompensate ());
264271
265272 assertNotNull (switchState .getDefaultCondition ());
Original file line number Diff line number Diff line change 2323 "produceEvents" : [
2424 {
2525 "eventRef" : " provisioningCompleteEvent" ,
26- "data" : " ${ .provisionedOrders }"
26+ "data" : " ${ .provisionedOrders }" ,
27+ "contextAttributes" : {
28+ "order_location" : " IN" ,
29+ "order_type" : " online"
30+ }
2731 }
2832 ]
2933 }
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ states:
1818 produceEvents :
1919 - eventRef : provisioningCompleteEvent
2020 data : " ${ .provisionedOrders }"
21+ contextAttributes :
22+ " order_location " : " IN"
23+ " order_type " : " online"
2124 defaultCondition :
2225 transition :
2326 nextState : RejectApplication
You can’t perform that action at this time.
0 commit comments