updated for functions

This commit is contained in:
2026-06-07 09:25:22 +02:00
parent 3c70d75d92
commit b268639074
15 changed files with 524 additions and 89 deletions

View File

@@ -9,6 +9,7 @@ import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

View File

@@ -173,12 +173,10 @@ class StateMachineAggregatorTest {
context.scan(tempDir);
TypeDeclaration childTd = context.getTypeDeclaration("ChildConfig");
Set<String> initialStates = new HashSet<>();
Set<String> endStates = new HashSet<>();
aggregator.aggregateStates(childTd, initialStates, endStates);
aggregator.aggregateStates(childTd);
assertThat(initialStates).containsExactly("BASE_START");
assertThat(endStates).containsExactly("CHILD_END");
assertThat(aggregator.getInitialStates()).containsExactly("BASE_START");
assertThat(aggregator.getEndStates()).containsExactly("CHILD_END");
}
@Test
@@ -199,11 +197,9 @@ class StateMachineAggregatorTest {
context.scan(tempDir);
TypeDeclaration td = context.getTypeDeclaration("StreamStateConfig");
Set<String> initialStates = new HashSet<>();
Set<String> endStates = new HashSet<>();
aggregator.aggregateStates(td, initialStates, endStates);
aggregator.aggregateStates(td);
assertThat(initialStates).containsExactlyInAnyOrder("S1", "S2");
assertThat(aggregator.getInitialStates()).containsExactlyInAnyOrder("S1", "S2");
}
@Test

View File

@@ -0,0 +1,59 @@
@startuml
skinparam state {
BackgroundColor<<choice>> LightYellow
}
[*] --> STATE1
state STATE17 <<choice>>
state STATE16 <<choice>>
state STATE14 <<choice>>
state STATE12 <<choice>>
state STATE11 <<choice>>
state STATE8 <<choice>>
state STATE20 <<choice>>
state STATE9 <<choice>>
state STATE19 <<choice>>
state STATE18 <<choice>>
STATE1 -[#1E90FF,bold]-> STATE2 : EVENT1
STATE2 -[#1E90FF,bold]-> STATE3 : EVENT2
STATE3 -[#1E90FF,bold]-> STATE4 : EVENT3
STATE4 -[#1E90FF,bold]-> STATE5 : EVENT4
STATE5 -[#1E90FF,bold]-> STATE6 : EVENT5
STATE6 -[#1E90FF,bold]-> STATE7 : EVENT6
STATE7 -[#1E90FF,bold]-> STATE8 : EVENT7
STATE8 -[#1E90FF,bold]-> STATE9 : EVENT8
STATE9 -[#1E90FF,bold]-> STATE10 : EVENT9
STATE10 -[#1E90FF,bold]-> STATE11 : EVENT10
STATE11 -[#1E90FF,bold]-> STATE12 : EVENT11
STATE12 -[#1E90FF,bold]-> STATE13 : EVENT12
STATE13 -[#1E90FF,bold]-> STATE14 : EVENT13
STATE14 -[#1E90FF,bold]-> STATE15 : EVENT14
STATE15 -[#1E90FF,bold]-> STATE16 : EVENT15
STATE16 -[#4682B4,bold]-> STATE17 : [guardVarEquals("value1")] (order=0)
STATE16 -[#4682B4,bold]-> STATE18 : [guardVarEquals("value2")] (order=1)
STATE16 -[#4682B4,bold]-> STATE19 : (order=2)
STATE17 -[#FF6347,bold]-> STATE20 : [guardEventHeaderEquals("header1","foo")] (order=0)
STATE17 -[#FF6347,bold]-> STATE16 : (order=1)
STATE18 -[#FFD700,bold]-> STATE19 : [guardVarEquals("value3")] (order=0)
STATE18 -[#FFD700,bold]-> STATE20 : (order=1)
STATE19 -[#32CD32,bold]-> STATE1 : [guardVarEquals("reset")] (order=0)
STATE19 -[#32CD32,bold]-> STATE20 : (order=1)
STATE20 -[#FF6347,bold]-> STATE5 : [guardEventHeaderEquals("header2","bar")] (order=0)
STATE20 -[#FF6347,bold]-> STATE1 : (order=1)
STATE11 -[#6A5ACD,bold]-> STATE13 : [guardVarEquals("goTo13")] (order=0)
STATE11 -[#6A5ACD,bold]-> STATE14 : [guardVarEquals("goTo14")] (order=1)
STATE11 -[#6A5ACD,bold]-> STATE15 : (order=2)
STATE12 -[#FFD700,bold]-> STATE10 : [guardVarEquals("goBack10")] (order=0)
STATE12 -[#FFD700,bold]-> STATE11 : (order=1)
STATE14 -[#32CD32,bold]-> STATE12 : [guardVarEquals("loop12")] (order=0)
STATE14 -[#32CD32,bold]-> STATE16 : (order=1)
STATE9 -[#4682B4,bold]-> STATE8 : [guardVarEquals("stepBack")] (order=0)
STATE9 -[#4682B4,bold]-> STATE7 : [guardVarEquals("stepBackMore")] (order=1)
STATE9 -[#4682B4,bold]-> STATE6 : (order=2)
STATE8 -[#FF69B4,bold]-> STATE9 : [guardVarEquals("forward9")] (order=0)
STATE8 -[#FF69B4,bold]-> STATE10 : (order=1)
@enduml

View File

@@ -0,0 +1,20 @@
@startuml
skinparam state {
BackgroundColor<<choice>> LightYellow
}
[*] --> START
START -[#1E90FF,bold]-> FORK : TO_FORK
FORK -[#20B2AA,bold]-> REGION1_STATE1
FORK -[#20B2AA,bold]-> REGION2_STATE1
REGION1_STATE1 -[#1E90FF,bold]-> REGION1_STATE2 : R1_NEXT
REGION2_STATE1 -[#1E90FF,bold]-> REGION2_STATE2 : R2_NEXT
REGION1_STATE2 -[#8A2BE2,bold]-> JOIN
REGION2_STATE2 -[#8A2BE2,bold]-> JOIN
JOIN -[#1E90FF,bold]-> END : TO_END
END --> [*]
@enduml

View File

@@ -0,0 +1,27 @@
@startuml
skinparam state {
BackgroundColor<<choice>> LightYellow
}
[*] --> SUBMITTED
state PAID1 <<choice>>
SUBMITTED -[#1E90FF,bold]-> PAID : PAY
PAID -[#1E90FF,bold]-> FULFILLED : FULFILL
SUBMITTED -[#1E90FF,bold]-> CANCELED : CANCEL [λ]
PAID -[#1E90FF,bold]-> CANCELED : CANCEL
SUBMITTED -[#1E90FF,bold]-> SUBMITTED : ABCD
SUBMITTED -[#1E90FF,bold]-> PAID1 : ABCD
PAID1 -[#FF6347,bold]-> PAID2 : [λ] (order=0)
PAID1 -[#FF6347,bold]-> PAID3 : [guard1] (order=1)
PAID1 -[#FF6347,bold]-> HAPPEN : [λ] (order=2)
PAID1 -[#FF6347,bold]-> CANCELED : (order=3)
PAID2 -[#1E90FF,bold]-> CANCELED
PAID3 -[#1E90FF,bold]-> CANCELED
PAID2 -[#1E90FF,bold]-> PAID2 : ABCD / λ, action2
CANCELED --> [*]
FULFILLED --> [*]
@enduml

View File

@@ -0,0 +1,65 @@
@startuml
skinparam state {
BackgroundColor<<choice>> LightYellow
}
[*] --> STATE1
state STATE17 <<choice>>
state STATE16 <<choice>>
state STATE14 <<choice>>
state STATE12 <<choice>>
state STATE11 <<choice>>
state STATE8 <<choice>>
state STATEY <<choice>>
state STATE20 <<choice>>
state STATE9 <<choice>>
state STATE19 <<choice>>
state STATE18 <<choice>>
STATE1 -[#1E90FF,bold]-> STATE2 : EVENT1
STATE2 -[#1E90FF,bold]-> STATE3 : EVENT2
STATE3 -[#1E90FF,bold]-> STATE4 : EVENT3
STATE4 -[#1E90FF,bold]-> STATE5 : EVENT4
STATE5 -[#1E90FF,bold]-> STATE6 : EVENT5
STATE6 -[#1E90FF,bold]-> STATE7 : EVENT6
STATE7 -[#1E90FF,bold]-> STATE8 : EVENT7
STATE8 -[#1E90FF,bold]-> STATE9 : EVENT8
STATE9 -[#1E90FF,bold]-> STATE10 : EVENT9
STATE10 -[#1E90FF,bold]-> STATE11 : EVENT10
STATE11 -[#1E90FF,bold]-> STATE12 : EVENT11
STATE12 -[#1E90FF,bold]-> STATE13 : EVENT12
STATE13 -[#1E90FF,bold]-> STATE14 : EVENT13
STATE14 -[#1E90FF,bold]-> STATE15 : EVENT14
STATE15 -[#1E90FF,bold]-> STATE16 : EVENT15
STATE4 -[#1E90FF,bold]-> STATEY : EVENTY
STATEY -[#FF6347,bold]-> STATEX : [guardVarEquals("value1")] (order=0)
STATEY -[#FF6347,bold]-> STATEZ : (order=1)
STATE16 -[#4682B4,bold]-> STATE17 : [guardVarEquals("value1")] (order=0)
STATE16 -[#4682B4,bold]-> STATE18 : [guardVarEquals("value2")] (order=1)
STATE16 -[#4682B4,bold]-> STATE19 : (order=2)
STATE17 -[#FF6347,bold]-> STATE20 : [guardEventHeaderEquals("header1","foo")] (order=0)
STATE17 -[#FF6347,bold]-> STATE16 : (order=1)
STATE18 -[#6A5ACD,bold]-> STATE19 : [guardVarEquals("value3")] (order=0)
STATE18 -[#6A5ACD,bold]-> STATE20 : (order=1)
STATE19 -[#FFD700,bold]-> STATE1 : [guardVarEquals("reset")] (order=0)
STATE19 -[#FFD700,bold]-> STATE20 : (order=1)
STATE20 -[#4682B4,bold]-> STATE5 : [guardEventHeaderEquals("header2","bar")] (order=0)
STATE20 -[#4682B4,bold]-> STATE1 : (order=1)
STATE11 -[#6A5ACD,bold]-> STATE13 : [guardVarEquals("goTo13")] (order=0)
STATE11 -[#6A5ACD,bold]-> STATE14 : [guardVarEquals("goTo14")] (order=1)
STATE11 -[#6A5ACD,bold]-> STATE15 : (order=2)
STATE12 -[#FFD700,bold]-> STATE10 : [guardVarEquals("goBack10")] (order=0)
STATE12 -[#FFD700,bold]-> STATE11 : (order=1)
STATE14 -[#32CD32,bold]-> STATE12 : [guardVarEquals("loop12")] (order=0)
STATE14 -[#32CD32,bold]-> STATE16 : (order=1)
STATE9 -[#32CD32,bold]-> STATE8 : [guardVarEquals("stepBack")] (order=0)
STATE9 -[#32CD32,bold]-> STATE7 : [guardVarEquals("stepBackMore")] (order=1)
STATE9 -[#32CD32,bold]-> STATE6 : (order=2)
STATE8 -[#FF69B4,bold]-> STATE9 : [guardVarEquals("forward9")] (order=0)
STATE8 -[#FF69B4,bold]-> STATE10 : (order=1)
STATE5 -[#1E90FF,bold]-> STATE_EXTRA_1 : EVENTX
STATEZ --> [*]
@enduml

View File

@@ -0,0 +1,29 @@
@startuml
skinparam state {
BackgroundColor<<choice>> LightYellow
}
[*] --> SUBMITTED
state PAID <<choice>>
state SUBMITTED <<choice>>
SUBMITTED -[#1E90FF,bold]-> PAID : PAY
PAID -[#1E90FF,bold]-> FULFILLED : FULFILL
SUBMITTED -[#1E90FF,bold]-> CANCELED : CANCEL [λ]
PAID -[#1E90FF,bold]-> CANCELED : CANCEL
SUBMITTED -[#1E90FF,bold]-> SUBMITTED : ABCD
SUBMITTED -[#4682B4,bold]-> PAID2 : [λ] (order=0)
SUBMITTED -[#4682B4,bold]-> PAID3 : (order=1)
PAID -[#FF6347,bold]-> PAID1 : [λ] (order=0)
PAID -[#FF6347,bold]-> PAID2 : [guard1] (order=1)
PAID -[#FF6347,bold]-> HAPPEN : [λ] (order=2)
PAID -[#FF6347,bold]-> PAID3 : (order=3)
PAID2 -[#1E90FF,bold]-> CANCELED
PAID3 -[#1E90FF,bold]-> CANCELED
PAID1 -[#1E90FF,bold]-> PAID1 : ABCD / λ, action2
CANCELED --> [*]
FULFILLED --> [*]
@enduml

View File

@@ -0,0 +1,72 @@
@startuml
skinparam state {
BackgroundColor<<choice>> LightYellow
}
[*] --> STATE1
state STATE17 <<choice>>
state STATE16 <<choice>>
state STATE14 <<choice>>
state STATE12 <<choice>>
state STATE11 <<choice>>
state STATE8 <<choice>>
state STATEY <<choice>>
state STATE20 <<choice>>
state STATE9 <<choice>>
state STATE19 <<choice>>
state STATE18 <<choice>>
STATE1 -[#1E90FF,bold]-> STATE2 : EVENT1
STATE2 -[#1E90FF,bold]-> STATE3 : EVENT2
STATE3 -[#1E90FF,bold]-> STATE4 : EVENT3
STATE4 -[#1E90FF,bold]-> STATE5 : EVENT4
STATE5 -[#1E90FF,bold]-> STATE6 : EVENT5
STATE6 -[#1E90FF,bold]-> STATE7 : EVENT6
STATE7 -[#1E90FF,bold]-> STATE8 : EVENT7
STATE8 -[#1E90FF,bold]-> STATE9 : EVENT8
STATE9 -[#1E90FF,bold]-> STATE10 : EVENT9
STATE10 -[#1E90FF,bold]-> STATE11 : EVENT10
STATE11 -[#1E90FF,bold]-> STATE12 : EVENT11
STATE12 -[#1E90FF,bold]-> STATE13 : EVENT12
STATE13 -[#1E90FF,bold]-> STATE14 : EVENT13
STATE14 -[#1E90FF,bold]-> STATE15 : EVENT14
STATE15 -[#1E90FF,bold]-> STATE16 : EVENT15
STATE1 -[#1E90FF,bold]-> CANCEL : EVENT_CANCEL
STATE2 -[#1E90FF,bold]-> CANCEL : EVENT_CANCEL
STATE3 -[#1E90FF,bold]-> CANCEL : EVENT_CANCEL
STATE4 -[#1E90FF,bold]-> CANCEL : EVENT_CANCEL
STATE5 -[#1E90FF,bold]-> CANCEL : EVENT_CANCEL
STATE4 -[#1E90FF,bold]-> STATEY : EVENTY
STATEY -[#FF6347,bold]-> STATEX : [guardVarEquals("value1")] (order=0)
STATEY -[#FF6347,bold]-> STATEZ : (order=1)
STATE16 -[#4682B4,bold]-> STATE17 : [guardVarEquals("value1")] (order=0)
STATE16 -[#4682B4,bold]-> STATE18 : [guardVarEquals("value2")] (order=1)
STATE16 -[#4682B4,bold]-> STATE19 : (order=2)
STATE17 -[#FF6347,bold]-> STATE20 : [guardEventHeaderEquals("header1","foo")] (order=0)
STATE17 -[#FF6347,bold]-> STATE16 : (order=1)
STATE18 -[#6A5ACD,bold]-> STATE19 : [guardVarEquals("value3")] (order=0)
STATE18 -[#6A5ACD,bold]-> STATE20 : (order=1)
STATE19 -[#FFD700,bold]-> STATE1 : [guardVarEquals("reset")] (order=0)
STATE19 -[#FFD700,bold]-> STATE20 : (order=1)
STATE20 -[#4682B4,bold]-> STATE5 : [guardEventHeaderEquals("header2","bar")] (order=0)
STATE20 -[#4682B4,bold]-> STATE1 : (order=1)
STATE11 -[#6A5ACD,bold]-> STATE13 : [guardVarEquals("goTo13")] (order=0)
STATE11 -[#6A5ACD,bold]-> STATE14 : [guardVarEquals("goTo14")] (order=1)
STATE11 -[#6A5ACD,bold]-> STATE15 : (order=2)
STATE12 -[#FFD700,bold]-> STATE10 : [guardVarEquals("goBack10")] (order=0)
STATE12 -[#FFD700,bold]-> STATE11 : (order=1)
STATE14 -[#32CD32,bold]-> STATE12 : [guardVarEquals("loop12")] (order=0)
STATE14 -[#32CD32,bold]-> STATE16 : (order=1)
STATE9 -[#32CD32,bold]-> STATE8 : [guardVarEquals("stepBack")] (order=0)
STATE9 -[#32CD32,bold]-> STATE7 : [guardVarEquals("stepBackMore")] (order=1)
STATE9 -[#32CD32,bold]-> STATE6 : (order=2)
STATE8 -[#FF69B4,bold]-> STATE9 : [guardVarEquals("forward9")] (order=0)
STATE8 -[#FF69B4,bold]-> STATE10 : (order=1)
STATE5 -[#1E90FF,bold]-> STATE_EXTRA_1 : EVENTX
STATE_EXTRA_1 -[#1E90FF,bold]-> CANCEL : EVENT_CANCEL
STATE_EXTRA_1 -[#1E90FF,bold]-> CANCEL : EVENT_CANCEL_2
STATEZ --> [*]
@enduml