Skip to content

Commit b5272c5

Browse files
committed
Rename and migrate test Petri net files for MigrationTest, updating identifiers and test assertions.
1 parent 2e2229d commit b5272c5

5 files changed

Lines changed: 15 additions & 660 deletions

File tree

src/test/groovy/com/netgrif/application/engine/migration/MigrationTest.groovy

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ class MigrationTest {
6161
void beforeEach() {
6262
testHelper.truncateDbs()
6363

64-
this.class.classLoader.getResourceAsStream("petriNets/nae_2432_v1.xml").withCloseable { is ->
64+
this.class.classLoader.getResourceAsStream("petriNets/migration_test_v1.xml").withCloseable { is ->
6565
ImportPetriNetEventOutcome netV1Outcome = petriNetService.importPetriNet(is, VersionType.MAJOR, superCreator.getLoggedSuper())
6666
assert netV1Outcome.getNet() != null
6767
netV1 = netV1Outcome.getNet()
6868
}
6969

70-
this.class.classLoader.getResourceAsStream("petriNets/nae_2432_v2.xml").withCloseable { is ->
70+
this.class.classLoader.getResourceAsStream("petriNets/migration_test_v2.xml").withCloseable { is ->
7171
ImportPetriNetEventOutcome netV2Outcome = petriNetService.importPetriNet(is, VersionType.MAJOR, superCreator.getLoggedSuper())
7272
assert netV2Outcome.getNet() != null
7373
netV2 = netV2Outcome.getNet()
@@ -81,7 +81,7 @@ class MigrationTest {
8181
@Test
8282
void migrationHelperShouldMigrateCasesAndReloadTasksThroughFacade() {
8383
List<Case> casesBeforeMigration = workflowService.search(
84-
QCase.case$.processIdentifier.eq("nae_2432"),
84+
QCase.case$.processIdentifier.eq("migration_test"),
8585
Pageable.ofSize(10)
8686
).content
8787

@@ -104,11 +104,11 @@ class MigrationTest {
104104
"recreate_info_text": ""
105105
])
106106
useCase.dataSet["income"] = new DataField(1000)
107-
}, "nae_2432", 2)
107+
}, "migration_test", 2)
108108
}
109109

110110
List<Case> casesAfterMigration = workflowService.search(
111-
QCase.case$.processIdentifier.eq("nae_2432"),
111+
QCase.case$.processIdentifier.eq("migration_test"),
112112
Pageable.ofSize(10)
113113
).content
114114

@@ -130,7 +130,7 @@ class MigrationTest {
130130
@Test
131131
void migrationHelperShouldUpdatePetriNetAndApplyCustomTransitionRoleUpdate() {
132132
ProcessRole role = migrationHelper.createRoleInNet(
133-
"nae_2432",
133+
"migration_test",
134134
"migration_supervisor",
135135
"Migration supervisor"
136136
)
@@ -144,9 +144,9 @@ class MigrationTest {
144144
]
145145
)
146146

147-
migrationHelper.updateNetIgnoreRoles("nae_2432", "nae_2432_v2.xml", [updateTransitionRole])
147+
migrationHelper.updateNetIgnoreRoles("migration_test", "migration_test_v2.xml", [updateTransitionRole])
148148

149-
PetriNet migratedNet = petriNetService.getNewestVersionByIdentifier("nae_2432")
149+
PetriNet migratedNet = petriNetService.getNewestVersionByIdentifier("migration_test")
150150

151151
assert migratedNet.dataSet.containsKey("income")
152152
assert migratedNet.dataSet.containsKey("recreate_info_text")
@@ -168,7 +168,7 @@ class MigrationTest {
168168
@Test
169169
void migrationHelperShouldUpdateTasksAndAddRoleToExistingTasks() {
170170
ProcessRole role = migrationHelper.createRoleInNet(
171-
"nae_2432",
171+
"migration_test",
172172
"migration_task_role",
173173
"Migration task role"
174174
)
@@ -184,7 +184,7 @@ class MigrationTest {
184184
)
185185

186186
Page<Case> casePage = workflowService.search(
187-
QCase.case$.processIdentifier.eq("nae_2432"),
187+
QCase.case$.processIdentifier.eq("migration_test"),
188188
Pageable.ofSize(10)
189189
)
190190

@@ -240,7 +240,7 @@ class MigrationTest {
240240
assert !migrationHelper.hasErrors()
241241

242242
List<Case> cases = workflowService.search(
243-
QCase.case$.processIdentifier.eq("nae_2432"),
243+
QCase.case$.processIdentifier.eq("migration_test"),
244244
Pageable.ofSize(10)
245245
).content
246246

@@ -267,9 +267,9 @@ class MigrationTest {
267267

268268
@Test
269269
void updateNetIgnoreRolesShouldMigrateExistingNet() {
270-
migrationHelper.updateNetIgnoreRoles("nae_2432", "nae_2432_v2.xml")
270+
migrationHelper.updateNetIgnoreRoles("migration_test", "migration_test_v2.xml")
271271

272-
def net = petriNetService.getNewestVersionByIdentifier("nae_2432")
272+
def net = petriNetService.getNewestVersionByIdentifier("migration_test")
273273

274274
assert net.dataSet.containsKey("income")
275275
assert net.transitions.values().any { it.importId == "recreate_person" }

src/test/resources/nae_2432_v1.xml renamed to src/test/resources/petriNets/migration_test_v1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://petriflow.com/petriflow.schema.xsd">
2-
<id>nae_2432</id>
2+
<id>migration_test</id>
33
<version>1.0.0</version>
44
<initials>NAE</initials>
55
<title>NAE-2432</title>

src/test/resources/nae_2432_v2.xml renamed to src/test/resources/petriNets/migration_test_v2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://petriflow.com/petriflow.schema.xsd">
2-
<id>nae_2432</id>
2+
<id>migration_test</id>
33
<version>1.0.0</version>
44
<initials>NAE</initials>
55
<title>NAE-2432</title>

src/test/resources/petriNets/nae_2432_v1.xml

Lines changed: 0 additions & 257 deletions
This file was deleted.

0 commit comments

Comments
 (0)