Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Load a Papyrus ModelSet programmatically
Load a Papyrus ModelSet programmatically [message #1767721] Mon, 10 July 2017 10:21 Go to next message
Marc-Florian Wendland is currently offline Marc-Florian WendlandFriend
Messages: 83
Registered: January 2013
Member
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 12:01 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
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


Camille Letavernier
Previous Topic:<<Trace>> Realization in Palette
Next Topic:Registering a Generated Static Profile
Goto Forum:
  


Current Time: Thu Apr 18 12:21:03 GMT 2024

Powered by FUDForum. Page generated in 0.02432 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top