eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[tests] Rationalize GlobalStateMemento for Attribution.REGISTRY #2348

Open eclipse-ocl-bot opened 2 months ago

eclipse-ocl-bot commented 2 months ago

| --- | --- | | Bugzilla Link | 583509 | | Status | NEW | | Importance | P3 normal | | Reported | Jul 30, 2024 03:32 EDT | | Modified | Sep 06, 2024 11:02 EDT | | Reporter | Ed Willink |

Description

The local copy of org.eclipse.xtext.testing.GlobalRegistries resolves EMF issues but is still inadequate. Perversely it is only used for testCompleteOCLRegistry_Access. Should be a full rteplacement of the PivotTestCase copy.

The standalone version of testUMLXCompiler_Forward2Reverse_CG identified a propblem whereby

registry.put(EssentialOCLCSPackage.Literals.SHADOW_PART_CS, ShadowPartCSAttribution.INSTANCE);

from EssentialOCLScoping has an initialization order dependency wrt

registry.put(EssentialOCLCSPackage.Literals.SHADOW_PART_CS, QVTimperativeShadowPartCSAttribution.INSTANCE);

from QVTimperativeScoping.

The immediate problem was worked around by an extra QVTimperativeScoping.init().

Attribution.REGISTRY should be part of the global state.

registry.put should perhaps be overloaded to detect a paut that is not a derived class of a prevailing init.

More generally makeCopyOfGlobalState() should perhaps diagnose unexpected global state that results from failure to observe the need to initialize pre-setup so that tearDown restores.

eclipse-ocl-bot commented 2 months ago

By Ed Willink on Jul 30, 2024 04:07

(In reply to Ed Willink from comment #0)

Attribution.REGISTRY should be part of the global state.

Yes, but clearing it in PicotStandaloneSetup.init forces a full re-init.

registry.put should perhaps be overloaded to detect a paut that is not a derived class of a prevailing init.

Done.

eclipse-ocl-bot commented 2 months ago

By Ed Willink on Sep 06, 2024 11:02

a) Enforcing the doXXXStandaloneSetup before JUnit setUp() policy\ b) abstracting AbstractPivotTestCAse with a TEstHelper to unifi OCL/QVTd\ c) using a single GlobalStateMemento\ improves general behaviour.

Since XXXScoping only happens when XXX is initialized, a thorough tearDown is needed to support GC testing.

There are no conflicting Attributions, e.g a refined QVTr Attribution extends and tests for the unrefined case. The AttributionRegistry can therefore just grow and grow with the no insyallation of anti-refined test.