Skip to content

Commit 2b55a25

Browse files
committed
fixed dumpRegion() test for SCXML dumper
1 parent 2bc2355 commit 2b55a25

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed

src/test/java/net/workingdeveloper/java/spring/statemachine/dumper/SsmScxmlDumperTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,20 @@ public void dumpRegion() throws Exception {
9393
assertThat(lIdMap, not(hasItem(lId)));
9494
lIdMap.add(lId);
9595
}
96+
lX = lDocument.getDocumentElement().getElementsByTagName("final");
97+
for (int i = 0; i < lX.getLength(); i++) {
98+
String lId = ((Element) lX.item(i)).getAttribute("id");
99+
assertThat(lIdMap, not(hasItem(lId)));
100+
lIdMap.add(lId);
101+
}
96102
assertThat(
97103
lIdMap,
98104
containsInAnyOrder(
99105
SMHierarch1.States.S1.toString(), SMHierarch1.States.S21.toString(),
100106
SMHierarch1.States.S2.toString(), SMHierarch1.States.S2F.toString(),
101107
SMHierarch1.States.S3I.toString(), SMHierarch1.States.S31.toString(),
102-
SMHierarch1.States.S3F.toString()
108+
SMHierarch1.States.S3F.toString(), SMHierarch1.States.S2I.toString(),
109+
SMHierarch1.States.SE.toString(), "S2r1", "S2r0"
103110
)
104111
);
105112
}

src/test/java/net/workingdeveloper/java/spring/statemachine/dumper/testdata/SMHierarch1.java

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,10 @@ public enum States {
1919
}
2020

2121
public enum Events {
22-
E_S1_SE, E_S1_1__S1_2, E_S1_S1, E_S1_S2, E_SI_S1
22+
E_S1_SE, E_S1_1__S1_2, E_S1_S1, E_S1_S2, E_S31__S3F, E_S2__SE, E_S3I__S31, E_S21_S21, E_S21_S2F, E_S2I_S21, E_SI_S1
2323

2424
}
2525

26-
public StateMachine<String, String> buildUmlMachine(String aPath) throws Exception {
27-
StateMachineBuilder.Builder<String, String> builder = StateMachineBuilder.builder();
28-
29-
builder.configureModel().withModel().factory(new UmlStateMachineModelFactory(
30-
aPath
31-
));
32-
builder.configureConfiguration()
33-
.withConfiguration()
34-
.taskExecutor(new SyncTaskExecutor())
35-
;
36-
return builder.build();
37-
}
38-
3926
public StateMachine<SMHierarch1.States, SMHierarch1.Events> buildMachine() throws Exception {
4027
StateMachineBuilder.Builder<SMHierarch1.States, SMHierarch1.Events> builder = StateMachineBuilder.builder();
4128

@@ -91,6 +78,7 @@ public StateMachine<SMHierarch1.States, SMHierarch1.Events> buildRegionMachine()
9178
.withStates()
9279
.initial(States.S1)
9380
.state(States.S2)
81+
.end(States.SE)
9482
.and()
9583
.withStates()
9684
.parent(States.S2)
@@ -112,23 +100,27 @@ public StateMachine<SMHierarch1.States, SMHierarch1.Events> buildRegionMachine()
112100
.and()
113101
.withExternal()
114102
.source(States.S2I).target(States.S21)
115-
.event(Events.E_S1_S1)
103+
.event(Events.E_S2I_S21)
116104
.and()
117105
.withExternal()
118106
.source(States.S21).target(States.S2F)
119-
.event(Events.E_S1_SE)
107+
.event(Events.E_S21_S2F)
120108
.and()
121109
.withInternal()
122110
.source(States.S21)
123-
.event(Events.E_S1_S1)
111+
.event(Events.E_S21_S21)
124112
.and()
125113
.withExternal()
126114
.source(States.S3I).target(States.S31)
127-
.event(Events.E_S1_1__S1_2)
115+
.event(Events.E_S3I__S31)
116+
.and()
117+
.withExternal()
118+
.source(States.S2).target(States.SE)
119+
.event(Events.E_S2__SE)
128120
.and()
129121
.withExternal()
130122
.source(States.S31).target(States.S3F)
131-
.event(Events.E_S1_1__S1_2)
123+
.event(Events.E_S31__S3F)
132124
.and()
133125
.withInternal()
134126
.source(States.S31)
@@ -137,4 +129,17 @@ public StateMachine<SMHierarch1.States, SMHierarch1.Events> buildRegionMachine()
137129

138130
return builder.build();
139131
}
132+
133+
public StateMachine<String, String> buildUmlMachine(String aPath) throws Exception {
134+
StateMachineBuilder.Builder<String, String> builder = StateMachineBuilder.builder();
135+
136+
builder.configureModel().withModel().factory(new UmlStateMachineModelFactory(
137+
aPath
138+
));
139+
builder.configureConfiguration()
140+
.withConfiguration()
141+
.taskExecutor(new SyncTaskExecutor())
142+
;
143+
return builder.build();
144+
}
140145
}

0 commit comments

Comments
 (0)