|
Re: Setting up OCLInEcore and standalone junit [message #794462 is a reply to message #794451] |
Thu, 09 February 2012 10:19 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi Filip
Well done, you've found what I consider the correct solution.
OCLinEcoreStandaloneSetup.doSetup();
is mentioned in the Standalone Setup part of the (Help Contents) OCL
Documentation.
But
OCLstdlib.install();
is missing. (https://bugs.eclipse.org/bugs/show_bug.cgi?id=371053 raised).
The dependencies are what's needed to make the JDT compilation errors go
away. I suspect that you've found them already. Most of the plugins have
transitive exports so org.eclipse.ocl.examples.xtext.oclinecore as
you've used is probably sufficient.
You might want to look at org.eclipse.ocl.examples.xtext.tests where all
the JUnit tests are. There are a variety of helper routines that ensure
that MetaModelManager's don't leak. One of many pending jobs is to merge
all these helpers together into a helper/facade API.
Regards
Ed Willink
On 09/02/2012 10:03, Filip Krikava wrote:
> Hi,
>
> I'm trying to setup standalone junit tests for validating the OCL
> invariants I have in my model. If I use the Ecore metamodel
> (http[:]//www.eclipse.org/emf/2002/Ecore/OCL) and following the
> Standalone Configuration section in the documentation it all works fine.
> However, if I try to use the Pivot metamodel then I have some troubles
> that I think are manly because I miss something in the setup (I hope I
> did not miss something obvious).
>
> Following the documentation I have this in my test class:
>
> import org.eclipse.ocl.examples.pivot.delegate.OCLDelegateDomain;
> import
> org.eclipse.ocl.examples.pivot.delegate.OCLValidationDelegateFactory;
>
> @BeforeClass
> public static void initialize() {
> org.eclipse.ocl.examples.pivot.OCL.OCL.initialize(null); // do it
> globally
>
> // initialize OCL validation
> EValidator.ValidationDelegate.Registry.INSTANCE.put(
> OCLDelegateDomain.OCL_DELEGATE_URI_PIVOT,
> new OCLValidationDelegateFactory.Global());
> }
>
>
> And in the MANIFEST.MF:
>
> Require-Bundle: org.junit;bundle-version="4.8.2",
> fr.unice.salty.core.model;bundle-version="1.0.0",
> fr.unice.salty.core.model.resource.scm;bundle-version="1.0.0",
> org.eclipse.ocl.examples.xtext.oclinecore;bundle-version="3.1.0"
>
>
> But that does not work and during validation using
> (org.eclipse.emf.ecore.util.Diagnostician) I get:
>
> An exception occurred while delegating evaluation of the
> 'uniqueDataTypeNames' constraint on
> 'fr.unice.salty.core.model.salty.impl.ControlSystemImpl@202264da{file:/var/folders/0f/85kh4b4j7g926q4k3lmgt48w0000gn/T/emfutils7731788511457067198.scm#/}':
> org/apache/log4j/Logger
>
>
> If I add the org.apache.log4j dependency then I get a step further:
>
> An exception occurred while delegating evaluation of the
> 'uniqueDataTypeNames' constraint on
> 'fr.unice.salty.core.model.salty.impl.ControlSystemImpl@6bd9e2c7{file:/var/folders/0f/85kh4b4j7g926q4k3lmgt48w0000gn/T/emfutils3021211280825794027.scm#/}':
> No OCL Standard Library content available
>
>
> In the end what works is adding these two lines in my test
> initialization method:
>
> OCLinEcoreStandaloneSetup.doSetup();
> OCLstdlib.install();
>
>
> My questions are: What are the proper initialization steps I should
> do? What are the proper dependencies I should add into the MANIFEST.MF?
>
> Thanks a lot,
> Filip
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04080 seconds