List of usage examples for org.springframework.statemachine.transition DefaultInternalTransition DefaultInternalTransition
public DefaultInternalTransition(State<S, E> source,
Collection<Function<StateContext<S, E>, Mono<Void>>> actions, E event,
Function<StateContext<S, E>, Mono<Boolean>> guard, Trigger<S, E> trigger)
From source file:org.springframework.statemachine.EnumStateMachineTests.java
@Test public void testInternalTransitions() { PseudoState<TestStates, TestEvents> pseudoState = new DefaultPseudoState<TestStates, TestEvents>( PseudoStateKind.INITIAL);//from w ww .j a va2 s. co m State<TestStates, TestEvents> stateSI = new EnumState<TestStates, TestEvents>(TestStates.SI, pseudoState); Collection<State<TestStates, TestEvents>> states = new ArrayList<State<TestStates, TestEvents>>(); states.add(stateSI); Collection<Action<TestStates, TestEvents>> actionsInSI = new ArrayList<Action<TestStates, TestEvents>>(); actionsInSI.add(new LoggingAction("actionsInSI")); DefaultInternalTransition<TestStates, TestEvents> transitionInternalSI = new DefaultInternalTransition<TestStates, TestEvents>( stateSI, actionsInSI, TestEvents.E1, null, new EventTrigger<TestStates, TestEvents>(TestEvents.E1)); // transitions Collection<Transition<TestStates, TestEvents>> transitions = new ArrayList<Transition<TestStates, TestEvents>>(); transitions.add(transitionInternalSI); SyncTaskExecutor taskExecutor = new SyncTaskExecutor(); BeanFactory beanFactory = new DefaultListableBeanFactory(); ObjectStateMachine<TestStates, TestEvents> machine = new ObjectStateMachine<TestStates, TestEvents>(states, transitions, stateSI); machine.setTaskExecutor(taskExecutor); machine.setBeanFactory(beanFactory); machine.afterPropertiesSet(); machine.start(); machine.sendEvent(MessageBuilder.withPayload(TestEvents.E1).build()); }