|
|
|
|
|
Re: [ACCELEO] Using OCL Invocation and Setting delegates [message #815060 is a reply to message #814835] |
Wed, 07 March 2012 07:13 |
Ed Willink Messages: 7679 Registered: July 2009 |
Senior Member |
|
|
Hi
This issue is nothing to do with the new Pivot model.
[The editing activities use the Pivot model and persist the OCL
expression as a String within an EAnnotation. When Acceleo runs, the OCL
string is processed by the legacy Ecore support.]
Acceleo does use the generated method; it just gets a parse error while
doing so.
There is a good chance that changing line 111 of
org.eclipse.acceleo.engine.internal.environment.AcceleoEnvironmentFactory from
AcceleoEnvironment result = new
AcceleoEnvironment(getEPackageRegistry());
to
AcceleoEnvironment result = new AcceleoEnvironment(parent);
and introducing the missing constructor
protected AcceleoEnvironment(Environment<EPackage, EClassifier,
EOperation, EStructuralFeature, EEnumLiteral, EParameter, EObject,
CallOperationAction, SendSignalAction, Constraint, EClass, EObject>
parent) {
super(parent);
}
will cure the problem.
Perhaps someone from Obeo can be more helpful.
Regards
Ed Willink
On 06/03/2012 23:35, Filip Krikava wrote:
> Hi,
>
> Thanks a lot for such a fat response. That is very unfortunate (I
> guess that even if the self was not hidden if it interprets OCL it
> will not likely use the Pivot meta-model, right?).
>
> I just don't understand why Acceleo does not use the generated java
> method? I mean if I add and operation or derived property that I
> implement manually in java it will work. Would it be possible to
> change the behavior so it does use it? I would be more than happy to
> hack it somehow if I knew where :).
> I cannot change to Juno and I'd love to have the project be built on
> the OMG stds rather than some other M2T toolkit :)
>
> /cheers
> Filip
|
|
|
Re: [ACCELEO] Using OCL Invocation and Setting delegates [message #815129 is a reply to message #815060] |
Wed, 07 March 2012 09:10 |
|
Ed, Filip,
What exactly am I to test here? If I launch the provided unit test with Helios :
- as JUnit test : testStandalone fails, testMTT is in error (as the template's first parameter is a proxy, I suppose due to testStandalone's failure.
- as JUnit plug-in test : testStandalone fails, testMTT passes.
testStandalone's failure is the same for both runs :
arrays first differed at element [0]; expected:<[B]> but was:<[C]>
at org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:52)
at org.junit.Assert.internalArrayEquals(Assert.java:414)
at org.junit.Assert.assertArrayEquals(Assert.java:166)
at org.junit.Assert.assertArrayEquals(Assert.java:183)
at Tests.testStandalone(Tests.java:44)
I'll try and launch the Acceleo generator itself, but here are my results with the unit test.
Laurent Goubet
Obeo
|
|
|
Re: [ACCELEO] Using OCL Invocation and Setting delegates [message #815151 is a reply to message #815129] |
Wed, 07 March 2012 09:39 |
Ed Willink Messages: 7679 Registered: July 2009 |
Senior Member |
|
|
Hi Laurent
When I run the attached launch config on 3.7.2, I get
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid loop
iteration at line 14 in Module main for block for (system.allTested).
Last recorded value of self was
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@16614e7 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@16546ef (name: System)
(instanceClassName: null) (abstract: false, interface: false)). Problem
found while generating the file
'C:\Development\Admin\Workspace3.6\ocltest3\output\system.txt'.
at main.main(System)(main.mtl:14)
at main.main(System)(main.mtl:7)
at main.main(System)(main.mtl:4)
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid loop
iteration at line 18 in Module main for block for
(system.allTestedNames). Last recorded value of self was
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@16614e7 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@16546ef (name: System)
(instanceClassName: null) (abstract: false, interface: false)). Problem
found while generating the file
'C:\Development\Admin\Workspace3.6\ocltest3\output\system.txt'.
at main.main(System)(main.mtl:18)
at main.main(System)(main.mtl:7)
at main.main(System)(main.mtl:4)
If you run with a Breakpoint on NPE you will see the underlying failure
to resolve 'self' that causes a ParseException that causes the eventual
diagnostic.
Regards
Ed
On 07/03/2012 09:10, Laurent Goubet wrote:
> Ed, Filip,
>
> What exactly am I to test here? If I launch the provided unit test
> with Helios :
>
> - as JUnit test : testStandalone fails, testMTT is in error (as the
> template's first parameter is a proxy, I suppose due to
> testStandalone's failure.
> - as JUnit plug-in test : testStandalone fails, testMTT passes.
>
> testStandalone's failure is the same for both runs :
>
> arrays first differed at element [0]; expected:<[B]> but was:<[C]>
> at
> org.junit.internal.ComparisonCriteria.arrayEquals(ComparisonCriteria.java:52)
> at org.junit.Assert.internalArrayEquals(Assert.java:414)
> at org.junit.Assert.assertArrayEquals(Assert.java:166)
> at org.junit.Assert.assertArrayEquals(Assert.java:183)
> at Tests.testStandalone(Tests.java:44)
>
> I'll try and launch the Acceleo generator itself, but here are my
> results with the unit test.
>
> Laurent Goubet
> Obeo
-
Attachment: Main.launch
(Size: 1.32KB, Downloaded 351 times)
|
|
|
Re: [ACCELEO] Using OCL Invocation and Setting delegates [message #815170 is a reply to message #815151] |
Wed, 07 March 2012 10:08 |
|
Ed,
Launching the generator itself did yield the expected failure indeed. Running the test, however, did not. That's why I asked.
As for the fix, it is indeed as you surmised with the broken parent/child relation on the evaluation's environment. This was an overlook (I used the same constructor for both methods of the factory ... which is somewhat stupid ). It will be fixed in both of the incoming versions (3.2 and 3.3).
Laurent Goubet
Obeo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06710 seconds