Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Using EMF generated objects with easyb and Groovy
Using EMF generated objects with easyb and Groovy [message #628705] Thu, 23 September 2010 17:52 Go to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

I am combining my ECore classes with easyb to do a combination of model
driven and Behaviour Driven Development. easyb uses a Groovy based DSL
to facilitate the story expressions. I have

delim1 = factory.createField();
delim1.setId(new Integer(0));
delim1.setName("integer");
delim1.setRecord(delimitRec);

transformation = factory.createTransformationNode()
transformation.setId(0)
transformation.setName("delimited record transformation")

transformationport1 = factory.createTransformationNodePort();
transformationport1.setId 0
transformationport1.setInputPort delim1
transformationport1.setTransformationNode transformation

Whenever a straight attribute is set, in this case "setId 0" it works.
But whenever a reference is set to another EClass it appears to work, I
put a breakpoint in this method

public void setRecord(Record newRecord) {

it sets it. But by the time it comes to a method in the later test code
the Record field is null?

public void setup(TransformationNode node) throws
IncorrectRecordTypeException {
transform = node;
ports = node.getNodeAssocPorts();
for (Iterator<TransformationNodePort> iter = ports.iterator();
iter.hasNext(); ) {
TransformationNodePort transformationport = iter.next();
Record aRecord = transformationport.getInputPort().getRecord();

This last line has a null in the Record field. Not really sure what is
going on here. Any ideas?

Thx.

David
Re: Using EMF generated objects with easyb and Groovy, nothing to do with Groovy, but still a proble [message #628849 is a reply to message #628705] Fri, 24 September 2010 12:18 Go to previous message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

I built a std JUnit test case with the same code as below in the Groovy
test case. I experience the same problem.

It turns out I missed that the Unique attribute in the model was set to
true, thus ECore being clever removed it as a reference when I set the
second Field object to point to the Record object.

Thx.

David

On 23/09/10 18:52, David Wynter wrote:
> Hi,
>
> I am combining my ECore classes with easyb to do a combination of model
> driven and Behaviour Driven Development. easyb uses a Groovy based DSL
> to facilitate the story expressions. I have
>
> delim1 = factory.createField();
> delim1.setId(new Integer(0));
> delim1.setName("integer");
> delim1.setRecord(delimitRec);
>
> transformation = factory.createTransformationNode()
> transformation.setId(0)
> transformation.setName("delimited record transformation")
>
> transformationport1 = factory.createTransformationNodePort();
> transformationport1.setId 0
> transformationport1.setInputPort delim1
> transformationport1.setTransformationNode transformation
>
> Whenever a straight attribute is set, in this case "setId 0" it works.
> But whenever a reference is set to another EClass it appears to work, I
> put a breakpoint in this method
>
> public void setRecord(Record newRecord) {
>
> it sets it. But by the time it comes to a method in the later test code
> the Record field is null?
>
> public void setup(TransformationNode node) throws
> IncorrectRecordTypeException {
> transform = node;
> ports = node.getNodeAssocPorts();
> for (Iterator<TransformationNodePort> iter = ports.iterator();
> iter.hasNext(); ) {
> TransformationNodePort transformationport = iter.next();
> Record aRecord = transformationport.getInputPort().getRecord();
>
> This last line has a null in the Record field. Not really sure what is
> going on here. Any ideas?
>
> Thx.
>
> David
Previous Topic:selection in ecore editor reverting to previous node
Next Topic:Resource factory not found by normalized URI?
Goto Forum:
  


Current Time: Tue Oct 22 17:17:54 GMT 2019

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

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

Back to the top