Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-05-17 16:31:11 +0000
committerEd Willink2016-05-17 16:31:11 +0000
commit47c5a4458adfb94fd3b7f2eb67d87922ddbc7017 (patch)
treeedc4f7966e3441cd028a3ecb474238feeb469dbb
parent2ddf4d2aaa34d62b40a2d6299bfd91f4117165fa (diff)
downloadorg.eclipse.qvtd-47c5a4458adfb94fd3b7f2eb67d87922ddbc7017.tar.gz
org.eclipse.qvtd-47c5a4458adfb94fd3b7f2eb67d87922ddbc7017.tar.xz
org.eclipse.qvtd-47c5a4458adfb94fd3b7f2eb67d87922ddbc7017.zip
[493791] Failing test
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java21
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/HstmToStm.qvtc102
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstm2stmMM.ecore62
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstmMM.emof38
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/stmMM.emof31
5 files changed, 254 insertions, 0 deletions
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java
index 8f5786cd6..3d9667d26 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/QVTcCompilerTests.java
@@ -324,6 +324,27 @@ public class QVTcCompilerTests extends LoadTestCase
}
@Test
+ public void testQVTcCompiler_HstmToStm() throws Exception {
+// AbstractTransformer.EXCEPTIONS.setState(true);
+// AbstractTransformer.INVOCATIONS.setState(true);
+ Scheduler.DEBUG_GRAPHS.setState(true);
+ MyQVT myQVT = new MyQVT("hstm2stm");
+// myQVT.getEnvironmentFactory().setEvaluationTracingEnabled(true);
+ try {
+ Transformation asTransformation = myQVT.compileTransformation("HstmToStm.qvtc", "stm");
+ myQVT.createInterpretedExecutor(asTransformation);
+ myQVT.loadInput("hstm", "SolarizedHSV.xmi");
+ myQVT.createModel(QVTimperativeUtil.MIDDLE_DOMAIN_NAME, "HstmToStm_trace.xmi");
+ myQVT.createModel("stm", "SolarizedHLS_Interpreted.xmi");
+ myQVT.executeTransformation();
+ myQVT.saveOutput("stm", "SolarizedHLS_Interpreted.xmi", "SolarizedHLS_expected.xmi", HSV2HLSNormalizer.INSTANCE); // FIXME Bug 490497 remove normalizer
+ }
+ finally {
+ myQVT.dispose();
+ }
+ }
+
+ @Test
public void testQVTcCompiler_HSVToHLS() throws Exception {
// AbstractTransformer.EXCEPTIONS.setState(true);
// AbstractTransformer.INVOCATIONS.setState(true);
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/HstmToStm.qvtc b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/HstmToStm.qvtc
new file mode 100644
index 000000000..7c3ec4681
--- /dev/null
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/HstmToStm.qvtc
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2007,2008 Tata Consultancy Services and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * TCS - initial implementation for ModelMorf
+ * E.D.Willink - alignment with evolved specification
+ * Horacio Hoyos - transliterate to QVTc
+ *******************************************************************************/
+import hstmMM : 'hstmMM.emof'::hstmMM_p;
+import stmMM : 'stmMM.emof'::stmMM_p;
+import hstm2stmMM : 'hstm2stmMM.ecore'::Hstm2Stm;
+
+transformation HstmToStm {
+ hstm imports hstmMM;
+ stm imports stmMM;
+ imports hstm2stmMM;
+}
+
+query HstmToStm::StateContainsState(cState:hstmMM_p::State, mState:hstmMM_p::State ) : Boolean {
+
+ if (mState.containedInState->isEmpty()) then
+ false
+ else
+ if (mState.containedInState = cState) then
+ true
+ else
+ StateContainsState(cState, mState.containedInState)
+ endif
+ endif
+}
+
+map LStateToState in HstmToStm {
+
+ hstm (s1:State |
+ s1.containsState->isEmpty();) {
+ }
+ enforce stm () {
+ realize s2 : State |
+ }
+ where () {
+ realize s2s : HstateToState |
+ s2s.hstate := s1;
+ s2s.state := s2;
+ }
+ map {
+ where () {
+ s2s.name := s1.name;
+ s1.name := s2s.name;
+ s2s.name := s2.name;
+ s2.name := s2s.name;
+ }
+ }
+}
+
+map CStateToState in HstmToStm {
+ hstm (fs1:State, ts1:State) {
+ t1:Trans,
+ ms1:State,
+ ms2:State |
+ t1.fromState = fs1;
+ t1.toState = ts1;
+ }
+ enforce stm (ts2:State) {
+ realize fs2:State,
+ realize t2 : Trans |
+ t2.fromState := fs2;
+ t2.toState := ts2;
+ }
+ -- s2s1 -> ms1
+ -- s2s1 -> ms2
+ where (s2s1:HstateToState, s2s2:HstateToState |) {
+ realize s2s : HstateToState,
+ realize t2t : HtransToTrans |
+ ms1 := s2s1.hstate;
+ ms2 := s2s2.hstate;
+ s2s.hstate := fs1;
+ s2s.state := fs2;
+ t2t.htrans := t1;
+ t2t.trans := t2;
+ }
+ map {
+ hstm(
+ ms1 = fs1 or StateContainsState(fs1, ms1);
+ ms2 = ts1 or StateContainsState(ts1, ms2);) {}
+ where ( )
+ {
+ s2s.name := fs1.name;
+ fs1.name := s2s.name;
+ s2s.name := fs2.name;
+ fs2.name := s2s.name;
+ t2t.name := t1.name;
+ t1.name := t2t.name;
+ t2t.name := t2.name;
+ t2.name := t2t.name;
+
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstm2stmMM.ecore b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstm2stmMM.ecore
new file mode 100644
index 000000000..c0a55bda9
--- /dev/null
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstm2stmMM.ecore
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="Hstm2Stm" nsURI="http://www.eclipse.org/qvt/2015/QVTcore/examples/Hstm2Stm"
+ nsPrefix="hstm2stm">
+ <eClassifiers xsi:type="ecore:EClass" name="HstateToState">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="hstate" eType="ecore:EClass hstmMM.emof#hstmMM_p.State">
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeUpper">
+ <details key="body" value="1"/>
+ </eAnnotations>
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeRoleName">
+ <details key="body" value="middle"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="state" eType="ecore:EClass stmMM.emof#stmMM_p.State">
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeUpper">
+ <details key="body" value="1"/>
+ </eAnnotations>
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeRoleName">
+ <details key="body" value="middle"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="HtransToTrans">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="htrans" eType="ecore:EClass hstmMM.emof#hstmMM_p.Trans">
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeUpper">
+ <details key="body" value="1"/>
+ </eAnnotations>
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeRoleName">
+ <details key="body" value="middle"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="trans" eType="ecore:EClass stmMM.emof#stmMM_p.Trans">
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeUpper">
+ <details key="body" value="1"/>
+ </eAnnotations>
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeRoleName">
+ <details key="body" value="middle"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="HmachToMach">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="hmach" eType="ecore:EClass hstmMM.emof#hstmMM_p.dummy">
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeUpper">
+ <details key="body" value="1"/>
+ </eAnnotations>
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeRoleName">
+ <details key="body" value="middle"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="mach" eType="ecore:EClass stmMM.emof#stmMM_p.dummy">
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeUpper">
+ <details key="body" value="1"/>
+ </eAnnotations>
+ <eAnnotations source="http://schema.omg.org/spec/MOF/2.0/emof.xml#Property.oppositeRoleName">
+ <details key="body" value="middle"/>
+ </eAnnotations>
+ </eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstmMM.emof b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstmMM.emof
new file mode 100644
index 000000000..31312b215
--- /dev/null
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/hstmMM.emof
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<emof:Package xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:emof="http://schema.omg.org/spec/MOF/2.0/emof.xml"
+ xmi:id="hstmMM_p" name="hstmMM_p" uri="hstmMM_p">
+ <ownedType xmi:type="emof:Class" xmi:id="hstmMM_p.State" name="State">
+ <ownedAttribute xmi:id="hstmMM_p.State.containsState" name="containsState" lower="0"
+ upper="*" type="hstmMM_p.State" opposite="hstmMM_p.State.containedInState"/>
+ <ownedAttribute xmi:id="hstmMM_p.State.containedInState" name="containedInState"
+ lower="0" type="hstmMM_p.State" opposite="hstmMM_p.State.containsState"/>
+ <ownedAttribute xmi:id="hstmMM_p.State.outTrans" name="outTrans" lower="0" upper="*"
+ type="hstmMM_p.Trans" opposite="hstmMM_p.Trans.fromState"/>
+ <ownedAttribute xmi:id="hstmMM_p.State.inTrans" name="inTrans" lower="0" upper="*"
+ type="hstmMM_p.Trans" opposite="hstmMM_p.Trans.toState"/>
+ <ownedAttribute xmi:id="hstmMM_p.State.name" name="name">
+ <type xmi:type="emof:PrimitiveType" href="http://schema.omg.org/spec/MOF/2.0/emof.xml#String"/>
+ </ownedAttribute>
+ </ownedType>
+ <ownedType xmi:type="emof:Class" xmi:id="hstmMM_p.Trans" name="Trans">
+ <ownedAttribute xmi:id="hstmMM_p.Trans.fromState" name="fromState" type="hstmMM_p.State"
+ opposite="hstmMM_p.State.outTrans"/>
+ <ownedAttribute xmi:id="hstmMM_p.Trans.toState" name="toState" type="hstmMM_p.State"
+ opposite="hstmMM_p.State.inTrans"/>
+ <ownedAttribute xmi:id="hstmMM_p.Trans.name" name="name">
+ <type xmi:type="emof:PrimitiveType" href="http://schema.omg.org/spec/MOF/2.0/emof.xml#String"/>
+ </ownedAttribute>
+ </ownedType>
+ <ownedType xmi:type="emof:Class" xmi:id="hstmMM_p.dummy" name="StateMachine">
+ <ownedAttribute xmi:id="hstmMM_p.dummy.contains_state" name="contains_state" upper="*"
+ type="hstmMM_p.State" isComposite="true"/>
+ <ownedAttribute xmi:id="hstmMM_p.dummy.conatains_trans" name="conatains_trans"
+ upper="*" type="hstmMM_p.Trans" isComposite="true"/>
+ <ownedAttribute xmi:id="hstmMM_p.dummy.name" name="name">
+ <type xmi:type="emof:PrimitiveType" href="http://schema.omg.org/spec/MOF/2.0/emof.xml#String"/>
+ </ownedAttribute>
+ </ownedType>
+ <xmi:Extension extender="http://www.eclipse.org/emf/2002/Ecore">
+ <nsPrefix>hstm</nsPrefix>
+ </xmi:Extension>
+</emof:Package>
diff --git a/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/stmMM.emof b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/stmMM.emof
new file mode 100644
index 000000000..d77da71cb
--- /dev/null
+++ b/tests/org.eclipse.qvtd.xtext.qvtcore.tests/src/org/eclipse/qvtd/xtext/qvtcore/tests/hstm2stm/stmMM.emof
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<emof:Package xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:emof="http://schema.omg.org/spec/MOF/2.0/emof.xml"
+ xmi:id="stmMM_p" name="stmMM_p" uri="stmMM_p">
+ <ownedType xmi:type="emof:Class" xmi:id="stmMM_p.State" name="State">
+ <ownedAttribute xmi:id="stmMM_p.State.outTrans" name="outTrans" upper="*" type="stmMM_p.Trans"
+ opposite="stmMM_p.Trans.fromState"/>
+ <ownedAttribute xmi:id="stmMM_p.State.inTrans" name="inTrans" upper="*" type="stmMM_p.Trans"
+ opposite="stmMM_p.Trans.toState"/>
+ <ownedAttribute xmi:id="stmMM_p.State.name" name="name">
+ <type xmi:type="emof:PrimitiveType" href="http://schema.omg.org/spec/MOF/2.0/emof.xml#String"/>
+ </ownedAttribute>
+ </ownedType>
+ <ownedType xmi:type="emof:Class" xmi:id="stmMM_p.Trans" name="Trans">
+ <ownedAttribute xmi:id="stmMM_p.Trans.fromState" name="fromState" type="stmMM_p.State"
+ opposite="stmMM_p.State.outTrans"/>
+ <ownedAttribute xmi:id="stmMM_p.Trans.toState" name="toState" type="stmMM_p.State"
+ opposite="stmMM_p.State.inTrans"/>
+ <ownedAttribute xmi:id="stmMM_p.Trans.name" name="name">
+ <type xmi:type="emof:PrimitiveType" href="http://schema.omg.org/spec/MOF/2.0/emof.xml#String"/>
+ </ownedAttribute>
+ </ownedType>
+ <ownedType xmi:type="emof:Class" xmi:id="stmMM_p.dummy" name="StateMachine">
+ <ownedAttribute xmi:id="stmMM_p.dummy.container_state" name="container_state"
+ upper="*" type="stmMM_p.State" isComposite="true"/>
+ <ownedAttribute xmi:id="stmMM_p.dummy.container_trans" name="container_trans"
+ upper="*" type="stmMM_p.Trans" isComposite="true"/>
+ <ownedAttribute xmi:id="stmMM_p.dummy.name" name="name">
+ <type xmi:type="emof:PrimitiveType" href="http://schema.omg.org/spec/MOF/2.0/emof.xml#String"/>
+ </ownedAttribute>
+ </ownedType>
+</emof:Package>

Back to the top