eclipse-viatra / org.eclipse.viatra

Main components of the VIATRA framework
https://eclipse.dev/viatra
Eclipse Public License 2.0
1 stars 1 forks source link

Query Test Framework shall support specifying BaseIndexOptions #63

Open eclipse-viatra-bot opened 6 months ago

eclipse-viatra-bot commented 6 months ago

| --- | --- | | Bugzilla Link | 516188 | | Status | NEW | | Importance | P3 normal | | Reported | May 04, 2017 11:20 EDT | | Modified | Feb 08, 2018 08:02 EDT | | Version | 1.6.0 | | Reporter | Gabor Bergmann |

Description

Currently, there is no easy way to override the default BaseIndexOptions in the query test framework without rolling your own resources and scope.

Take a test that should ideally look like this:\ \ val snapshot = "uri..."\ \ @Test\ def void stateToState1Ideal() {\ ViatraQueryTest.test(StateToState1QuerySpecification.instance) .with(new BaseIndexOptions().withDanglingFreeAssumption(false)) .with(snapshot) .withAll .assertEquals\ }\ \ Or alternatively, if the scope is constructed when the snapshot is passed, and it is important to have the BIO ready at that time:

@Test\
def void stateToState1Ideal() {\
    ViatraQueryTest.test(StateToState1QuerySpecification.instance)
                    .with(snapshot, new BaseIndexOptions().withDanglingFreeAssumption(false)) // config steps merged
                    .withAll
                    .assertEquals\
}

Now this test has to be written like this:

@Test\
def void stateToState1() {\
    val scope = makeScope\
    ViatraQueryTest.test(StateToState1QuerySpecification.instance)
                    .on(scope)
                    .with(scope.extractSnapshot)
                    .withAll
                    .assertEquals\
}\
def makeScope() {\
    val options = new BaseIndexOptions().withDanglingFreeAssumption(false) \
    val uri = XmiModelUtil::resolvePlatformURI(XmiModelUtilRunningOptionEnum.BOTH, snapshot)\
    val ResourceSet rSet = new ResourceSetImpl()\
    rSet.getResource(uri , true)\
    return new EMFScope(rSet, options)\
} \
def extractSnapshot(EMFScope scope) {\
    (scope.scopeRoots.get(0) as ResourceSet).resources.get(0).contents.get(0) as QuerySnapshot\
}
eclipse-viatra-bot commented 6 months ago

By Zoltan Ujhelyi on Oct 04, 2017 05:04

Postponing.