diff options
Diffstat (limited to 'subprojects/store-dse/src/test/java/tools/refinery/store/dse/TransformationRuleTest.java')
-rw-r--r-- | subprojects/store-dse/src/test/java/tools/refinery/store/dse/TransformationRuleTest.java | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/TransformationRuleTest.java b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/TransformationRuleTest.java index 312bcebd..5d24d712 100644 --- a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/TransformationRuleTest.java +++ b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/TransformationRuleTest.java | |||
@@ -6,6 +6,7 @@ | |||
6 | package tools.refinery.store.dse; | 6 | package tools.refinery.store.dse; |
7 | 7 | ||
8 | import org.junit.jupiter.api.Test; | 8 | import org.junit.jupiter.api.Test; |
9 | import tools.refinery.store.dse.strategy.DepthFirstStrategy; | ||
9 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
10 | import tools.refinery.store.query.ModelQueryAdapter; | 11 | import tools.refinery.store.query.ModelQueryAdapter; |
11 | import tools.refinery.store.query.dnf.Query; | 12 | import tools.refinery.store.query.dnf.Query; |
@@ -23,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; | |||
23 | import static tools.refinery.store.query.literal.Literals.not; | 24 | import static tools.refinery.store.query.literal.Literals.not; |
24 | import static tools.refinery.store.dse.tests.QueryAssertions.assertResults; | 25 | import static tools.refinery.store.dse.tests.QueryAssertions.assertResults; |
25 | 26 | ||
26 | public class TransformationRuleTest { | 27 | class TransformationRuleTest { |
27 | 28 | ||
28 | private static final Symbol<Boolean> classModel = Symbol.of("ClassModel", 1); | 29 | private static final Symbol<Boolean> classModel = Symbol.of("ClassModel", 1); |
29 | private static final Symbol<Boolean> classElement = Symbol.of("ClassElement", 1); | 30 | private static final Symbol<Boolean> classElement = Symbol.of("ClassElement", 1); |
@@ -103,7 +104,8 @@ public class TransformationRuleTest { | |||
103 | .with(ViatraModelQueryAdapter.builder() | 104 | .with(ViatraModelQueryAdapter.builder() |
104 | .queries(assignFeaturePrecondition, assignFeaturePreconditionHelper, | 105 | .queries(assignFeaturePrecondition, assignFeaturePreconditionHelper, |
105 | deleteEmptyClassPrecondition)) | 106 | deleteEmptyClassPrecondition)) |
106 | .with(DesignSpaceExplorationAdapter.builder()) | 107 | .with(DesignSpaceExplorationAdapter.builder() |
108 | .strategy(new DepthFirstStrategy().withDepthLimit(0))) | ||
107 | .build(); | 109 | .build(); |
108 | 110 | ||
109 | var model = store.createEmptyModel(); | 111 | var model = store.createEmptyModel(); |
@@ -137,8 +139,8 @@ public class TransformationRuleTest { | |||
137 | 139 | ||
138 | queryEngine.flushChanges(); | 140 | queryEngine.flushChanges(); |
139 | 141 | ||
140 | var assignFeatureRuleActivations = assignFeatureRule.getAllActivationsAsSets(); | 142 | var assignFeatureRuleActivations = assignFeatureRule.getAllActivationsAsResultSet(); |
141 | var deleteEmptyClassRuleActivations = deleteEmptyClassRule.getAllActivationsAsSets(); | 143 | var deleteEmptyClassRuleActivations = deleteEmptyClassRule.getAllActivationsAsResultSet(); |
142 | 144 | ||
143 | assertResults(Map.of( | 145 | assertResults(Map.of( |
144 | Tuple.of(newClass1Id, newFieldId), true, | 146 | Tuple.of(newClass1Id, newFieldId), true, |
@@ -195,7 +197,8 @@ public class TransformationRuleTest { | |||
195 | .symbols(classModel, classElement, feature, isEncapsulatedBy, encapsulates, classes, features) | 197 | .symbols(classModel, classElement, feature, isEncapsulatedBy, encapsulates, classes, features) |
196 | .with(ViatraModelQueryAdapter.builder() | 198 | .with(ViatraModelQueryAdapter.builder() |
197 | .queries(deleteEmptyClassPrecondition)) | 199 | .queries(deleteEmptyClassPrecondition)) |
198 | .with(DesignSpaceExplorationAdapter.builder()) | 200 | .with(DesignSpaceExplorationAdapter.builder() |
201 | .strategy(new DepthFirstStrategy().withDepthLimit(0))) | ||
199 | .build(); | 202 | .build(); |
200 | 203 | ||
201 | var model = store.createEmptyModel(); | 204 | var model = store.createEmptyModel(); |
@@ -236,12 +239,12 @@ public class TransformationRuleTest { | |||
236 | assertResults(Map.of( | 239 | assertResults(Map.of( |
237 | Tuple.of(newModelId, newClass1Id), true, | 240 | Tuple.of(newModelId, newClass1Id), true, |
238 | Tuple.of(newModelId, newClass2Id), true | 241 | Tuple.of(newModelId, newClass2Id), true |
239 | ), deleteEmptyClassRule0.getAllActivationsAsSets()); | 242 | ), deleteEmptyClassRule0.getAllActivationsAsResultSet()); |
240 | 243 | ||
241 | assertResults(Map.of( | 244 | assertResults(Map.of( |
242 | Tuple.of(newModelId, newClass1Id), true, | 245 | Tuple.of(newModelId, newClass1Id), true, |
243 | Tuple.of(newModelId, newClass2Id), true | 246 | Tuple.of(newModelId, newClass2Id), true |
244 | ), deleteEmptyClassRule1.getAllActivationsAsSets()); | 247 | ), deleteEmptyClassRule1.getAllActivationsAsResultSet()); |
245 | 248 | ||
246 | assertEquals(Tuple.of(newModelId, newClass2Id), activation0); | 249 | assertEquals(Tuple.of(newModelId, newClass2Id), activation0); |
247 | assertEquals(Tuple.of(newModelId, newClass1Id), activation1); | 250 | assertEquals(Tuple.of(newModelId, newClass1Id), activation1); |
@@ -276,7 +279,8 @@ public class TransformationRuleTest { | |||
276 | .symbols(classModel, classElement, feature, isEncapsulatedBy, encapsulates, classes, features) | 279 | .symbols(classModel, classElement, feature, isEncapsulatedBy, encapsulates, classes, features) |
277 | .with(ViatraModelQueryAdapter.builder() | 280 | .with(ViatraModelQueryAdapter.builder() |
278 | .queries(deleteEmptyClassPrecondition)) | 281 | .queries(deleteEmptyClassPrecondition)) |
279 | .with(DesignSpaceExplorationAdapter.builder()) | 282 | .with(DesignSpaceExplorationAdapter.builder() |
283 | .strategy(new DepthFirstStrategy().withDepthLimit(0))) | ||
280 | .build(); | 284 | .build(); |
281 | 285 | ||
282 | var model = store.createEmptyModel(); | 286 | var model = store.createEmptyModel(); |
@@ -312,7 +316,7 @@ public class TransformationRuleTest { | |||
312 | assertResults(Map.of( | 316 | assertResults(Map.of( |
313 | Tuple.of(newModelId, newClass1Id), true, | 317 | Tuple.of(newModelId, newClass1Id), true, |
314 | Tuple.of(newModelId, newClass2Id), true | 318 | Tuple.of(newModelId, newClass2Id), true |
315 | ), deleteEmptyClassRule.getAllActivationsAsSets()); | 319 | ), deleteEmptyClassRule.getAllActivationsAsResultSet()); |
316 | 320 | ||
317 | 321 | ||
318 | deleteEmptyClassRule.fireActivation(Tuple.of(0, 1)); | 322 | deleteEmptyClassRule.fireActivation(Tuple.of(0, 1)); |
@@ -320,7 +324,7 @@ public class TransformationRuleTest { | |||
320 | assertResults(Map.of( | 324 | assertResults(Map.of( |
321 | Tuple.of(newModelId, newClass1Id), false, | 325 | Tuple.of(newModelId, newClass1Id), false, |
322 | Tuple.of(newModelId, newClass2Id), true | 326 | Tuple.of(newModelId, newClass2Id), true |
323 | ), deleteEmptyClassRule.getAllActivationsAsSets()); | 327 | ), deleteEmptyClassRule.getAllActivationsAsResultSet()); |
324 | } | 328 | } |
325 | 329 | ||
326 | @Test | 330 | @Test |
@@ -352,7 +356,8 @@ public class TransformationRuleTest { | |||
352 | .symbols(classModel, classElement, feature, isEncapsulatedBy, encapsulates, classes, features) | 356 | .symbols(classModel, classElement, feature, isEncapsulatedBy, encapsulates, classes, features) |
353 | .with(ViatraModelQueryAdapter.builder() | 357 | .with(ViatraModelQueryAdapter.builder() |
354 | .queries(deleteEmptyClassPrecondition)) | 358 | .queries(deleteEmptyClassPrecondition)) |
355 | .with(DesignSpaceExplorationAdapter.builder()) | 359 | .with(DesignSpaceExplorationAdapter.builder() |
360 | .strategy(new DepthFirstStrategy().withDepthLimit(0))) | ||
356 | .build(); | 361 | .build(); |
357 | 362 | ||
358 | var model = store.createEmptyModel(); | 363 | var model = store.createEmptyModel(); |
@@ -388,21 +393,21 @@ public class TransformationRuleTest { | |||
388 | assertResults(Map.of( | 393 | assertResults(Map.of( |
389 | Tuple.of(newModelId, newClass1Id), true, | 394 | Tuple.of(newModelId, newClass1Id), true, |
390 | Tuple.of(newModelId, newClass2Id), true | 395 | Tuple.of(newModelId, newClass2Id), true |
391 | ), deleteEmptyClassRule.getAllActivationsAsSets()); | 396 | ), deleteEmptyClassRule.getAllActivationsAsResultSet()); |
392 | 397 | ||
393 | deleteEmptyClassRule.fireRandomActivation(); | 398 | deleteEmptyClassRule.fireRandomActivation(); |
394 | 399 | ||
395 | assertResults(Map.of( | 400 | assertResults(Map.of( |
396 | Tuple.of(newModelId, newClass1Id), true, | 401 | Tuple.of(newModelId, newClass1Id), true, |
397 | Tuple.of(newModelId, newClass2Id), false | 402 | Tuple.of(newModelId, newClass2Id), false |
398 | ), deleteEmptyClassRule.getAllActivationsAsSets()); | 403 | ), deleteEmptyClassRule.getAllActivationsAsResultSet()); |
399 | 404 | ||
400 | deleteEmptyClassRule.fireRandomActivation(); | 405 | deleteEmptyClassRule.fireRandomActivation(); |
401 | 406 | ||
402 | assertResults(Map.of( | 407 | assertResults(Map.of( |
403 | Tuple.of(newModelId, newClass1Id), false, | 408 | Tuple.of(newModelId, newClass1Id), false, |
404 | Tuple.of(newModelId, newClass2Id), false | 409 | Tuple.of(newModelId, newClass2Id), false |
405 | ), deleteEmptyClassRule.getAllActivationsAsSets()); | 410 | ), deleteEmptyClassRule.getAllActivationsAsResultSet()); |
406 | 411 | ||
407 | } | 412 | } |
408 | } | 413 | } |