Commit Graph

184 Commits

Author SHA1 Message Date
Janne Valkealahti
1800616d48 Update jepsen tests 2015-08-21 18:08:06 +01:00
Janne Valkealahti
99275380c3 Tune tests, modify web sample, add more logging
- In web sample change other event C to K which brings
  machine back from S2 to S1.
- Add more logging.
- New test sending parallel events.
2015-08-21 12:59:41 +01:00
Janne Valkealahti
ad3c082670 Tweak ZookeeperStateMachineEnsembleTests await times 2015-08-15 23:03:56 +01:00
Janne Valkealahti
781c2e62fd Polish 2015-08-15 22:38:17 +01:00
Janne Valkealahti
5e2ac9dd84 Tweak tests for being more reliable
- For #76, try to make sure that join is fully done
  before continue sending events.
2015-08-15 17:23:57 +01:00
Janne Valkealahti
d7f5f9f573 Better zk connection error handling
- Modifying concepts around DistributedStateMachine and
  ZookeeperStateMachineEnsemble to get better handling when
  zk connection is lost.
- New jepsen test showing that after a brain split machine
  will get back to a consistent state.
- Polish javadocs
- Hopefully fixes #91
2015-08-15 15:36:52 +01:00
Janne Valkealahti
edf3938c9d Tuning TasksHandlerTests, take2 2015-08-14 09:59:00 +01:00
Janne Valkealahti
a2ff794ebd Tuning TasksHandlerTests 2015-08-14 09:56:54 +01:00
Janne Valkealahti
f12b94e548 Add extended state variable change into test plan
- Add missing test method for testing variable change events.
- This may also contribute to make tests more reliable when
  testing variable values.
- Should contribute to #76 also.
2015-08-14 09:36:17 +01:00
Janne Valkealahti
dea718c13d Making overflow test more reliable 2015-08-14 08:55:34 +01:00
Janne Valkealahti
7c4ab42919 ZookeeperStateMachineEnsemble may miss events
- Adding secondary read if event logs were read which
  should make it less probable losing events at a time
  when main state is changed while logs are replayed.
- Hopefully fixes #97
2015-08-14 08:31:22 +01:00
Janne Valkealahti
7f7c2334ff Add state reset for regions
- This relates to #94 but doesn't provide full solution
  as it simply allows to use nested state machine contexts
  to reset region states.
2015-08-13 14:37:48 +01:00
Janne Valkealahti
9e0dfe9c24 Fix DefaultStateMachineExecutor concurrency issue
- Check task is null and then set it was wrongly
  not made as thread safe, changing it to be wrapped
  inside AtomicReference.
- This relates to #76 and hopefully fixes #96
2015-08-12 21:23:45 +01:00
Janne Valkealahti
edda97af16 Docs for extended state 2015-08-09 17:15:03 +01:00
Janne Valkealahti
04f807f1a7 Add docs for testing support
- Adding some docs for testing framework which has been
  in place for some time now.
- Fixes #49
2015-08-09 15:41:09 +01:00
Janne Valkealahti
e8debdc5a5 Add listener api for extended state variables
- New extendedStateChanged method in StateMachineListener and
  its wingman OnExtendedStateChanged in context events.
- DefaultExtendedState is now using ObservableMap to get notify
  when individual variables has been modified.
- Fixes #85
2015-08-09 14:56:54 +01:00
Janne Valkealahti
05f69070d8 Change TaskExecutor bean name
- Now using stateMachineTaskExecutor instead of taskExecutor
  so that it's easier to use custom executor and not to
  collide with bean created i.e. scheduling.
- Fixes #83
2015-08-09 09:53:46 +01:00
Janne Valkealahti
ab2277b3f7 Add initial set of jepsen tests
- Add simple tests for sending events via random machine,
  via all machines and also testing extended state variables.
- Relates to #80
2015-08-08 17:16:15 +01:00
Janne Valkealahti
7fc7dd9cac Fix potential concurrency issue with join pseudostate
- Change notified flag to volatile which might explain
  some test failures.
- More testing tweaks for #76
2015-08-08 16:30:24 +01:00
Janne Valkealahti
5347ea4dd9 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.
2015-08-08 10:53:44 +01:00
Janne Valkealahti
7572a9ced3 Add extended state variables for web sample rest api 2015-08-07 17:49:49 +01:00
Janne Valkealahti
ba16830151 Remove extra debug logging 2015-08-07 17:28:48 +01:00
Janne Valkealahti
672a41ecf1 Add internal transition to web sample
- This is purely for jepsen tests, though also
  handy for UI for showing that variable can be changed.
  Essentially we want to have a way to set extended state
  variable via internal transition which takes an value from
  event headers and set that to extended state. This is then
  supposed to be used from jepsen to test concurrenty issues
  around extended state variables.
2015-08-07 17:26:02 +01:00
Janne Valkealahti
435b306cf9 Fix DistributedStateMachine internal transition
- For some reason ZookeeperStateMachineEnsemble may return null
  for very early when postTransition() is handled. Adding check not
  to ping back ensemble if its getState() returns null. It really
  feels a bit wrong right now, so need to follow this.
2015-08-07 17:25:52 +01:00
Janne Valkealahti
bba3b231b3 Synchronize Join PseudoState state machine listener
- Synchronize JoinPseudoState's
  JoinTracker.stateChanged(State<S, E>, State<S, E>) method
  for playing nice with concurrent region execution.
  Should fix #93.
- Tuning test which relates to #76. What comes for the
  tests, there was this concurrency issue and also problem
  in tests itself.
- Polish JoinPseudoState.
2015-08-07 14:38:49 +01:00
Janne Valkealahti
4008436d75 Better handling of zk bad version
- Remove propagating BadVersionException from ZookeeperStateMachineEnsemble
  via event so that machine can be kept running. Further logs are then read
  anyway via watcher. Thought we still need better handling but this
  is better for now.
- Relates to #92
2015-08-07 11:15:16 +01:00
Janne Valkealahti
e6c400e31c Fix jdk8 javadoc build 2015-08-04 09:08:22 +01:00
Janne Valkealahti
924300999e Update ref docs
- Relates to #88
2015-08-02 16:00:03 +01:00
Janne Valkealahti
70455ed329 Add status to web sample rest api 2015-08-01 18:39:49 +01:00
Janne Valkealahti
0d7ec09885 Add zk web sample ref docs 2015-07-31 19:22:35 +01:00
Janne Valkealahti
48d6459c26 Add zookeeper web example
- This is a web based distributed zookeeper state machine
  sample showing how multiple Spring boot instances having
  a state machine can work with a zookeeper to distribute state
  handling thoughout a jvm boundaries.
- Also this example is using websocket support to have live
  updates of a UI for state machine state changes.
2015-07-31 18:29:06 +01:00
Janne Valkealahti
5ab1cb3fcb Add ref docs for error handling
- Base docs for error handling and some tests
  to verify added doc samples.
- Relates to #88
2015-07-31 16:58:47 +01:00
Janne Valkealahti
d5257c64e7 Add base feature for error handling
- Add related error handling methods to StateMachine.
- Enhance StateMachineListener and context events around
  error events.
- Modify StateMachineInterceptor and stuff around it order
  to handle errors.
- Fixes #6, fixes #77
2015-07-31 13:11:19 +01:00
Janne Valkealahti
6684b0deda Fixes for zk ensemble operations
- Fix some concurrent event issues which were
  born with new tests
- Enhance tests for dist machine and ensemble
- Add new features to testing system
- Polish and add more logging
2015-07-29 20:15:42 +01:00
Janne Valkealahti
706f1de232 Update ref docs
- First set of changes for doc updates for M3
- Relates #88
2015-07-26 16:52:15 +01:00
Janne Valkealahti
e92a6c5a09 Add test framework skeleton
- Relates to #49
- New project spring-statemachine-test which contains public
  classes to easy generic state machine testing.
- Concepts of StateMachineTestPlan and StateMachineTestPlanBuilder.
- Replaced one zk test to use this framework.
2015-07-26 13:27:10 +01:00
Janne Valkealahti
ba6c689123 Fix for failing tests 2015-07-25 17:22:54 +01:00
Janne Valkealahti
178ee816a4 Enhancements to tasks recipe
- Fix AbstractStateMachineFactory so that it does not try
  to create transitions with null source or target. Basically we
  just skip transition source or target which doesn't belong to
  region.
- Change DefaultExtendedState to use ConcurrentHashMap so that
  there's less change to get into trouble with concurrency.
- Add statechart for tasks recipe.
- Fix various concepts in TasksHandler and its tests.
- Prepare some examples for docs.
- Fixes #74
2015-07-25 17:09:54 +01:00
Janne Valkealahti
0fba91cbf2 Fix event overflow
- Fixes #89
- Added new method into EnsembleListeger which can
  be used to listen ensemble errors.
2015-07-25 08:31:03 +01:00
Janne Valkealahti
74f2f72ed6 Fix concepts around internal transitions
- Fixes #86
- Fix internal transition changes when extended
  state variables has been modified. Also internal
  transition is now correctly passed into other
  distributed state machines.
2015-07-24 09:07:03 +01:00
Janne Valkealahti
550c17f5e4 update readme 2015-07-19 18:48:08 +01:00
Janne Valkealahti
0cdd833648 Enhance concepts around interceptor
- Rename StateChangeInterceptor to StateMachineInterceptor and
  add methods for pre/post transitions.
- Adding getId concept into a state machine to help distributed
  machines to know from where a state change originates.
- Fix ZookeeperStateMachineEnsemble to work better with
  persisted state machine contexts.
2015-07-19 10:33:28 +01:00
Janne Valkealahti
15c6e507d8 Tweak concepts around state reset
- StateMachineAccess, replace state reset and variables
  with a StateMachineContext.
- Additional fixes to reset state properly even if
  target transition is a super state.
- Some polish
- Add tests
2015-07-15 11:17:43 +01:00
Janne Valkealahti
db5a1ab3f7 Update docs 2015-07-12 17:19:46 +01:00
Janne Valkealahti
c28ace7945 Enhance config model with StateMachineListener
- Fixes #84
2015-07-11 16:43:28 +01:00
Janne Valkealahti
48bb6631f9 Tweak factory lifecycle handling
- Setup autostart and afterPropertiesSet() for distributed machine.
2015-07-11 16:08:41 +01:00
Janne Valkealahti
087da55cbb Add autostart flag for top-level machine - take2
- Add actual start calls
- Rename autoStart to autoStartup in config methods.
- Tweak so that this works in factory and builder
2015-07-11 09:34:45 +01:00
Janne Valkealahti
2c0c79a537 Add autostart flag for top-level machine
- Fixes #82
- Now have configure method ConfigurationConfigurer.autoStart(boolean)
  which can be used to enable autostart feature for top-level state machine.
  We keep this feature disabled as default because most of the cases it is
  easier to enable it than disable it.
2015-07-10 18:37:16 +01:00
Janne Valkealahti
8292bbff00 Fixing initial state transitions
- Reported and fixex #81
- Change how internal state is entered and handled
  when transition doesn't terminate into initial state.
- Needed to change stuff in various places because
  some of the concepts were literally broken which were
  overlooked due to missing tests.
2015-07-10 17:24:56 +01:00
Janne Valkealahti
9b6caaf6b8 Docs updates 2015-07-05 17:36:45 +01:00