DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • The SPACE Framework for Developer Productivity
  • Using Render Log Streams to Log to Papertrail
  • Mastering Go-Templates in Ansible With Jinja2
  • AI and Cybersecurity Protecting Against Emerging Threats

Trending

  • The SPACE Framework for Developer Productivity
  • Using Render Log Streams to Log to Papertrail
  • Mastering Go-Templates in Ansible With Jinja2
  • AI and Cybersecurity Protecting Against Emerging Threats
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. Spring Statemachine 1.0.0.RC1 Released

Spring Statemachine 1.0.0.RC1 Released

Learn more about how this release makes the core framework more stable and adds Jepsen tests for a distributed state machine.

Pieter Humphrey user avatar by
Pieter Humphrey
CORE ·
Sep. 02, 15 · News
Like (1)
Save
Tweet
Share
3.67K Views

Join the DZone community and get the full member experience.

Join For Free

We’re pleased to announce a first release candicate of Spring Statemachine 1.0.0.RC1.

Focus of this release is to get core framework more stable and finally add jepsen tests for a distributed state machine. We also added a first version of a testing support. Resolved github tickets can be found from RC1 issues. We’re relatively close to issue a release version, meaning if nothing major pop-up, next release will be a 1.0.0.RELEASE. If something urgent turns up we will do 1.0.0.RC2 prior to a release.

Now that we’re here, let’s crack it and see what new features we have in this release.

Beyond usual bug fixes here is a list of main new features:

  • Testing support
  • Jepsen tests for a Distributed State Machine

Testing Support

Testing a state machine is not easiest task to accomplish and thus we’re introcuding new spring-statemachine-test module which will ease a process of making unit tests for a Spring Statemachine. Due to dependencies it’s not used in a core system but what comes for a recipes and a Zookeeper integration it is already used to test those modules.

Testing a simple state machine in a tests will look simple as:

StateMachine<String, String> machine = buildMachine();
StateMachineTestPlan<String, String> plan =
  StateMachineTestPlanBuilder.<String, String>builder()
    .defaultAwaitTime(2)
    .stateMachine(machine)
    .step()
      .expectStates("SI")
      .and()
    .step()
      .sendEvent("E1")
      .expectStateChanged(1)
      .expectStates("S1")
      .and()
    .build();
plan.test();

If having a state machine defined as:

StateMachine<String, String> buildMachine()
    throws Exception {
  StateMachineBuilder.Builder<String, String> builder =
    StateMachineBuilder.builder();

  builder.configureConfiguration()
    .withConfiguration()
      .taskExecutor(new SyncTaskExecutor())
      .autoStartup(true);

  builder.configureStates()
    .withStates()
      .initial("SI")
      .state("S1");

  builder.configureTransitions()
    .withExternal()
      .source("SI").target("S1")
      .event("E1");

   return builder.build();
}

Jepsen Tests

Our support for using distributed states with a Zookeeker turned out to be relatively difficult to test with a normal set of unit tests and thus we hit a wall with a test coverage. I’d like to use this moment to tell something about testing distributed systems with jepsen.

Jepsen testing framework by Kyle Kingsbury (aka @aphyr) is a system what can be used to test distibuted systems and have a features like synchronizing events sent into a nodes and causing a brain splits on a network. Jepsen will be a core of our system to make sure that our distributed support will do what it it supposed to do. This is a first class system to test Spring Distributed Statemachine backed by a Zookeeper.

There’s going to be a separate blog post for this but preliminary results can be found from our reference docs Distributed State Machine Technical Paper. Stay stuned about that blog post!

In here we take a peek from our jepsen tests to show what happens when a cluster suffers a split which is causing a zookeeper ensemble to totally break and what happes when a network is break and healed.

Zookeeper Sample

In above graph we have a 5 node cluster sharing a same state machine configuration backed by a Zookeeper ensemble where each node is connecting to its own local instance. First an event C is sent into all machines(only one will handle a distributed state change) which will initiate distributed transition from state S21 into S211. Network is then break and graph is showing how each machine eventually will end up into an error state. When network and Zookeeper ensemble is later healed, all machines will re-join an ensemble and sync their states. Finally event K is send, again to all machines, to show that all machines are working properly after network problems has been healed.

As mentioned in our documentation, if existing zookeer leader is kept in minority all instances are disconnected from ensemble, thus causing all state machines to enter into an error state. This situation is then resolved automatically later when network is healed and zookeeper emsemble fixes itself and state machines connected to it can reset their own states.

SpringOne 2GX 2015 is Around the Corner!

Book your place at SpringOne2GX in Washington, DC soon. It’s simply the best opportunity to find out first hand all that’s going on and to provide direct feedback.

unit test Spring Framework Machine

Published at DZone with permission of Pieter Humphrey, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • The SPACE Framework for Developer Productivity
  • Using Render Log Streams to Log to Papertrail
  • Mastering Go-Templates in Ansible With Jinja2
  • AI and Cybersecurity Protecting Against Emerging Threats

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: