Commit Graph

279 Commits

Author SHA1 Message Date
Janne Valkealahti
ea9dee4aad Fix mockito deprecation warnings
- Relates to #342
2017-04-11 20:36:55 +01:00
Janne Valkealahti
7cd5f3c069 Fix Assert deprecation warnings
- Fixes #346
2017-04-11 19:59:44 +01:00
Janne Valkealahti
cf7b9d7e24 Fix StateMachineMonitorTests
- Attempt to make these tests more reliable
- Relates to #343
2017-04-10 14:58:48 +01:00
Janne Valkealahti
6ced0371d8 Disarm timers
- Trying to handle scenario where TimerTrigger keeps firing
  even if machine is stopped or has moved away from its
  hosting state.
- Explicitely handle trigger starts/stops in
  DefaultStateMachineExecutor when executor itself
  is started/stopped.
- Backport #321
- Relates to #307
2017-03-09 10:51:20 +00:00
Janne Valkealahti
688b61d5d2 Notify transition before calling its actions
- Add new api to Transition to expose calling
  its actions.
- Modify rest of a framework to first notify before
  calling transtion action.
- Backport #322
- Relates to #307
2017-03-09 10:51:20 +00:00
Janne Valkealahti
7371f67eb6 Timer trigger deadlock in DefaultStateMachineExecutor
- Add new tests for DefaultStateMachineExecutor to find
  possible causes for a deadlock.
- Handle lifecycle scenario little differently
  if timer is fired during a executor starting phase
  order to not getting into a deadlock.
- Backport #315
- Relates to #307
2017-03-09 10:51:20 +00:00
Gary Rosales
70a8657463 StateMachineInterceptorList set() does nothing
- Fixes #318
2017-02-16 09:31:52 +00:00
Janne Valkealahti
90637d68d6 Better generics handling with adapters
- Modify StateMachineConfiguration and StateMachineFactoryConfiguration
  so that if you have different states and events classes with multiple
  machines or factories, you can autowire by types without
  adding qualifiers.
- Manually try to discover generic types from enclosing adapther class
  and if succesfull pass that information into bean definition
  as ResolvableType.
- Backporting #306
- Relates to #307
2017-02-10 11:57:04 +00:00
Janne Valkealahti
c35286e83f Fix typo
- Fixes #310
2017-02-09 17:55:32 +00:00
Janne Valkealahti
29e8cdd276 @WithStateMachine with factory and builder
- Backport #292
- Backport #224
- Add support so that @WithStateMachine can be used with
  machines build via @EnableStateMachineFactory or via
  manual builders.
- Adding new annotation @EnableWithStateMachine to help
  handling needed context configuration.
- Add tests and docs.
- Relates to #307
2017-01-18 09:49:10 +00:00
Janne Valkealahti
17d977ddc1 Make autostart smarter
- Backport #298
- Factory now listens machine event if autostart
  is requested which should give fully started machine
  i.e. if asynch executor is used. Bails out after 30
  seconds. Further tweaks like allowing user to define
  this time or conditionally not wait could be added later.
- Fix typos.
- Relates to #307
2017-01-18 09:48:14 +00:00
Janne Valkealahti
b26b03e6bb Update docs
- Add intro builder which goes to gh pages
- Relates to #284
2016-12-11 11:31:26 +00:00
Janne Valkealahti
3d9059a075 Update docs
- Add section about machineId
- Relates to #284
2016-12-10 12:27:58 +00:00
Janne Valkealahti
457c924e67 Remove some EventNotAccepted events
- Now only trying to notify those from
  a root machine as same events from childs are
  kinda pointless and just create noise.
- Fixes #287
2016-12-08 12:15:52 +00:00
Janne Valkealahti
19d5232293 Fix fork/join with composite states
- Handle new pseudostate listener registration when
  machine is restored. Make sure that we have only one set
  of listeners by clearing existing ones.
- Fix join issue when regions are partially ended into
  join source states and machine is persisted from that
  moment.
- Lot of new tests to cover possible cases where these
  bugs were hidden.
- Fixes #286
2016-12-03 11:26:57 +00:00
Janne Valkealahti
0c3ea7fb2d Add initial action to repository config
- Now RepositoryState can have initial action
  if it is an initial state.
- Implement all needed tests.
- Fixes #281
2016-11-23 13:55:52 +00:00
Janne Valkealahti
6a5a704c75 Update docs
- Add section about error actions for states.
- Relates to #270
2016-11-20 16:24:34 +00:00
Janne Valkealahti
38e6c9db0a Polish
- Fix javadoc warnings
2016-11-19 18:29:02 +00:00
Janne Valkealahti
0dd9d2fa66 Add error actions to states
- Now do behaviour and entry/error actions
  can have error action callback with
  a raised Exception.
- New modified added methods in a StateConfigurer.
- Fixes #277
2016-11-19 09:50:28 +00:00
Janne Valkealahti
8dea842830 No null collections from AbstractState
- Fix to create empty collections in
  favour of returning nulls.
- Fixes #271
2016-11-12 14:38:41 +00:00
Janne Valkealahti
b3e6a22dce Fix choice back to source
- Previously if choice took transition back
  to its original source, this source wasn't
  entered. Adding this special case to get handled.
- Fixes #228
2016-11-11 21:55:44 +00:00
Janne Valkealahti
735a06f28c Fix typos
- "contextOjb" vs. "contextObj"
- Fixes #269
2016-11-09 14:18:35 +00:00
Janne Valkealahti
8cb5a81652 Exit action may get interrupted
- Add test case
- Synchronise recursive scheduleEventQueueProcessing()
  in DefaultStateMachineExecutor.
- Fixes #233
2016-11-09 13:47:56 +00:00
Janne Valkealahti
d1f7f31aeb Fix problems in JoinPseudoState
- Fix possible NPE which is a regression.
- Fix state entry notification for JOIN states.
- Fixes #229
2016-11-06 14:39:19 +00:00
Janne Valkealahti
c48f671ee1 Document monitoring and boot
- Relates to #263
2016-11-06 08:16:44 +00:00
Janne Valkealahti
bd7e0141ea Fix interceptor handling
- Modify so that interceptor `preStateChange` is not called
  for transient states which would falsely try to i.e. persist
  choice and other states with persist recipe.
- Added some tests to verify that `preStateChange` is called
  only once.
- Relates to #266
2016-10-29 08:48:53 +01:00
Janne Valkealahti
728dd433d9 Make test more reliable
- Relates to #149
2016-10-28 07:27:33 +01:00
Janne Valkealahti
cc2893c4b8 Implement action monitoring and tracing
- Modify transitions and actions so that
  action execution can be monitored.
- Extend StateMachineMonitor
- Add new ActionListener
- Relates to #149
2016-10-27 06:58:23 +01:00
Janne Valkealahti
944a3cf1f5 Polish 2016-10-19 08:26:03 +01:00
Janne Valkealahti
79f0280990 Add monitoring subsystem
- This is a preliminary work.
- New monitoring and tracing conceps around StateMachineMonitor.
- Adds hooks internally to better calculate transition times.
- Add new annotation configurer for monitors.
- New boot module which autoconfigures monitoring for boot's metrics
  and trancing repos.
- New monitoring sample.
- Relates to #149
2016-10-18 06:54:47 +01:00
Janne Valkealahti
27d67bfd47 Fix StateMachineHandler method caching
- Adding ApplicationListener so that we can
  consult time of last ContextRefreshedEvent and
  rebuild a cache of StateMachineHandler methods.
- This implementation is a bit naive as we speak but
  work for #224 will need to add better concept to work
  outside of app context.
- Fixes #232
2016-09-30 17:16:53 +01:00
Janne Valkealahti
3cc626c947 Upgrade to Boot 1.4.1
- Align related spring train deps
- Modify some other deps to get correct versions
- Some testing changes as boot 1.4.1 shuffled some
  test stuff around.
- Fixed deprecations with newer boot and framework
- Fixes #256
2016-09-30 07:55:12 +01:00
Janne Valkealahti
99460531b4 Fix region persist
- Correctly set main persisted state id into
  StateMachineContext if state is orthogonal.
- Fixes #242
2016-09-28 09:34:13 +01:00
Janne Valkealahti
0f3ffa1876 Transition error action not used per defined action
- Revert some previous changes order to define transition
  error action logic in a different place. Now basically
  wrapping try/catch in a dedicated action order to have
  separate error action per action as is expected by a config
  SPI.
- Added some tests.
- Added docs for transition error actions.
- Relates to #238
- Fixes #259
2016-09-27 09:21:30 +01:00
Janne Valkealahti
8fc7592404 Fix wrong event object comparison
- Classic case of using == vs. equals if Strings are involved.
- In DefaultStateMachineExecutor change event comparison
  from == to equals.
- Tests using enums naturally work, but some tests using Strings
  had a wrong checks.
- Fixes #253
2016-09-26 10:29:01 +01:00
Janne Valkealahti
9c20ddd051 Fix state action tests
- Tests should now be more reliable as trying to
  make sure actions run before testing further.
- Fixes #257
2016-09-25 11:20:20 +01:00
Janne Valkealahti
49bae38eb3 Hook StateMachineModelFactory and StateMachineFactory together
- Change so that machine id used in StateMachineFactory
  can use same id in StateMachineModelFactory which now
  extended with method build(String machineId).
- Polish repo and jpa classes.
- Fixes #255
2016-09-25 10:08:57 +01:00
Janne Valkealahti
9f9acd3567 Add docs for state actions
- Relates to #238
2016-09-24 15:55:06 +01:00
Janne Valkealahti
3a4aab647e Update docs for join state
- Relates to #238
2016-09-24 11:31:32 +01:00
Janne Valkealahti
693d7b8951 Fix StateMachineModelFactory usage
- When StateMachineModelFactory is passed into config
  it is now used everytime when machine is build which
  allows model factory to get a fresh model from its
  own storage if needed.
- Shuffled stuff around in machine factory base classes
  to call StateMachineModelFactory only once during a machine
  build operation.
- Other tweaks and a polish.
- Fixes #254
2016-09-23 15:44:13 +01:00
Janne Valkealahti
25e190c57d Fix local transition logic
- Add missing creating of a local transition
- Fix logic how entry/exit is not called with local
- Add tests comparing functionality with external
- Fixes #248
- Fixes #249
2016-09-11 10:25:05 +01:00
Christophe
e6f10b60f5 Ability to set UUID for StateMachine
- Squash commits with below entries
- Add factory with a given uuid
- Fix compile error, replace spaces by tabs and clean imports
- Make more sense to swap uuid and stringId
- Fixes #241
2016-09-09 15:42:19 +01:00
Christophe
4c34e46ccf Add capabilities to provide ActionError in Transition
- Add classes directory to be ignored by git
- Doesn't yet handle actions defined for entry,
  exit or do behariour.
- Docs to come when features around error actions
  are fully implemented.
- Fixes #240
2016-08-30 20:54:56 +01:00
Janne Valkealahti
062bc9aa0e Support state activity
- AbstractState now extends LifecycleObjectSupport getting
  access to TaskScheduler.
- Modify all configs so that we can have a cancellable Action
  which is executed after state is entered and which is
  cancelled(if running) when state is exited.
- Fixes #239
2016-08-14 10:06:33 +01:00
Janne Valkealahti
c387979d75 Support for UML Sub State Machines
- Enhance config model so that a state can be
  configured as a submachine or a factory.
- With uml it's possible to put multiple machines
  into one xml(one needs to be a root machine) and
  in a same way, define state as a separate machine.
- JavaConfig vs. uml config differs in a bit where
  latter is passing raw model data into pojo config and
  JavaConfig either full machine or machine factory.
- Fixes #121
2016-08-13 07:19:21 +01:00
Janne Valkealahti
049f811f56 Refactor join handling
- Refactor how join is handled
- Add new StateListener for listening entry/exit per State.
- Transition is now passed to next guy from a join state.
- A lot of changes in core machine/factory/executor to support
  this new join handling.
- Fixes #235
- Fixes #237
2016-08-11 08:58:34 +01:00
Janne Valkealahti
ba8353367a Add locking to state handling
- We still got trouble with #227 with smoke
  tests so adding some locking sync to state
  handling.
2016-05-21 21:21:02 +01:00
Janne Valkealahti
e9cb3af785 Fix possible NPE
- getState() now handles null better when checking
  running state when possibly going to return
  final state.
- Fixes #227
2016-05-21 09:54:21 +01:00
Janne Valkealahti
ec21afc131 Refactor concepts around uml model factory
- Fixes #226
2016-05-17 09:11:14 +01:00
Janne Valkealahti
fca98d8e4d Add tests
- Adding a simple test for checking that
  custom task executor is set via configurer
  if executor is created as bean.
2016-05-12 15:31:26 +01:00