256 Commits

Author SHA1 Message Date
Janne Valkealahti
f33fa4055c Fix npe with choice
- Preventing passing nulls into factory if choice configurer
  only have last() defined.
- Polish some classes around those classes.
- Fixes #101
2015-09-02 18:35:22 +01:00
Janne Valkealahti
af27f19e63 Update to newer boot and framework versions 2015-08-31 13:54:35 +01:00
Janne Valkealahti
d882c392a9 Fix event handling with threading
- With a combination of a task executor using a thread pool,
  substates with triggerless transitions and actions may fail to
  properly pass on message headers.
- Move queue message outside of loop on a class level which
  should give next loop a change to see previous queued message
  which is then used from triggerless transitions.
- Relates to #100
2015-08-31 10:24:21 +01:00
Janne Valkealahti
7027a2c52a Add docs for TimerTrigger
- Fixes #102.
2015-08-29 18:26:35 +01:00
Janne Valkealahti
ad57bc7085 Add transition header tests for choice 2015-08-29 17:11:15 +01:00
Janne Valkealahti
98b41dde44 Disable artifactoryPublish task for samples
- This should fix errors when we eventually push
  to maven central.
- Fixes #90
2015-08-29 15:55:15 +01:00
Janne Valkealahti
a6145072b5 Pass event headers into triggerless transitions
- Change DefaultStateMachineExecutor to keep event message
  around and then loop triggerless transitions order to
  pass that message to whole chain.
- Fixes #100
2015-08-29 10:33:32 +01:00
Janne Valkealahti
022143b5ce Fix docs typo 2015-08-28 18:41:01 +01:00
Janne Valkealahti
a3d6aa9d05 Fix docs typo 2015-08-28 18:38:20 +01:00
Janne Valkealahti
50f7cef4cd Update docs 2015-08-28 17:59:30 +01:00
Janne Valkealahti
a93f6a5f8f Update docs 2015-08-28 17:54:09 +01:00
Janne Valkealahti
4845a6f6d0 Update docs 2015-08-28 17:28:58 +01:00
Janne Valkealahti
b90382575c Move StateMachinePersist up to parent package 2015-08-28 09:15:08 +01:00
Janne Valkealahti
1371ceac7b Forward event headers to initial transition
- Enhancing internal model so that event and its headers can
  be passed into action if it's used in an initial sub-state
  when transition target its super state.
- Added tests and better docs.
- Fixes #99.
2015-08-28 08:14:38 +01:00
Janne Valkealahti
166c586458 Add enum manual builder test 2015-08-25 17:23:37 +01:00
Janne Valkealahti
8dff5eec4d Tweak jepsen partition tests having better output" 2015-08-23 19:17:22 +01:00
Janne Valkealahti
5879332f9f More docs for dist machine 2015-08-23 09:47:38 +01:00
Janne Valkealahti
f2fc59b726 Fix wrong section header 2015-08-22 17:22:22 +01:00
Janne Valkealahti
c8afe725da Add crash/start jepsen test 2015-08-22 16:27:38 +01:00
Janne Valkealahti
efce1fa3af Update wrong pic in docs 2015-08-22 08:59:36 +01:00
Janne Valkealahti
1b59e1f4d5 Polish docs 2015-08-21 19:42:22 +01:00
Janne Valkealahti
c26f3546e7 Update ref docs
- Update web sample.
- Add web statechart and update its dist screenshots
  to align changes in web sample.
- Add first version of zk dist article.
2015-08-21 18:36:23 +01:00
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