Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Using EOL to build test models(Is it the right tool for the job?)
Using EOL to build test models [message #735340] Tue, 11 October 2011 14:54 Go to next message
Michael Jastram is currently offline Michael JastramFriend
Messages: 161
Registered: April 2010
Location: Düsseldorf, Germany
Senior Member
Hello,

SUMMARY: I need a tool to build test files that are based on an EMF model. After having played with Epsilon/EOL for a day or so (arguably not that long), I am still not sure whether I use it right, and whether it is the right tool for the job. Getting the answers to a few questions would help me a lot!

WHAT I WANT TO DO: I have an EMF model with a custom file format. I'd like to be able to create a script that builds arbitrary models and persists them in my custom format. The idea is to simply script the creation of test files for all kind of edge cases. I'd like an editor for writing the scripts that supports auto-complete and related nifty features.

WHAT I TRIED: My understanding is, that plain EOL is what I need. I followed the screencasts "Defining and instantiating an OO metamodel" and " Populating an OO model using EOL". Of course, I used my .ecore model, rather than the one from the example. Things worked in principle: I could fairly easily build up a model using EOL. But there were a number of things that I didn't get to work as I liked:

MY QUESTIONS:

1. The script can only write one file, the one that is configured through the "Run Configuration" dialog. Is it possible to write multiple files?

2. The script can only process .model files, but I'd like it to use my native format. I couldn't figure out how to do this (I tried through the Meta-model URI or file extension, but to no avail). As a workaround, is there an easy way to convert the .model in another format? It's the same underlying model, it just needs to be persisted differently.

3. I was hoping that the editor would be aware of the registered model and support auto-complete. But auto-complete is only available for the build-in types. Is there a way to get this functionality?

Thanks in advance,

- Michael
Re: Using EOL to build test models [message #735560 is a reply to message #735340] Wed, 12 October 2011 08:16 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 309
Registered: January 2010
Senior Member
Glad you decided to try Epsilon for your work Smile. It's a pretty long message, so I'll reply by parts, if you don't mind.

Michael Jastram wrote on Tue, 11 October 2011 10:54

WHAT I WANT TO DO: I have an EMF model with a custom file format. I'd like to be able to create a script that builds arbitrary models and persists them in my custom format. The idea is to simply script the creation of test files for all kind of edge cases. I'd like an editor for writing the scripts that supports auto-complete and related nifty features.


EOL is good at instantiating arbitrary models, but it is not intended for saving them to custom formats. Perhaps you could call a EGL module on an empty model (not read but stored) which imports the EOL model instantiation script, and generate your custom format from there.

By the way: the E*L languages support some modelling technologies which do not have explicit metamodels (such as XML files or Java object graphs). Enabling autocompletion on a case by case basis is difficult. We have looked into supporting autocompletion for EMF-based models, but we haven't started work on that yet.

Quote:

1. The script can only write one file, the one that is configured through the "Run Configuration" dialog. Is it possible to write multiple files?


Using pure EOL, you could invoke Java classes to generate several files. It's a bit clunky, but it should work. For instance:

var myfile := new Native('java.io.File')('f.myformat');
var fs := new Native('java.io.FileOutputStream')(myfile);
// and so on


However, I would recommend EGL for this, as it supports running a subtemplate to generate a different file. This example should help you:

http://eclipse.org/gmt/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.egldoc

Quote:

2. The script can only process .model files, but I'd like it to use my native format. I couldn't figure out how to do this (I tried through the Meta-model URI or file extension, but to no avail). As a workaround, is there an easy way to convert the .model in another format? It's the same underlying model, it just needs to be persisted differently.


You can implement your own driver for the Epsilon Model Connectivity layer. For instance, here's a driver for loading HUTN models:

http://dev.eclipse.org/svnroot/modeling/org.eclipse.gmt.epsilon/trunk/plugins/org.eclipse.epsilon.emc.hutn/src/org/eclipse/epsilon/emc/hutn/HutnModel.java

Here's another for MDR (NetBeans) models:

http://epsilonlabs.svn.sourceforge.net/viewvc/epsilonlabs/org.eclipse.epsilon.emc.mdr/

And here's another for Z models:

http://epsilonlabs.svn.sourceforge.net/viewvc/epsilonlabs/org.eclipse.epsilon.emc.z/

The last two might be a bit outdated, though. Of course, we use the same approach for EMF models:

http://dev.eclipse.org/svnroot/modeling/org.eclipse.gmt.epsilon/trunk/plugins/org.eclipse.epsilon.emc.emf/

If you need to read your custom format, I would recommend writing your own driver for EMC: it'll probably be the most natural solution. If you only need to write those models, then using EGL will be simpler.

Quote:

3. I was hoping that the editor would be aware of the registered model and support auto-complete. But auto-complete is only available for the build-in types. Is there a way to get this functionality?


As I said above, but the E*L editors do not support autocomplete because not all EMC drivers work on models with a well-defined metamodel.

I hope that cleared matters a bit. If you need any more help, just ask.
Previous Topic:[ECL] Finding out "visited" features of an ECL rule
Next Topic:[EVL] EVL only for EMF?!
Goto Forum:
  


Current Time: Sat Nov 22 00:23:04 GMT 2014

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

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