Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZoltán Ujhelyi2024-02-09 17:28:48 +0000
committerZoltán Ujhelyi2024-02-09 17:28:48 +0000
commit82a5acf73397ecdfce8715b6d2ef02b72dc020ad (patch)
treea6832b1512ec74a2c25800704757fcb5be22c66a
parente84babb08a50024a60f4dfe0bfb50339e92df3a4 (diff)
downloadorg.eclipse.viatra-82a5acf73397ecdfce8715b6d2ef02b72dc020ad.tar.gz
org.eclipse.viatra-82a5acf73397ecdfce8715b6d2ef02b72dc020ad.tar.xz
org.eclipse.viatra-82a5acf73397ecdfce8715b6d2ef02b72dc020ad.zip
[517629] Testing wildcard mode propagation to visitorsHEADmaster
Change-Id: I3cfc636c6d724c1c2b5de23248a6e23b17927e51 Signed-off-by: Zoltán Ujhelyi <zoltan.ujhelyi@incquerylabs.com> Signed-off-by: Balázs Grill <balazs.grill@incquerylabs.com>
-rw-r--r--query/tests/org.eclipse.viatra.query.runtime.cps.tests/src/org/eclipse/viatra/query/runtime/cps/tests/BaseIndexWildcardModePropagationTest.xtend60
1 files changed, 60 insertions, 0 deletions
diff --git a/query/tests/org.eclipse.viatra.query.runtime.cps.tests/src/org/eclipse/viatra/query/runtime/cps/tests/BaseIndexWildcardModePropagationTest.xtend b/query/tests/org.eclipse.viatra.query.runtime.cps.tests/src/org/eclipse/viatra/query/runtime/cps/tests/BaseIndexWildcardModePropagationTest.xtend
new file mode 100644
index 000000000..e7af0888a
--- /dev/null
+++ b/query/tests/org.eclipse.viatra.query.runtime.cps.tests/src/org/eclipse/viatra/query/runtime/cps/tests/BaseIndexWildcardModePropagationTest.xtend
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2017-2014 Balazs Grill, Zoltan Ujhelyi, IncQuery Labs Ltd.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-v20.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************/
+package org.eclipse.viatra.query.runtime.cps.tests
+
+import org.eclipse.emf.common.util.URI
+import org.eclipse.emf.ecore.resource.impl.ResourceImpl
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
+import org.eclipse.viatra.examples.cps.cyberPhysicalSystem.CyberPhysicalSystemFactory
+import org.eclipse.viatra.query.runtime.base.api.IndexingLevel
+import org.eclipse.viatra.query.runtime.base.api.ViatraBaseFactory
+import org.junit.Assert
+import org.junit.Test
+import static org.eclipse.viatra.examples.cps.cyberPhysicalSystem.CyberPhysicalSystemPackage.Literals.*
+import org.junit.Ignore
+
+class BaseIndexWildcardModePropagationTest {
+
+ val extension CyberPhysicalSystemFactory factory = CyberPhysicalSystemFactory.eINSTANCE
+
+ @Test
+ @Ignore("Known to fail until https://bugs.eclipse.org/bugs/show_bug.cgi?id=517629 is not fixed")
+ def testProxyResolution(){
+ val rs = new ResourceSetImpl();
+ val r1 = new ResourceImpl(URI.createURI("nothing://host"))
+
+ val ht = createHostType => [
+ identifier = "ht"
+ instances += createHostInstance => [
+ identifier = "hi1"
+ ]
+ ]
+ r1.contents += ht
+ rs.resources += r1
+
+ val baseIndex = ViatraBaseFactory::instance.createNavigationHelper(rs, false, null)
+ baseIndex.wildcardLevel = IndexingLevel.FULL
+
+ baseIndex.getHoldersOfFeature(HOST_TYPE__INSTANCES).forEach[holder|
+ val targets = baseIndex.getFeatureTargets(holder, HOST_TYPE__INSTANCES)
+ Assert.assertEquals(1, targets.size)
+ ]
+
+ // Add another element
+ ht.instances += createHostInstance => [
+ identifier = "hi2"
+ ]
+
+ baseIndex.getHoldersOfFeature(HOST_TYPE__INSTANCES).forEach[holder|
+ val targets = baseIndex.getFeatureTargets(holder, HOST_TYPE__INSTANCES)
+ Assert.assertEquals(2, targets.size)
+ ]
+ }
+
+} \ No newline at end of file

Back to the top