Fix internal transition for dist machine

- Change previous DistributedStateMachine fixes which didn't
  really work. Now explicitely getting state from machine to be set
  into ensemble for post internal transition.
- Now can send Message<E> via test plan instead of plain E.
- More testing for tweaked features.
This commit is contained in:
Janne Valkealahti
2015-08-08 10:43:54 +01:00
parent 7572a9ced3
commit 5347ea4dd9
5 changed files with 206 additions and 12 deletions

View File

@@ -219,11 +219,14 @@ public class DistributedStateMachine<S, E> extends LifecycleObjectSupport implem
stateContext.getMessageHeader(StateMachineSystemConstants.STATEMACHINE_IDENTIFIER))) {
StateMachineContext<S, E> current = ensemble.getState();
if (current != null) {
// TODO: it feels a bit wrong that this can be null so
// adding note here. feel this will come back to haunt us
ensemble.setState(new DefaultStateMachineContext<S, E>(
current.getState(), stateContext.getEvent(), stateContext
.getMessageHeaders(), stateContext.getStateMachine().getExtendedState()));
} else if (stateContext.getStateMachine().getState() != null) {
// if current ensemble state is null, get it from sm itself
ensemble.setState(new DefaultStateMachineContext<S, E>(stateContext.getStateMachine().getState()
.getId(), stateContext.getEvent(), stateContext.getMessageHeaders(), stateContext
.getStateMachine().getExtendedState()));
}
}
return stateContext;