Add backwards compatibility between StateMachineContext serialization of spring-statemachine 2.0.x and 2.1.x

- Add tests between old serialised context(write) and new context(write)
- Fix setting childRefs to empty array instead of null if childRefs
  are not given.
This commit is contained in:
Jonathon Seah
2019-04-05 23:15:58 +01:00
committed by Janne Valkealahti
parent 02ecb28751
commit 39ab4a0732
3 changed files with 90 additions and 17 deletions

View File

@@ -126,7 +126,7 @@ public class DefaultStateMachineContext<S, E> implements StateMachineContext<S,
public DefaultStateMachineContext(List<StateMachineContext<S, E>> childs, S state, E event,
Map<String, Object> eventHeaders, ExtendedState extendedState, Map<S, S> historyStates, String id) {
this.childs = childs;
this.childRefs = null;
this.childRefs = new ArrayList<>();
this.state = state;
this.event = event;
this.eventHeaders = eventHeaders;