Unexpected results while testing


This doubt refers to MPS 3.1.5 (we're still working on migrating to a more recent version).
We have a set of xml files that contain some information. We also have a language that is responsible for reading those files and create the corresponding instances on our solution.
For that, there's a button on the corresponding editor.
Now, I wanted to do this import from outside MPS and thought that the easier way was to have a test for invoking this functionality (as it's easily executable using ANT).
I can run the test I created, I see it running and creating the expected instances (I've log to prove it) HOWEVER, they don't show up in the model at the end of the execution... they seem to have been added to some temporary model, not to the model we want.
".getModel().isReadOnly()" says "false"; and, while running, concepts are added to it...
The log writes down the correct model name (and uses the correct information that exists on that model, like the xml files location). Before the test ends I iterate over all instances of the model and log them and they are there...
Is the test creating a copy of the original model to work on?
Is this possible? Is there another way to do this import (without opening mps)?

Thank you,

Sérgio Ribeiro
Porto - Portugal
Hi Sérgio,

AFAIK you are right - the tests get their own copy of the model, which gets discarded after run. MPS 3.2.3 added the capability to run arbitrary Java code from a solution (http://blog.jetbrains.com/mps/2015/06/mps-3-2-3-is-out/), which you may be able to use for this.

Thank you for your answer.

I don't think there's any chance, on 3.1.5, to get those instances to the original model...
Is there, in alternative, a to persist that model-copy to some file system location?

Do you have any suggestion on what the right approach should be?

What I want is to, via ANT (use MPS in headless mode), execute the import to an existing model.

Thank you,

Sérgio Ribeiro
Porto - Portugal

Please sign in to leave a comment.