Load a Papyrus ModelSet programmatically [message #1767721] |
Mon, 10 July 2017 06:21  |
Eclipse User |
|
|
|
Hi guys,
I am currently trying to write some smoke tests for transformations as JUnit Plugin tests. Therfore I need to load a Papyrus model programmatically in the same way (as if it would have been started via the UI.
The transformation is based on EMF transaction, so a transactional editing domain is required. However, even if I load all the three resources (.di, .notation. uml) into a resource set, there is no transactional editing domain set.
I am pretty sure I once found a loading facility in the Papyrus code base, that allowed me to simply add a URI and the properly loaded resource set with transactional rediting domain.
Would somebody please adivse me how to properly load the entire Papyrus ModelSet programmatically?!
Thanks a lot in advance,
Marc-Florian
|
|
|
Re: Load a Papyrus ModelSet programmatically [message #1767728 is a reply to message #1767721] |
Mon, 10 July 2017 08:01  |
Eclipse User |
|
|
|
Hi Marc-Florian,
In JUnit tests, you can use the @Rules provided in the Papyrus JUnit Utils plug-in, e.g.:
@Rule
public final ModelSetFixture modelSet = new ModelSetFixture();
@Test
@PluginResource("/resources/model/model.uml")
public void test() {
ModelSet ms = modelSet.getModelSet();
}
Check the Javadoc of org.eclipse.papyrus.junit.utils.rules.AbstractModelFixture<T> for more details.
If you don't want to reuse the complete rule, you can reuse the implementation from these methods:
org.eclipse.papyrus.junit.utils.rules.ModelSetFixture.createEditingDomain()
org.eclipse.papyrus.junit.utils.rules.ModelSetFixture.didLoadResourceSet()
Regards,
Camille
|
|
|
Powered by
FUDForum. Page generated in 0.02903 seconds