Hi all,
I am using junit4 to create tests regarding the import of APP4MC models and I think there might be a bug in the APP4MC (de-) serializer code. I have the following two identical tests:
@Test
def testARAMiS2Import() {
val pathURL = class.protectionDomain.codeSource.location
val pathURI = (new
File(pathURL.file).toURI)
val path = Paths.get(pathURI)
val subPath = path.subpath(0,
path.nameCount - 3)
val finalPath = Paths.get(path.root.toString, subPath.toString,
'''com.co4e.assist.mapping.tests/resources/project-aramis-uc55/aramis_usecase55.amxmi''').toString
val
model_1 = AmaltheaLoader.loadFromFileNamed(finalPath)
Assert.assertNotNull(model_1)
val
model_2 = AmaltheaLoader.loadFromFileNamed(finalPath)
Assert.assertNotNull(model_2)
}
@Test
def testARAMiS2Import_copy() {
val pathURL = class.protectionDomain.codeSource.location
val pathURI = (new
File(pathURL.file).toURI)
val path = Paths.get(pathURI)
val subPath = path.subpath(0,
path.nameCount - 3)
val finalPath = Paths.get(path.root.toString, subPath.toString,
'''com.co4e.assist.mapping.tests/resources/project-aramis-uc55/aramis_usecase55.amxmi''').toString
val
model_1 = AmaltheaLoader.loadFromFileNamed(finalPath)
Assert.assertNotNull(model_1)
val
model_2 = AmaltheaLoader.loadFromFileNamed(finalPath)
Assert.assertNotNull(model_2)
}
Interestingly, the first test that is executed by junit succeeds, but the following test fails, because it returns an empty model.
![](pngWxAEqe8qZA.png)
It seems like I can execute “loadFromFileNamed” multiple times within a single test, but not in two different test cases of the same testsuite. This is weird, because most of the loading code is static – just the EPackage
registry stuff isn’t. Anybody ever stumbled over this behavior?
Any pointers or feedback would be greatly appreciated.
Best,
Robert
——————————————————————————
Deutsches Zentrum für Luft- und Raumfahrt
e.V. (DLR)
Institut für Verkehrssystemtechnik |
Rutherfordstraße 2 | 12489 Berlin
Dr. Robert Hilbrich | Gruppenleiter Simulation und Modellierung
Telefon 030 67055-582 | Telefax 030 67055-291 |
Robert.Hilbrich@xxxxxx
www.DLR.de |
Institut für Verkehrssystemtechnik