Add redis repository config support
- Change machine id as empty string instead of null if it's not set. - Implement domain classes for redis. - Shared tests. - Fixes #267
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.statemachine.data.redis;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.data.keyvalue.core.KeyValueTemplate;
|
||||
import org.springframework.statemachine.data.AbstractRepositoryTests;
|
||||
import org.springframework.statemachine.transition.TransitionKind;
|
||||
|
||||
/**
|
||||
* Redis repository config tests.
|
||||
*
|
||||
* @author Janne Valkealahti
|
||||
*/
|
||||
public class RedisRepositoryTests extends AbstractRepositoryTests {
|
||||
|
||||
@Rule
|
||||
public RedisRule redisAvailableRule = new RedisRule();
|
||||
|
||||
@Override
|
||||
protected void cleanInternal() {
|
||||
AnnotationConfigApplicationContext c = new AnnotationConfigApplicationContext();
|
||||
c.register(TestConfig.class);
|
||||
c.refresh();
|
||||
KeyValueTemplate kvTemplate = c.getBean(KeyValueTemplate.class);
|
||||
kvTemplate.delete(RedisRepositoryAction.class);
|
||||
kvTemplate.delete(RedisRepositoryGuard.class);
|
||||
kvTemplate.delete(RedisRepositoryState.class);
|
||||
kvTemplate.delete(RedisRepositoryTransition.class);
|
||||
c.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPopulate1() {
|
||||
context.register(getRegisteredClasses());
|
||||
context.register(Config2.class);
|
||||
context.refresh();
|
||||
|
||||
RedisStateRepository stateRepository = context.getBean(RedisStateRepository.class);
|
||||
RedisTransitionRepository transitionRepository = context.getBean(RedisTransitionRepository.class);
|
||||
assertThat(stateRepository.count(), is(3l));
|
||||
assertThat(transitionRepository.count(), is(3l));
|
||||
|
||||
List<RedisRepositoryState> states = new ArrayList<>();
|
||||
stateRepository.findAll().iterator().forEachRemaining(states::add);
|
||||
List<RedisRepositoryTransition> transitions = new ArrayList<>();
|
||||
transitionRepository.findAll().iterator().forEachRemaining(transitions::add);
|
||||
assertThat(states.size(), is(3));
|
||||
assertThat(transitions.size(), is(3));
|
||||
RedisRepositoryTransition transition1 = transitions.get(0);
|
||||
assertThat(transition1.getSource(), notNullValue());
|
||||
assertThat(transition1.getTarget(), notNullValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepository1() {
|
||||
context.register(getRegisteredClasses());
|
||||
context.refresh();
|
||||
|
||||
RedisStateRepository statesRepository = context.getBean(RedisStateRepository.class);
|
||||
RedisRepositoryState stateS1 = new RedisRepositoryState("S1");
|
||||
RedisRepositoryState stateS2 = new RedisRepositoryState("S2");
|
||||
assertThat(statesRepository.count(), is(0l));
|
||||
|
||||
statesRepository.save(stateS1);
|
||||
statesRepository.save(stateS2);
|
||||
assertThat(statesRepository.count(), is(2l));
|
||||
|
||||
RedisTransitionRepository transitionsRepository = context.getBean(RedisTransitionRepository.class);
|
||||
RedisRepositoryTransition transition = new RedisRepositoryTransition(stateS1, stateS2, "E1");
|
||||
transition.setKind(TransitionKind.EXTERNAL);
|
||||
transitionsRepository.save(transition);
|
||||
|
||||
assertThat(statesRepository.count(), is(2l));
|
||||
|
||||
RedisRepositoryTransition transition2 = transitionsRepository.findAll().iterator().next();
|
||||
assertThat(transition2.getSource().getState(), is("S1"));
|
||||
assertThat(transition2.getTarget().getState(), is("S2"));
|
||||
assertThat(transition2.getEvent(), is("E1"));
|
||||
assertThat(transition2.getKind(), is(TransitionKind.EXTERNAL));
|
||||
|
||||
List<RedisRepositoryState> findByMachineId = statesRepository.findByMachineId("");
|
||||
assertThat(findByMachineId.size(), is(2));
|
||||
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?>[] getRegisteredClasses() {
|
||||
return new Class<?>[] { TestConfig.class };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AnnotationConfigApplicationContext buildContext() {
|
||||
return new AnnotationConfigApplicationContext();
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
static class TestConfig {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.statemachine.data.redis;
|
||||
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.rules.TestWatcher;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||
|
||||
/**
|
||||
* Rule skipping tests if redis is not available from localhost with default settings.
|
||||
*
|
||||
* @author Janne Valkealahti
|
||||
*
|
||||
*/
|
||||
public class RedisRule extends TestWatcher implements TestRule {
|
||||
|
||||
@Override
|
||||
public Statement apply(Statement base, Description description) {
|
||||
JedisConnectionFactory connectionFactory = null;
|
||||
try {
|
||||
connectionFactory = new JedisConnectionFactory();
|
||||
connectionFactory.afterPropertiesSet();
|
||||
connectionFactory.getConnection().close();
|
||||
} catch (Exception e) {
|
||||
return super.apply(new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
}
|
||||
}, Description.EMPTY);
|
||||
} finally {
|
||||
if (connectionFactory != null) {
|
||||
connectionFactory.destroy();
|
||||
}
|
||||
}
|
||||
return super.apply(base, description);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "SI"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S1",
|
||||
"kind": "FORK"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "SF",
|
||||
"kind": "END"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"region": "r2",
|
||||
"parentState": "3",
|
||||
"state": "S20"
|
||||
},
|
||||
{
|
||||
"@id": "6",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r2",
|
||||
"parentState": "3",
|
||||
"state": "S21"
|
||||
},
|
||||
{
|
||||
"@id": "7",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"region": "r3",
|
||||
"parentState": "3",
|
||||
"state": "S30"
|
||||
},
|
||||
{
|
||||
"@id": "8",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r3",
|
||||
"parentState": "3",
|
||||
"state": "S31"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "6"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "8"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,93 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "SI"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S3",
|
||||
"kind": "JOIN"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S4"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"region": "r2",
|
||||
"parentState": "2",
|
||||
"state": "S20"
|
||||
},
|
||||
{
|
||||
"@id": "6",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r2",
|
||||
"parentState": "2",
|
||||
"state": "S21"
|
||||
},
|
||||
{
|
||||
"@id": "7",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"region": "r3",
|
||||
"parentState": "2",
|
||||
"state": "S30"
|
||||
},
|
||||
{
|
||||
"@id": "8",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r3",
|
||||
"parentState": "2",
|
||||
"state": "S31"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "5",
|
||||
"target": "6",
|
||||
"event": "E2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "7",
|
||||
"target": "8",
|
||||
"event": "E3"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "7",
|
||||
"target": "3"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "8",
|
||||
"target": "3"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "3",
|
||||
"target": "4"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "4",
|
||||
"target": "1",
|
||||
"event": "E4"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,60 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "READY"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S1"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S3",
|
||||
"deferredEvents": ["E1", "E2"]
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "3",
|
||||
"event": "E2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "4",
|
||||
"event": "E3"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "4",
|
||||
"target": "2",
|
||||
"event": "E4"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "4",
|
||||
"target": "3",
|
||||
"event": "E5"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "4",
|
||||
"target": "1",
|
||||
"event": "E6"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,50 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "S1"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"submachineId": "machineS2",
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S3"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"machineId": "machineS2",
|
||||
"initial": true,
|
||||
"state": "S21"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"machineId": "machineS2",
|
||||
"state": "S22"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "3",
|
||||
"event": "E2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "4",
|
||||
"target": "5",
|
||||
"event": "E3"
|
||||
}
|
||||
]
|
||||
46
spring-statemachine-data/redis/src/test/resources/data2.json
Normal file
46
spring-statemachine-data/redis/src/test/resources/data2.json
Normal file
@@ -0,0 +1,46 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "S1"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S3"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"spel": "true"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "3",
|
||||
"event": "E2",
|
||||
"guard": "4"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "3",
|
||||
"event": "E3",
|
||||
"kind": "LOCAL"
|
||||
}
|
||||
]
|
||||
52
spring-statemachine-data/redis/src/test/resources/data3.json
Normal file
52
spring-statemachine-data/redis/src/test/resources/data3.json
Normal file
@@ -0,0 +1,52 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "S1"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"parentState": "2",
|
||||
"state": "S20"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"parentState": "2",
|
||||
"state": "S21"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "3",
|
||||
"target": "4",
|
||||
"event": "E2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "1",
|
||||
"event": "E3"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "4",
|
||||
"event": "E4"
|
||||
}
|
||||
]
|
||||
64
spring-statemachine-data/redis/src/test/resources/data4.json
Normal file
64
spring-statemachine-data/redis/src/test/resources/data4.json
Normal file
@@ -0,0 +1,64 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "S1"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"parentState": "2",
|
||||
"state": "S20"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"parentState": "2",
|
||||
"state": "S21"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"parentState": "2",
|
||||
"state": "SH",
|
||||
"kind": "HISTORY_SHALLOW"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "3",
|
||||
"target": "4",
|
||||
"event": "E2",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "1",
|
||||
"event": "E3",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "5",
|
||||
"event": "E4",
|
||||
"kind": "EXTERNAL"
|
||||
}
|
||||
]
|
||||
58
spring-statemachine-data/redis/src/test/resources/data5.json
Normal file
58
spring-statemachine-data/redis/src/test/resources/data5.json
Normal file
@@ -0,0 +1,58 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r1",
|
||||
"initial": true,
|
||||
"state": "S10"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r1",
|
||||
"initial": false,
|
||||
"state": "S11"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r2",
|
||||
"initial": true,
|
||||
"state": "S20"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"region": "r2",
|
||||
"initial": false,
|
||||
"state": "S21"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "3",
|
||||
"target": "4",
|
||||
"event": "E1",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "1",
|
||||
"event": "E2",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "4",
|
||||
"target": "3",
|
||||
"event": "E3",
|
||||
"kind": "EXTERNAL"
|
||||
}
|
||||
]
|
||||
84
spring-statemachine-data/redis/src/test/resources/data6.json
Normal file
84
spring-statemachine-data/redis/src/test/resources/data6.json
Normal file
@@ -0,0 +1,84 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "SI"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S3",
|
||||
"kind": "CHOICE"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S30"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S31"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S32"
|
||||
},
|
||||
{
|
||||
"@id": "6",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S33"
|
||||
},
|
||||
{
|
||||
"@id": "7",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"name": "s30Guard"
|
||||
},
|
||||
{
|
||||
"@id": "8",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"name": "s31Guard"
|
||||
},
|
||||
{
|
||||
"@id": "9",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"name": "s32Guard"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "3",
|
||||
"guard": "7"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "4",
|
||||
"guard": "8"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "5",
|
||||
"guard": "9"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "6"
|
||||
}
|
||||
]
|
||||
38
spring-statemachine-data/redis/src/test/resources/data7.json
Normal file
38
spring-statemachine-data/redis/src/test/resources/data7.json
Normal file
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"spel": "true"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryAction",
|
||||
"spel": "true"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryAction",
|
||||
"spel": "false"
|
||||
},
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "S1"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1",
|
||||
"kind": "EXTERNAL",
|
||||
"guard": "3",
|
||||
"actions": ["4", "5"]
|
||||
}
|
||||
]
|
||||
84
spring-statemachine-data/redis/src/test/resources/data8.json
Normal file
84
spring-statemachine-data/redis/src/test/resources/data8.json
Normal file
@@ -0,0 +1,84 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "SI"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S3",
|
||||
"kind": "JUNCTION"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S30"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S31"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S32"
|
||||
},
|
||||
{
|
||||
"@id": "6",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": false,
|
||||
"state": "S33"
|
||||
},
|
||||
{
|
||||
"@id": "7",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"name": "s30Guard"
|
||||
},
|
||||
{
|
||||
"@id": "8",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"name": "s31Guard"
|
||||
},
|
||||
{
|
||||
"@id": "9",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryGuard",
|
||||
"name": "s32Guard"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1",
|
||||
"kind": "EXTERNAL"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "3",
|
||||
"guard": "7"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "4",
|
||||
"guard": "8"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "5",
|
||||
"guard": "9"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "6"
|
||||
}
|
||||
]
|
||||
131
spring-statemachine-data/redis/src/test/resources/data9.json
Normal file
131
spring-statemachine-data/redis/src/test/resources/data9.json
Normal file
@@ -0,0 +1,131 @@
|
||||
[
|
||||
{
|
||||
"@id": "1",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "S1"
|
||||
},
|
||||
{
|
||||
"@id": "2",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2"
|
||||
},
|
||||
{
|
||||
"@id": "3",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S3"
|
||||
},
|
||||
{
|
||||
"@id": "4",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S4"
|
||||
},
|
||||
{
|
||||
"@id": "5",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S5"
|
||||
},
|
||||
{
|
||||
"@id": "6",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"initial": true,
|
||||
"state": "S21",
|
||||
"parentState": "2"
|
||||
},
|
||||
{
|
||||
"@id": "7",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S22",
|
||||
"parentState": "2"
|
||||
},
|
||||
{
|
||||
"@id": "8",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S23",
|
||||
"parentState": "2"
|
||||
},
|
||||
{
|
||||
"@id": "9",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2ENTRY1",
|
||||
"parentState": "2",
|
||||
"kind": "ENTRY"
|
||||
},
|
||||
{
|
||||
"@id": "10",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2ENTRY2",
|
||||
"parentState": "2",
|
||||
"kind": "ENTRY"
|
||||
},
|
||||
{
|
||||
"@id": "11",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2EXIT1",
|
||||
"parentState": "2",
|
||||
"kind": "EXIT"
|
||||
},
|
||||
{
|
||||
"@id": "12",
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryState",
|
||||
"state": "S2EXIT2",
|
||||
"parentState": "2",
|
||||
"kind": "EXIT"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "2",
|
||||
"event": "E1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "2",
|
||||
"target": "3",
|
||||
"event": "E2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "9",
|
||||
"event": "ENTRY1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "1",
|
||||
"target": "10",
|
||||
"event": "ENTRY2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "7",
|
||||
"target": "11",
|
||||
"event": "EXIT1"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "7",
|
||||
"target": "12",
|
||||
"event": "EXIT2"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "9",
|
||||
"target": "7"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "10",
|
||||
"target": "9"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "11",
|
||||
"target": "4"
|
||||
},
|
||||
{
|
||||
"_class": "org.springframework.statemachine.data.redis.RedisRepositoryTransition",
|
||||
"source": "12",
|
||||
"target": "5"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user